summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-06-17 21:06:45 +0200
committerFlorian Dold <florian@dold.me>2021-06-17 21:06:54 +0200
commit99550b001178965cae6d5e204783f8d2fd0adc1f (patch)
tree12eef418c6712b51297df2b62b956b91344098cb /packages/taler-wallet-cli
parent954ed23911cf7e5d4dae30d56a74358bf571342b (diff)
downloadwallet-core-99550b001178965cae6d5e204783f8d2fd0adc1f.tar.gz
wallet-core-99550b001178965cae6d5e204783f8d2fd0adc1f.tar.bz2
wallet-core-99550b001178965cae6d5e204783f8d2fd0adc1f.zip
hide internal wallet state, keep it internal to package
Diffstat (limited to 'packages/taler-wallet-cli')
-rw-r--r--packages/taler-wallet-cli/src/index.ts18
1 files changed, 7 insertions, 11 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index 3949444a1..d4e5bbe46 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -51,7 +51,7 @@ import {
getClientFromWalletState,
WalletApiOperation,
WalletCoreApiClient,
- InternalWalletState,
+ Wallet,
} from "@gnu-taler/taler-wallet-core";
// This module also serves as the entry point for the crypto
@@ -172,10 +172,7 @@ type WalletCliArgsType = clk.GetArgType<typeof walletCli>;
async function withWallet<T>(
walletCliArgs: WalletCliArgsType,
- f: (w: {
- client: WalletCoreApiClient;
- ws: InternalWalletState;
- }) => Promise<T>,
+ f: (w: { client: WalletCoreApiClient; ws: Wallet }) => Promise<T>,
): Promise<T> {
const dbPath = walletCliArgs.wallet.walletDbFile ?? defaultWalletDbPath;
const myHttpLib = new NodeHttpLib();
@@ -190,7 +187,7 @@ async function withWallet<T>(
try {
const w = {
ws: wallet,
- client: await getClientFromWalletState(wallet),
+ client: wallet.client,
};
const ret = await f(w);
return ret;
@@ -242,8 +239,7 @@ walletCli
console.error("Invalid JSON");
process.exit(1);
}
- const resp = await handleCoreApiRequest(
- wallet.ws,
+ const resp = await wallet.ws.handleCoreApiRequest(
args.api.operation,
"reqid-1",
requestJson,
@@ -294,7 +290,7 @@ walletCli
.flag("forceNow", ["-f", "--force-now"])
.action(async (args) => {
await withWallet(args, async (wallet) => {
- await runPending(wallet.ws, args.runPendingOpt.forceNow);
+ await wallet.ws.runPending(args.runPendingOpt.forceNow);
});
});
@@ -318,7 +314,7 @@ walletCli
.maybeOption("maxRetries", ["--max-retries"], clk.INT)
.action(async (args) => {
await withWallet(args, async (wallet) => {
- await runUntilDone(wallet.ws, {
+ await wallet.ws.runUntilDone({
maxRetries: args.finishPendingOpt.maxRetries,
});
wallet.ws.stop();
@@ -607,7 +603,7 @@ depositCli
},
);
console.log(`Created deposit ${resp.depositGroupId}`);
- await runPending(wallet.ws);
+ await wallet.ws.runPending();
});
});