wallet-core: report number of coins in withdrawal details
This commit is contained in:
parent
ea953f2b77
commit
4627c0781c
@ -1134,6 +1134,13 @@ export interface ManualWithdrawalDetails {
|
|||||||
*/
|
*/
|
||||||
amountEffective: AmountString;
|
amountEffective: AmountString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of coins that would be used for withdrawal.
|
||||||
|
*
|
||||||
|
* The UIs should warn if this number is too high (rougly at >100).
|
||||||
|
*/
|
||||||
|
numCoins: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ways to pay the exchange.
|
* Ways to pay the exchange.
|
||||||
*/
|
*/
|
||||||
|
@ -1107,12 +1107,17 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
|
|||||||
Amounts.parseOrThrow(req.amount),
|
Amounts.parseOrThrow(req.amount),
|
||||||
req.restrictAge,
|
req.restrictAge,
|
||||||
);
|
);
|
||||||
|
let numCoins = 0;
|
||||||
|
for (const x of wi.selectedDenoms.selectedDenoms) {
|
||||||
|
numCoins += x.count;
|
||||||
|
}
|
||||||
const resp: ManualWithdrawalDetails = {
|
const resp: ManualWithdrawalDetails = {
|
||||||
amountRaw: req.amount,
|
amountRaw: req.amount,
|
||||||
amountEffective: Amounts.stringify(wi.selectedDenoms.totalCoinValue),
|
amountEffective: Amounts.stringify(wi.selectedDenoms.totalCoinValue),
|
||||||
paytoUris: wi.exchangePaytoUris,
|
paytoUris: wi.exchangePaytoUris,
|
||||||
tosAccepted: wi.termsOfServiceAccepted,
|
tosAccepted: wi.termsOfServiceAccepted,
|
||||||
ageRestrictionOptions: wi.ageRestrictionOptions,
|
ageRestrictionOptions: wi.ageRestrictionOptions,
|
||||||
|
numCoins,
|
||||||
};
|
};
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user