gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: clean up taler-wire tool


From: gnunet
Subject: [taler-exchange] branch master updated: clean up taler-wire tool
Date: Sat, 18 Jan 2020 20:36:12 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new c1996b7e clean up taler-wire tool
c1996b7e is described below

commit c1996b7e69d7cb51adbd687b3a1cffdc02e28d3c
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Jan 18 20:36:02 2020 +0100

    clean up taler-wire tool
---
 src/exchange-tools/taler-wire.c | 58 ++++++++++++++---------------------------
 1 file changed, 19 insertions(+), 39 deletions(-)

diff --git a/src/exchange-tools/taler-wire.c b/src/exchange-tools/taler-wire.c
index 4cb81f10..7fc3b041 100644
--- a/src/exchange-tools/taler-wire.c
+++ b/src/exchange-tools/taler-wire.c
@@ -18,7 +18,7 @@
 */
 /**
  * @file taler-wire.c
- * @brief Utility performing wire transfers.
+ * @brief Utility for performing wire transfers.
  * @author Marcello Stanisci
  * @author Christian Grothoff
  */
@@ -47,10 +47,9 @@ static unsigned int global_ret = 1;
 
 /**
  * When a wire transfer is being performed, this value
- * specifies the amount to wire-transfer.  It's given in
- * the usual CURRENCY:X[.Y] format.
+ * specifies the amount to transfer.
  */
-static char *amount;
+static struct TALER_Amount amount;
 
 /**
  * Starting row.
@@ -183,36 +182,15 @@ confirmation_cb (void *cls,
 static void
 execute_wire_transfer ()
 {
-  struct TALER_Amount a;
   struct TALER_WireTransferIdentifierRawP wtid;
   void *buf;
   size_t buf_size;
 
-  if (NULL == amount)
-  {
-    fprintf (stderr,
-             "The option -a: AMOUNT, is mandatory.\n");
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  if (GNUNET_OK != TALER_string_to_amount (amount,
-                                           &a))
-  {
-    fprintf (stderr,
-             "Amount string incorrect.\n");
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  if (NULL == destination_account_url)
-  {
-    fprintf (stderr,
-             "Please give destination"
-             " account URL (--destination/-d)\n");
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
+  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
+                              &wtid,
+                              sizeof (wtid));
   TALER_BANK_prepare_wire_transfer (destination_account_url,
-                                    &a,
+                                    &amount,
                                     "http://exchange.example.com/";,
                                     &wtid,
                                     &buf,
@@ -387,16 +365,18 @@ main (int argc,
                                     "ACCOUNT-SECTION",
                                     "Which config section has the credentials 
to access the bank.  Mandatory.\n",
                                     &account_section)),
-    GNUNET_GETOPT_option_string ('a',
-                                 "amount",
-                                 "AMOUNT",
-                                 "Specify the amount to transfer.",
-                                 &amount),
-    GNUNET_GETOPT_option_string ('d',
-                                 "destination",
-                                 "PAYTO-URL",
-                                 "Destination account for the wire transfer.",
-                                 &destination_account_url),
+    GNUNET_GETOPT_option_mandatory
+      (TALER_getopt_get_amount ('a',
+                                "amount",
+                                "AMOUNT",
+                                "Specify the amount to transfer.",
+                                &amount)),
+    GNUNET_GETOPT_option_mandatory
+      (GNUNET_GETOPT_option_string ('d',
+                                    "destination",
+                                    "PAYTO-URL",
+                                    "Destination account for the wire 
transfer.",
+                                    &destination_account_url)),
     GNUNET_GETOPT_OPTION_END
   };
   int ret;

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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