mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-01-10 20:24:19 +01:00
fix types
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from sqlite3 import Row
|
||||
from typing import List
|
||||
from typing import List, Union
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
@@ -12,7 +12,7 @@ class CashuError(BaseModel):
|
||||
class P2SHScript(BaseModel):
|
||||
script: str
|
||||
signature: str
|
||||
address: str = None
|
||||
address: Union[str, None] = None
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: Row):
|
||||
@@ -28,7 +28,7 @@ class Proof(BaseModel):
|
||||
amount: int
|
||||
secret: str = ""
|
||||
C: str
|
||||
script: P2SHScript = None
|
||||
script: Union[P2SHScript, None] = None
|
||||
reserved: bool = False # whether this proof is reserved for sending
|
||||
send_id: str = "" # unique ID of send attempt
|
||||
time_created: str = ""
|
||||
@@ -121,15 +121,17 @@ class GetMintResponse(BaseModel):
|
||||
|
||||
|
||||
class GetMeltResponse(BaseModel):
|
||||
paid: str
|
||||
preimage: str
|
||||
paid: Union[bool, None]
|
||||
preimage: Union[str, None]
|
||||
|
||||
|
||||
class SplitRequest(BaseModel):
|
||||
proofs: List[Proof]
|
||||
amount: int
|
||||
output_data: MintRequest = None # backwards compatibility with clients < v0.2.2
|
||||
outputs: MintRequest = None
|
||||
output_data: Union[
|
||||
MintRequest, None
|
||||
] = None # backwards compatibility with clients < v0.2.2
|
||||
outputs: Union[MintRequest, None] = None
|
||||
|
||||
def __init__(self, **data):
|
||||
super().__init__(**data)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
from environs import Env # type: ignore
|
||||
from loguru import logger
|
||||
|
||||
env = Env()
|
||||
|
||||
ENV_FILE = os.path.join(str(Path.home()), ".cashu", ".env")
|
||||
ENV_FILE: Union[str, None] = os.path.join(str(Path.home()), ".cashu", ".env")
|
||||
if not os.path.isfile(ENV_FILE):
|
||||
ENV_FILE = os.path.join(os.getcwd(), ".env")
|
||||
if os.path.isfile(ENV_FILE):
|
||||
|
||||
@@ -80,7 +80,7 @@ async def split(payload: SplitRequest):
|
||||
"""
|
||||
proofs = payload.proofs
|
||||
amount = payload.amount
|
||||
outputs = payload.outputs.blinded_messages
|
||||
outputs = payload.outputs.blinded_messages if payload.outputs else None
|
||||
try:
|
||||
split_return = await ledger.split(proofs, amount, outputs)
|
||||
except Exception as exc:
|
||||
|
||||
Reference in New Issue
Block a user