diff options
author | Florian Dold <florian@dold.me> | 2023-12-11 20:01:28 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-12-12 15:42:34 +0100 |
commit | e31f18b8f129adb9cbe33158297a9cff56a7143e (patch) | |
tree | fc960e069a08ca1924a79c154f5ced26db709348 /packages/taler-util/src | |
parent | 055645e17aa9424f299aa04f686de7574ab437c7 (diff) | |
download | wallet-core-e31f18b8f129adb9cbe33158297a9cff56a7143e.tar.xz |
wallet-core: towards better DD48 support
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r-- | packages/taler-util/src/notifications.ts | 33 | ||||
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 17 |
2 files changed, 30 insertions, 20 deletions
diff --git a/packages/taler-util/src/notifications.ts b/packages/taler-util/src/notifications.ts index b91d91777..571d8f036 100644 --- a/packages/taler-util/src/notifications.ts +++ b/packages/taler-util/src/notifications.ts @@ -23,15 +23,14 @@ * Imports. */ import { TransactionState } from "./transactions-types.js"; -import { TalerErrorDetail } from "./wallet-types.js"; +import { ExchangeEntryState, TalerErrorDetail } from "./wallet-types.js"; export enum NotificationType { BalanceChange = "balance-change", - ExchangeOperationError = "exchange-operation-error", - ExchangeAdded = "exchange-added", BackupOperationError = "backup-error", PendingOperationProcessed = "pending-operation-processed", TransactionStateTransition = "transaction-state-transition", + ExchangeStateTransition = "exchange-state-transition", } export interface ErrorInfoSummary { @@ -59,19 +58,29 @@ export interface TransactionStateTransitionNotification { experimentalUserData?: any; } -export interface ExchangeAddedNotification { - type: NotificationType.ExchangeAdded; +export interface ExchangeStateTransitionNotification { + type: NotificationType.ExchangeStateTransition; + /** + * Identification of the exchange entry that this + * notification is about. + */ + exchangeBaseUrl: string; + + /** + * If missing, the notification means that + * the exchange entry is newly created. + */ + oldExchangeState?: ExchangeEntryState; + + newExchangeState: ExchangeEntryState; + + errorInfo?: ErrorInfoSummary; } export interface BalanceChangeNotification { type: NotificationType.BalanceChange; } -export interface ExchangeOperationErrorNotification { - type: NotificationType.ExchangeOperationError; - error: TalerErrorDetail; -} - export interface BackupOperationErrorNotification { type: NotificationType.BackupOperationError; error: TalerErrorDetail; @@ -80,12 +89,12 @@ export interface BackupOperationErrorNotification { export interface PendingOperationProcessedNotification { type: NotificationType.PendingOperationProcessed; id: string; + taskResultType: string; } export type WalletNotification = | BalanceChangeNotification | BackupOperationErrorNotification - | ExchangeAddedNotification - | ExchangeOperationErrorNotification + | ExchangeStateTransitionNotification | PendingOperationProcessedNotification | TransactionStateTransitionNotification; diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 82c58246a..aa498c409 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -1289,12 +1289,11 @@ export enum ExchangeEntryStatus { export enum ExchangeUpdateStatus { Initial = "initial", - InitialUpdate = "initial(update)", + InitialUpdate = "initial-update", Suspended = "suspended", - Failed = "failed", - OutdatedUpdate = "outdated(update)", + UnavailableUpdate = "unavailable-update", Ready = "ready", - ReadyUpdate = "ready(update)", + ReadyUpdate = "ready-update", } export interface OperationErrorInfo { @@ -1645,15 +1644,11 @@ export type GetExchangeEntryByUrlResponse = ExchangeListItem; export interface AddExchangeRequest { exchangeBaseUrl: string; - masterPub?: string; - forceUpdate?: boolean; } export const codecForAddExchangeRequest = (): Codec<AddExchangeRequest> => buildCodecForObject<AddExchangeRequest>() .property("exchangeBaseUrl", codecForString()) - .property("forceUpdate", codecOptional(codecForBoolean())) - .property("masterPub", codecOptional(codecForString())) .build("AddExchangeRequest"); export interface UpdateExchangeEntryRequest { @@ -2875,3 +2870,9 @@ export interface PrepareWithdrawExchangeResponse { */ amount?: AmountString; } + +export interface ExchangeEntryState { + tosStatus: ExchangeTosStatus; + exchangeEntryStatus: ExchangeEntryStatus; + exchangeUpdateStatus: ExchangeUpdateStatus; +} |