(Feature) - #1531 EWC estimate fee on modal (#1543)

* Add fixed price in gas to ewc configuration
This commit is contained in:
Agustin Pane 2020-10-30 16:30:40 -03:00 committed by GitHub
parent 3fa0b74137
commit 503b99973e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 13 deletions

View File

@ -1,13 +1,16 @@
import EwcLogo from 'src/config/assets/token_ewc.svg'
import { EnvironmentSettings, ETHEREUM_NETWORK, NetworkConfig, WALLETS } from 'src/config/networks/network.d'
// @todo (agustin) we need to use fixed gasPrice because the oracle is not working right now and it's returning 0
// once the oracle is fixed we need to remove the fixed value
const baseConfig: EnvironmentSettings = {
txServiceUrl: 'https://safe-transaction.ewc.gnosis.io/api/v1',
txServiceUrl: 'https://safe-transaction.ewc.gnosis.io/api/v1',
safeAppsUrl: 'https://safe-apps.dev.gnosisdev.com',
gasPriceOracle: {
url: 'https://station.energyweb.org',
gasParameter: 'standard',
},
gasPrice: 1e6,
rpcServiceUrl: 'https://rpc.energyweb.org',
networkExplorerName: 'Energy web explorer',
networkExplorerUrl: 'https://explorer.energyweb.org',

View File

@ -4,7 +4,6 @@ import { BigNumber } from 'bignumber.js'
import { getWeb3, web3ReadOnly } from 'src/logic/wallets/getWeb3'
import { getGasPrice, getGasPriceOracle } from 'src/config'
// const MAINNET_NETWORK = 1
export const EMPTY_DATA = '0x'
export const checkReceiptStatus = async (hash) => {
@ -28,16 +27,6 @@ export const checkReceiptStatus = async (hash) => {
}
export const calculateGasPrice = async (): Promise<string> => {
/*
const web3 = getWeb3()
const { network } = web3.version
const isMainnet = MAINNET_NETWORK === network
const url = isMainnet
? 'https://safe-relay.staging.gnosisdev.com/api/v1/gas-station/'
: 'https://safe-relay.dev.gnosisdev.com/'
*/
if (process.env.NODE_ENV === 'test') {
return '20000000000'
}
@ -61,7 +50,7 @@ export const calculateGasPrice = async (): Promise<string> => {
}
}
export const calculateGasOf = async (data, from, to) => {
export const calculateGasOf = async (data: string, from: string, to: string): Promise<number> => {
const web3 = getWeb3()
try {
const gas = await web3.eth.estimateGas({ data, from, to })