-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from blockchain/fix/xlm-send-copies
fix(XLM): fixed send copies
- Loading branch information
Showing
11 changed files
with
99 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...blockchain-wallet-v4-frontend/src/modals/SendXlm/FirstStep/MaximumAmountLink/selectors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { prop } from 'ramda' | ||
import BigNumber from 'bignumber.js' | ||
|
||
import { Exchange } from 'blockchain-wallet-v4' | ||
|
||
export const getData = (state, props) => { | ||
const fee = prop('fee', props) | ||
const feeXlm = Exchange.convertXlmToXlm({ | ||
value: fee, | ||
fromUnit: 'STROOP', | ||
toUnit: 'XLM' | ||
}).value | ||
const effectiveBalanceXlm = prop('effectiveBalanceXlm', props) | ||
return { | ||
effectiveBalance: new BigNumber(effectiveBalanceXlm) | ||
.minus(feeXlm) | ||
.toString() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/blockchain-wallet-v4-frontend/src/modals/XlmReserveLearn/selectors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Exchange } from 'blockchain-wallet-v4/src' | ||
import { BigNumber } from 'bignumber.js' | ||
import { currencySymbolMap } from 'services/CoinifyService' | ||
|
||
const convertXlmToFiat = (rates, currency) => amount => | ||
Exchange.convertXlmToFiat({ | ||
value: amount, | ||
fromUnit: 'XLM', | ||
toCurrency: currency, | ||
rates: rates | ||
}).value | ||
|
||
export const getData = (state, props) => { | ||
const { reserveXlm, rates, effectiveBalanceXlm, currency, fee } = props | ||
const convertToFiat = convertXlmToFiat(rates, currency) | ||
const totalAmountXlm = new BigNumber(effectiveBalanceXlm) | ||
.add(reserveXlm) | ||
.toString() | ||
const totalAmountFiat = convertToFiat(totalAmountXlm) | ||
const reserveFiat = convertToFiat(reserveXlm) | ||
const feeXlm = Exchange.convertXlmToXlm({ | ||
value: fee, | ||
fromUnit: 'STROOP', | ||
toUnit: 'XLM' | ||
}).value | ||
const feeFiat = convertToFiat(feeXlm) | ||
const effectiveBalanceMinusFeeXlm = new BigNumber(effectiveBalanceXlm) | ||
.minus(feeXlm) | ||
.toString() | ||
const effectiveBalanceMinusFeeFiat = convertToFiat( | ||
effectiveBalanceMinusFeeXlm | ||
) | ||
const currencySymbol = currencySymbolMap[currency] | ||
|
||
return { | ||
currencySymbol, | ||
effectiveBalanceMinusFeeFiat, | ||
effectiveBalanceMinusFeeXlm, | ||
feeFiat, | ||
feeXlm, | ||
reserveFiat, | ||
reserveXlm, | ||
totalAmountFiat, | ||
totalAmountXlm | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters