aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog6
-rw-r--r--packages/taler-wallet-cli/src/index.ts22
2 files changed, 22 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog
index 3042c53f8..7068ef049 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+taler-wallet-cli (0.0.1-2) unstable; urgency=low
+
+ * Improved denomination generator.
+
+ -- Florian Dold <dold@taler.net> Wed, 04 Aug 2021 23:26:17 +0200
+
taler-wallet-cli (0.0.1-1) unstable; urgency=low
* Added exchange deployment linting tool.
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index 6bc4897fc..673bfab2a 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -40,6 +40,7 @@ import {
codecForString,
Logger,
Configuration,
+ getTimestampNow,
} from "@gnu-taler/taler-util";
import {
NodeHttpLib,
@@ -891,15 +892,24 @@ deploymentCli
.subcommand("coincfg", "gen-coin-config", {
help: "Generate a coin/denomination configuration for the exchange.",
})
- .requiredOption("currency", ["--currency"], clk.STRING, {
- help: "Currency to use",
+ .requiredOption("minAmount", ["--min-amount"], clk.STRING, {
+ help: "Smallest denomination",
+ })
+ .requiredOption("maxAmount", ["--max-amount"], clk.STRING, {
+ help: "Largest denomination",
})
.action(async (args) => {
let out = "";
- const currency = args.coincfg.currency;
- const min = Amounts.parseOrThrow(`${currency}:0.01`);
- const max = Amounts.parseOrThrow(`${currency}:100`);
+ const stamp = Math.floor((new Date()).getTime() / 1000);
+
+ const min = Amounts.parseOrThrow(args.coincfg.minAmount);
+ const max = Amounts.parseOrThrow(args.coincfg.maxAmount);
+ if (min.currency != max.currency) {
+ console.error("currency mismatch")
+ process.exit(1);
+ }
+ const currency = min.currency;
let x = min;
let n = 1;
@@ -908,7 +918,7 @@ deploymentCli
out += "\n";
while (Amounts.cmp(x, max) < 0) {
- out += `[COIN-${currency}_${n}]\n`;
+ out += `[COIN-${currency}-n${n}-t${stamp}]\n`;
out += `VALUE = ${Amounts.stringify(x)}\n`;
out += `DURATION_WITHDRAW = 7 days\n`;
out += `DURATION_SPEND = 2 years\n`;