aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-cli/src/index.ts')
-rw-r--r--packages/taler-wallet-cli/src/index.ts31
1 files changed, 3 insertions, 28 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index 8c4760223..f0ff02903 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -358,25 +358,6 @@ async function withWallet<T>(
}
}
-/**
- * Run a function with a local wallet.
- *
- * Stops the wallet after the function is done.
- */
-async function withLocalWallet<T>(
- walletCliArgs: WalletCliArgsType,
- f: (w: { client: WalletCoreApiClient; ws: Wallet }) => Promise<T>,
-): Promise<T> {
- const wh = await createLocalWallet(walletCliArgs, (notif) => {
- writeObservabilityLog(notif);
- });
- const w = wh.wallet;
- const res = await f({ client: w.client, ws: w });
- logger.info("Work done, stopping wallet.");
- w.stop();
- return res;
-}
-
walletCli
.subcommand("balance", "balance", { help: "Show wallet balance." })
.flag("json", ["--json"], {
@@ -584,12 +565,8 @@ walletCli
help: "Run until no more work is left.",
})
.action(async (args) => {
- await withLocalWallet(args, async (wallet) => {
- logger.info("running until pending operations are finished");
- await wallet.ws.runTaskLoop({
- stopWhenDone: true,
- });
- wallet.ws.stop();
+ await withWallet(args, async (ctx) => {
+ await ctx.client.call(WalletApiOperation.TestingWaitTasksDone, {});
});
});
@@ -1330,9 +1307,7 @@ advancedCli
exchangeBaseUrl: "http://localhost:8081/",
merchantBaseUrl: "http://localhost:8083/",
});
- await wallet.runTaskLoop({
- stopWhenDone: true,
- });
+ await wallet.client.call(WalletApiOperation.TestingWaitTasksDone, {});
wallet.stop();
});