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 . import db
from .models import Wallets, Charges, Mempool
from .models import Wallets, Addresses, Mempool
from lnbits.helpers import urlsafe_short_hash

View File

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

View File

@ -13,21 +13,6 @@ class Wallets(NamedTuple):
def from_row(cls, row: Row) -> "Wallets":
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):
user: str
endpoint: str
@ -35,3 +20,12 @@ class Mempool(NamedTuple):
@classmethod
def from_row(cls, row: Row) -> "Mempool":
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,
update_watch_wallet,
delete_watch_wallet,
create_charge,
get_charge,
get_charges,
delete_charge,
get_fresh_address,
get_addresses,
create_mempool,
update_mempool,
get_mempool,