summaryrefslogtreecommitdiff
path: root/packages/taler-util/src
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-03-06 21:15:30 +0100
committerFlorian Dold <florian@dold.me>2024-03-07 00:03:59 +0100
commit7ba1d1f3351e58a331e99337afea0fbedb6eb828 (patch)
tree60b7a485cd317c1fe55276acdc0e055cd9353bfb /packages/taler-util/src
parent618caa117111b9fed6a792b6816fc724483eb349 (diff)
downloadwallet-core-7ba1d1f3351e58a331e99337afea0fbedb6eb828.tar.gz
wallet-core-7ba1d1f3351e58a331e99337afea0fbedb6eb828.tar.bz2
wallet-core-7ba1d1f3351e58a331e99337afea0fbedb6eb828.zip
refactor coin selection, report maxEffectiveSpendAmount
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r--packages/taler-util/src/wallet-types.ts39
1 files changed, 14 insertions, 25 deletions
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index 9fe114b3d..cb4374648 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -868,21 +868,15 @@ export interface PayMerchantInsufficientBalanceDetails {
balanceMerchantDepositable: AmountString;
/**
- * If the payment would succeed without fees
- * (i.e. balanceMerchantDepositable >= amountRequested),
- * this field contains an estimate of the amount that would additionally
- * be required to cover the fees.
- *
- * It is not possible to give an exact value here, since it depends
- * on the coin selection for the amount that would be additionally withdrawn.
+ * Maximum effective amount that the wallet can spend,
+ * when all fees are paid by the wallet.
*/
- feeGapEstimate: AmountString;
+ maxEffectiveSpendAmount: AmountString;
perExchange: {
[url: string]: {
balanceAvailable: AmountString;
balanceMaterial: AmountString;
- feeGapEstimate: AmountString;
};
};
}
@@ -896,8 +890,8 @@ export const codecForPayMerchantInsufficientBalanceDetails =
.property("balanceMaterial", codecForAmountString())
.property("balanceMerchantAcceptable", codecForAmountString())
.property("balanceMerchantDepositable", codecForAmountString())
- .property("feeGapEstimate", codecForAmountString())
.property("perExchange", codecForAny())
+ .property("maxEffectiveSpendAmount", codecForAmountString())
.build("PayMerchantInsufficientBalanceDetails");
export const codecForPreparePayResultInsufficientBalance =
@@ -2623,7 +2617,15 @@ export interface ForcedCoinSel {
}
export interface TestPayResult {
- payCoinSelection: PayCoinSelection;
+ /**
+ * Number of coins used for the payment.
+ */
+ numCoins: number;
+}
+
+export interface SelectedCoin {
+ coinPub: string;
+ contribution: AmountString;
}
/**
@@ -2631,20 +2633,7 @@ export interface TestPayResult {
* coins with their denomination.
*/
export interface PayCoinSelection {
- /**
- * Amount requested by the merchant.
- */
- paymentAmount: AmountString;
-
- /**
- * Public keys of the coins that were selected.
- */
- coinPubs: string[];
-
- /**
- * Amount that each coin contributes.
- */
- coinContributions: AmountString[];
+ coins: SelectedCoin[];
/**
* How much of the wire fees is the customer paying?