diff --git a/cashu/core/base.py b/cashu/core/base.py index 4cb12e6..7db5eb2 100644 --- a/cashu/core/base.py +++ b/cashu/core/base.py @@ -24,9 +24,9 @@ class P2SHScript(BaseModel): class Proof(BaseModel): id: str = "" - amount: int + amount: int = 0 secret: str = "" - C: str + C: str = "" script: Union[P2SHScript, None] = None reserved: bool = False # whether this proof is reserved for sending send_id: str = "" # unique ID of send attempt diff --git a/cashu/mint/router.py b/cashu/mint/router.py index 79b3ca7..b846ae4 100644 --- a/cashu/mint/router.py +++ b/cashu/mint/router.py @@ -59,7 +59,6 @@ async def mint( Call this endpoint after `GET /mint`. """ - print(mint_request.dict()) try: promises = await ledger.mint( mint_request.blinded_messages, payment_hash=payment_hash @@ -74,7 +73,6 @@ async def melt(payload: MeltRequest) -> GetMeltResponse: """ Requests tokens to be destroyed and sent out via Lightning. """ - print(payload) ok, preimage = await ledger.melt(payload.proofs, payload.invoice) resp = GetMeltResponse(paid=ok, preimage=preimage) return resp @@ -83,7 +81,6 @@ async def melt(payload: MeltRequest) -> GetMeltResponse: @router.post("/check") async def check_spendable(payload: CheckRequest) -> Dict[int, bool]: """Check whether a secret has been spent already or not.""" - print(payload) return await ledger.check_spendable(payload.proofs) @@ -94,7 +91,6 @@ async def check_fees(payload: CheckFeesRequest) -> CheckFeesResponse: Used by wallets for figuring out the fees they need to supply. This is can be useful for checking whether an invoice is internal (Cashu-to-Cashu). """ - print(payload) fees_msat = await ledger.check_fees(payload.pr) return CheckFeesResponse(fee=fees_msat / 1000) diff --git a/cashu/wallet/wallet.py b/cashu/wallet/wallet.py index 18362ae..6f17cfa 100644 --- a/cashu/wallet/wallet.py +++ b/cashu/wallet/wallet.py @@ -273,9 +273,16 @@ class LedgerAPI: Cheks whether the secrets in proofs are already spent or not and returns a list of booleans. """ payload = CheckRequest(proofs=proofs) + + def _check_spendable_include_fields(proofs): + """strips away fields from the model that aren't necessary for the /split""" + return { + "proofs": {i: {"secret"} for i in range(len(proofs))}, + } + resp = self.s.post( self.url + "/check", - json=payload.dict(), + json=payload.dict(include=_check_spendable_include_fields(proofs)), ) resp.raise_for_status() return_dict = resp.json()