diff options
author | Florian Dold <florian@dold.me> | 2024-01-22 13:49:11 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-22 13:49:11 +0100 |
commit | 88851f45403c1995c973bcae7ad2976db3c430c7 (patch) | |
tree | 8a7bbd228b7b647a4ddc22bff732b71e0c6be276 /packages/taler-wallet-cli/src | |
parent | d32731fc7526df18361aae6aa5541e10cf6b41aa (diff) | |
download | wallet-core-88851f45403c1995c973bcae7ad2976db3c430c7.tar.xz |
wallet-core: implement DD45 global currency management requests
Diffstat (limited to 'packages/taler-wallet-cli/src')
-rw-r--r-- | packages/taler-wallet-cli/src/index.ts | 104 |
1 files changed, 102 insertions, 2 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts index 8a8f9737a..d1c8cc4d1 100644 --- a/packages/taler-wallet-cli/src/index.ts +++ b/packages/taler-wallet-cli/src/index.ts @@ -1308,17 +1308,117 @@ const currenciesCli = walletCli.subcommand("currencies", "currencies", { }); currenciesCli - .subcommand("show", "show", { help: "Show currencies." }) + .subcommand("listGlobalAuditors", "list-global-auditors", { + help: "List global-currency auditors.", + }) .action(async (args) => { await withWallet(args, async (wallet) => { const currencies = await wallet.client.call( - WalletApiOperation.ListCurrencies, + WalletApiOperation.ListGlobalCurrencyAuditors, {}, ); console.log(JSON.stringify(currencies, undefined, 2)); }); }); +currenciesCli + .subcommand("listGlobalExchanges", "list-global-exchanges", { + help: "List global-currency exchanges.", + }) + .action(async (args) => { + await withWallet(args, async (wallet) => { + const currencies = await wallet.client.call( + WalletApiOperation.ListGlobalCurrencyExchanges, + {}, + ); + console.log(JSON.stringify(currencies, undefined, 2)); + }); + }); + +currenciesCli + .subcommand("addGlobalExchange", "add-global-exchange", { + help: "Add a global-currency exchange.", + }) + .requiredOption("currency", ["--currency"], clk.STRING) + .requiredOption("exchangeBaseUrl", ["--url"], clk.STRING) + .requiredOption("exchangePub", ["--pub"], clk.STRING) + .action(async (args) => { + await withWallet(args, async (wallet) => { + const currencies = await wallet.client.call( + WalletApiOperation.AddGlobalCurrencyExchange, + { + currency: args.addGlobalExchange.currency, + exchangeBaseUrl: args.addGlobalExchange.exchangeBaseUrl, + exchangeMasterPub: args.addGlobalExchange.exchangePub, + }, + ); + console.log(JSON.stringify(currencies, undefined, 2)); + }); + }); + +currenciesCli + .subcommand("removeGlobalExchange", "remove-global-exchange", { + help: "Remove a global-currency exchange.", + }) + .requiredOption("currency", ["--currency"], clk.STRING) + .requiredOption("exchangeBaseUrl", ["--url"], clk.STRING) + .requiredOption("exchangePub", ["--pub"], clk.STRING) + .action(async (args) => { + await withWallet(args, async (wallet) => { + const currencies = await wallet.client.call( + WalletApiOperation.RemoveGlobalCurrencyExchange, + { + currency: args.removeGlobalExchange.currency, + exchangeBaseUrl: args.removeGlobalExchange.exchangeBaseUrl, + exchangeMasterPub: args.removeGlobalExchange.exchangePub, + }, + ); + console.log(JSON.stringify(currencies, undefined, 2)); + }); + }); + +currenciesCli + .subcommand("addGlobalAuditor", "add-global-auditor", { + help: "Add a global-currency auditor.", + }) + .requiredOption("currency", ["--currency"], clk.STRING) + .requiredOption("auditorBaseUrl", ["--url"], clk.STRING) + .requiredOption("auditorPub", ["--pub"], clk.STRING) + .action(async (args) => { + await withWallet(args, async (wallet) => { + const currencies = await wallet.client.call( + WalletApiOperation.AddGlobalCurrencyAuditor, + { + currency: args.addGlobalAuditor.currency, + auditorBaseUrl: args.addGlobalAuditor.auditorBaseUrl, + auditorPub: args.addGlobalAuditor.auditorPub, + }, + ); + console.log(JSON.stringify(currencies, undefined, 2)); + }); + }); + +currenciesCli + .subcommand("removeGlobalAuditor", "remove-global-auditor", { + help: "Remove a global-currency auditor.", + }) + .requiredOption("currency", ["--currency"], clk.STRING) + .requiredOption("auditorBaseUrl", ["--url"], clk.STRING) + .requiredOption("auditorPub", ["--pub"], clk.STRING) + .action(async (args) => { + await withWallet(args, async (wallet) => { + const currencies = await wallet.client.call( + WalletApiOperation.RemoveGlobalCurrencyAuditor, + { + currency: args.removeGlobalAuditor.currency, + auditorBaseUrl: args.removeGlobalAuditor.auditorBaseUrl, + auditorPub: args.removeGlobalAuditor.auditorPub, + }, + ); + console.log(JSON.stringify(currencies, undefined, 2)); + }); + }); + advancedCli .subcommand("clearDatabase", "clear-database", { help: "Clear the database, irrevocable deleting all data in the wallet.", |