mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-24 03:54:21 +01:00
update readme and errors for mint (#107)
This commit is contained in:
@@ -104,12 +104,15 @@ async def mint(
|
||||
name="Melt tokens",
|
||||
summary="Melt tokens for a Bitcoin payment that the mint will make for the user in exchange",
|
||||
)
|
||||
async def melt(payload: PostMeltRequest) -> GetMeltResponse:
|
||||
async def melt(payload: PostMeltRequest) -> Union[CashuError, GetMeltResponse]:
|
||||
"""
|
||||
Requests tokens to be destroyed and sent out via Lightning.
|
||||
"""
|
||||
ok, preimage = await ledger.melt(payload.proofs, payload.invoice)
|
||||
resp = GetMeltResponse(paid=ok, preimage=preimage)
|
||||
try:
|
||||
ok, preimage = await ledger.melt(payload.proofs, payload.invoice)
|
||||
resp = GetMeltResponse(paid=ok, preimage=preimage)
|
||||
except Exception as exc:
|
||||
return CashuError(code=0, error=str(exc))
|
||||
return resp
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user