refactor: use core currency and rate endpoints (#93)
This commit is contained in:
parent
f9ee067e88
commit
0cf2df2dcb
2 changed files with 1 additions and 17 deletions
|
|
@ -239,7 +239,7 @@ window.app = Vue.createApp({
|
|||
},
|
||||
updateFiatRate(currency) {
|
||||
LNbits.api
|
||||
.request('GET', '/lnurlp/api/v1/rate/' + currency, null)
|
||||
.request('GET', '/api/v1/rate/' + currency, null)
|
||||
.then(response => {
|
||||
let rates = _.clone(this.fiatRates)
|
||||
rates[currency] = response.data.rate
|
||||
|
|
|
|||
16
views_api.py
16
views_api.py
|
|
@ -11,7 +11,6 @@ from lnbits.decorators import (
|
|||
require_admin_key,
|
||||
require_invoice_key,
|
||||
)
|
||||
from lnbits.utils.exchange_rates import currencies, get_fiat_rate_satoshis
|
||||
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl
|
||||
from starlette.exceptions import HTTPException
|
||||
|
||||
|
|
@ -32,11 +31,6 @@ from .models import CreatePayLinkData, LnurlpSettings
|
|||
lnurlp_api_router = APIRouter()
|
||||
|
||||
|
||||
@lnurlp_api_router.get("/api/v1/currencies")
|
||||
async def api_list_currencies_available():
|
||||
return list(currencies.keys())
|
||||
|
||||
|
||||
@lnurlp_api_router.get("/api/v1/links", status_code=HTTPStatus.OK)
|
||||
async def api_links(
|
||||
req: Request,
|
||||
|
|
@ -225,16 +219,6 @@ async def api_link_delete(
|
|||
return {"success": True}
|
||||
|
||||
|
||||
@lnurlp_api_router.get("/api/v1/rate/{currency}", status_code=HTTPStatus.OK)
|
||||
async def api_check_fiat_rate(currency):
|
||||
try:
|
||||
rate = await get_fiat_rate_satoshis(currency)
|
||||
except AssertionError:
|
||||
rate = None
|
||||
|
||||
return {"rate": rate}
|
||||
|
||||
|
||||
@lnurlp_api_router.get("/api/v1/settings", dependencies=[Depends(check_admin)])
|
||||
async def api_get_or_create_settings() -> LnurlpSettings:
|
||||
return await get_or_create_lnurlp_settings()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue