Browse Source

fix countervalue for btc

master
Gaëtan Renaudeau 7 years ago
parent
commit
d51ddbf801
  1. 2
      package.json
  2. 21
      src/components/CalculateBalance.js
  3. 21
      src/components/CounterValue/index.js
  4. 14
      src/components/DashboardPage/AccountsOrder.js
  5. 4
      src/components/RequestAmount/index.js
  6. 28
      src/components/SettingsPage/sections/Currencies.js
  7. 6
      yarn.lock

2
package.json

@ -42,7 +42,7 @@
"@ledgerhq/hw-transport": "^4.12.0",
"@ledgerhq/hw-transport-node-hid": "^4.12.0",
"@ledgerhq/ledger-core": "1.4.5",
"@ledgerhq/live-common": "2.27.0",
"@ledgerhq/live-common": "2.27.1",
"axios": "^0.18.0",
"babel-runtime": "^6.26.0",
"bcryptjs": "^2.4.3",

21
src/components/CalculateBalance.js

@ -51,18 +51,15 @@ const mapStateToProps = (state: State, props: OwnProps) => {
originalValues.push(value)
const fromExchange = exchangeSettingsForAccountSelector(state, { account })
const cv =
fromExchange &&
counterValueExchange &&
CounterValues.calculateWithIntermediarySelector(state, {
value,
date,
from: account.currency,
fromExchange,
intermediary: intermediaryCurrency,
toExchange: counterValueExchange,
to: counterValueCurrency,
})
const cv = CounterValues.calculateWithIntermediarySelector(state, {
value,
date,
from: account.currency,
fromExchange,
intermediary: intermediaryCurrency,
toExchange: counterValueExchange,
to: counterValueCurrency,
})
if (!cv && cv !== 0) {
isAvailable = false
return 0

21
src/components/CounterValue/index.js

@ -39,18 +39,15 @@ const mapStateToProps = (state: State, props: OwnProps) => {
const counterValueCurrency = counterValueCurrencySelector(state)
const fromExchange = currencySettingsSelector(state, { currency }).exchange
const toExchange = counterValueExchangeSelector(state)
const counterValue =
fromExchange &&
toExchange &&
CounterValues.calculateWithIntermediarySelector(state, {
from: currency,
fromExchange,
intermediary: intermediaryCurrency,
toExchange,
to: counterValueCurrency,
value,
date,
})
const counterValue = CounterValues.calculateWithIntermediarySelector(state, {
from: currency,
fromExchange,
intermediary: intermediaryCurrency,
toExchange,
to: counterValueCurrency,
value,
date,
})
return {
counterValueCurrency,

14
src/components/DashboardPage/AccountsOrder.js

@ -82,14 +82,12 @@ const accountsBtcBalanceSelector = createSelector(
accounts.map(account => {
const { exchange } = currencySettingsForAccountSelector(state, { account })
return (
(exchange &&
CounterValues.calculateSelector(state, {
from: account.currency,
to: intermediaryCurrency,
exchange,
value: account.balance,
})) ||
0
CounterValues.calculateSelector(state, {
from: account.currency,
to: intermediaryCurrency,
exchange,
value: account.balance,
}) || 0
)
}),
)

4
src/components/RequestAmount/index.js

@ -80,8 +80,6 @@ const mapStateToProps = (state: State, props: OwnProps) => {
const fromExchange = currencySettingsSelector(state, { currency }).exchange
const toExchange = counterValueExchangeSelector(state)
const getCounterValue = value =>
fromExchange &&
toExchange &&
CounterValues.calculateWithIntermediarySelector(state, {
from: currency,
fromExchange,
@ -92,8 +90,6 @@ const mapStateToProps = (state: State, props: OwnProps) => {
})
const getReverseCounterValue = value =>
fromExchange &&
toExchange &&
CounterValues.reverseWithIntermediarySelector(state, {
from: currency,
fromExchange,

28
src/components/SettingsPage/sections/Currencies.js

@ -110,19 +110,21 @@ class TabCurrencies extends PureComponent<Props, State> {
}
/>
<Body>
<Row
title={`Exchange (${currency.ticker}${intermediaryCurrency.ticker})`}
desc="The exchange to use"
>
<ExchangeSelect
small
from={currency}
to={intermediaryCurrency}
exchangeId={exchange}
onChange={this.handleChangeExchange}
minWidth={200}
/>
</Row>
{currency !== intermediaryCurrency ? (
<Row
title={`Exchange (${currency.ticker}${intermediaryCurrency.ticker})`}
desc="The exchange to use"
>
<ExchangeSelect
small
from={currency}
to={intermediaryCurrency}
exchangeId={exchange}
onChange={this.handleChangeExchange}
minWidth={200}
/>
</Row>
) : null}
{defaults.confirmationsNb ? (
<Row
title={t('settings:currencies.confirmationsNb')}

6
yarn.lock

@ -1495,9 +1495,9 @@
npm "^5.7.1"
prebuild-install "^2.2.2"
"@ledgerhq/live-common@2.27.0":
version "2.27.0"
resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-2.27.0.tgz#342478f7b85607a11f20803e2f2862394b6f2bbe"
"@ledgerhq/live-common@2.27.1":
version "2.27.1"
resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-2.27.1.tgz#3ea96eb80b3e2676529c805c76e6b20ce14b95f0"
dependencies:
axios "^0.18.0"
invariant "^2.2.2"

Loading…
Cancel
Save