make
This commit is contained in:
parent
55eacd1009
commit
b24224a7e5
3 changed files with 11 additions and 7 deletions
|
|
@ -1,8 +1,6 @@
|
|||
import secp256k1
|
||||
|
||||
|
||||
|
||||
|
||||
async def m001_initial(db):
|
||||
"""
|
||||
Initial tables
|
||||
|
|
@ -70,13 +68,15 @@ async def m003_default_config(db):
|
|||
"""
|
||||
await db.execute(
|
||||
"""
|
||||
INSERT OR REPLACE INTO nwcprovider.config (key, value) VALUES ('relay', 'nostrclient');
|
||||
INSERT OR REPLACE INTO nwcprovider.config
|
||||
(key, value) VALUES ('relay', 'nostrclient');
|
||||
"""
|
||||
)
|
||||
new_private_key = bytes.hex(secp256k1._gen_private_key())
|
||||
await db.execute(
|
||||
"""
|
||||
INSERT OR REPLACE INTO nwcprovider.config (key, value) VALUES ('provider_key', :provider_key);
|
||||
INSERT OR REPLACE INTO nwcprovider.config
|
||||
(key, value) VALUES ('provider_key', :provider_key);
|
||||
""",
|
||||
{"provider_key": new_private_key},
|
||||
)
|
||||
|
|
@ -89,9 +89,10 @@ async def m004_default_config2(db):
|
|||
|
||||
await db.execute(
|
||||
"""
|
||||
INSERT OR REPLACE INTO nwcprovider.config (key, value) VALUES ('relay_alias', :value);
|
||||
INSERT OR REPLACE INTO nwcprovider.config
|
||||
(key, value) VALUES ('relay_alias', :value);
|
||||
""",
|
||||
{"value":""},
|
||||
{"value": ""},
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class DeleteNWC(BaseModel):
|
|||
class OnInvoicePaid(BaseModel):
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
sp: NWCServiceProvider
|
||||
pubkey: str
|
||||
payload: Dict
|
||||
|
|
|
|||
4
nwcp.py
4
nwcp.py
|
|
@ -5,7 +5,6 @@ import json
|
|||
import random
|
||||
import time
|
||||
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, Union
|
||||
from pydantic import BaseModel
|
||||
|
||||
import secp256k1
|
||||
import websockets.client as websockets
|
||||
|
|
@ -15,6 +14,8 @@ from Cryptodome.Util.Padding import pad, unpad
|
|||
from lnbits.helpers import encrypt_internal_message
|
||||
from lnbits.settings import settings
|
||||
from loguru import logger
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class MainSubscription(BaseModel):
|
||||
class Config:
|
||||
|
|
@ -49,6 +50,7 @@ class MainSubscription(BaseModel):
|
|||
class NWCServiceProvider(BaseModel):
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
def __init__(self, private_key: Optional[str] = None, relay: Optional[str] = None):
|
||||
if not relay: # Connect to nostrclient
|
||||
relay = "nostrclient"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue