mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-24 03:54:21 +01:00
TokenV3 and new Mint startup in tests (#149)
* tokenv3 send and receive * receive v2 and v1 tokens with tests
This commit is contained in:
@@ -331,3 +331,29 @@ class TokenV2(BaseModel):
|
||||
)
|
||||
else:
|
||||
return dict(proofs=[p.to_dict() for p in self.proofs])
|
||||
|
||||
|
||||
class TokenV3Token(BaseModel):
|
||||
mint: Optional[str] = None
|
||||
proofs: List[Proof]
|
||||
|
||||
def to_dict(self):
|
||||
return_dict = dict(proofs=[p.to_dict() for p in self.proofs])
|
||||
if self.mint:
|
||||
return_dict.update(dict(mint=self.mint)) # type: ignore
|
||||
return return_dict
|
||||
|
||||
|
||||
class TokenV3(BaseModel):
|
||||
"""
|
||||
A Cashu token that includes proofs and their respective mints. Can include proofs from multiple different mints and keysets.
|
||||
"""
|
||||
|
||||
token: List[TokenV3Token] = []
|
||||
memo: Optional[str] = None
|
||||
|
||||
def to_dict(self):
|
||||
return_dict = dict(token=[t.to_dict() for t in self.token])
|
||||
if self.memo:
|
||||
return_dict.update(dict(memo=self.memo)) # type: ignore
|
||||
return return_dict
|
||||
|
||||
Reference in New Issue
Block a user