From 80433b939962815ad8807b0d6e957d66dbd0e306 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 23 Jul 2020 18:30:08 +0530 Subject: remove more history remains --- src/headless/integrationtest.ts | 9 --------- src/headless/taler-wallet-cli.ts | 42 +++++++++++++++++----------------------- 2 files changed, 18 insertions(+), 33 deletions(-) (limited to 'src/headless') diff --git a/src/headless/integrationtest.ts b/src/headless/integrationtest.ts index db96d57c4..51e93f30b 100644 --- a/src/headless/integrationtest.ts +++ b/src/headless/integrationtest.ts @@ -184,13 +184,6 @@ export async function runIntegrationTest( ); await myWallet.runUntilDone(); - - const history = await myWallet.getHistory({ extraDebug: true }); - - console.log( - "history after integration test:", - JSON.stringify(history, undefined, 2), - ); } export async function runIntegrationTestBasic( @@ -327,8 +320,6 @@ export async function runIntegrationTestBasic( await myWallet.runUntilDone(); - const history = await myWallet.getHistory({ extraDebug: true }); - console.log( "history after integration test:", JSON.stringify(history, undefined, 2), diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts index b8ae84d72..0357a10fe 100644 --- a/src/headless/taler-wallet-cli.ts +++ b/src/headless/taler-wallet-cli.ts @@ -39,6 +39,7 @@ import { makeCodecForList, codecForString } from "../util/codec"; import { NodeHttpLib } from "./NodeHttpLib"; import * as nacl from "../crypto/primitives/nacl-fast"; import { addPaytoQueryParams } from "../util/payto"; +import { handleCoreApiRequest } from "../walletCoreApiHandler"; const logger = new Logger("taler-wallet-cli.ts"); @@ -198,33 +199,26 @@ walletCli }); walletCli - .subcommand("history", "history", { help: "Show wallet event history." }) - .flag("json", ["--json"], { - default: false, - }) - .maybeOption("from", ["--from"], clk.STRING) - .maybeOption("to", ["--to"], clk.STRING) - .maybeOption("limit", ["--limit"], clk.STRING) - .maybeOption("contEvt", ["--continue-with"], clk.STRING) - .flag("extraDebug", ["--extra-debug"]) + .subcommand("api", "balance", { help: "Call the wallet-core API directly." }) + .requiredArgument("operation", clk.STRING) + .requiredArgument("request", clk.STRING) .action(async (args) => { await withWallet(args, async (wallet) => { - const history = await wallet.getHistory({ - extraDebug: args.history.extraDebug, - }); - if (args.history.json) { - console.log(JSON.stringify(history, undefined, 2)); - } else { - for (const h of history.history) { - console.log( - `event at ${new Date(h.timestamp.t_ms).toISOString()} with type ${ - h.type - }:`, - ); - console.log(JSON.stringify(h, undefined, 2)); - console.log(); - } + let requestJson; + try { + requestJson = JSON.parse(args.api.operation); + } catch (e) { + console.error("malformed request"); + process.exit(1); + return; } + const resp = await handleCoreApiRequest( + wallet, + args.api.operation, + 1, + requestJson, + ); + console.log(JSON.stringify(resp, undefined, 2)); }); }); -- cgit v1.2.3