[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: wallet-core: make scope info
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: wallet-core: make scope info mandatory on exchange entry responses |
Date: |
Fri, 05 Apr 2024 19:45:59 +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 f5747b394 wallet-core: make scope info mandatory on exchange entry
responses
f5747b394 is described below
commit f5747b394d14f65d9bee342eb30edf47a36d9751
Author: Florian Dold <florian@dold.me>
AuthorDate: Fri Apr 5 19:13:48 2024 +0200
wallet-core: make scope info mandatory on exchange entry responses
---
packages/taler-harness/src/integrationtests/test-wallet-config.ts | 2 ++
packages/taler-util/src/wallet-types.ts | 8 ++++----
packages/taler-wallet-core/src/exchanges.ts | 8 ++++++--
packages/taler-wallet-webextension/src/wallet/AddExchange/test.ts | 7 ++++++-
.../src/wallet/DestinationSelection/test.ts | 7 ++++++-
5 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-wallet-config.ts
b/packages/taler-harness/src/integrationtests/test-wallet-config.ts
index 81a723473..461574031 100644
--- a/packages/taler-harness/src/integrationtests/test-wallet-config.ts
+++ b/packages/taler-harness/src/integrationtests/test-wallet-config.ts
@@ -45,9 +45,11 @@ export async function runWalletConfigTest(t:
GlobalTestState) {
exchanges: [
{
exchangeBaseUrl: "https://exchange.demo.taler.net/",
+ currencyHint: "KUDOS",
},
{
exchangeBaseUrl: "https://exchange.test.taler.net/",
+ currencyHint: "TESTKUDOS",
},
],
},
diff --git a/packages/taler-util/src/wallet-types.ts
b/packages/taler-util/src/wallet-types.ts
index 441da7a87..40c837994 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -462,7 +462,7 @@ export interface GetCurrencySpecificationResponse {
export interface BuiltinExchange {
exchangeBaseUrl: string;
- currencyHint?: string;
+ currencyHint: string;
}
export interface PartialWalletRunConfig {
@@ -1397,7 +1397,7 @@ export interface ShortExchangeListItem {
export interface ExchangeListItem {
exchangeBaseUrl: string;
masterPub: string | undefined;
- currency: string | undefined;
+ currency: string;
paytoUris: string[];
tosStatus: ExchangeTosStatus;
exchangeEntryStatus: ExchangeEntryStatus;
@@ -1415,7 +1415,7 @@ export interface ExchangeListItem {
*/
noFees: boolean;
- scopeInfo: ScopeInfo | undefined;
+ scopeInfo: ScopeInfo;
lastUpdateTimestamp: TalerPreciseTimestamp | undefined;
@@ -1483,7 +1483,7 @@ export const codecForExchangeFullDetails = ():
Codec<ExchangeFullDetails> =>
export const codecForExchangeListItem = (): Codec<ExchangeListItem> =>
buildCodecForObject<ExchangeListItem>()
- .property("currency", codecOptional(codecForString()))
+ .property("currency", codecForString())
.property("exchangeBaseUrl", codecForString())
.property("masterPub", codecOptional(codecForString()))
.property("paytoUris", codecForList(codecForString()))
diff --git a/packages/taler-wallet-core/src/exchanges.ts
b/packages/taler-wallet-core/src/exchanges.ts
index cae758a43..ca8e48c06 100644
--- a/packages/taler-wallet-core/src/exchanges.ts
+++ b/packages/taler-wallet-core/src/exchanges.ts
@@ -327,7 +327,7 @@ async function makeExchangeListItem(
masterPub: exchangeDetails?.masterPublicKey,
noFees: r.noFees ?? false,
peerPaymentsDisabled: r.peerPaymentsDisabled ?? false,
- currency: exchangeDetails?.currency ?? r.presetCurrencyHint,
+ currency: exchangeDetails?.currency ?? r.presetCurrencyHint ?? "UNKNOWN",
exchangeUpdateStatus: getExchangeUpdateStatusFromRecord(r),
exchangeEntryStatus: getExchangeEntryStatusFromRecord(r),
tosStatus: getExchangeTosStatusFromRecord(r),
@@ -337,7 +337,11 @@ async function makeExchangeListItem(
paytoUris: exchangeDetails?.wireInfo.accounts.map((x) => x.payto_uri) ??
[],
lastUpdateTimestamp: timestampOptionalPreciseFromDb(r.lastUpdate),
lastUpdateErrorInfo,
- scopeInfo,
+ scopeInfo: scopeInfo ?? {
+ type: ScopeType.Exchange,
+ currency: "UNKNOWN",
+ url: r.baseUrl,
+ },
};
}
diff --git a/packages/taler-wallet-webextension/src/wallet/AddExchange/test.ts
b/packages/taler-wallet-webextension/src/wallet/AddExchange/test.ts
index aa844f175..d0e78a94e 100644
--- a/packages/taler-wallet-webextension/src/wallet/AddExchange/test.ts
+++ b/packages/taler-wallet-webextension/src/wallet/AddExchange/test.ts
@@ -23,6 +23,7 @@ import {
ExchangeEntryStatus,
ExchangeTosStatus,
ExchangeUpdateStatus,
+ ScopeType,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import * as tests from "@gnu-taler/web-util/testing";
@@ -48,7 +49,11 @@ describe("AddExchange states", () => {
{
exchangeBaseUrl: "http://exchange.local/",
ageRestrictionOptions: [],
- scopeInfo: undefined,
+ scopeInfo: {
+ currency: "ARS",
+ type: ScopeType.Exchange,
+ url: "http://exchange.local/",
+ },
masterPub: "123qwe123",
currency: "ARS",
exchangeEntryStatus: ExchangeEntryStatus.Ephemeral,
diff --git
a/packages/taler-wallet-webextension/src/wallet/DestinationSelection/test.ts
b/packages/taler-wallet-webextension/src/wallet/DestinationSelection/test.ts
index 29cf23739..683378613 100644
--- a/packages/taler-wallet-webextension/src/wallet/DestinationSelection/test.ts
+++ b/packages/taler-wallet-webextension/src/wallet/DestinationSelection/test.ts
@@ -25,6 +25,7 @@ import {
ExchangeListItem,
ExchangeTosStatus,
ExchangeUpdateStatus,
+ ScopeType,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import * as tests from "@gnu-taler/web-util/testing";
@@ -37,7 +38,11 @@ const exchangeArs: ExchangeListItem = {
currency: "ARS",
exchangeBaseUrl: "http://",
masterPub: "123qwe123",
- scopeInfo: undefined,
+ scopeInfo: {
+ currency: "ARS",
+ type: ScopeType.Exchange,
+ url: "http://",
+ },
tosStatus: ExchangeTosStatus.Accepted,
exchangeEntryStatus: ExchangeEntryStatus.Used,
exchangeUpdateStatus: ExchangeUpdateStatus.Initial,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: wallet-core: make scope info mandatory on exchange entry responses,
gnunet <=