mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-01-05 09:54:21 +01:00
works
This commit is contained in:
28
core/base.py
28
core/base.py
@@ -15,18 +15,44 @@ class Proof(BaseModel):
|
||||
amount: int
|
||||
C: BasePoint
|
||||
secret: str
|
||||
reserved: bool = False # whether this proof is reserved for sending
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: Row):
|
||||
return dict(
|
||||
return cls(
|
||||
amount=row[0],
|
||||
C=dict(
|
||||
x=int(row[1]),
|
||||
y=int(row[2]),
|
||||
),
|
||||
secret=row[3],
|
||||
reserved=row[4] or False,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, d: dict):
|
||||
return cls(
|
||||
amount=d["amount"],
|
||||
C=dict(
|
||||
x=int(d["C"]["x"]),
|
||||
y=int(d["C"]["y"]),
|
||||
),
|
||||
secret=d["secret"],
|
||||
reserved=d["reserved"] or False,
|
||||
)
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.__getattribute__(key)
|
||||
|
||||
def __setitem__(self, key, val):
|
||||
self.__setattr__(key, val)
|
||||
|
||||
|
||||
class Proofs(BaseModel):
|
||||
"""TODO: Use this model"""
|
||||
|
||||
proofs: List[Proof]
|
||||
|
||||
|
||||
class Invoice(BaseModel):
|
||||
amount: int
|
||||
|
||||
@@ -4,6 +4,7 @@ env = Env()
|
||||
env.read_env()
|
||||
|
||||
DEBUG = env.bool("DEBUG", default=False)
|
||||
LIGHTNING = env.bool("LIGHTNING", default=False)
|
||||
|
||||
MINT_PRIVATE_KEY = env.str("MINT_PRIVATE_KEY")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user