gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: improved denomination generat


From: gnunet
Subject: [taler-wallet-core] branch master updated: improved denomination generator
Date: Wed, 04 Aug 2021 23:26:55 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 0439096a improved denomination generator
0439096a is described below

commit 0439096a534fa38f5522c3a1e152dc7b650545a6
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Aug 4 23:26:47 2021 +0200

    improved denomination generator
---
 debian/changelog                       |  6 ++++++
 packages/taler-wallet-cli/src/index.ts | 22 ++++++++++++++++------
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3042c53f..7068ef04 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 6bc4897f..673bfab2 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`;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]