wallet-core: return numCoins in checkPeerPullCredit response
This commit is contained in:
parent
eae3571607
commit
4b61945f6b
@ -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;
|
||||
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user