gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: prettier


From: gnunet
Subject: [taler-wallet-core] branch master updated: prettier
Date: Sun, 21 Jun 2020 14:50:46 +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 06d9aab4 prettier
06d9aab4 is described below

commit 06d9aab47c066fe162752a2dce7b3d2ea32ae470
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Sun Jun 21 18:20:39 2020 +0530

    prettier
---
 src/headless/taler-wallet-cli.ts | 95 +++++++++++++++++++++-------------------
 src/util/payto.ts                |  5 ++-
 2 files changed, 53 insertions(+), 47 deletions(-)

diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index 839ee999..99d7b5a0 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -25,7 +25,11 @@ import * as clk from "./clk";
 import { BridgeIDBFactory } from "idb-bridge";
 import { Logger } from "../util/logging";
 import { Amounts } from "../util/amounts";
-import { decodeCrock, setupRefreshPlanchet, encodeCrock } from 
"../crypto/talerCrypto";
+import {
+  decodeCrock,
+  setupRefreshPlanchet,
+  encodeCrock,
+} from "../crypto/talerCrypto";
 import { OperationFailedAndReportedError } from "../operations/errors";
 import { Bank } from "./bank";
 import { classifyTalerUri, TalerUriType } from "../util/taleruri";
@@ -368,41 +372,42 @@ advancedCli
     fs.writeFileSync(1, decodeCrock(enc.trim()));
   });
 
-
 advancedCli
-.subcommand("withdrawManually", "withdraw-manually", {
-  help: "Withdraw manually from an exchange.",
-})
-.requiredOption("exchange", ["--exchange"], clk.STRING, {
-  help: "Base URL of the exchange.",
-})
-.requiredOption("amount", ["--amount"], clk.STRING, {
-  help: "Amount to withdraw",
-})
-.action(async (args) => {
-  await withWallet(args, async (wallet) => {
-    const exchange = await 
wallet.updateExchangeFromUrl(args.withdrawManually.exchange);
-    const acct = exchange.wireInfo?.accounts[0];
-    if (!acct) {
-      console.log("exchange has no accounts");
-      return;
-    }
-    const reserve = await wallet.createReserve({
-      amount: Amounts.parseOrThrow(args.withdrawManually.amount),
-      exchangeWire: acct.payto_uri,
-      exchange: exchange.baseUrl,
-    });
-    await wallet.confirmReserve({
-      reservePub: reserve.reservePub,
-    });
-    const completePaytoUri = addPaytoQueryParams(acct.payto_uri, {
-      amount: args.withdrawManually.amount,
-      message: `Taler top-up ${reserve.reservePub}`,
+  .subcommand("withdrawManually", "withdraw-manually", {
+    help: "Withdraw manually from an exchange.",
+  })
+  .requiredOption("exchange", ["--exchange"], clk.STRING, {
+    help: "Base URL of the exchange.",
+  })
+  .requiredOption("amount", ["--amount"], clk.STRING, {
+    help: "Amount to withdraw",
+  })
+  .action(async (args) => {
+    await withWallet(args, async (wallet) => {
+      const exchange = await wallet.updateExchangeFromUrl(
+        args.withdrawManually.exchange,
+      );
+      const acct = exchange.wireInfo?.accounts[0];
+      if (!acct) {
+        console.log("exchange has no accounts");
+        return;
+      }
+      const reserve = await wallet.createReserve({
+        amount: Amounts.parseOrThrow(args.withdrawManually.amount),
+        exchangeWire: acct.payto_uri,
+        exchange: exchange.baseUrl,
+      });
+      await wallet.confirmReserve({
+        reservePub: reserve.reservePub,
+      });
+      const completePaytoUri = addPaytoQueryParams(acct.payto_uri, {
+        amount: args.withdrawManually.amount,
+        message: `Taler top-up ${reserve.reservePub}`,
+      });
+      console.log("Created reserve", reserve.reservePub);
+      console.log("Payto URI", completePaytoUri);
     });
-    console.log("Created reserve", reserve.reservePub);
-    console.log("Payto URI", completePaytoUri);
   });
-});
 
 const reservesCli = advancedCli.subcommand("reserves", "reserves", {
   help: "Manage reserves.",
@@ -572,19 +577,17 @@ const testCli = walletCli.subcommand("testingArgs", 
"testing", {
   help: "Subcommands for testing GNU Taler deployments.",
 });
 
-testCli
-  .subcommand("vectors", "vectors")
-  .action(async (args) => {
-    const secretSeed = nacl.randomBytes(64);
-    const coinIndex = Math.ceil(Math.random() * 100)
-    const p = setupRefreshPlanchet(secretSeed, coinIndex);
-    console.log("setupRefreshPlanchet")
-    console.log(`  (in) secret seed: ${encodeCrock(secretSeed)}`);
-    console.log(`  (in) coin index: ${coinIndex}`);
-    console.log(`  (out) blinding secret: ${encodeCrock(p.bks)}`);
-    console.log(`  (out) coin priv: ${encodeCrock(p.coinPriv)}`);
-    console.log(`  (out) coin pub: ${encodeCrock(p.coinPub)}`);
-  });
+testCli.subcommand("vectors", "vectors").action(async (args) => {
+  const secretSeed = nacl.randomBytes(64);
+  const coinIndex = Math.ceil(Math.random() * 100);
+  const p = setupRefreshPlanchet(secretSeed, coinIndex);
+  console.log("setupRefreshPlanchet");
+  console.log(`  (in) secret seed: ${encodeCrock(secretSeed)}`);
+  console.log(`  (in) coin index: ${coinIndex}`);
+  console.log(`  (out) blinding secret: ${encodeCrock(p.bks)}`);
+  console.log(`  (out) coin priv: ${encodeCrock(p.coinPriv)}`);
+  console.log(`  (out) coin pub: ${encodeCrock(p.coinPub)}`);
+});
 
 testCli
   .subcommand("integrationtestBasic", "integrationtest-basic")
diff --git a/src/util/payto.ts b/src/util/payto.ts
index b675b5d1..835214b8 100644
--- a/src/util/payto.ts
+++ b/src/util/payto.ts
@@ -25,7 +25,10 @@ const paytoPfx = "payto://";
 /**
  * Add query parameters to a payto URI
  */
-export function addPaytoQueryParams(s: string, params: { [name: string]: 
string }): string {
+export function addPaytoQueryParams(
+  s: string,
+  params: { [name: string]: string },
+): string {
   const [acct, search] = s.slice(paytoPfx.length).split("?");
   const searchParams = new URLSearchParams(search || "");
   for (const k of Object.keys(params)) {

-- 
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]