taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit ce139cd061f0d592804232d72aaf8904bbaf0caf
parent 3c2e2aeba979dbafaed6c4ed749175da0ef93426
Author: Florian Dold <florian@dold.me>
Date:   Mon, 11 Dec 2023 10:45:02 +0100

wallet-core: add scopeInfo to exchange list entry items

Diffstat:
MAPI_CHANGES.md | 4++--
Mpackages/taler-util/src/wallet-types.ts | 3+++
Mpackages/taler-wallet-core/src/operations/common.ts | 13+++++++++++++
3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/API_CHANGES.md b/API_CHANGES.md @@ -21,4 +21,5 @@ This files contains all the API changes for the current release: request the ToS status separately via a getExchangeEntryForUri request. - 2023-12-07 dold: Add the prepareWithdrawExchange request for withdrawals via a taler://withdraw-exchange URI. -- 2023-12-11 dold: Add exchangeBaseUrl to the checkPeerPushDebit response. -\ No newline at end of file +- 2023-12-11 dold: Add exchangeBaseUrl to the checkPeerPushDebit response. +- 2023-12-11 dold: Add scopeInfo to exchange entry list items. diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts @@ -1317,6 +1317,8 @@ export interface ExchangeListItem { exchangeUpdateStatus: ExchangeUpdateStatus; ageRestrictionOptions: number[]; + scopeInfo: ScopeInfo | undefined; + /** * Information about the last error that occurred when trying * to update the exchange info. @@ -1388,6 +1390,7 @@ export const codecForExchangeListItem = (): Codec<ExchangeListItem> => .property("exchangeEntryStatus", codecForAny()) .property("exchangeUpdateStatus", codecForAny()) .property("ageRestrictionOptions", codecForList(codecForNumber())) + .property("scopeInfo", codecForScopeInfo()) .build("ExchangeListItem"); export const codecForExchangesListResponse = (): Codec<ExchangesListResponse> => diff --git a/packages/taler-wallet-core/src/operations/common.ts b/packages/taler-wallet-core/src/operations/common.ts @@ -37,6 +37,8 @@ import { NotificationType, OperationErrorInfo, RefreshReason, + ScopeInfo, + ScopeType, TalerError, TalerErrorCode, TalerErrorDetail, @@ -591,6 +593,16 @@ export function makeExchangeListItem( break; } + let scopeInfo: ScopeInfo | undefined = undefined; + if (exchangeDetails) { + // FIXME: Look up actual scope info. + scopeInfo = { + currency: exchangeDetails.currency, + type: ScopeType.Exchange, + url: r.baseUrl, + }; + } + return { exchangeBaseUrl: r.baseUrl, currency: exchangeDetails?.currency ?? r.presetCurrencyHint, @@ -604,6 +616,7 @@ export function makeExchangeListItem( : [], paytoUris: exchangeDetails?.wireInfo.accounts.map((x) => x.payto_uri) ?? [], lastUpdateErrorInfo, + scopeInfo, }; }