rename TokenMintJson to TokenMintV2

This commit is contained in:
callebtc
2023-01-14 15:02:54 +01:00
parent f808366eb2
commit c34636e2f3
3 changed files with 7 additions and 7 deletions

View File

@@ -276,14 +276,14 @@ class MintKeysets:
# ------- TOKEN -------
class TokenMintJson(BaseModel):
class TokenMintV2(BaseModel):
url: str
ks: List[str]
class TokenV2(BaseModel):
proofs: List[Proof]
mints: Optional[Dict[str, TokenMintJson]] = None
mints: Optional[Dict[str, TokenMintV2]] = None
def to_dict(self):
return dict(

View File

@@ -3,7 +3,7 @@ import urllib.parse
import click
from cashu.core.base import Proof, TokenMintJson, TokenV2, WalletKeyset
from cashu.core.base import Proof, TokenMintV2, TokenV2, WalletKeyset
from cashu.core.settings import CASHU_DIR, MINT_URL
from cashu.wallet.crud import get_keyset
from cashu.wallet.wallet import Wallet as Wallet
@@ -168,6 +168,6 @@ async def proofs_to_token(wallet, proofs, url: str):
input(f"Enter mint URL (press enter for default {MINT_URL}): ") or MINT_URL
)
token.mints[url] = TokenMintJson(url=url, ks=keysets) # type: ignore
token.mints[url] = TokenMintV2(url=url, ks=keysets) # type: ignore
token_serialized = await wallet._serialize_token_base64(token)
return token_serialized

View File

@@ -27,7 +27,7 @@ from cashu.core.base import (
PostMintResponseLegacy,
Proof,
SplitRequest,
TokenMintJson,
TokenMintV2,
TokenV2,
WalletKeyset,
)
@@ -515,7 +515,7 @@ class Wallet(LedgerAPI):
# add mint information to the token, if requested
if include_mints:
# hold information about the mint
mints: Dict[str, TokenMintJson] = dict()
mints: Dict[str, TokenMintV2] = dict()
# iterate through all proofs and add their keyset to `mints`
for proof in proofs:
if proof.id:
@@ -526,7 +526,7 @@ class Wallet(LedgerAPI):
placeholder_mint_id = keyset.mint_url
if placeholder_mint_id not in mints:
# mint information
id = TokenMintJson(
id = TokenMintV2(
url=keyset.mint_url,
ks=[keyset.id],
)