Skip to content

Commit

Permalink
Add env var to force using legacy txs w/ EVMs
Browse files Browse the repository at this point in the history
  • Loading branch information
lambertkevin committed Oct 25, 2024
1 parent fb25d72 commit d7a26a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libs/coin-modules/coin-evm/src/api/node/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export const getFeeData: NodeApi["getFeeData"] = async (currency, transaction) =
* cf. libs/coin-evm/src/createTransaction.ts:23
*/
options: {
useEIP1559: transaction.type === 2,
useEIP1559: getEnv("EVM_FORCE_LEGACY_TRANSACTIONS") ? false : transaction.type === 2,
overrideGasTracker: { type: "ledger", explorerId: node.explorerId },
},
});
Expand Down
5 changes: 4 additions & 1 deletion libs/coin-modules/coin-evm/src/api/node/rpc.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { ethers } from "ethers";
import BigNumber from "bignumber.js";
import { log } from "@ledgerhq/logs";
import { getEnv } from "@ledgerhq/live-env";
import { delay } from "@ledgerhq/live-promise";
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
import { makeLRUCache } from "@ledgerhq/live-network/cache";
Expand Down Expand Up @@ -151,7 +152,9 @@ export const getGasEstimation: NodeApi["getGasEstimation"] = (account, transacti
export const getFeeData: NodeApi["getFeeData"] = currency =>
withApi(currency, async api => {
const block = await api.getBlock("latest");
const currencySupports1559 = Boolean(block.baseFeePerGas);
const currencySupports1559 = getEnv("EVM_FORCE_LEGACY_TRANSACTIONS")
? false
: Boolean(block.baseFeePerGas);

const feeData = await (async (): Promise<
| {
Expand Down
5 changes: 5 additions & 0 deletions libs/env/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,11 @@ const envDefinitions = {
parser: floatParser,
desc: "Replace transaction max priority fee factor for EIP1559 evm transaction. This value should be 1.1 minimum since this is the minimum increase required by most nodes",
},
EVM_FORCE_LEGACY_TRANSACTIONS: {
def: false,
parser: boolParser,
desc: "Force transaction type 0 on EVM networks",
},
ENABLE_NETWORK_LOGS: {
def: false,
parser: boolParser,
Expand Down

0 comments on commit d7a26a4

Please sign in to comment.