Override gas station (#42)

WA-234 Fix CORS problem on travis testing
This commit is contained in:
Adolfo Panizo 2018-06-20 12:44:03 +02:00 committed by GitHub
parent 6c2f20fc93
commit 6bab62a0a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,8 +24,10 @@ export const checkReceiptStatus = async (hash: string) => {
}
}
// export const calculateGasPrice = async () => '1000000000'
export const calculateGasPrice = async () => {
/*
/*
const web3 = getWeb3()
const { network } = web3.version
const isMainnet = MAINNET_NETWORK === network
@ -33,9 +35,13 @@ export const calculateGasPrice = async () => {
const url = isMainnet
? 'https://safe-relay.staging.gnosisdev.com/api/v1/gas-station/'
: 'https://safe-relay.dev.gnosisdev.com/'
*/
*/
const corsProblem = process.env.NODE_ENV === 'test'
if (corsProblem) {
return '4000000'
}
const response = await fetch('https://ethgasstation.info/json/ethgasAPI.json', { mode: 'cors' })
const response = await fetch('https://ethgasstation.info/json/ethgasAPI.json')
if (!response.ok) {
throw new Error('Error querying gast station')
}