gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (951d1b66f -> 6286699f2)


From: gnunet
Subject: [taler-wallet-core] branch master updated (951d1b66f -> 6286699f2)
Date: Sat, 05 Aug 2023 23:34:41 +0200

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

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

    from 951d1b66f Added translation using Weblate (Dutch)
     new 308a4282c wallet-core: mock implementation of GetCurrencyInfo
     new 6286699f2 -validation

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../integrationtests/test-age-restrictions-peer.ts |  4 +-
 packages/taler-util/src/wallet-types.ts            | 64 ++++++++++++++++++++--
 packages/taler-wallet-core/src/db.ts               |  5 +-
 packages/taler-wallet-core/src/wallet-api-types.ts | 10 ++++
 packages/taler-wallet-core/src/wallet.ts           | 13 +++++
 5 files changed, 89 insertions(+), 7 deletions(-)

diff --git 
a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts 
b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts
index d15858322..45a4391cb 100644
--- a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts
+++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts
@@ -26,7 +26,7 @@ import {
 } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { defaultCoinConfig } from "../harness/denomStructures.js";
-import { GlobalTestState, WalletCli } from "../harness/harness.js";
+import { GlobalTestState } from "../harness/harness.js";
 import {
   createSimpleTestkudosEnvironmentV2,
   createWalletDaemonWithClient,
@@ -106,7 +106,7 @@ export async function runAgeRestrictionsPeerTest(t: 
GlobalTestState) {
     );
 
     await wallet2.call(WalletApiOperation.ConfirmPeerPushCredit, {
-      peerPushPaymentIncomingId: checkResp.peerPushPaymentIncomingId,
+      transactionId: checkResp.transactionId,
     });
 
     const peerPullCreditDoneCond = wallet2.waitForNotificationCond(
diff --git a/packages/taler-util/src/wallet-types.ts 
b/packages/taler-util/src/wallet-types.ts
index 38e5787ba..42d54752a 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -379,6 +379,53 @@ export interface Balance {
   requiresUserInput: boolean;
 }
 
+export const codecForScopeInfoGlobal = (): Codec<ScopeInfoGlobal> =>
+  buildCodecForObject<ScopeInfoGlobal>()
+    .property("currency", codecForString())
+    .property("type", codecForConstString(ScopeType.Global))
+    .build("ScopeInfoGlobal");
+
+export const codecForScopeInfoExchange = (): Codec<ScopeInfoExchange> =>
+  buildCodecForObject<ScopeInfoExchange>()
+    .property("currency", codecForString())
+    .property("type", codecForConstString(ScopeType.Exchange))
+    .property("url", codecForString())
+    .build("ScopeInfoExchange");
+
+export const codecForScopeInfoAuditor = (): Codec<ScopeInfoAuditor> =>
+  buildCodecForObject<ScopeInfoAuditor>()
+    .property("currency", codecForString())
+    .property("type", codecForConstString(ScopeType.Auditor))
+    .property("url", codecForString())
+    .build("ScopeInfoAuditor");
+
+export const codecForScopeInfo = (): Codec<ScopeInfo> =>
+  buildCodecForUnion<ScopeInfo>()
+    .discriminateOn("type")
+    .alternative(ScopeType.Global, codecForScopeInfoGlobal())
+    .alternative(ScopeType.Exchange, codecForScopeInfoExchange())
+    .alternative(ScopeType.Auditor, codecForScopeInfoAuditor())
+    .build("ScopeInfo");
+
+export interface GetCurrencyInfoRequest {
+  scope: ScopeInfo;
+}
+
+export const codecForGetCurrencyInfoRequest =
+  (): Codec<GetCurrencyInfoRequest> =>
+    buildCodecForObject<GetCurrencyInfoRequest>()
+      .property("scope", codecForScopeInfo())
+      .build("GetCurrencyInfoRequest");
+
+export interface GetCurrencyInfoResponse {
+  decimalSeparator: string;
+  numFractionalDigits: number;
+  /**
+   * Is the currency name leading or trailing?
+   */
+  isCurrencyNameLeading: boolean;
+}
+
 export interface InitRequest {
   skipDefaults?: boolean;
 }
@@ -393,10 +440,19 @@ export enum ScopeType {
   Auditor = "auditor",
 }
 
-export type ScopeInfo =
-  | { type: ScopeType.Global; currency: string }
-  | { type: ScopeType.Exchange; currency: string; url: string }
-  | { type: ScopeType.Auditor; currency: string; url: string };
+export type ScopeInfoGlobal = { type: ScopeType.Global; currency: string };
+export type ScopeInfoExchange = {
+  type: ScopeType.Exchange;
+  currency: string;
+  url: string;
+};
+export type ScopeInfoAuditor = {
+  type: ScopeType.Auditor;
+  currency: string;
+  url: string;
+};
+
+export type ScopeInfo = ScopeInfoGlobal | ScopeInfoExchange | ScopeInfoAuditor;
 
 export interface BalancesResponse {
   balances: Balance[];
diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index 3d2878d93..c7d0b0bda 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -711,7 +711,10 @@ export interface RewardCoinSource {
   coinIndex: number;
 }
 
-export type CoinSource = WithdrawCoinSource | RefreshCoinSource | 
RewardCoinSource;
+export type CoinSource =
+  | WithdrawCoinSource
+  | RefreshCoinSource
+  | RewardCoinSource;
 
 /**
  * CoinRecord as stored in the "coins" data store
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts 
b/packages/taler-wallet-core/src/wallet-api-types.ts
index eaa99a6c3..36c4809af 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -114,6 +114,8 @@ import {
   WithdrawUriInfoResponse,
   SharePaymentRequest,
   SharePaymentResult,
+  GetCurrencyInfoRequest,
+  GetCurrencyInfoResponse,
 } from "@gnu-taler/taler-util";
 import { AuditorTrustRecord, WalletContractData } from "./db.js";
 import {
@@ -210,6 +212,7 @@ export enum WalletApiOperation {
   ApplyDevExperiment = "applyDevExperiment",
   ValidateIban = "validateIban",
   TestingWaitTransactionsFinal = "testingWaitTransactionsFinal",
+  GetScopedCurrencyInfo = "getScopedCurrencyInfo",
 }
 
 // group: Initialization
@@ -601,6 +604,12 @@ export type ListCurrenciesOp = {
   response: WalletCurrencyInfo;
 };
 
+export type GetScopedCurrencyInfoOp = {
+  op: WalletApiOperation.GetScopedCurrencyInfo;
+  request: GetCurrencyInfoRequest;
+  response: GetCurrencyInfoResponse;
+};
+
 // group: Deposits
 
 /**
@@ -1072,6 +1081,7 @@ export type WalletOperations = {
   [WalletApiOperation.ApplyDevExperiment]: ApplyDevExperimentOp;
   [WalletApiOperation.ValidateIban]: ValidateIbanOp;
   [WalletApiOperation.TestingWaitTransactionsFinal]: 
TestingWaitTransactionsFinal;
+  [WalletApiOperation.GetScopedCurrencyInfo]: GetScopedCurrencyInfoOp;
 };
 
 export type WalletCoreRequestType<
diff --git a/packages/taler-wallet-core/src/wallet.ts 
b/packages/taler-wallet-core/src/wallet.ts
index aab414e94..dfa41d60e 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -118,6 +118,8 @@ import {
   sampleWalletCoreTransactions,
   validateIban,
   codecForSharePaymentRequest,
+  GetCurrencyInfoResponse,
+  codecForGetCurrencyInfoRequest,
 } from "@gnu-taler/taler-util";
 import {
   HttpRequestLibrary,
@@ -1395,6 +1397,17 @@ async function dispatchRequestInternal<Op extends 
WalletApiOperation>(
       const resp = await getBackupRecovery(ws);
       return resp;
     }
+    case WalletApiOperation.GetScopedCurrencyInfo: {
+      logger.info(`payload: ${j2s(payload)}`);
+      // Ignore result, just validate in this mock implementation
+      codecForGetCurrencyInfoRequest().decode(payload);
+      const resp: GetCurrencyInfoResponse = {
+        decimalSeparator: ",",
+        isCurrencyNameLeading: false,
+        numFractionalDigits: 2,
+      };
+      return resp;
+    }
     case WalletApiOperation.ImportBackupRecovery: {
       const req = codecForAny().decode(payload);
       await loadBackupRecovery(ws, req);

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