taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 68b4d0c4de7df98190fcc07c11fa809622b27bfc
parent dc2c2b36501b24c7f2ed8f3dd0f7e6edc9dd6658
Author: Florian Dold <florian@dold.me>
Date:   Mon, 18 Apr 2022 21:23:25 +0200

wallet-cli: allow generating segwit addresses

Diffstat:
Mpackages/taler-wallet-cli/src/index.ts | 13+++++++++++++
Mpackages/taler-wallet-core/src/operations/withdraw.ts | 9+++++++++
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts @@ -45,6 +45,7 @@ import { rsaBlind, LogLevel, setGlobalLogLevelFromString, + parsePaytoUri, } from "@gnu-taler/taler-util"; import { NodeHttpLib, @@ -743,6 +744,18 @@ advancedCli }); advancedCli + .subcommand("genSegwit", "gen-segwit") + .requiredArgument("paytoUri", clk.STRING) + .requiredArgument("reservePub", clk.STRING) + .action(async (args) => { + const p = parsePaytoUri(args.genSegwit.paytoUri); + if (p?.isKnown && p?.targetType === "bitcoin") { + p.generateSegwitAddress(args.genSegwit.reservePub); + } + console.log(p); + }); + +advancedCli .subcommand("withdrawManually", "withdraw-manually", { help: "Withdraw manually from an exchange.", }) diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -1016,6 +1016,15 @@ export async function getExchangeWithdrawalInfo( instructedAmount, denoms, ); + + if (selectedDenoms.selectedDenoms.length === 0) { + throw Error( + `unable to withdraw from ${exchangeBaseUrl}, can't select denominations for instructed amount (${Amounts.stringify( + instructedAmount, + )}`, + ); + } + const exchangeWireAccounts: string[] = []; for (const account of exchangeDetails.wireInfo.accounts) { exchangeWireAccounts.push(account.payto_uri);