mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-24 03:54:21 +01:00
started
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from sqlite3 import Row
|
||||
from typing import List, Union
|
||||
from typing import List, Union, Dict
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
@@ -9,6 +9,26 @@ class CashuError(BaseModel):
|
||||
error = "CashuError"
|
||||
|
||||
|
||||
class Keyset(BaseModel):
|
||||
id: str
|
||||
keys: Dict
|
||||
mint_url: Union[str, None] = None
|
||||
first_seen: Union[str, None] = None
|
||||
active: bool = True
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: Row):
|
||||
if row is None:
|
||||
return cls
|
||||
return cls(
|
||||
id=row[0],
|
||||
keys=row[1],
|
||||
mint_url=row[2],
|
||||
first_seen=row[3],
|
||||
active=row[4],
|
||||
)
|
||||
|
||||
|
||||
class P2SHScript(BaseModel):
|
||||
script: str
|
||||
signature: str
|
||||
@@ -25,6 +45,7 @@ class P2SHScript(BaseModel):
|
||||
|
||||
|
||||
class Proof(BaseModel):
|
||||
id: str = ""
|
||||
amount: int
|
||||
secret: str = ""
|
||||
C: str
|
||||
@@ -60,10 +81,10 @@ class Proof(BaseModel):
|
||||
)
|
||||
|
||||
def to_dict(self):
|
||||
return dict(amount=self.amount, secret=self.secret, C=self.C)
|
||||
return dict(id=self.id, amount=self.amount, secret=self.secret, C=self.C)
|
||||
|
||||
def to_dict_no_secret(self):
|
||||
return dict(amount=self.amount, C=self.C)
|
||||
return dict(id=self.id, amount=self.amount, C=self.C)
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.__getattribute__(key)
|
||||
|
||||
Reference in New Issue
Block a user