diff options
author | Florian Dold <florian@dold.me> | 2024-03-06 14:17:31 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-03-06 20:34:42 +0100 |
commit | 91be5b89cd92c53d6aa2f68247f9626c8bc8f64a (patch) | |
tree | 2c562c9170d32833647d2bffb69a91c42bef9b0d /packages/taler-util/src | |
parent | 2e344093305ddf72f97e099cba107356970bb1e4 (diff) | |
download | wallet-core-91be5b89cd92c53d6aa2f68247f9626c8bc8f64a.tar.gz wallet-core-91be5b89cd92c53d6aa2f68247f9626c8bc8f64a.tar.bz2 wallet-core-91be5b89cd92c53d6aa2f68247f9626c8bc8f64a.zip |
towards refactoring coin selection
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r-- | packages/taler-util/src/errors.ts | 3 | ||||
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 43 |
2 files changed, 10 insertions, 36 deletions
diff --git a/packages/taler-util/src/errors.ts b/packages/taler-util/src/errors.ts index 155562865..c4733a194 100644 --- a/packages/taler-util/src/errors.ts +++ b/packages/taler-util/src/errors.ts @@ -26,7 +26,6 @@ import { AbsoluteTime, PayMerchantInsufficientBalanceDetails, - PayPeerInsufficientBalanceDetails, TalerErrorCode, TalerErrorDetail, TransactionType, @@ -136,7 +135,7 @@ export interface DetailsMap { insufficientBalanceDetails: PayMerchantInsufficientBalanceDetails; }; [TalerErrorCode.WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE]: { - insufficientBalanceDetails: PayPeerInsufficientBalanceDetails; + insufficientBalanceDetails: PayMerchantInsufficientBalanceDetails; }; [TalerErrorCode.WALLET_REFRESH_GROUP_INCOMPLETE]: { numErrors: number; diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 1efa6651f..9fe114b3d 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -877,6 +877,14 @@ export interface PayMerchantInsufficientBalanceDetails { * on the coin selection for the amount that would be additionally withdrawn. */ feeGapEstimate: AmountString; + + perExchange: { + [url: string]: { + balanceAvailable: AmountString; + balanceMaterial: AmountString; + feeGapEstimate: AmountString; + }; + }; } export const codecForPayMerchantInsufficientBalanceDetails = @@ -889,6 +897,7 @@ export const codecForPayMerchantInsufficientBalanceDetails = .property("balanceMerchantAcceptable", codecForAmountString()) .property("balanceMerchantDepositable", codecForAmountString()) .property("feeGapEstimate", codecForAmountString()) + .property("perExchange", codecForAny()) .build("PayMerchantInsufficientBalanceDetails"); export const codecForPreparePayResultInsufficientBalance = @@ -2858,40 +2867,6 @@ export interface InitiatePeerPullCreditResponse { transactionId: TransactionIdStr; } -/** - * Detailed reason for why the wallet's balance is insufficient. - */ -export interface PayPeerInsufficientBalanceDetails { - /** - * Amount requested by the merchant. - */ - amountRequested: AmountString; - - /** - * Balance of type "available" (see balance.ts for definition). - */ - balanceAvailable: AmountString; - - /** - * Balance of type "material" (see balance.ts for definition). - */ - balanceMaterial: AmountString; - - /** - * If non-zero, the largest fee gap estimate of an exchange - * where we would otherwise have enough balance available. - */ - feeGapEstimate: AmountString; - - perExchange: { - [url: string]: { - balanceAvailable: AmountString; - balanceMaterial: AmountString; - feeGapEstimate: AmountString; - }; - }; -} - export interface ValidateIbanRequest { iban: string; } |