Browse Source

Prefix ticker units with 't' when running on testnet

renovate/lint-staged-8.x
Ben Woosley 7 years ago
parent
commit
08fbed672f
No known key found for this signature in database GPG Key ID: 6EE5F3785F78B345
  1. 6
      app/reducers/info.js
  2. 12
      app/reducers/ticker.js
  3. 1
      test/reducers/__snapshots__/info.spec.js.snap

6
app/reducers/info.js

@ -39,11 +39,13 @@ export const receiveInfo = (event, data) => (dispatch) => {
const networks = { const networks = {
testnet: { testnet: {
explorerUrl: 'https://testnet.smartbit.com.au', explorerUrl: 'https://testnet.smartbit.com.au',
bitcoinJsNetwork: bitcoin.networks.testnet bitcoinJsNetwork: bitcoin.networks.testnet,
unitPrefix: 't'
}, },
mainnet: { mainnet: {
explorerUrl: 'https://smartbit.com.au', explorerUrl: 'https://smartbit.com.au',
bitcoinJsNetwork: bitcoin.networks.bitcoin bitcoinJsNetwork: bitcoin.networks.bitcoin,
unitPrefix: ''
} }
} }
// IPC info fetch failed // IPC info fetch failed

12
app/reducers/ticker.js

@ -1,5 +1,7 @@
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
import { requestTickers } from '../api' import { requestTickers } from '../api'
import { infoSelectors } from './info'
// ------------------------------------ // ------------------------------------
// Constants // Constants
// ------------------------------------ // ------------------------------------
@ -97,11 +99,13 @@ tickerSelectors.currentCurrencyFilters = createSelector(
tickerSelectors.currencyName = createSelector( tickerSelectors.currencyName = createSelector(
currencySelector, currencySelector,
(currency) => { infoSelectors.networkSelector,
if (currency === 'btc') { return 'BTC' } (currency, network) => {
if (currency === 'sats') { return 'satoshis' } let unit = currency
if (currency === 'btc') { unit = 'BTC' }
if (currency === 'sats') { unit = 'satoshis' }
return currency return `${network.unitPrefix}${unit}`
} }
) )

1
test/reducers/__snapshots__/info.spec.js.snap

@ -27,6 +27,7 @@ Object {
"wif": 128, "wif": 128,
}, },
"explorerUrl": "https://smartbit.com.au", "explorerUrl": "https://smartbit.com.au",
"unitPrefix": "",
}, },
"showWalletCurrencyFilters": false, "showWalletCurrencyFilters": false,
} }

Loading…
Cancel
Save