mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-24 03:54:21 +01:00
clean
This commit is contained in:
@@ -41,11 +41,6 @@ class Proof(BaseModel):
|
||||
self.__setattr__(key, val)
|
||||
|
||||
|
||||
class Proofs(BaseModel):
|
||||
# NOTE: not used in Pydantic validation
|
||||
__root__: List[Proof]
|
||||
|
||||
|
||||
# ------- LIGHTNING INVOICE -------
|
||||
|
||||
|
||||
@@ -276,6 +271,11 @@ class MintKeysets:
|
||||
# ------- TOKEN -------
|
||||
|
||||
|
||||
class TokenV1(BaseModel):
|
||||
# NOTE: not used in Pydantic validation
|
||||
__root__: List[Proof]
|
||||
|
||||
|
||||
class TokenMintV2(BaseModel):
|
||||
url: str
|
||||
ks: List[str]
|
||||
|
||||
@@ -388,7 +388,7 @@ async def receive(ctx, token: str, lock: str):
|
||||
# deserialize token
|
||||
dtoken = json.loads(base64.urlsafe_b64decode(token))
|
||||
|
||||
# backwards compatibility < 0.8: V2 tokens with "tokens" field instead of "proofs" field
|
||||
# backwards compatibility wallet to wallet < 0.8: V2 tokens renamed "tokens" field to "proofs"
|
||||
if "tokens" in dtoken:
|
||||
dtoken["proofs"] = dtoken.pop("tokens")
|
||||
|
||||
|
||||
@@ -514,7 +514,7 @@ class Wallet(LedgerAPI):
|
||||
|
||||
# add mint information to the token, if requested
|
||||
if include_mints:
|
||||
# hold information about the mint
|
||||
# dummy object to hold information about the mint
|
||||
mints: Dict[str, TokenMintV2] = dict()
|
||||
# iterate through all proofs and add their keyset to `mints`
|
||||
for proof in proofs:
|
||||
@@ -535,7 +535,9 @@ class Wallet(LedgerAPI):
|
||||
# if a mint has multiple keysets, append to the existing list
|
||||
if keyset.id not in mints[placeholder_mint_id].ks:
|
||||
mints[placeholder_mint_id].ks.append(keyset.id)
|
||||
|
||||
if len(mints) > 0:
|
||||
# add dummy object to token
|
||||
token.mints = mints
|
||||
return token
|
||||
|
||||
|
||||
Reference in New Issue
Block a user