diff options
author | Chen Wei <wei.chen@cobinhood.com> | 2019-09-09 21:45:05 +0800 |
---|---|---|
committer | Chen Wei <wei.chen@cobinhood.com> | 2019-09-09 21:45:05 +0800 |
commit | d820292491cc56363da73e22b1f3f491924bd970 (patch) | |
tree | df113a5e77130cc5b77cc9bb6b6119e61b131a96 | |
parent | 1e68b9c31535c0dfe585937155479a281bfcee3c (diff) | |
download | tangerine-wallet-browser-d820292491cc56363da73e22b1f3f491924bd970.tar tangerine-wallet-browser-d820292491cc56363da73e22b1f3f491924bd970.tar.gz tangerine-wallet-browser-d820292491cc56363da73e22b1f3f491924bd970.tar.bz2 tangerine-wallet-browser-d820292491cc56363da73e22b1f3f491924bd970.tar.lz tangerine-wallet-browser-d820292491cc56363da73e22b1f3f491924bd970.tar.xz tangerine-wallet-browser-d820292491cc56363da73e22b1f3f491924bd970.tar.zst tangerine-wallet-browser-d820292491cc56363da73e22b1f3f491924bd970.zip |
use rpcUrl from network config when estimating gas
-rw-r--r-- | ui/app/components/app/dropdowns/network-dropdown.js | 1 | ||||
-rw-r--r-- | ui/app/ducks/gas/gas.duck.js | 15 |
2 files changed, 13 insertions, 3 deletions
diff --git a/ui/app/components/app/dropdowns/network-dropdown.js b/ui/app/components/app/dropdowns/network-dropdown.js index 8563f0771..1d3ff521f 100644 --- a/ui/app/components/app/dropdowns/network-dropdown.js +++ b/ui/app/components/app/dropdowns/network-dropdown.js @@ -307,7 +307,6 @@ NetworkDropdown.prototype.getNetworkName = function () { let name if (providerName === 'tangerine_testnet') { - console.log('tangerine netowkr get name!!') name = this.context.t('tangerine_testnet') } else if (providerName === 'mainnet') { name = this.context.t('mainnet') diff --git a/ui/app/ducks/gas/gas.duck.js b/ui/app/ducks/gas/gas.duck.js index bcb9a8450..5dc5d6b87 100644 --- a/ui/app/ducks/gas/gas.duck.js +++ b/ui/app/ducks/gas/gas.duck.js @@ -11,6 +11,9 @@ import { import { isEthereumNetwork, } from '../../selectors/selectors' +import { + defaultNetworksData +} from '../../pages/settings/networks-tab/networks-tab.constants'; // Actions const BASIC_GAS_ESTIMATE_LOADING_FINISHED = 'metamask/gas/BASIC_GAS_ESTIMATE_LOADING_FINISHED' @@ -186,8 +189,12 @@ export function fetchBasicGasEstimates () { const timeLastRetrieved = basicPriceEstimatesLastRetrieved || loadLocalStorageData('BASIC_PRICE_ESTIMATES_LAST_RETRIEVED') || 0 dispatch(basicGasEstimatesLoadingStarted()) + + const { provider } = getState().metamask; + const { rpcUrl } = defaultNetworksData.find(it => it.providerType === provider.type) || {}; + const promiseToFetch = Date.now() - timeLastRetrieved > 75000 - ? fetch('https://testnet-rpc.tangerine-network.io', { + ? fetch(rpcUrl, { 'headers': { 'Content-Type': 'application/json', }, @@ -236,10 +243,14 @@ export function fetchBasicGasAndTimeEstimates () { } = getState().gas const timeLastRetrieved = basicPriceAndTimeEstimatesLastRetrieved || loadLocalStorageData('BASIC_GAS_AND_TIME_API_ESTIMATES_LAST_RETRIEVED') || 0 + + const { provider } = getState().metamask; + const { rpcUrl } = defaultNetworksData.find(it => it.providerType === provider.type) || {}; + dispatch(basicGasEstimatesLoadingStarted()) const promiseToFetch = Date.now() - timeLastRetrieved > 75000 - ? fetch('https://testnet-rpc.tangerine-network.io', { + ? fetch(rpcUrl, { 'headers': { 'Content-Type': 'application/json', }, |