This commit is contained in:
callebtc
2022-09-15 17:50:19 +03:00
parent 0e0d094044
commit c409619aea
9 changed files with 218 additions and 105 deletions

View File

@@ -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

View File

@@ -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")