This commit is contained in:
callebtc
2022-12-28 15:34:28 +01:00
parent 16d18e8a00
commit 47ccd6608d

View File

@@ -229,6 +229,9 @@ async def balance(ctx, verbose):
async def nostr_send(ctx, amount: int, pubkey: str, verbose: bool, yes: bool): async def nostr_send(ctx, amount: int, pubkey: str, verbose: bool, yes: bool):
"""
Sends tokens via nostr.
"""
wallet = await get_mint_wallet(ctx) wallet = await get_mint_wallet(ctx)
await wallet.load_proofs() await wallet.load_proofs()
_, send_proofs = await wallet.split_to_send( _, send_proofs = await wallet.split_to_send(
@@ -258,6 +261,9 @@ async def nostr_send(ctx, amount: int, pubkey: str, verbose: bool, yes: bool):
async def send(ctx, amount: int, lock: str, legacy: bool): async def send(ctx, amount: int, lock: str, legacy: bool):
"""
Prints token to send to stdout.
"""
if lock and len(lock) < 22: if lock and len(lock) < 22:
print("Error: lock has to be at least 22 characters long.") print("Error: lock has to be at least 22 characters long.")
return return
@@ -460,7 +466,7 @@ async def receive_cli(ctx, token: str, lock: str, nostr: bool, verbose: bool):
elif nostr: elif nostr:
await receive_nostr(ctx, verbose) await receive_nostr(ctx, verbose)
else: else:
print("Error: specify token or use --nostr.") print("Error: enter token or use the flag --nostr.")
@cli.command("burn", help="Burn spent tokens.") @cli.command("burn", help="Burn spent tokens.")
@@ -624,54 +630,6 @@ async def wallets(ctx):
pass pass
# @cli.command("nsend", help="Send tokens via nostr.")
# @click.argument("amount", type=int)
# @click.argument(
# "pubkey",
# type=str,
# )
# @click.option(
# "--verbose",
# "-v",
# default=False,
# is_flag=True,
# help="Show more information.",
# type=bool,
# )
# @click.option(
# "--yes", "-y", default=False, is_flag=True, help="Skip confirmation.", type=bool
# )
# @click.pass_context
# @coro
# async def nsend(ctx, amount: int, pubkey: str, verbose: bool, yes: bool):
# wallet = await get_mint_wallet(ctx)
# await wallet.load_proofs()
# _, send_proofs = await wallet.split_to_send(
# wallet.proofs, amount, set_reserved=True
# )
# token = await wallet.serialize_proofs(send_proofs)
# print("")
# print(token)
# if not yes:
# print("")
# click.confirm(
# f"Send {amount} sat to nostr pubkey {pubkey}?",
# abort=True,
# default=True,
# )
# # we only use ephemeral private keys for sending
# client = NostrClient(relays=NOSTR_RELAYS)
# if verbose:
# print(f"Your ephemeral nostr private key: {client.private_key.hex()}")
# await asyncio.sleep(1)
# client.dm(token, PublicKey(bytes.fromhex(pubkey)))
# print(f"Token sent to {pubkey}")
# client.close()
@cli.command("info", help="Information about Cashu wallet.") @cli.command("info", help="Information about Cashu wallet.")
@click.pass_context @click.pass_context
@coro @coro