From f96f34fe9fe15f78b3cd7c809b41f8a7212f38ad Mon Sep 17 00:00:00 2001 From: katspaugh <381895+katspaugh@users.noreply.github.com> Date: Wed, 20 Oct 2021 16:59:51 +0200 Subject: [PATCH] Use EIP-1559 maxFeePerGas only on mainnet --- package.json | 2 +- src/logic/safe/store/actions/createTransaction.ts | 5 ++++- src/logic/safe/store/actions/processTransaction.ts | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 91f5eae9bd..ca9ce5bb51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "safe-react", - "version": "3.14.4", + "version": "3.14.5", "description": "Allowing crypto users manage funds in a safer way", "website": "https://github.com/gnosis/safe-react#readme", "bugs": { diff --git a/src/logic/safe/store/actions/createTransaction.ts b/src/logic/safe/store/actions/createTransaction.ts index c98569edaa..bde59c8f26 100644 --- a/src/logic/safe/store/actions/createTransaction.ts +++ b/src/logic/safe/store/actions/createTransaction.ts @@ -34,6 +34,8 @@ import { checkIfOffChainSignatureIsPossible, getPreValidatedSignatures } from 's import { TxParameters } from 'src/routes/safe/container/hooks/useTransactionParameters' import { isTxPendingError } from 'src/logic/wallets/getWeb3' import { Errors, logError } from 'src/logic/exceptions/CodedException' +import { getNetworkId } from 'src/config' +import { ETHEREUM_NETWORK } from 'src/config/networks/network.d' export interface CreateTransactionArgs { navigateToTransactionsTab?: boolean @@ -148,11 +150,12 @@ export const createTransaction = } const tx = isExecution ? getExecutionTransaction(txArgs) : getApprovalTransaction(safeInstance, safeTxHash) + const gasParam = getNetworkId() === ETHEREUM_NETWORK.MAINNET ? 'maxFeePerGas' : 'gasPrice' const sendParams: PayableTx = { from, value: 0, gas: ethParameters?.ethGasLimit, - maxFeePerGas: ethParameters?.ethGasPriceInGWei, + [gasParam]: ethParameters?.ethGasPriceInGWei, nonce: ethParameters?.ethNonce, } diff --git a/src/logic/safe/store/actions/processTransaction.ts b/src/logic/safe/store/actions/processTransaction.ts index 6750d62a51..7088e3e287 100644 --- a/src/logic/safe/store/actions/processTransaction.ts +++ b/src/logic/safe/store/actions/processTransaction.ts @@ -32,6 +32,8 @@ import { Confirmation } from 'src/logic/safe/store/models/types/confirmation' import { Operation, TransactionStatus } from '@gnosis.pm/safe-react-gateway-sdk' import { isTxPendingError } from 'src/logic/wallets/getWeb3' import { Errors, logError } from 'src/logic/exceptions/CodedException' +import { getNetworkId } from 'src/config' +import { ETHEREUM_NETWORK } from 'src/config/networks/network.d' interface ProcessTransactionArgs { approveAndExecute: boolean @@ -134,11 +136,12 @@ export const processTransaction = transaction = isExecution ? getExecutionTransaction(txArgs) : getApprovalTransaction(safeInstance, tx.safeTxHash) + const gasParam = getNetworkId() === ETHEREUM_NETWORK.MAINNET ? 'maxFeePerGas' : 'gasPrice' const sendParams: PayableTx = { from, value: 0, gas: ethParameters?.ethGasLimit, - maxFeePerGas: ethParameters?.ethGasPriceInGWei, + [gasParam]: ethParameters?.ethGasPriceInGWei, nonce: ethParameters?.ethNonce, }