From 13e7a674778754c0ed641dfd428e3d6b2b71ab2d Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 5 Sep 2022 18:12:30 +0200 Subject: wallet-core: uniform retry handling --- packages/taler-util/src/walletTypes.ts | 84 +++++++++++++++++----------------- 1 file changed, 43 insertions(+), 41 deletions(-) (limited to 'packages/taler-util/src/walletTypes.ts') diff --git a/packages/taler-util/src/walletTypes.ts b/packages/taler-util/src/walletTypes.ts index a993f29a0..c10e3be40 100644 --- a/packages/taler-util/src/walletTypes.ts +++ b/packages/taler-util/src/walletTypes.ts @@ -32,7 +32,12 @@ import { codecForAmountJson, codecForAmountString, } from "./amounts.js"; -import { AbsoluteTime, codecForAbsoluteTime, codecForTimestamp, TalerProtocolTimestamp } from "./time.js"; +import { + AbsoluteTime, + codecForAbsoluteTime, + codecForTimestamp, + TalerProtocolTimestamp, +} from "./time.js"; import { buildCodecForObject, codecForString, @@ -797,46 +802,43 @@ const codecForExchangeTos = (): Codec => .property("content", codecOptional(codecForString())) .build("ExchangeTos"); -export const codecForFeeDescriptionPair = - (): Codec => - buildCodecForObject() - .property("value", codecForAmountJson()) - .property("from", codecForAbsoluteTime) - .property("until", codecForAbsoluteTime) - .property("left", codecOptional(codecForAmountJson())) - .property("right", codecOptional(codecForAmountJson())) - .build("FeeDescriptionPair"); - -export const codecForFeeDescription = - (): Codec => - buildCodecForObject() - .property("value", codecForAmountJson()) - .property("from", codecForAbsoluteTime) - .property("until", codecForAbsoluteTime) - .property("fee", codecOptional(codecForAmountJson())) - .build("FeeDescription"); - - -export const codecForFeesByOperations = - (): Codec> => - buildCodecForObject>() - .property("deposit", codecForList(codecForFeeDescription())) - .property("withdraw", codecForList(codecForFeeDescription())) - .property("refresh", codecForList(codecForFeeDescription())) - .property("refund", codecForList(codecForFeeDescription())) - .build("FeesByOperations"); - -export const codecForExchangeFullDetails = - (): Codec => - buildCodecForObject() - .property("currency", codecForString()) - .property("exchangeBaseUrl", codecForString()) - .property("paytoUris", codecForList(codecForString())) - .property("tos", codecForExchangeTos()) - .property("auditors", codecForList(codecForExchangeAuditor())) - .property("wireInfo", codecForWireInfo()) - .property("feesDescription", codecForFeesByOperations()) - .build("ExchangeFullDetails"); +export const codecForFeeDescriptionPair = (): Codec => + buildCodecForObject() + .property("value", codecForAmountJson()) + .property("from", codecForAbsoluteTime) + .property("until", codecForAbsoluteTime) + .property("left", codecOptional(codecForAmountJson())) + .property("right", codecOptional(codecForAmountJson())) + .build("FeeDescriptionPair"); + +export const codecForFeeDescription = (): Codec => + buildCodecForObject() + .property("value", codecForAmountJson()) + .property("from", codecForAbsoluteTime) + .property("until", codecForAbsoluteTime) + .property("fee", codecOptional(codecForAmountJson())) + .build("FeeDescription"); + +export const codecForFeesByOperations = (): Codec< + OperationMap +> => + buildCodecForObject>() + .property("deposit", codecForList(codecForFeeDescription())) + .property("withdraw", codecForList(codecForFeeDescription())) + .property("refresh", codecForList(codecForFeeDescription())) + .property("refund", codecForList(codecForFeeDescription())) + .build("FeesByOperations"); + +export const codecForExchangeFullDetails = (): Codec => + buildCodecForObject() + .property("currency", codecForString()) + .property("exchangeBaseUrl", codecForString()) + .property("paytoUris", codecForList(codecForString())) + .property("tos", codecForExchangeTos()) + .property("auditors", codecForList(codecForExchangeAuditor())) + .property("wireInfo", codecForWireInfo()) + .property("feesDescription", codecForFeesByOperations()) + .build("ExchangeFullDetails"); export const codecForExchangeListItem = (): Codec => buildCodecForObject() -- cgit v1.2.3