summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli/src/index.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-04-23 12:49:42 +0200
committerFlorian Dold <florian@dold.me>2024-04-23 12:49:42 +0200
commit666b767766ef299bd58655c55ece6d4a82c3e947 (patch)
treead55f617626d96fb656ff7ab4ccb71b7931ee7b9 /packages/taler-wallet-cli/src/index.ts
parent0308290a128d29792225d7b2f4d2e22cb5d42f72 (diff)
downloadwallet-core-666b767766ef299bd58655c55ece6d4a82c3e947.tar.gz
wallet-core-666b767766ef299bd58655c55ece6d4a82c3e947.tar.bz2
wallet-core-666b767766ef299bd58655c55ece6d4a82c3e947.zip
wallet-core: support for withdrawals with forced reserve key
Diffstat (limited to 'packages/taler-wallet-cli/src/index.ts')
-rw-r--r--packages/taler-wallet-cli/src/index.ts25
1 files changed, 21 insertions, 4 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index b85995052..b915de538 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -57,6 +57,7 @@ import { JsonMessage, runRpcServer } from "@gnu-taler/taler-util/twrpc";
import {
AccessStats,
createNativeWalletHost2,
+ nativeCrypto,
Wallet,
WalletApiOperation,
WalletCoreApiClient,
@@ -349,7 +350,7 @@ async function withWallet<T>(
},
};
const result = await f(ctx);
- wh.wallet.stop();
+ await wh.wallet.client.call(WalletApiOperation.Shutdown, {});
if (process.env.TALER_WALLET_DBSTATS) {
console.log("database stats:");
console.log(j2s(wh.getStats()));
@@ -723,6 +724,7 @@ withdrawCli
.requiredOption("amount", ["--amount"], clk.AMOUNT, {
help: "Amount to withdraw",
})
+ .maybeOption("forcedReservePriv", ["--forced-reserve-priv"], clk.STRING, {})
.maybeOption("restrictAge", ["--restrict-age"], clk.INT)
.action(async (args) => {
await withWallet(args, async (wallet) => {
@@ -735,7 +737,7 @@ withdrawCli
exchangeBaseUrl: exchangeBaseUrl,
},
);
- const acct = d.paytoUris[0];
+ const acct = d.withdrawalAccountsList[0];
if (!acct) {
console.log("exchange has no accounts");
return;
@@ -746,10 +748,11 @@ withdrawCli
amount,
exchangeBaseUrl,
restrictAge: parseInt(String(args.withdrawManually.restrictAge), 10),
+ forceReservePriv: args.withdrawManually.forcedReservePriv,
},
);
const reservePub = resp.reservePub;
- const completePaytoUri = addPaytoQueryParams(acct, {
+ const completePaytoUri = addPaytoQueryParams(acct.paytoUri, {
amount: args.withdrawManually.amount,
message: `Taler top-up ${reservePub}`,
});
@@ -1172,6 +1175,20 @@ const advancedCli = walletCli.subcommand("advancedArgs", "advanced", {
});
advancedCli
+ .subcommand("genReserve", "gen-reserve", {
+ help: "Generate a reserve key pair (not stored in the DB).",
+ })
+ .action(async (args) => {
+ const pair = await nativeCrypto.createEddsaKeypair({});
+ console.log(
+ j2s({
+ reservePub: pair.pub,
+ reservePriv: pair.priv,
+ }),
+ );
+ });
+
+advancedCli
.subcommand("tasks", "tasks", {
help: "Show active wallet-core tasks.",
})
@@ -1322,7 +1339,7 @@ advancedCli
merchantBaseUrl: "http://localhost:8083/",
});
await wallet.client.call(WalletApiOperation.TestingWaitTasksDone, {});
- wallet.stop();
+ await wallet.client.call(WalletApiOperation.Shutdown, {});
});
advancedCli