mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-20 10:34:20 +01:00
[Wallet/mint] P2PK with timelocks (#270)
* p2pk with nostr privatekey and timelocks * add p2pk * fix test * fix test with custom secret * sign whole split transaction * p2pk signature now commits to entire secret and thus to a nonce * use schnorr signatures * revamp P2SH and P2PK with new Secret model * test p2pk * add comments * add nostr private key to tests * fix nostr receive * make format * test redemption after timelock * refactor Server.serialize() * sign sha256(secret) * add optional refund pubkey that triggers after timelock * use nostr private key for now (including nsec parser) * use nostr private key and fix tests * bump version to 0.12.2
This commit is contained in:
@@ -220,7 +220,6 @@ async def send_command(
|
||||
@router.post("/receive", name="Receive tokens", response_model=ReceiveResponse)
|
||||
async def receive_command(
|
||||
token: str = Query(default=None, description="Token to receive"),
|
||||
lock: str = Query(default=None, description="Unlock tokens"),
|
||||
nostr: bool = Query(default=False, description="Receive tokens via nostr"),
|
||||
all: bool = Query(default=False, description="Receive all pending tokens"),
|
||||
):
|
||||
@@ -228,7 +227,7 @@ async def receive_command(
|
||||
if token:
|
||||
tokenObj: TokenV3 = deserialize_token_from_string(token)
|
||||
await verify_mints(wallet, tokenObj)
|
||||
balance = await receive(wallet, tokenObj, lock)
|
||||
balance = await receive(wallet, tokenObj)
|
||||
elif nostr:
|
||||
await receive_nostr(wallet)
|
||||
balance = wallet.available_balance
|
||||
@@ -241,7 +240,7 @@ async def receive_command(
|
||||
token = await wallet.serialize_proofs(proofs)
|
||||
tokenObj = deserialize_token_from_string(token)
|
||||
await verify_mints(wallet, tokenObj)
|
||||
balance = await receive(wallet, tokenObj, lock)
|
||||
balance = await receive(wallet, tokenObj)
|
||||
else:
|
||||
raise Exception("enter token or use either flag --nostr or --all.")
|
||||
assert balance
|
||||
@@ -337,9 +336,8 @@ async def pending(
|
||||
|
||||
@router.get("/lock", name="Generate receiving lock", response_model=LockResponse)
|
||||
async def lock():
|
||||
p2shscript = await wallet.create_p2sh_lock()
|
||||
txin_p2sh_address = p2shscript.address
|
||||
return LockResponse(P2SH=txin_p2sh_address)
|
||||
address = await wallet.create_p2sh_address_and_store()
|
||||
return LockResponse(P2SH=address)
|
||||
|
||||
|
||||
@router.get("/locks", name="Show unused receiving locks", response_model=LocksResponse)
|
||||
|
||||
Reference in New Issue
Block a user