diff options
Diffstat (limited to 'packages/taler-wallet-cli')
-rw-r--r-- | packages/taler-wallet-cli/src/index.ts | 81 |
1 files changed, 11 insertions, 70 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts index fadf84d5c..cc7c119b9 100644 --- a/packages/taler-wallet-cli/src/index.ts +++ b/packages/taler-wallet-cli/src/index.ts @@ -27,25 +27,18 @@ import { CoreApiResponse, Duration, encodeCrock, - ExtendedStatus, getErrorDetailFromException, getRandomBytes, j2s, Logger, parsePaytoUri, - PaymentStatus, PreparePayResultType, RecoveryMergeStrategy, - RefreshReason, sampleWalletCoreTransactions, setDangerousTimetravel, setGlobalLogLevelFromString, summarizeTalerErrorDetail, TalerUriType, - Transaction, - TransactionState, - TransactionSubstate, - TransactionType, WalletNotification, } from "@gnu-taler/taler-util"; import { clk } from "@gnu-taler/taler-util/clk"; @@ -61,15 +54,9 @@ import { JsonMessage, runRpcServer } from "@gnu-taler/taler-util/twrpc"; import { createNativeWalletHost, createNativeWalletHost2, - CryptoDispatcher, - nativeCrypto, - //NodeThreadCryptoWorkerFactory, - //SynchronousCryptoWorkerFactoryPlain, - TalerCryptoInterface, Wallet, WalletApiOperation, WalletCoreApiClient, - walletCoreDebugFlags, } from "@gnu-taler/taler-wallet-core"; import { createRemoteWallet, @@ -264,12 +251,19 @@ async function createLocalWallet( } }, cryptoWorkerType: walletCliArgs.wallet.cryptoWorker as any, + config: { + features: { + batchWithdrawal: checkEnvFlag("TALER_WALLET_BATCH_WITHDRAWAL"), + }, + testing: { + devModeActive: checkEnvFlag("TALER_WALLET_DEV_MODE"), + denomselAllowLate: checkEnvFlag( + "TALER_WALLET_DEBUG_DENOMSEL_ALLOW_LATE", + ), + }, + }, }); - if (checkEnvFlag("TALER_WALLET_BATCH_WITHDRAWAL")) { - wallet.setBatchWithdrawal(true); - } - applyVerbose(walletCliArgs.wallet.verbose); try { await wallet.handleCoreApiRequest("initWallet", "native-init", { @@ -1405,30 +1399,6 @@ advancedCli }); }); -advancedCli - .subcommand("enableDevMode", "enable-dev-mode", { - help: "Enable developer mode (dangerous!)", - }) - .action(async (args) => { - await withWallet(args, async (wallet) => { - await wallet.client.call(WalletApiOperation.SetDevMode, { - devModeEnabled: true, - }); - }); - }); - -advancedCli - .subcommand("disableDevMode", "disable-dev-mode", { - help: "Disable developer mode", - }) - .action(async (args) => { - await withWallet(args, async (wallet) => { - await wallet.client.call(WalletApiOperation.SetDevMode, { - devModeEnabled: false, - }); - }); - }); - const coinPubListCodec = codecForList(codecForString()); advancedCli @@ -1647,35 +1617,6 @@ async function read(stream: NodeJS.ReadStream) { return Buffer.concat(chunks).toString("utf8"); } -// testCli -// .subcommand("cryptoworker", "cryptoworker") -// .maybeOption("impl", ["--impl"], clk.STRING) -// .action(async (args) => { -// let cryptoApi: TalerCryptoInterface; -// if (!args.cryptoworker.impl || args.cryptoworker.impl === "node") { -// const workerFactory = new NodeThreadCryptoWorkerFactory(); -// const cryptoDisp = new CryptoDispatcher(workerFactory); -// cryptoApi = cryptoDisp.cryptoApi; -// } else if (args.cryptoworker.impl === "sync") { -// const workerFactory = new SynchronousCryptoWorkerFactoryPlain(); -// const cryptoDisp = new CryptoDispatcher(workerFactory); -// cryptoApi = cryptoDisp.cryptoApi; -// } else if (args.cryptoworker.impl === "none") { -// cryptoApi = nativeCrypto; -// } else { -// throw Error(`invalid crypto worker type ${args.cryptoworker.impl}`); -// } - -// const input = "foo"; -// console.log(`testing crypto worker by hashing string '${input}'`); -// const res = await cryptoApi.hashString({ str: input }); -// console.log(res); -// }); - export function main() { - if (getenv("TALER_WALLET_DEBUG_DENOMSEL_ALLOW_LATE")) { - logger.warn("Allowing withdrawal of late denominations for debugging"); - walletCoreDebugFlags.denomselAllowLate = true; - } walletCli.run(); } |