diff options
author | Florian Dold <florian@dold.me> | 2024-04-08 14:34:38 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-04-08 14:34:38 +0200 |
commit | f3f35390cf2ef78eef9f4aff9dd337c33eeb3931 (patch) | |
tree | 8b07288763a89c7b5ec1dc75d53201f153ed0c1d /packages/taler-util | |
parent | 22856a7756cc41a0bd664eb947fb94f1e1b09e8d (diff) | |
download | wallet-core-f3f35390cf2ef78eef9f4aff9dd337c33eeb3931.tar.xz |
wallet-core: improve refresh error handling, test
Diffstat (limited to 'packages/taler-util')
-rw-r--r-- | packages/taler-util/src/taler-types.ts | 55 | ||||
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 15 |
2 files changed, 68 insertions, 2 deletions
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<DenominationExpiredMessage>() + .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<CoinHistoryResponse>() + .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<RefreshCoinSpec> => + buildCodecForObject<RefreshCoinSpec>() + .property("amount", codecForAmountString()) + .property("coinPub", codecForString()) + .build("ForceRefreshRequest"); + export interface ForceRefreshRequest { - coinPubList: string[]; + refreshCoinSpecs: RefreshCoinSpec[]; } export const codecForForceRefreshRequest = (): Codec<ForceRefreshRequest> => buildCodecForObject<ForceRefreshRequest>() - .property("coinPubList", codecForList(codecForString())) + .property("refreshCoinSpecs", codecForList(codecForRefreshCoinSpec())) .build("ForceRefreshRequest"); export interface PrepareRefundRequest { |