summaryrefslogtreecommitdiff
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.ts268
1 files changed, 162 insertions, 106 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index b915de538..5bde7db01 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -29,6 +29,7 @@ import {
encodeCrock,
getErrorDetailFromException,
getRandomBytes,
+ InitRequest,
j2s,
Logger,
NotificationType,
@@ -252,8 +253,8 @@ interface CreateWalletResult {
async function createLocalWallet(
walletCliArgs: WalletCliArgsType,
+ args: WalletRunArgs,
notificationHandler?: (n: WalletNotification) => void,
- noInit?: boolean,
): Promise<CreateWalletResult> {
const dbPath = walletCliArgs.wallet.walletDbFile ?? defaultWalletDbPath;
const myHttpLib = createPlatformHttpLib({
@@ -275,23 +276,27 @@ async function createLocalWallet(
applyVerbose(walletCliArgs.wallet.verbose);
const res = { wallet: wh.wallet, getStats: wh.getDbStats };
- if (noInit) {
+ if (args.noInit) {
return res;
}
try {
- await wh.wallet.handleCoreApiRequest("initWallet", "native-init", {
- config: {
- features: {},
- testing: {
- devModeActive: checkEnvFlag("TALER_WALLET_DEV_MODE"),
- denomselAllowLate: checkEnvFlag(
- "TALER_WALLET_DEBUG_DENOMSEL_ALLOW_LATE",
- ),
- emitObservabilityEvents: observabilityEventFile != null,
- skipDefaults: walletCliArgs.wallet.skipDefaults,
+ await wh.wallet.handleCoreApiRequest(
+ WalletApiOperation.InitWallet,
+ "native-init",
+ {
+ config: {
+ lazyTaskLoop: args.lazyTaskLoop,
+ testing: {
+ devModeActive: checkEnvFlag("TALER_WALLET_DEV_MODE"),
+ denomselAllowLate: checkEnvFlag(
+ "TALER_WALLET_DEBUG_DENOMSEL_ALLOW_LATE",
+ ),
+ emitObservabilityEvents: observabilityEventFile != null,
+ skipDefaults: walletCliArgs.wallet.skipDefaults,
+ },
},
- },
- });
+ } satisfies InitRequest,
+ );
return res;
} catch (e) {
const ed = getErrorDetailFromException(e);
@@ -312,8 +317,14 @@ function writeObservabilityLog(notif: WalletNotification): void {
}
}
+export interface WalletRunArgs {
+ lazyTaskLoop?: boolean;
+ noInit?: boolean;
+}
+
async function withWallet<T>(
walletCliArgs: WalletCliArgsType,
+ args: WalletRunArgs = {},
f: (ctx: WalletContext) => Promise<T>,
): Promise<T> {
const waiter = makeNotificationWaiter();
@@ -341,7 +352,7 @@ async function withWallet<T>(
w.close();
return res;
} else {
- const wh = await createLocalWallet(walletCliArgs, onNotif);
+ const wh = await createLocalWallet(walletCliArgs, args, onNotif);
const ctx: WalletContext = {
client: wh.wallet.client,
waitForNotificationCond: waiter.waitForNotificationCond,
@@ -365,13 +376,19 @@ walletCli
help: "Show raw JSON.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
- const balance = await wallet.client.call(
- WalletApiOperation.GetBalances,
- {},
- );
- console.log(JSON.stringify(balance, undefined, 2));
- });
+ await withWallet(
+ args,
+ {
+ lazyTaskLoop: true,
+ },
+ async (wallet) => {
+ const balance = await wallet.client.call(
+ WalletApiOperation.GetBalances,
+ {},
+ );
+ console.log(JSON.stringify(balance, undefined, 2));
+ },
+ );
});
walletCli
@@ -382,7 +399,7 @@ walletCli
help: "Exit with non-zero status code when request fails instead of returning error JSON.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, {}, async (wallet) => {
let requestJson;
logger.info(`handling 'api' request (${args.api.operation})`);
const jsonContent = args.api.request.startsWith("@")
@@ -425,18 +442,24 @@ const transactionsCli = walletCli
// Default action
transactionsCli.action(async (args) => {
- await withWallet(args, async (wallet) => {
- const pending = await wallet.client.call(
- WalletApiOperation.GetTransactions,
- {
- currency: args.transactions.currency,
- search: args.transactions.search,
- includeRefreshes: args.transactions.includeRefreshes,
- sort: "stable-ascending",
- },
- );
- console.log(JSON.stringify(pending, undefined, 2));
- });
+ await withWallet(
+ args,
+ {
+ lazyTaskLoop: true,
+ },
+ async (wallet) => {
+ const pending = await wallet.client.call(
+ WalletApiOperation.GetTransactions,
+ {
+ currency: args.transactions.currency,
+ search: args.transactions.search,
+ includeRefreshes: args.transactions.includeRefreshes,
+ sort: "stable-ascending",
+ },
+ );
+ console.log(JSON.stringify(pending, undefined, 2));
+ },
+ );
});
transactionsCli
@@ -447,11 +470,18 @@ transactionsCli
help: "Identifier of the transaction to delete",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
- await wallet.client.call(WalletApiOperation.DeleteTransaction, {
- transactionId: args.deleteTransaction.transactionId as TransactionIdStr,
- });
- });
+ await withWallet(
+ args,
+ {
+ lazyTaskLoop: true,
+ },
+ async (wallet) => {
+ await wallet.client.call(WalletApiOperation.DeleteTransaction, {
+ transactionId: args.deleteTransaction
+ .transactionId as TransactionIdStr,
+ });
+ },
+ );
});
transactionsCli
@@ -462,12 +492,18 @@ transactionsCli
help: "Identifier of the transaction to suspend.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
- await wallet.client.call(WalletApiOperation.SuspendTransaction, {
- transactionId: args.suspendTransaction
- .transactionId as TransactionIdStr,
- });
- });
+ await withWallet(
+ args,
+ {
+ lazyTaskLoop: true,
+ },
+ async (wallet) => {
+ await wallet.client.call(WalletApiOperation.SuspendTransaction, {
+ transactionId: args.suspendTransaction
+ .transactionId as TransactionIdStr,
+ });
+ },
+ );
});
transactionsCli
@@ -478,11 +514,17 @@ transactionsCli
help: "Identifier of the transaction to fail.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
- await wallet.client.call(WalletApiOperation.FailTransaction, {
- transactionId: args.fail.transactionId as TransactionIdStr,
- });
- });
+ await withWallet(
+ args,
+ {
+ lazyTaskLoop: true,
+ },
+ async (wallet) => {
+ await wallet.client.call(WalletApiOperation.FailTransaction, {
+ transactionId: args.fail.transactionId as TransactionIdStr,
+ });
+ },
+ );
});
transactionsCli
@@ -493,7 +535,7 @@ transactionsCli
help: "Identifier of the transaction to suspend.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.ResumeTransaction, {
transactionId: args.resumeTransaction.transactionId as TransactionIdStr,
});
@@ -508,7 +550,7 @@ transactionsCli
help: "Identifier of the transaction to delete",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const tx = await wallet.client.call(
WalletApiOperation.GetTransactionById,
{
@@ -527,7 +569,7 @@ transactionsCli
help: "Identifier of the transaction to delete",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.AbortTransaction, {
transactionId: args.abortTransaction.transactionId as TransactionIdStr,
});
@@ -539,7 +581,7 @@ walletCli
help: "Show version details.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const versionInfo = await wallet.client.call(
WalletApiOperation.GetVersion,
{},
@@ -554,7 +596,7 @@ transactionsCli
})
.requiredArgument("transactionId", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.RetryTransaction, {
transactionId: args.retryTransaction.transactionId as TransactionIdStr,
});
@@ -566,7 +608,7 @@ walletCli
help: "Run until no more work is left.",
})
.action(async (args) => {
- await withWallet(args, async (ctx) => {
+ await withWallet(args, { lazyTaskLoop: false }, async (ctx) => {
await ctx.client.call(WalletApiOperation.TestingWaitTasksDone, {});
});
});
@@ -583,7 +625,7 @@ withdrawCli
const uri = args.withdrawCheckUri.uri;
const restrictAge = args.withdrawCheckUri.restrictAge;
console.log(`age restriction requested (${restrictAge})`);
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const withdrawInfo = await wallet.client.call(
WalletApiOperation.GetWithdrawalDetailsForUri,
{
@@ -603,7 +645,7 @@ withdrawCli
.action(async (args) => {
const restrictAge = args.withdrawCheckAmount.restrictAge;
console.log(`age restriction requested (${restrictAge})`);
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const withdrawInfo = await wallet.client.call(
WalletApiOperation.GetWithdrawalDetailsForAmount,
{
@@ -625,7 +667,7 @@ withdrawCli
const uri = args.withdrawAcceptUri.uri;
const restrictAge = args.withdrawAcceptUri.restrictAge;
console.log(`age restriction requested (${restrictAge})`);
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const res = await wallet.client.call(
WalletApiOperation.AcceptBankIntegratedWithdrawal,
{
@@ -649,7 +691,7 @@ walletCli
.maybeOption("restrictAge", ["--restrict-age"], clk.INT)
.flag("autoYes", ["-y", "--yes"])
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
let uri;
if (args.handleUri.uri) {
uri = args.handleUri.uri;
@@ -727,7 +769,7 @@ withdrawCli
.maybeOption("forcedReservePriv", ["--forced-reserve-priv"], clk.STRING, {})
.maybeOption("restrictAge", ["--restrict-age"], clk.INT)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const exchangeBaseUrl = args.withdrawManually.exchange;
const amount = args.withdrawManually.amount;
const d = await wallet.client.call(
@@ -771,7 +813,7 @@ exchangesCli
})
.action(async (args) => {
console.log("Listing exchanges ...");
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const exchanges = await wallet.client.call(
WalletApiOperation.ListExchanges,
{},
@@ -789,7 +831,7 @@ exchangesCli
})
.flag("force", ["-f", "--force"])
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.UpdateExchangeEntry, {
exchangeBaseUrl: args.exchangesUpdateCmd.url,
force: args.exchangesUpdateCmd.force,
@@ -805,7 +847,7 @@ exchangesCli
help: "Base URL of the exchange.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.GetExchangeDetailedInfo,
{
@@ -824,7 +866,7 @@ exchangesCli
help: "Base URL of the exchange.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.AddExchange, {
exchangeBaseUrl: args.exchangesAddCmd.url,
});
@@ -840,7 +882,7 @@ exchangesCli
})
.flag("purge", ["--purge"])
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.DeleteExchange, {
exchangeBaseUrl: args.exchangesAddCmd.url,
purge: args.exchangesAddCmd.purge,
@@ -856,7 +898,7 @@ exchangesCli
help: "Base URL of the exchange.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.SetExchangeTosAccepted, {
exchangeBaseUrl: args.exchangesAcceptTosCmd.url,
});
@@ -879,7 +921,7 @@ exchangesCli
.map((x) => x.trim());
acceptedFormat = split;
}
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const tosResult = await wallet.client.call(
WalletApiOperation.GetExchangeTos,
{
@@ -896,14 +938,14 @@ const backupCli = walletCli.subcommand("backupArgs", "backup", {
});
backupCli.subcommand("exportDb", "export-db").action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const backup = await wallet.client.call(WalletApiOperation.ExportDb, {});
console.log(JSON.stringify(backup, undefined, 2));
});
});
backupCli.subcommand("storeBackup", "store").action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.CreateStoredBackup,
{},
@@ -913,7 +955,7 @@ backupCli.subcommand("storeBackup", "store").action(async (args) => {
});
backupCli.subcommand("storeBackup", "list-stored").action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.ListStoredBackups,
{},
@@ -926,7 +968,7 @@ backupCli
.subcommand("storeBackup", "delete-stored")
.requiredArgument("name", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.DeleteStoredBackup,
{
@@ -941,7 +983,7 @@ backupCli
.subcommand("recoverBackup", "recover-stored")
.requiredArgument("name", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.RecoverStoredBackup,
{
@@ -953,7 +995,7 @@ backupCli
});
backupCli.subcommand("importDb", "import-db").action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const dumpRaw = await read(process.stdin);
const dump = JSON.parse(dumpRaw);
await wallet.client.call(WalletApiOperation.ImportDb, {
@@ -971,7 +1013,7 @@ depositCli
.requiredArgument("amount", clk.AMOUNT)
.requiredArgument("targetPayto", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.CreateDepositGroup,
{
@@ -995,7 +1037,7 @@ peerCli
help: "Amount to pay",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.CheckPeerPushDebit,
{
@@ -1014,7 +1056,7 @@ peerCli
help: "Amount to request",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.CheckPeerPullCredit,
{
@@ -1029,7 +1071,7 @@ peerCli
.subcommand("prepareIncomingPayPull", "prepare-pull-debit")
.requiredArgument("talerUri", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.PreparePeerPullDebit,
{
@@ -1044,7 +1086,7 @@ peerCli
.subcommand("confirmIncomingPayPull", "confirm-pull-debit")
.requiredArgument("transactionId", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.ConfirmPeerPullDebit,
{
@@ -1060,7 +1102,7 @@ peerCli
.subcommand("confirmIncomingPayPush", "confirm-push-credit")
.requiredArgument("transactionId", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.ConfirmPeerPushCredit,
{
@@ -1098,7 +1140,7 @@ peerCli
);
}
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.InitiatePeerPullCredit,
{
@@ -1118,7 +1160,7 @@ peerCli
.subcommand("preparePushCredit", "prepare-push-credit")
.requiredArgument("talerUri", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.PreparePeerPushCredit,
{
@@ -1155,7 +1197,7 @@ peerCli
);
}
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.InitiatePeerPushDebit,
{
@@ -1189,11 +1231,21 @@ advancedCli
});
advancedCli
+ .subcommand("resetAllRetries", "reset-all-retries", {
+ help: "Reset all retry counters.",
+ })
+ .action(async (args) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
+ await wallet.client.call(WalletApiOperation.TestingResetAllRetries, {});
+ });
+ });
+
+advancedCli
.subcommand("tasks", "tasks", {
help: "Show active wallet-core tasks.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const tasks = await wallet.client.call(
WalletApiOperation.GetActiveTasks,
{},
@@ -1244,7 +1296,11 @@ advancedCli
const onNotif = (notif: WalletNotification) => {
writeObservabilityLog(notif);
};
- const wh = await createLocalWallet(args, onNotif, args.serve.noInit);
+ const wh = await createLocalWallet(
+ args,
+ { lazyTaskLoop: false, noInit: args.serve.noInit },
+ onNotif,
+ );
const w = wh.wallet;
let nextClientId = 1;
const notifyHandlers = new Map<number, (n: WalletNotification) => void>();
@@ -1293,7 +1349,7 @@ advancedCli
help: "Initialize the wallet (with DB) and exit.",
})
.action(async (args) => {
- await withWallet(args, async () => {});
+ await withWallet(args, { lazyTaskLoop: true }, async () => {});
});
advancedCli
@@ -1309,7 +1365,7 @@ advancedCli
advancedCli
.subcommand("pending", "pending", { help: "Show pending operations." })
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const pending = await wallet.client.call(
WalletApiOperation.GetPendingOperations,
{},
@@ -1360,7 +1416,7 @@ currenciesCli
help: "List global-currency auditors.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const currencies = await wallet.client.call(
WalletApiOperation.ListGlobalCurrencyAuditors,
{},
@@ -1374,7 +1430,7 @@ currenciesCli
help: "List global-currency exchanges.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const currencies = await wallet.client.call(
WalletApiOperation.ListGlobalCurrencyExchanges,
{},
@@ -1391,7 +1447,7 @@ currenciesCli
.requiredOption("exchangeBaseUrl", ["--url"], clk.STRING)
.requiredOption("exchangePub", ["--pub"], clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const currencies = await wallet.client.call(
WalletApiOperation.AddGlobalCurrencyExchange,
{
@@ -1412,7 +1468,7 @@ currenciesCli
.requiredOption("exchangeBaseUrl", ["--url"], clk.STRING)
.requiredOption("exchangePub", ["--pub"], clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const currencies = await wallet.client.call(
WalletApiOperation.RemoveGlobalCurrencyExchange,
{
@@ -1433,7 +1489,7 @@ currenciesCli
.requiredOption("auditorBaseUrl", ["--url"], clk.STRING)
.requiredOption("auditorPub", ["--pub"], clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const currencies = await wallet.client.call(
WalletApiOperation.AddGlobalCurrencyAuditor,
{
@@ -1454,7 +1510,7 @@ currenciesCli
.requiredOption("auditorBaseUrl", ["--url"], clk.STRING)
.requiredOption("auditorPub", ["--pub"], clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const currencies = await wallet.client.call(
WalletApiOperation.RemoveGlobalCurrencyAuditor,
{
@@ -1472,7 +1528,7 @@ advancedCli
help: "Clear the database, irrevocable deleting all data in the wallet.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.ClearDb, {});
});
});
@@ -1482,7 +1538,7 @@ advancedCli
help: "Export, clear and re-import the database via the backup mechanism.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.Recycle, {});
});
});
@@ -1493,7 +1549,7 @@ advancedCli
})
.requiredArgument("url", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const res = await wallet.client.call(
WalletApiOperation.PreparePayForUri,
{
@@ -1526,7 +1582,7 @@ advancedCli
})
.requiredArgument("transactionId", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.StartRefundQuery, {
transactionId: args.queryRefund.transactionId as TransactionIdStr,
});
@@ -1540,7 +1596,7 @@ advancedCli
.requiredArgument("proposalId", clk.STRING)
.maybeOption("sessionIdOverride", ["--session-id"], clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.ConfirmPay, {
proposalId: args.payConfirm.proposalId,
sessionId: args.payConfirm.sessionIdOverride,
@@ -1554,7 +1610,7 @@ advancedCli
})
.requiredArgument("coinPub", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.ForceRefresh, {
refreshCoinSpecs: [
{
@@ -1570,7 +1626,7 @@ advancedCli
help: "Dump coins in an easy-to-process format.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const coinDump = await wallet.client.call(
WalletApiOperation.DumpCoins,
{},
@@ -1587,7 +1643,7 @@ advancedCli
})
.requiredArgument("coinPubSpec", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
let coinPubList: string[];
try {
coinPubList = coinPubListCodec.decode(
@@ -1612,7 +1668,7 @@ advancedCli
})
.requiredArgument("coinPubSpec", clk.STRING)
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
let coinPubList: string[];
try {
coinPubList = coinPubListCodec.decode(
@@ -1636,7 +1692,7 @@ advancedCli
help: "List coins.",
})
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
const coins = await wallet.client.call(WalletApiOperation.DumpCoins, {});
for (const coin of coins.coins) {
console.log(`coin ${coin.coin_pub}`);
@@ -1654,13 +1710,13 @@ const testCli = walletCli.subcommand("testingArgs", "testing", {
testCli
.subcommand("withdrawTestkudos", "withdraw-testkudos")
.action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.WithdrawTestkudos, {});
});
});
testCli.subcommand("withdrawKudos", "withdraw-kudos").action(async (args) => {
- await withWallet(args, async (wallet) => {
+ await withWallet(args, { lazyTaskLoop: true }, async (wallet) => {
await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
amount: "KUDOS:50" as AmountString,
corebankApiBaseUrl: "https://bank.demo.taler.net/",