diff options
author | Florian Dold <florian@dold.me> | 2022-03-29 21:21:57 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-03-29 21:22:03 +0200 |
commit | bbd6ccf1c7c0baea44234863967e640f5cb10a3a (patch) | |
tree | 219086b57e229b79e674619180200284762c3f4b /packages/taler-wallet-core/src/operations/refresh.ts | |
parent | fdd272af203d7048f980a2f2b5d405e5c94ebec2 (diff) | |
download | wallet-core-bbd6ccf1c7c0baea44234863967e640f5cb10a3a.tar.xz |
wallet: allow forced denom selection for tests
Diffstat (limited to 'packages/taler-wallet-core/src/operations/refresh.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/refresh.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts index 762023d2e..cf292061f 100644 --- a/packages/taler-wallet-core/src/operations/refresh.ts +++ b/packages/taler-wallet-core/src/operations/refresh.ts @@ -106,11 +106,12 @@ export function getTotalRefreshCost( amountLeft, refreshedDenom.feeRefresh, ).amount; + const denomMap = Object.fromEntries(denoms.map((x) => [x.denomPubHash, x])); const withdrawDenoms = selectWithdrawalDenominations(withdrawAmount, denoms); const resultingAmount = Amounts.add( Amounts.getZero(withdrawAmount.currency), ...withdrawDenoms.selectedDenoms.map( - (d) => Amounts.mult(d.denom.value, d.count).amount, + (d) => Amounts.mult(denomMap[d.denomPubHash].value, d.count).amount, ), ).amount; const totalCost = Amounts.sub(amountLeft, resultingAmount).amount; @@ -277,7 +278,7 @@ async function refreshCreateSession( sessionSecretSeed: sessionSecretSeed, newDenoms: newCoinDenoms.selectedDenoms.map((x) => ({ count: x.count, - denomPubHash: x.denom.denomPubHash, + denomPubHash: x.denomPubHash, })), amountRefreshOutput: newCoinDenoms.totalCoinValue, }; |