Still have broken watchonly, but addresses added

This commit is contained in:
benarc 2021-02-23 15:19:51 +00:00
parent da20588c84
commit 81326b2368
4 changed files with 16 additions and 29 deletions

View File

@ -2,7 +2,7 @@ from typing import List, Optional, Union
#from lnbits.db import open_ext_db #from lnbits.db import open_ext_db
from . import db from . import db
from .models import Wallets, Charges, Mempool from .models import Wallets, Addresses, Mempool
from lnbits.helpers import urlsafe_short_hash from lnbits.helpers import urlsafe_short_hash

View File

@ -17,19 +17,14 @@ async def m001_initial(db):
await db.execute( await db.execute(
""" """
CREATE TABLE IF NOT EXISTS charges ( CREATE TABLE IF NOT EXISTS addresses (
id TEXT NOT NULL PRIMARY KEY, address TEXT NOT NULL PRIMARY KEY,
user TEXT,
title TEXT,
wallet TEXT NOT NULL, wallet TEXT NOT NULL,
address TEXT NOT NULL, amount INTEGER NOT NULL
time_to_pay INTEGER,
amount INTEGER,
balance INTEGER DEFAULT 0,
time TIMESTAMP NOT NULL DEFAULT (strftime('%s', 'now'))
); );
""" """
) )
await db.execute( await db.execute(
""" """
CREATE TABLE IF NOT EXISTS mempool ( CREATE TABLE IF NOT EXISTS mempool (

View File

@ -13,21 +13,6 @@ class Wallets(NamedTuple):
def from_row(cls, row: Row) -> "Wallets": def from_row(cls, row: Row) -> "Wallets":
return cls(**dict(row)) return cls(**dict(row))
class Charges(NamedTuple):
id: str
user: str
wallet: str
title: str
address: str
time_to_pay: str
amount: int
balance: int
time: int
@classmethod
def from_row(cls, row: Row) -> "Payments":
return cls(**dict(row))
class Mempool(NamedTuple): class Mempool(NamedTuple):
user: str user: str
endpoint: str endpoint: str
@ -35,3 +20,12 @@ class Mempool(NamedTuple):
@classmethod @classmethod
def from_row(cls, row: Row) -> "Mempool": def from_row(cls, row: Row) -> "Mempool":
return cls(**dict(row)) return cls(**dict(row))
class Addresses(NamedTuple):
address: str
wallet: str
amount: int
@classmethod
def from_row(cls, row: Row) -> "Addresses":
return cls(**dict(row))

View File

@ -14,10 +14,8 @@ from .crud import (
get_watch_wallets, get_watch_wallets,
update_watch_wallet, update_watch_wallet,
delete_watch_wallet, delete_watch_wallet,
create_charge, get_fresh_address,
get_charge, get_addresses,
get_charges,
delete_charge,
create_mempool, create_mempool,
update_mempool, update_mempool,
get_mempool, get_mempool,