gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: implement currencies subcomma


From: gnunet
Subject: [taler-wallet-core] branch master updated: implement currencies subcommand
Date: Wed, 12 May 2021 16:18:39 +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 f4ec5b1a implement currencies subcommand
f4ec5b1a is described below

commit f4ec5b1a32193744e439c04faca0b3d31f49c2bc
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed May 12 16:18:32 2021 +0200

    implement currencies subcommand
---
 packages/taler-util/src/notifications.ts           |  2 +-
 packages/taler-wallet-cli/src/index.ts             | 13 +++++++
 packages/taler-wallet-core/src/db.ts               | 41 ++++++++++++++++------
 .../taler-wallet-core/src/operations/reserves.ts   |  1 +
 packages/taler-wallet-core/src/wallet.ts           | 11 ++++--
 5 files changed, 54 insertions(+), 14 deletions(-)

diff --git a/packages/taler-util/src/notifications.ts 
b/packages/taler-util/src/notifications.ts
index edfb377b..ade538d0 100644
--- a/packages/taler-util/src/notifications.ts
+++ b/packages/taler-util/src/notifications.ts
@@ -22,7 +22,7 @@
 /**
  * Imports.
  */
-import { TalerErrorDetails } from "./walletTypes";
+import { TalerErrorDetails } from "./walletTypes.js";
 
 export enum NotificationType {
   CoinWithdrawn = "coin-withdrawn",
diff --git a/packages/taler-wallet-cli/src/index.ts 
b/packages/taler-wallet-cli/src/index.ts
index 8b203a4c..8a9e28d3 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -604,6 +604,19 @@ advancedCli
     });
   });
 
+const currenciesCli = walletCli.subcommand("currencies", "currencies", {
+  help: "Manage currencies.",
+});
+
+currenciesCli
+  .subcommand("show", "show", { help: "Show currencies."})
+  .action(async (args) => {
+    await withWallet(args, async (wallet) => {
+      const currencies = await wallet.getCurrencies();
+      console.log(JSON.stringify(currencies, undefined, 2));
+    });
+  })
+
 const reservesCli = advancedCli.subcommand("reserves", "reserves", {
   help: "Manage reserves.",
 });
diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index 7a7c3656..2c009b4c 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -357,20 +357,41 @@ export interface AuditorRecord {
   expirationStamp: number;
 }
 
-/**
- * Exchange for currencies as stored in the wallet's currency
- * information database.
- */
-export interface ExchangeForCurrencyRecord {
+
+export interface AuditorTrustInfo {
   /**
-   * FIXME: unused?
+   * Base URL of the auditor.
    */
-  exchangeMasterPub: string;
+  auditorBaseUrl: string;
 
   /**
-   * Base URL of the exchange.
+   * Public key of the auditor.
+   */
+  auditorPub: string;
+
+  /**
+   * UIDs for the operation of adding this auditor
+   * as a trusted auditor.
+   */
+  uids: string[];
+}
+
+export interface ExchangeTrustInfo {
+  /**
+   * Canonicalized exchange base URL.
    */
   exchangeBaseUrl: string;
+
+  /**
+   * Master public key of the exchange.
+   */
+  exchangeMasterPub: string;
+
+  /**
+   * UIDs for the operation of adding this exchange
+   * as trusted.
+   */
+  uids: string[];
 }
 
 /**
@@ -390,12 +411,12 @@ export interface CurrencyRecord {
   /**
    * Auditors that the wallet trusts for this currency.
    */
-  auditors: AuditorRecord[];
+  auditors: AuditorTrustInfo[];
 
   /**
    * Exchanges that the wallet trusts for this currency.
    */
-  exchanges: ExchangeForCurrencyRecord[];
+  exchanges: ExchangeTrustInfo[];
 }
 
 /**
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts 
b/packages/taler-wallet-core/src/operations/reserves.ts
index 855ee82e..9a479427 100644
--- a/packages/taler-wallet-core/src/operations/reserves.ts
+++ b/packages/taler-wallet-core/src/operations/reserves.ts
@@ -175,6 +175,7 @@ export async function createReserve(
     currencyRecord.exchanges.push({
       exchangeBaseUrl: req.exchange,
       exchangeMasterPub: exchangeDetails.masterPublicKey,
+      uids: [encodeCrock(getRandomBytes(32))],
     });
   }
 
diff --git a/packages/taler-wallet-core/src/wallet.ts 
b/packages/taler-wallet-core/src/wallet.ts
index bf277659..f69d26e8 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -22,7 +22,11 @@
 /**
  * Imports.
  */
-import { BackupRecovery, codecForAny, TalerErrorCode } from 
"@gnu-taler/taler-util";
+import {
+  BackupRecovery,
+  codecForAny,
+  TalerErrorCode,
+} from "@gnu-taler/taler-util";
 import { CryptoWorkerFactory } from "./crypto/workers/cryptoApi";
 import {
   addBackupProvider,
@@ -181,8 +185,8 @@ const builtinCurrencies: CurrencyRecord[] = [
     auditors: [
       {
         auditorPub: "BW9DC48PHQY4NH011SHHX36DZZ3Q22Y6X7FZ1VD1CMZ2PTFZ6PN0",
-        baseUrl: "https://auditor.demo.taler.net/";,
-        expirationStamp: new Date(2027, 1).getTime(),
+        auditorBaseUrl: "https://auditor.demo.taler.net/";,
+        uids: ["5P25XF8TVQP9AW6VYGY2KV47WT5Y3ZXFSJAA570GJPX5SVJXKBVG"],
       },
     ],
     exchanges: [],
@@ -672,6 +676,7 @@ export class Wallet {
     return await this.db.iter(Stores.exchanges).toArray();
   }
 
+
   async getExchanges(): Promise<ExchangesListRespose> {
     const exchanges: (ExchangeListItem | undefined)[] = await this.db
       .iter(Stores.exchanges)

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