From f3f35390cf2ef78eef9f4aff9dd337c33eeb3931 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 8 Apr 2024 14:34:38 +0200 Subject: wallet-core: improve refresh error handling, test --- packages/taler-util/src/taler-types.ts | 55 +++++++++++++++++++++++++++++++++ packages/taler-util/src/wallet-types.ts | 15 +++++++-- 2 files changed, 68 insertions(+), 2 deletions(-) (limited to 'packages/taler-util/src') diff --git a/packages/taler-util/src/taler-types.ts b/packages/taler-util/src/taler-types.ts index 7cc703fd6..2b8e55e38 100644 --- a/packages/taler-util/src/taler-types.ts +++ b/packages/taler-util/src/taler-types.ts @@ -2359,3 +2359,58 @@ export const codecForBankConversionInfoConfig = codecForCurrencySpecificiation(), ) .build("BankConversionInfoConfig"); + +export interface DenominationExpiredMessage { + // Taler error code. Note that beyond + // expiration this message format is also + // used if the key is not yet valid, or + // has been revoked. + code: number; + + // Signature by the exchange over a + // TALER_DenominationExpiredAffirmationPS. + // Must have purpose TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED. + exchange_sig: EddsaSignatureString; + + // Public key of the exchange used to create + // the 'exchange_sig. + exchange_pub: EddsaPublicKeyString; + + // Hash of the denomination public key that is unknown. + h_denom_pub: HashCodeString; + + // When was the signature created. + timestamp: TalerProtocolTimestamp; + + // What kind of operation was requested that now + // failed? + oper: string; +} + +export const codecForDenominationExpiredMessage = () => + buildCodecForObject() + .property("code", codecForNumber()) + .property("exchange_sig", codecForString()) + .property("exchange_pub", codecForString()) + .property("h_denom_pub", codecForString()) + .property("timestamp", codecForTimestamp) + .property("oper", codecForString()) + .build("DenominationExpiredMessage"); + +export interface CoinHistoryResponse { + // Current balance of the coin. + balance: AmountString; + + // Hash of the coin's denomination. + h_denom_pub: HashCodeString; + + // Transaction history for the coin. + history: any[]; +} + +export const codecForCoinHistoryResponse = () => + buildCodecForObject() + .property("balance", codecForAmountString()) + .property("h_denom_pub", codecForString()) + .property("history", codecForAny()) + .build("CoinHistoryResponse"); diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 40c837994..693aa704a 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -2180,13 +2180,24 @@ export const codecForSetCoinSuspendedRequest = .property("suspended", codecForBoolean()) .build("SetCoinSuspendedRequest"); +export interface RefreshCoinSpec { + coinPub: string; + amount?: AmountString; +} + +export const codecForRefreshCoinSpec = (): Codec => + buildCodecForObject() + .property("amount", codecForAmountString()) + .property("coinPub", codecForString()) + .build("ForceRefreshRequest"); + export interface ForceRefreshRequest { - coinPubList: string[]; + refreshCoinSpecs: RefreshCoinSpec[]; } export const codecForForceRefreshRequest = (): Codec => buildCodecForObject() - .property("coinPubList", codecForList(codecForString())) + .property("refreshCoinSpecs", codecForList(codecForRefreshCoinSpec())) .build("ForceRefreshRequest"); export interface PrepareRefundRequest { -- cgit v1.2.3