diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 52ce87725..3710e6d3c 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -2474,6 +2474,12 @@ export interface CheckPeerPullCreditResponse { exchangeBaseUrl: string; amountRaw: AmountString; amountEffective: AmountString; + + /** + * Number of coins that will be used, + * can be used by the UI to warn if excessively large. + */ + numCoins: number; } export interface InitiatePeerPullCreditRequest { exchangeBaseUrl?: string; diff --git a/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts b/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts index 5baba8cdc..c0b728567 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts @@ -649,10 +649,16 @@ export async function checkPeerPullPaymentInitiation( logger.trace(`got withdrawal info`); + let numCoins = 0; + for (let i = 0; i < wi.selectedDenoms.selectedDenoms.length; i++) { + numCoins += wi.selectedDenoms.selectedDenoms[i].count; + } + return { exchangeBaseUrl: exchangeUrl, amountEffective: wi.withdrawalAmountEffective, amountRaw: req.amount, + numCoins, }; }