diff --git a/src/config/index.ts b/src/config/index.ts index 01fcbe4ce8..219cc1efd5 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -4,6 +4,7 @@ import { GAS_PRICE_TYPE, RPC_AUTHENTICATION, RpcUri, + GasPriceFixed, } from '@gnosis.pm/safe-react-gateway-sdk' import { CONFIG_REDUCER_ID, initialConfigState } from 'src/logic/config/store/reducer' @@ -89,6 +90,13 @@ export const getGasPriceOracles = (): Extract => { + const isFixed = (gasPrice: ChainInfo['gasPrice'][number]): gasPrice is GasPriceFixed => { + return gasPrice.type === GAS_PRICE_TYPE.FIXED + } + return getChainInfo().gasPrice.filter(isFixed)[0] +} + export const getTxServiceUrl = (): ChainInfo['transactionService'] => { const { transactionService } = getChainInfo() // To avoid breaking changes, we define the version the web uses manually diff --git a/src/logic/safe/utils/safeVersion.ts b/src/logic/safe/utils/safeVersion.ts index bb4c83103a..25725b7001 100644 --- a/src/logic/safe/utils/safeVersion.ts +++ b/src/logic/safe/utils/safeVersion.ts @@ -10,7 +10,6 @@ import { Errors, logError } from 'src/logic/exceptions/CodedException' import { getChainInfo } from 'src/config' const FEATURES_BY_VERSION: Record = { - [FEATURES.ERC1155]: '>=1.1.1', [FEATURES.SAFE_TX_GAS_OPTIONAL]: '>=1.3.0', } diff --git a/src/logic/wallets/ethTransactions.ts b/src/logic/wallets/ethTransactions.ts index 2e40097fec..8d02a015a9 100644 --- a/src/logic/wallets/ethTransactions.ts +++ b/src/logic/wallets/ethTransactions.ts @@ -3,7 +3,7 @@ import { BigNumber } from 'bignumber.js' import { EthAdapterTransaction } from '@gnosis.pm/safe-core-sdk/dist/src/ethereumLibs/EthAdapter' import { getSDKWeb3ReadOnly, getWeb3, getWeb3ReadOnly } from 'src/logic/wallets/getWeb3' -import { getGasPriceOracles } from 'src/config' +import { getFixedGasPrice, getGasPriceOracles } from 'src/config' import { CodedException, Errors } from '../exceptions/CodedException' import { GasPriceOracle } from '@gnosis.pm/safe-react-gateway-sdk' @@ -33,6 +33,12 @@ export const calculateGasPrice = async (): Promise => { } } + // A fallback to fixed gas price from the chain config + const fixedGasPrice = getFixedGasPrice() + if (fixedGasPrice) { + return fixedGasPrice.weiValue + } + // A fallback based on the latest mined blocks when none of the oracles are working const web3ReadOnly = getWeb3ReadOnly() const fixedFee = web3ReadOnly.utils.toWei(FIXED_GAS_FEE, 'gwei') diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 5328f93911..2c34523a17 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -33,9 +33,10 @@ export const CONFIG_SERVICE_URL = process.env.CONFIG_SERVICE_URL || IS_PRODUCTION ? 'https://safe-config.gnosis.io/api/v1' : 'https://safe-config.staging.gnosisdev.com/api/v1' -export const GATEWAY_URL = IS_PRODUCTION - ? 'https://safe-client.gnosis.io/v1' - : 'https://safe-client.staging.gnosisdev.com/v1' +export const GATEWAY_URL = + IS_PRODUCTION || window.location.hash === '#prod' + ? 'https://safe-client.gnosis.io/v1' + : 'https://safe-client.staging.gnosisdev.com/v1' export const IPFS_GATEWAY = process.env.REACT_APP_IPFS_GATEWAY export const SPENDING_LIMIT_MODULE_ADDRESS = process.env.REACT_APP_SPENDING_LIMIT_MODULE_ADDRESS || '0xCFbFaC74C26F8647cBDb8c5caf80BB5b32E43134'