fix: mint format

This commit is contained in:
Vlad Stan 2022-10-07 15:09:26 +03:00
parent 94aca31c32
commit 03313e975c

View file

@ -255,8 +255,9 @@ async def mint_pay_request(
@cashu_ext.post("/api/v1/mint/{cashu_id}") @cashu_ext.post("/api/v1/mint/{cashu_id}")
async def mint_coins( async def mint_coins(
data: CreateTokens, data: MintPayloads,
cashu_id: str = Query(None), cashu_id: str = Query(None),
payment_hash: Union[str, None] = None,
wallet: WalletTypeInfo = Depends(require_admin_key), wallet: WalletTypeInfo = Depends(require_admin_key),
): ):
""" """
@ -271,8 +272,8 @@ async def mint_coins(
) )
invoice: Invoice = ( invoice: Invoice = (
None None
if data.payment_hash == None if payment_hash == None
else await get_lightning_invoice(cashu_id, data.payment_hash) else await get_lightning_invoice(cashu_id, payment_hash)
) )
if invoice is None: if invoice is None:
raise HTTPException( raise HTTPException(
@ -282,7 +283,7 @@ async def mint_coins(
# todo: give old tokens? # todo: give old tokens?
status: PaymentStatus = await check_transaction_status( status: PaymentStatus = await check_transaction_status(
cashu.wallet, data.payment_hash cashu.wallet, payment_hash
) )
# todo: revert to: status.paid != True: # todo: revert to: status.paid != True:
if status.paid == False: if status.paid == False:
@ -292,7 +293,7 @@ async def mint_coins(
amounts = [] amounts = []
B_s = [] B_s = []
for payload in data.payloads.blinded_messages: for payload in data.blinded_messages:
amounts.append(payload.amount) amounts.append(payload.amount)
B_s.append(PublicKey(bytes.fromhex(payload.B_), raw=True)) B_s.append(PublicKey(bytes.fromhex(payload.B_), raw=True))