gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] 01/02: wallet-cli: allow generating segwit addresses


From: gnunet
Subject: [taler-wallet-core] 01/02: wallet-cli: allow generating segwit addresses
Date: Mon, 18 Apr 2022 21:23:53 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

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

    wallet-cli: allow generating segwit addresses
---
 packages/taler-wallet-cli/src/index.ts                | 13 +++++++++++++
 packages/taler-wallet-core/src/operations/withdraw.ts |  9 +++++++++
 2 files changed, 22 insertions(+)

diff --git a/packages/taler-wallet-cli/src/index.ts 
b/packages/taler-wallet-cli/src/index.ts
index 254dadf9..fca6bf67 100644
--- 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,
@@ -742,6 +743,18 @@ advancedCli
     fs.writeFileSync(1, decodeCrock(enc.trim()));
   });
 
+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
index 6d45599d..66bfd6b9 100644
--- 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);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]