mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-22 22:25:47 +01:00
feat: add rate endpoint per currency (#2641)
this is already used and implemented by tpos, lnurlp and i probably need it for satspay aswell
This commit is contained in:
parent
1900cf9aa4
commit
65ecca2507
1 changed files with 7 additions and 0 deletions
|
@ -33,6 +33,7 @@ from lnbits.settings import settings
|
||||||
from lnbits.utils.exchange_rates import (
|
from lnbits.utils.exchange_rates import (
|
||||||
allowed_currencies,
|
allowed_currencies,
|
||||||
fiat_amount_as_satoshis,
|
fiat_amount_as_satoshis,
|
||||||
|
get_fiat_rate_satoshis,
|
||||||
satoshis_amount_as_fiat,
|
satoshis_amount_as_fiat,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -200,6 +201,12 @@ async def api_perform_lnurlauth(
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
@api_router.get("/api/v1/rate/{currency}")
|
||||||
|
async def api_check_fiat_rate(currency: str) -> Dict[str, float]:
|
||||||
|
rate = await get_fiat_rate_satoshis(currency)
|
||||||
|
return {"rate": rate}
|
||||||
|
|
||||||
|
|
||||||
@api_router.get("/api/v1/currencies")
|
@api_router.get("/api/v1/currencies")
|
||||||
async def api_list_currencies_available() -> List[str]:
|
async def api_list_currencies_available() -> List[str]:
|
||||||
return allowed_currencies()
|
return allowed_currencies()
|
||||||
|
|
Loading…
Add table
Reference in a new issue