diff --git a/cashu/core/base.py b/cashu/core/base.py index a2cc436..9007ff0 100644 --- a/cashu/core/base.py +++ b/cashu/core/base.py @@ -106,15 +106,15 @@ class BlindedSignature(BaseModel): ) -class MintPayloads(BaseModel): +class MintRequest(BaseModel): blinded_messages: List[BlindedMessage] = [] class SplitRequest(BaseModel): proofs: List[Proof] amount: int - output_data: MintPayloads = None # backwards compatibility with clients < v0.2.1 - outputs: MintPayloads = None + output_data: MintRequest = None # backwards compatibility with clients < v0.2.1 + outputs: MintRequest = None def __init__(self): self.backwards_compatibility_v021() diff --git a/cashu/mint/router.py b/cashu/mint/router.py index e5c1958..807fbf4 100644 --- a/cashu/mint/router.py +++ b/cashu/mint/router.py @@ -3,7 +3,7 @@ from typing import Union from fastapi import APIRouter from secp256k1 import PublicKey -from cashu.core.base import CheckRequest, MeltRequest, MintPayloads, SplitRequest +from cashu.core.base import CheckRequest, MeltRequest, MintRequest, SplitRequest from cashu.mint import ledger router: APIRouter = APIRouter() @@ -24,7 +24,7 @@ async def request_mint(amount: int = 0): @router.post("/mint") -async def mint(payloads: MintPayloads, payment_hash: Union[str, None] = None): +async def mint(payloads: MintRequest, payment_hash: Union[str, None] = None): """ Requests the minting of tokens belonging to a paid payment request. diff --git a/cashu/wallet/wallet.py b/cashu/wallet/wallet.py index d95574c..c1ba4d5 100644 --- a/cashu/wallet/wallet.py +++ b/cashu/wallet/wallet.py @@ -13,7 +13,7 @@ from cashu.core.base import ( BlindedSignature, CheckRequest, MeltRequest, - MintPayloads, + MintRequest, P2SHScript, Proof, SplitRequest, @@ -96,7 +96,7 @@ class LedgerAPI: assert len(amounts) == len( secrets ), f"len(amounts)={len(amounts)} not equal to len(secrets)={len(secrets)}" - payloads: MintPayloads = MintPayloads() + payloads: MintRequest = MintRequest() rs = [] for secret, amount in zip(secrets, amounts): B_, r = b_dhke.step1_alice(secret) diff --git a/docs/specs/cashu_client_spec.md b/docs/specs/cashu_client_spec.md index 071df92..fc65024 100644 --- a/docs/specs/cashu_client_spec.md +++ b/docs/specs/cashu_client_spec.md @@ -52,8 +52,8 @@ Here we see how `Alice` generates `N` blinded messages `T_i`. The following step - `Alice` remembers `r` for the construction of the proof in Step 5. ### Step 4: Request tokens -- `Alice` constructs JSON `MintPayloads = {"blinded_messages" : ["amount" : , "B_" : ] }` [NOTE: rename "blinded_messages", rename "B_", rename "MintPayloads"] -- `Alice` requests tokens via `POST /mint?payment_hash=` with body `MintPayloads` [NOTE: rename MintPayloads] +- `Alice` constructs JSON `MintRequest = {"blinded_messages" : ["amount" : , "B_" : ] }` [NOTE: rename "blinded_messages", rename "B_", rename "MintRequest"] +- `Alice` requests tokens via `POST /mint?payment_hash=` with body `MintRequest` [NOTE: rename MintRequest] - `Alice` receives from `Bob` a list of blinded signatures `List[BlindedSignature]`, one for each token, e.g. `[{"amount" : , "C_" : }, ...]` [NOTE: rename C_] - If an error occured, `Alice` receives JSON `{"error" : }}`[TODO: Specify case of error] @@ -120,5 +120,5 @@ Here we describe how `Alice` can request from `Bob` to make a Lightning payment # Todo: - Call subsections 1. and 1.2 etc so they can be referenced -- Define objets like `MintPayloads` and `SplitRequests` once when they appear and reuse them. +- Define objets like `MintRequest` and `SplitRequests` once when they appear and reuse them. - Clarify whether a `TOKEN` is a single Proof or a list of Proofs \ No newline at end of file