allow wallet rename issue #141

This commit is contained in:
Tiago vasconcelos
2021-08-06 12:37:30 -03:00
committed by fiatjaf
parent 16f8071731
commit b3856d5aff
4 changed files with 76 additions and 3 deletions
+17 -1
View File
@@ -13,7 +13,7 @@ from lnbits.decorators import api_check_wallet_key, api_validate_post_request
from lnbits.utils.exchange_rates import currencies, fiat_amount_as_satoshis
from .. import core_app, db
from ..crud import get_payments, save_balance_check
from ..crud import get_payments, save_balance_check, update_wallet
from ..services import (
PaymentFailure,
InvoiceFailure,
@@ -38,6 +38,22 @@ async def api_wallet():
HTTPStatus.OK,
)
@core_app.route("/api/v1/wallet/<new_name>", methods=["PUT"])
@api_check_wallet_key("invoice")
async def api_update_wallet(new_name):
print("UPDATE", g.wallet.id, new_name)
await update_wallet(g.wallet.id, new_name)
return (
jsonify(
{
"id": g.wallet.id,
"name": g.wallet.name,
"balance": g.wallet.balance_msat,
}
),
HTTPStatus.OK,
)
@core_app.route("/api/v1/payments", methods=["GET"])
@api_check_wallet_key("invoice")