@ledgerhq/coin-evm 15.0.0 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/lib/adapters/etherscan.d.ts.map +1 -1
- package/lib/adapters/etherscan.js +14 -0
- package/lib/adapters/etherscan.js.map +1 -1
- package/lib/adapters/ledger.d.ts.map +1 -1
- package/lib/adapters/ledger.js +2 -0
- package/lib/adapters/ledger.js.map +1 -1
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +14 -15
- package/lib/api/index.js.map +1 -1
- package/lib/chains.d.ts +7 -0
- package/lib/chains.d.ts.map +1 -1
- package/lib/chains.js +17 -1
- package/lib/chains.js.map +1 -1
- package/lib/config.d.ts +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +2 -1
- package/lib/config.js.map +1 -1
- package/lib/errors.d.ts +11 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +17 -1
- package/lib/errors.js.map +1 -1
- package/lib/logic/broadcast.d.ts +1 -1
- package/lib/logic/broadcast.d.ts.map +1 -1
- package/lib/logic/broadcast.js +2 -2
- package/lib/logic/broadcast.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts +1 -1
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js +3 -3
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib/logic/estimateFees.d.ts +1 -1
- package/lib/logic/estimateFees.d.ts.map +1 -1
- package/lib/logic/estimateFees.js +19 -4
- package/lib/logic/estimateFees.js.map +1 -1
- package/lib/logic/getBalance.d.ts +1 -2
- package/lib/logic/getBalance.d.ts.map +1 -1
- package/lib/logic/getBalance.js +5 -6
- package/lib/logic/getBalance.js.map +1 -1
- package/lib/logic/getBlock.d.ts +1 -1
- package/lib/logic/getBlock.d.ts.map +1 -1
- package/lib/logic/getBlock.js +23 -6
- package/lib/logic/getBlock.js.map +1 -1
- package/lib/logic/getBlockInfo.d.ts +1 -1
- package/lib/logic/getBlockInfo.d.ts.map +1 -1
- package/lib/logic/getBlockInfo.js +2 -2
- package/lib/logic/getBlockInfo.js.map +1 -1
- package/lib/logic/getNextSequence.d.ts +1 -1
- package/lib/logic/getNextSequence.d.ts.map +1 -1
- package/lib/logic/getNextSequence.js +2 -2
- package/lib/logic/getNextSequence.js.map +1 -1
- package/lib/logic/getStakes.d.ts +1 -1
- package/lib/logic/getStakes.d.ts.map +1 -1
- package/lib/logic/getStakes.js +2 -2
- package/lib/logic/getStakes.js.map +1 -1
- package/lib/logic/lastBlock.d.ts +1 -1
- package/lib/logic/lastBlock.d.ts.map +1 -1
- package/lib/logic/lastBlock.js +2 -2
- package/lib/logic/lastBlock.js.map +1 -1
- package/lib/logic/listOperations.d.ts +1 -1
- package/lib/logic/listOperations.d.ts.map +1 -1
- package/lib/logic/listOperations.js +4 -2
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/validateIntent.d.ts +1 -1
- package/lib/logic/validateIntent.d.ts.map +1 -1
- package/lib/logic/validateIntent.js +3 -3
- package/lib/logic/validateIntent.js.map +1 -1
- package/lib/logic.d.ts.map +1 -1
- package/lib/logic.js +5 -10
- package/lib/logic.js.map +1 -1
- package/lib/network/node/explorerProxy.d.ts.map +1 -1
- package/lib/network/node/explorerProxy.js +2 -0
- package/lib/network/node/explorerProxy.js.map +1 -1
- package/lib/network/node/ledger.d.ts.map +1 -1
- package/lib/network/node/ledger.js +2 -9
- package/lib/network/node/ledger.js.map +1 -1
- package/lib/network/node/rpc.common.d.ts.map +1 -1
- package/lib/network/node/rpc.common.js +18 -9
- package/lib/network/node/rpc.common.js.map +1 -1
- package/lib/network/node/types.d.ts +3 -1
- package/lib/network/node/types.d.ts.map +1 -1
- package/lib/network/node/types.js.map +1 -1
- package/lib/staking/detectOperationType.js +1 -1
- package/lib/staking/validators/index.d.ts +1 -1
- package/lib/staking/validators/index.d.ts.map +1 -1
- package/lib/staking/validators/index.js +2 -2
- package/lib/staking/validators/index.js.map +1 -1
- package/lib/staking/validators/monadResolver.js +1 -1
- package/lib/staking/validators/monadResolver.js.map +1 -1
- package/lib-es/adapters/etherscan.d.ts.map +1 -1
- package/lib-es/adapters/etherscan.js +14 -0
- package/lib-es/adapters/etherscan.js.map +1 -1
- package/lib-es/adapters/ledger.d.ts.map +1 -1
- package/lib-es/adapters/ledger.js +2 -0
- package/lib-es/adapters/ledger.js.map +1 -1
- package/lib-es/api/index.d.ts +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +14 -15
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/chains.d.ts +7 -0
- package/lib-es/chains.d.ts.map +1 -1
- package/lib-es/chains.js +16 -0
- package/lib-es/chains.js.map +1 -1
- package/lib-es/config.d.ts +1 -1
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/config.js +1 -1
- package/lib-es/config.js.map +1 -1
- package/lib-es/errors.d.ts +11 -0
- package/lib-es/errors.d.ts.map +1 -1
- package/lib-es/errors.js +15 -0
- package/lib-es/errors.js.map +1 -1
- package/lib-es/logic/broadcast.d.ts +1 -1
- package/lib-es/logic/broadcast.d.ts.map +1 -1
- package/lib-es/logic/broadcast.js +2 -2
- package/lib-es/logic/broadcast.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts +1 -1
- package/lib-es/logic/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/craftTransaction.js +3 -3
- package/lib-es/logic/craftTransaction.js.map +1 -1
- package/lib-es/logic/estimateFees.d.ts +1 -1
- package/lib-es/logic/estimateFees.d.ts.map +1 -1
- package/lib-es/logic/estimateFees.js +19 -4
- package/lib-es/logic/estimateFees.js.map +1 -1
- package/lib-es/logic/getBalance.d.ts +1 -2
- package/lib-es/logic/getBalance.d.ts.map +1 -1
- package/lib-es/logic/getBalance.js +5 -6
- package/lib-es/logic/getBalance.js.map +1 -1
- package/lib-es/logic/getBlock.d.ts +1 -1
- package/lib-es/logic/getBlock.d.ts.map +1 -1
- package/lib-es/logic/getBlock.js +23 -6
- package/lib-es/logic/getBlock.js.map +1 -1
- package/lib-es/logic/getBlockInfo.d.ts +1 -1
- package/lib-es/logic/getBlockInfo.d.ts.map +1 -1
- package/lib-es/logic/getBlockInfo.js +2 -2
- package/lib-es/logic/getBlockInfo.js.map +1 -1
- package/lib-es/logic/getNextSequence.d.ts +1 -1
- package/lib-es/logic/getNextSequence.d.ts.map +1 -1
- package/lib-es/logic/getNextSequence.js +2 -2
- package/lib-es/logic/getNextSequence.js.map +1 -1
- package/lib-es/logic/getStakes.d.ts +1 -1
- package/lib-es/logic/getStakes.d.ts.map +1 -1
- package/lib-es/logic/getStakes.js +2 -2
- package/lib-es/logic/getStakes.js.map +1 -1
- package/lib-es/logic/lastBlock.d.ts +1 -1
- package/lib-es/logic/lastBlock.d.ts.map +1 -1
- package/lib-es/logic/lastBlock.js +2 -2
- package/lib-es/logic/lastBlock.js.map +1 -1
- package/lib-es/logic/listOperations.d.ts +1 -1
- package/lib-es/logic/listOperations.d.ts.map +1 -1
- package/lib-es/logic/listOperations.js +4 -2
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/validateIntent.d.ts +1 -1
- package/lib-es/logic/validateIntent.d.ts.map +1 -1
- package/lib-es/logic/validateIntent.js +3 -3
- package/lib-es/logic/validateIntent.js.map +1 -1
- package/lib-es/logic.d.ts.map +1 -1
- package/lib-es/logic.js +6 -11
- package/lib-es/logic.js.map +1 -1
- package/lib-es/network/node/explorerProxy.d.ts.map +1 -1
- package/lib-es/network/node/explorerProxy.js +2 -0
- package/lib-es/network/node/explorerProxy.js.map +1 -1
- package/lib-es/network/node/ledger.d.ts.map +1 -1
- package/lib-es/network/node/ledger.js +3 -10
- package/lib-es/network/node/ledger.js.map +1 -1
- package/lib-es/network/node/rpc.common.d.ts.map +1 -1
- package/lib-es/network/node/rpc.common.js +19 -10
- package/lib-es/network/node/rpc.common.js.map +1 -1
- package/lib-es/network/node/types.d.ts +3 -1
- package/lib-es/network/node/types.d.ts.map +1 -1
- package/lib-es/network/node/types.js.map +1 -1
- package/lib-es/staking/detectOperationType.js +1 -1
- package/lib-es/staking/validators/index.d.ts +1 -1
- package/lib-es/staking/validators/index.d.ts.map +1 -1
- package/lib-es/staking/validators/index.js +2 -2
- package/lib-es/staking/validators/index.js.map +1 -1
- package/lib-es/staking/validators/monadResolver.js +1 -1
- package/lib-es/staking/validators/monadResolver.js.map +1 -1
- package/package.json +2 -2
- package/src/adapters/etherscan.test.ts +57 -5
- package/src/adapters/etherscan.ts +15 -0
- package/src/adapters/ledger.test.ts +57 -9
- package/src/adapters/ledger.ts +2 -0
- package/src/api/index.ts +14 -17
- package/src/api/{getBlock.integ.test.ts → tests/getBlock.integ.test.ts} +7 -7
- package/src/api/{index.arbitrum.integ.test.ts → tests/index.arbitrum.integ.test.ts} +4 -4
- package/src/api/{index.arc.integ.test.ts → tests/index.arc.integ.test.ts} +4 -4
- package/src/api/{index.avalanche_c_chain_fuji.integ.test.ts → tests/index.avalanche_c_chain_fuji.integ.test.ts} +4 -4
- package/src/api/{index.cronos.integ.test.ts → tests/index.cronos.integ.test.ts} +4 -4
- package/src/api/{index.flare.integ.test.ts → tests/index.flare.integ.test.ts} +4 -4
- package/src/api/{index.integ.test.ts → tests/index.integ.test.ts} +8 -8
- package/src/api/{index.linea.integ.test.ts → tests/index.linea.integ.test.ts} +4 -4
- package/src/api/{index.monad_testnet.integ.test.ts → tests/index.monad_testnet.integ.test.ts} +5 -5
- package/src/api/{index.optimism.integ.test.ts → tests/index.optimism.integ.test.ts} +4 -4
- package/src/api/{index.rsk.integ.test.ts → tests/index.rsk.integ.test.ts} +4 -4
- package/src/api/{index.shape.integ.test.ts → tests/index.shape.integ.test.ts} +4 -4
- package/src/api/{index.somnia.integ.test.ts → tests/index.somnia.integ.test.ts} +4 -4
- package/src/api/{index.test.ts → tests/index.test.ts} +10 -10
- package/src/api/{index.zksync.integ.test.ts → tests/index.zksync.integ.test.ts} +3 -3
- package/src/chains.ts +17 -0
- package/src/config.ts +1 -1
- package/src/errors.ts +14 -0
- package/src/fixtures/context.fixtures.ts +2 -4
- package/src/logic/broadcast.ts +1 -2
- package/src/logic/craftTransaction.ts +2 -3
- package/src/logic/estimateFees.ts +22 -4
- package/src/logic/getBalance.ts +3 -6
- package/src/logic/getBlock.ts +39 -10
- package/src/logic/getBlockInfo.ts +2 -6
- package/src/logic/getNextSequence.ts +2 -6
- package/src/logic/getStakes.ts +1 -2
- package/src/logic/lastBlock.ts +2 -2
- package/src/logic/listOperations.ts +3 -2
- package/src/logic/tests/broadcast.integ.test.ts +1 -1
- package/src/logic/tests/broadcast.test.ts +5 -5
- package/src/logic/tests/broadcastSource.test.ts +4 -4
- package/src/logic/tests/common.test.ts +1 -1
- package/src/logic/tests/craftTransaction.test.ts +16 -21
- package/src/logic/tests/estimateFees.test.ts +40 -18
- package/src/logic/tests/getBalance.test.ts +20 -23
- package/src/logic/tests/getBlock.test.ts +159 -39
- package/src/logic/tests/getBlockInfo.test.ts +6 -6
- package/src/logic/tests/getNextSequence.test.ts +2 -2
- package/src/logic/tests/getStakes.test.ts +14 -14
- package/src/logic/tests/internalTransactionsFetcher.test.ts +1 -1
- package/src/logic/tests/lastBlock.test.ts +4 -4
- package/src/logic/tests/listOperations.test.ts +51 -55
- package/src/logic/tests/validateIntent.test.ts +39 -61
- package/src/logic/validateIntent.ts +2 -3
- package/src/logic.test.ts +24 -7
- package/src/logic.ts +6 -11
- package/src/network/node/explorerProxy.ts +2 -0
- package/src/network/node/ledger.ts +3 -10
- package/src/network/node/rpc.common.ts +23 -10
- package/src/network/node/types.ts +5 -2
- package/src/network/{explorer → tests/explorer}/etherscan.test.ts +8 -8
- package/src/network/{explorer → tests/explorer}/index.test.ts +11 -11
- package/src/network/{explorer → tests/explorer}/ledger.test.ts +11 -11
- package/src/network/{explorer → tests/explorer}/types.test.ts +1 -1
- package/src/network/{gasTracker → tests/gasTracker}/index.test.ts +3 -3
- package/src/network/{gasTracker → tests/gasTracker}/ledger.test.ts +4 -4
- package/src/network/{gasTracker → tests/gasTracker}/types.test.ts +1 -1
- package/src/network/{node → tests/node}/explorerProxy.test.ts +5 -2
- package/src/network/{node → tests/node}/gethCallTracerToTraceBlockItems.test.ts +4 -4
- package/src/network/{node → tests/node}/index.memoization.test.ts +3 -3
- package/src/network/{node → tests/node}/index.test.ts +3 -3
- package/src/network/{node → tests/node}/ledger.test.ts +9 -6
- package/src/network/{node → tests/node}/node.fixtures.ts +1 -1
- package/src/network/{node → tests/node}/rpc.errors.test.ts +1 -1
- package/src/network/{node → tests/node}/rpc.test.ts +57 -6
- package/src/network/{node → tests/node}/types.test.ts +1 -1
- package/src/network/{node → tests/node}/withNodeSources.test.ts +3 -3
- package/src/network/{withRetries.test.ts → tests/withRetries.test.ts} +2 -2
- package/src/staking/detectOperationType.ts +1 -1
- package/src/staking/redelegations.test.ts +3 -3
- package/src/staking/validators/index.ts +1 -2
- package/src/staking/validators/monadResolver.ts +1 -1
- package/src/staking/validators.integ.test.ts +1 -1
- package/src/staking/validators.test.ts +1 -1
|
@@ -22,7 +22,7 @@ import { ethers, FetchRequest, JsonRpcProvider } from 'ethers'
|
|
|
22
22
|
import ERC20Abi from '../../abis/erc20.abi.json'
|
|
23
23
|
import OptimismGasPriceOracleAbi from '../../abis/optimismGasPriceOracle.abi.json'
|
|
24
24
|
import ScrollGasPriceOracleAbi from '../../abis/scrollGasPriceOracle.abi.json'
|
|
25
|
-
import { CHAIN_ID } from '../../config'
|
|
25
|
+
import { CHAIN_ID, OP_STACK_L1_FEE_CHAIN_IDS } from '../../config'
|
|
26
26
|
import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '../../errors'
|
|
27
27
|
import { isSmartContractInput, safeEncodeEIP55, normalizeAddress } from '../../logic-public'
|
|
28
28
|
import {
|
|
@@ -301,6 +301,7 @@ async function getTransaction(
|
|
|
301
301
|
nonce: tx.nonce,
|
|
302
302
|
gasUsed: quantityToDecimal(receipt.gasUsed),
|
|
303
303
|
gasPrice: receiptGasPrice(receipt),
|
|
304
|
+
gasLimit: tx.gasLimit.toString(),
|
|
304
305
|
status: receiptStatus(receipt.status),
|
|
305
306
|
value: tx.value.toString(),
|
|
306
307
|
from: tx.from,
|
|
@@ -597,6 +598,10 @@ async function getBlockByHeight(
|
|
|
597
598
|
...(typeof data === 'string' && isSmartContractInput(data) ? { input: data } : {}),
|
|
598
599
|
// EIP-1559 transactions have gasPrice: null; fall back to maxFeePerGas then 0
|
|
599
600
|
gasPrice: (tx.gasPrice ?? tx.maxFeePerGas ?? 0n).toString(),
|
|
601
|
+
...(tx.gasLimit !== null && tx.gasLimit !== undefined
|
|
602
|
+
? { gasLimit: BigInt(tx.gasLimit).toString() }
|
|
603
|
+
: {}),
|
|
604
|
+
...(typeof tx.nonce === 'number' ? { nonce: tx.nonce } : {}),
|
|
600
605
|
}
|
|
601
606
|
})
|
|
602
607
|
|
|
@@ -691,6 +696,12 @@ async function getBlockByHeightFromRawRpc(
|
|
|
691
696
|
throw new Error(
|
|
692
697
|
'Malformed prefetched transaction gasPrice in eth_getBlockByNumber response'
|
|
693
698
|
)
|
|
699
|
+
if ('gas' in tx && tx.gas !== undefined && typeof tx.gas !== 'string')
|
|
700
|
+
throw new Error('Malformed prefetched transaction gas in eth_getBlockByNumber response')
|
|
701
|
+
if ('nonce' in tx && tx.nonce !== undefined && typeof tx.nonce !== 'string')
|
|
702
|
+
throw new Error(
|
|
703
|
+
'Malformed prefetched transaction nonce in eth_getBlockByNumber response'
|
|
704
|
+
)
|
|
694
705
|
if (
|
|
695
706
|
'input' in tx &&
|
|
696
707
|
tx.input !== undefined &&
|
|
@@ -710,6 +721,12 @@ async function getBlockByHeightFromRawRpc(
|
|
|
710
721
|
? { input: tx.input }
|
|
711
722
|
: {}),
|
|
712
723
|
gasPrice: BigInt(tx.gasPrice ?? '0x0').toString(),
|
|
724
|
+
...('gas' in tx && typeof tx.gas === 'string'
|
|
725
|
+
? { gasLimit: BigInt(tx.gas).toString() }
|
|
726
|
+
: {}),
|
|
727
|
+
...('nonce' in tx && typeof tx.nonce === 'string'
|
|
728
|
+
? { nonce: Number(BigInt(tx.nonce)) }
|
|
729
|
+
: {}),
|
|
713
730
|
}
|
|
714
731
|
})
|
|
715
732
|
: undefined
|
|
@@ -838,6 +855,8 @@ type EthersPrefetchedTransaction = {
|
|
|
838
855
|
data?: string | null
|
|
839
856
|
gasPrice?: bigint | string | null
|
|
840
857
|
maxFeePerGas?: bigint | string | null
|
|
858
|
+
gasLimit?: bigint | string | null
|
|
859
|
+
nonce?: number | null
|
|
841
860
|
}
|
|
842
861
|
|
|
843
862
|
function recordOf(value: object): Record<string, unknown> {
|
|
@@ -854,6 +873,8 @@ function isPrefetchedBlockTransaction(value: unknown): value is EthersPrefetched
|
|
|
854
873
|
isOptionalString(value.to) &&
|
|
855
874
|
isOptionalQuantity(value.gasPrice) &&
|
|
856
875
|
isOptionalQuantity(value.maxFeePerGas) &&
|
|
876
|
+
isOptionalQuantity(value.gasLimit) &&
|
|
877
|
+
(value.nonce === undefined || value.nonce === null || typeof value.nonce === 'number') &&
|
|
857
878
|
isOptionalString(value.data)
|
|
858
879
|
)
|
|
859
880
|
}
|
|
@@ -893,15 +914,7 @@ async function getOptimismAdditionalFees(
|
|
|
893
914
|
chainId: ChainId,
|
|
894
915
|
transaction: string
|
|
895
916
|
): Promise<BigNumber> {
|
|
896
|
-
|
|
897
|
-
CHAIN_ID.OPTIMISM,
|
|
898
|
-
CHAIN_ID.OPTIMISM_SEPOLIA,
|
|
899
|
-
CHAIN_ID.BASE,
|
|
900
|
-
CHAIN_ID.BASE_SEPOLIA,
|
|
901
|
-
CHAIN_ID.BLAST,
|
|
902
|
-
CHAIN_ID.BLAST_SEPOLIA,
|
|
903
|
-
]
|
|
904
|
-
if (!optimismFeeChainIds.includes(chainId)) {
|
|
917
|
+
if (!OP_STACK_L1_FEE_CHAIN_IDS.includes(chainId)) {
|
|
905
918
|
return new BigNumber(0)
|
|
906
919
|
}
|
|
907
920
|
|
|
@@ -105,6 +105,8 @@ export type TransactionInfo = {
|
|
|
105
105
|
nonce: number
|
|
106
106
|
gasUsed: string
|
|
107
107
|
gasPrice: string
|
|
108
|
+
/** Gas limit set by the sender (decimal), when the source reports it */
|
|
109
|
+
gasLimit?: string
|
|
108
110
|
value: string | bigint // can be returned as bigint by ethers prefetched txs, or string in raw payloads
|
|
109
111
|
status: number | null
|
|
110
112
|
from: string
|
|
@@ -123,8 +125,9 @@ export type TransactionInfo = {
|
|
|
123
125
|
|
|
124
126
|
export type PrefetchedBlockTransaction = Pick<
|
|
125
127
|
TransactionInfo,
|
|
126
|
-
'hash' | 'value' | 'from' | 'to' | 'input' | 'gasPrice'
|
|
127
|
-
>
|
|
128
|
+
'hash' | 'value' | 'from' | 'to' | 'input' | 'gasPrice' | 'gasLimit'
|
|
129
|
+
> &
|
|
130
|
+
Partial<Pick<TransactionInfo, 'nonce'>>
|
|
128
131
|
|
|
129
132
|
export type BlockReceiptInfo = Pick<
|
|
130
133
|
TransactionInfo,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { PagingState } from '
|
|
5
|
-
import type { EvmConfigInfo, NftStandard } from '
|
|
4
|
+
import type { PagingState } from '../../../adapters'
|
|
5
|
+
import type { EvmConfigInfo, NftStandard } from '../../../config'
|
|
6
6
|
import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
7
7
|
import type { AxiosRequestConfig } from 'axios'
|
|
8
8
|
import { AssertionError, fail } from 'assert'
|
|
@@ -16,26 +16,26 @@ import {
|
|
|
16
16
|
etherscanOperationToOperations,
|
|
17
17
|
deserializePagingToken,
|
|
18
18
|
serializePagingToken,
|
|
19
|
-
} from '
|
|
20
|
-
import { CHAIN_ID } from '
|
|
19
|
+
} from '../../../adapters'
|
|
20
|
+
import { CHAIN_ID } from '../../../config'
|
|
21
21
|
import {
|
|
22
22
|
EtherscanAPIError,
|
|
23
23
|
EtherscanLikeExplorerUsedIncorrectly,
|
|
24
24
|
RateLimitError,
|
|
25
|
-
} from '
|
|
25
|
+
} from '../../../errors'
|
|
26
26
|
import {
|
|
27
27
|
createMockEvmConfigInfo,
|
|
28
28
|
mkExternalNode,
|
|
29
29
|
testLogger,
|
|
30
|
-
} from '
|
|
30
|
+
} from '../../../fixtures/context.fixtures'
|
|
31
31
|
import {
|
|
32
32
|
etherscanCoinOperations,
|
|
33
33
|
etherscanERC1155Operations,
|
|
34
34
|
etherscanERC721Operations,
|
|
35
35
|
etherscanInternalOperations,
|
|
36
36
|
etherscanTokenOperations,
|
|
37
|
-
} from '
|
|
38
|
-
import * as ETHERSCAN_API from '
|
|
37
|
+
} from '../../../fixtures/etherscan.fixtures'
|
|
38
|
+
import * as ETHERSCAN_API from '../../explorer/etherscan'
|
|
39
39
|
|
|
40
40
|
jest.mock('axios')
|
|
41
41
|
jest.mock('@ledgerhq/coin-module-framework/promises')
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../../config'
|
|
5
5
|
import { AssertionError, fail } from 'assert'
|
|
6
|
-
import { UnknownExplorer } from '
|
|
6
|
+
import { UnknownExplorer } from '../../../errors'
|
|
7
7
|
import {
|
|
8
8
|
createMockEvmConfigInfo,
|
|
9
9
|
mkEtherscanExplorer,
|
|
10
10
|
mkExternalNode,
|
|
11
11
|
mkLedgerExplorer,
|
|
12
12
|
testLogger,
|
|
13
|
-
} from '
|
|
14
|
-
import etherscanLikeApi from '
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
13
|
+
} from '../../../fixtures/context.fixtures'
|
|
14
|
+
import etherscanLikeApi from '../../explorer/etherscan'
|
|
15
|
+
import { getExplorerApi } from '../../explorer/index'
|
|
16
|
+
import ledgerExplorerApi from '../../explorer/ledger'
|
|
17
|
+
import noExplorerAPI from '../../explorer/none'
|
|
18
18
|
|
|
19
|
-
const configFor = (
|
|
19
|
+
const configFor = (chainName: string): EvmConfigInfo => {
|
|
20
20
|
const node = mkExternalNode()
|
|
21
|
-
switch (
|
|
21
|
+
switch (chainName) {
|
|
22
22
|
case 'anything-coin':
|
|
23
23
|
return createMockEvmConfigInfo({
|
|
24
24
|
chainId: 1,
|
|
@@ -109,8 +109,8 @@ describe('EVM Family', () => {
|
|
|
109
109
|
['etherscan', 'etherscan-coin'],
|
|
110
110
|
['ledger', 'ledger-coin'],
|
|
111
111
|
['none', 'none-coin'],
|
|
112
|
-
])('%s arm exposes discoverTokenAssets', (_type,
|
|
113
|
-
const explorer = getExplorerApi(configFor(
|
|
112
|
+
])('%s arm exposes discoverTokenAssets', (_type, chainName) => {
|
|
113
|
+
const explorer = getExplorerApi(configFor(chainName))
|
|
114
114
|
|
|
115
115
|
expect(typeof explorer.discoverTokenAssets).toBe('function')
|
|
116
116
|
})
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo, NftStandard } from '
|
|
5
|
-
import type { LedgerExplorerOperation } from '
|
|
4
|
+
import type { EvmConfigInfo, NftStandard } from '../../../config'
|
|
5
|
+
import type { LedgerExplorerOperation } from '../../../types'
|
|
6
6
|
import type { AssetInfo } from '@ledgerhq/coin-module-framework/api/types'
|
|
7
7
|
import type { AxiosRequestConfig } from 'axios'
|
|
8
8
|
import { AssertionError, fail } from 'assert'
|
|
9
9
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
10
10
|
import axios from 'axios'
|
|
11
11
|
import eip55 from 'eip55'
|
|
12
|
-
import { DEFAULT_LEDGER_EXPLORER_URI } from '
|
|
12
|
+
import { DEFAULT_LEDGER_EXPLORER_URI } from '../../../config'
|
|
13
13
|
import {
|
|
14
14
|
LedgerExplorerUsedIncorrectly,
|
|
15
15
|
RateLimitError,
|
|
16
16
|
UnpageableLedgerExplorerBlock,
|
|
17
|
-
} from '
|
|
17
|
+
} from '../../../errors'
|
|
18
18
|
import {
|
|
19
19
|
createMockEvmConfigInfo,
|
|
20
20
|
mkExternalNode,
|
|
21
21
|
mkLedgerNode,
|
|
22
22
|
testLogger,
|
|
23
|
-
} from '
|
|
23
|
+
} from '../../../fixtures/context.fixtures'
|
|
24
24
|
import {
|
|
25
25
|
coinOperation1,
|
|
26
26
|
coinOperation2,
|
|
27
27
|
coinOperation3,
|
|
28
28
|
coinOperation4,
|
|
29
|
-
} from '
|
|
30
|
-
import * as LEDGER_API from '
|
|
29
|
+
} from '../../../fixtures/ledger.fixtures'
|
|
30
|
+
import * as LEDGER_API from '../../explorer/ledger'
|
|
31
31
|
|
|
32
32
|
jest.mock('axios')
|
|
33
33
|
jest.mock('@ledgerhq/coin-module-framework/promises')
|
|
@@ -385,7 +385,7 @@ describe('EVM Family', () => {
|
|
|
385
385
|
value: 0n,
|
|
386
386
|
asset: { type: 'native' },
|
|
387
387
|
tx: tx1,
|
|
388
|
-
details: { sequence: 75 },
|
|
388
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
389
389
|
},
|
|
390
390
|
{
|
|
391
391
|
id: `${addr}-${txHash}-OUT`,
|
|
@@ -395,7 +395,7 @@ describe('EVM Family', () => {
|
|
|
395
395
|
value: 10n,
|
|
396
396
|
asset: { type: 'native' },
|
|
397
397
|
tx: tx2,
|
|
398
|
-
details: { sequence: 75 },
|
|
398
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
399
399
|
},
|
|
400
400
|
{
|
|
401
401
|
id: `${addr}-${txHash}-IN`,
|
|
@@ -405,7 +405,7 @@ describe('EVM Family', () => {
|
|
|
405
405
|
value: 100n,
|
|
406
406
|
asset: { type: 'native' },
|
|
407
407
|
tx: tx3,
|
|
408
|
-
details: { sequence: 75 },
|
|
408
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
409
409
|
},
|
|
410
410
|
{
|
|
411
411
|
id: `${addr}-${txHash}-IN`,
|
|
@@ -415,7 +415,7 @@ describe('EVM Family', () => {
|
|
|
415
415
|
value: 100n,
|
|
416
416
|
asset: { type: 'native' },
|
|
417
417
|
tx: tx4,
|
|
418
|
-
details: { sequence: 75 },
|
|
418
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
419
419
|
},
|
|
420
420
|
],
|
|
421
421
|
lastNftOperations: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { isEtherscanLikeExplorerConfig, isLedgerExplorerConfig } from '
|
|
4
|
+
import { isEtherscanLikeExplorerConfig, isLedgerExplorerConfig } from '../../explorer/types'
|
|
5
5
|
|
|
6
6
|
describe('EVM Family', () => {
|
|
7
7
|
describe('network/explorer/types.ts', () => {
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
createMockEvmConfigInfo,
|
|
6
6
|
mkLedgerGasTracker,
|
|
7
7
|
mkLedgerNode,
|
|
8
|
-
} from '
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
} from '../../../fixtures/context.fixtures'
|
|
9
|
+
import { getGasTracker } from '../../gasTracker/index'
|
|
10
|
+
import { getGasOptions as ledgerGetGasOptions } from '../../gasTracker/ledger'
|
|
11
11
|
|
|
12
12
|
const configWithGasTracker = createMockEvmConfigInfo({
|
|
13
13
|
chainId: 1,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { GasOptions } from '
|
|
4
|
+
import type { GasOptions } from '../../../types'
|
|
5
5
|
import { AssertionError } from 'assert'
|
|
6
6
|
import network from '@ledgerhq/live-network/network'
|
|
7
7
|
import { AxiosHeaders } from 'axios'
|
|
@@ -11,14 +11,14 @@ function makeNetworkResponse<T>(data: T) {
|
|
|
11
11
|
const headers = new AxiosHeaders()
|
|
12
12
|
return Promise.resolve({ data, status: 200, statusText: 'OK', headers, config: { headers } })
|
|
13
13
|
}
|
|
14
|
-
import { LedgerGasTrackerUsedIncorrectly, NoGasTrackerFound } from '
|
|
14
|
+
import { LedgerGasTrackerUsedIncorrectly, NoGasTrackerFound } from '../../../errors'
|
|
15
15
|
import {
|
|
16
16
|
createMockEvmConfigInfo,
|
|
17
17
|
mkExternalNode,
|
|
18
18
|
mkLedgerGasTracker,
|
|
19
19
|
mkLedgerNode,
|
|
20
|
-
} from '
|
|
21
|
-
import { getGasOptions } from '
|
|
20
|
+
} from '../../../fixtures/context.fixtures'
|
|
21
|
+
import { getGasOptions } from '../../gasTracker/ledger'
|
|
22
22
|
|
|
23
23
|
jest.mock('@ledgerhq/live-network/network')
|
|
24
24
|
const mockedNetwork = jest.mocked(network)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { isLedgerGasTracker } from '
|
|
4
|
+
import { isLedgerGasTracker } from '../../gasTracker/types'
|
|
5
5
|
|
|
6
6
|
describe('EVM Family', () => {
|
|
7
7
|
describe('network/gasTracker/types.ts', () => {
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
createMockEvmConfigInfo,
|
|
8
8
|
mkExternalNode,
|
|
9
9
|
testLogger,
|
|
10
|
-
} from '
|
|
10
|
+
} from '../../../fixtures/context.fixtures'
|
|
11
11
|
import {
|
|
12
12
|
createExplorerProxyNodeApi,
|
|
13
13
|
getBlockFromExplorerProxy,
|
|
14
14
|
getTransactionFromExplorerProxy,
|
|
15
|
-
} from '
|
|
15
|
+
} from '../../node/explorerProxy'
|
|
16
16
|
|
|
17
17
|
jest.mock('axios')
|
|
18
18
|
const mockAxiosGet = jest.mocked(axios.get)
|
|
@@ -115,6 +115,7 @@ describe('createExplorerProxyNodeApi', () => {
|
|
|
115
115
|
blockHash: '0xblockhash',
|
|
116
116
|
nonce: '0x1',
|
|
117
117
|
gasPrice: '0x3b9aca00',
|
|
118
|
+
gas: '0x11e72',
|
|
118
119
|
value: '0x0',
|
|
119
120
|
from: '0xaabbcc0000000000000000000000000000000001',
|
|
120
121
|
to: '0xaabbcc0000000000000000000000000000000002',
|
|
@@ -139,6 +140,8 @@ describe('createExplorerProxyNodeApi', () => {
|
|
|
139
140
|
expect(result.hash).toBe(TX_HASH)
|
|
140
141
|
expect(result.status).toBe(1)
|
|
141
142
|
expect(result.erc20Transfers).toEqual([])
|
|
143
|
+
expect(result.gasLimit).toBe('73330')
|
|
144
|
+
expect(result.nonce).toBe(1)
|
|
142
145
|
})
|
|
143
146
|
|
|
144
147
|
it('propagates network errors as a throw (via the null path)', async () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { TraceBlockItem } from '
|
|
5
|
-
import { isTraceBlockItem } from '
|
|
6
|
-
import { gethCallTracerToTraceBlockItems } from '
|
|
7
|
-
import flareBlock0x36ffc39CallTracerTrace from '
|
|
4
|
+
import type { TraceBlockItem } from '../../node/types'
|
|
5
|
+
import { isTraceBlockItem } from '../../../logic/predicates'
|
|
6
|
+
import { gethCallTracerToTraceBlockItems } from '../../node/gethCallTracerToTraceBlockItems'
|
|
7
|
+
import flareBlock0x36ffc39CallTracerTrace from '../../node/resources/flare-0x36ffc39-debug-trace-block-call-tracer.json'
|
|
8
8
|
|
|
9
9
|
describe('gethCallTracerToTraceBlockItems', () => {
|
|
10
10
|
const blockNumber = 12345
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { CHAIN_ID } from '
|
|
4
|
+
import { CHAIN_ID } from '../../../config'
|
|
5
5
|
import {
|
|
6
6
|
createMockEvmConfigInfo,
|
|
7
7
|
mkExternalNode,
|
|
8
8
|
testLogger,
|
|
9
|
-
} from '
|
|
10
|
-
import { getNodeApi } from '
|
|
9
|
+
} from '../../../fixtures/context.fixtures'
|
|
10
|
+
import { getNodeApi } from '../../node/index'
|
|
11
11
|
|
|
12
12
|
describe('getNodeApi memoization', () => {
|
|
13
13
|
it('should return the same NodeApi instance for same chain and retries (memoization)', () => {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { UnknownNode } from '
|
|
4
|
+
import { UnknownNode } from '../../../errors'
|
|
5
5
|
import {
|
|
6
6
|
createMockEvmConfigInfo,
|
|
7
7
|
mkExternalNode,
|
|
8
8
|
mkLedgerNode,
|
|
9
9
|
testLogger,
|
|
10
|
-
} from '
|
|
11
|
-
import { getNodeApi } from '
|
|
10
|
+
} from '../../../fixtures/context.fixtures'
|
|
11
|
+
import { getNodeApi } from '../../node/index'
|
|
12
12
|
|
|
13
13
|
describe('EVM Family', () => {
|
|
14
14
|
describe('network/node/index.ts', () => {
|
|
@@ -5,17 +5,17 @@ import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
|
5
5
|
import axios from 'axios'
|
|
6
6
|
import BigNumber from 'bignumber.js'
|
|
7
7
|
import { Transaction } from 'ethers'
|
|
8
|
-
import { CHAIN_ID, DEFAULT_LEDGER_EXPLORER_URI } from '
|
|
9
|
-
import { GasEstimationError } from '
|
|
10
|
-
import { createMockEvmConfigInfo, testLogger } from '
|
|
11
|
-
import { getGasOptions } from '
|
|
12
|
-
import { createLedgerNodeApi } from '
|
|
8
|
+
import { CHAIN_ID, DEFAULT_LEDGER_EXPLORER_URI } from '../../../config'
|
|
9
|
+
import { GasEstimationError } from '../../../errors'
|
|
10
|
+
import { createMockEvmConfigInfo, testLogger } from '../../../fixtures/context.fixtures'
|
|
11
|
+
import { getGasOptions } from '../../gasTracker/ledger'
|
|
12
|
+
import { createLedgerNodeApi } from '../../node/ledger'
|
|
13
13
|
|
|
14
14
|
jest.useFakeTimers({ doNotFake: ['setTimeout'] })
|
|
15
15
|
|
|
16
16
|
jest.mock('axios')
|
|
17
17
|
jest.mock('@ledgerhq/coin-module-framework/promises')
|
|
18
|
-
jest.mock('
|
|
18
|
+
jest.mock('../../gasTracker/ledger', () => ({
|
|
19
19
|
getGasOptions: jest.fn(),
|
|
20
20
|
}))
|
|
21
21
|
|
|
@@ -204,6 +204,7 @@ describe('EVM Family', () => {
|
|
|
204
204
|
const response = await api.getTransaction('0xHash')
|
|
205
205
|
expect(response).toEqual({
|
|
206
206
|
gasPrice: '83953611012',
|
|
207
|
+
gasLimit: '32000',
|
|
207
208
|
gasUsed: '21000',
|
|
208
209
|
value: '70494048649554430',
|
|
209
210
|
hash: '0x8d5ef4d7673fbfa6a4755cdfdb913742c47c7fdac2d214046387bbcbf10957c9',
|
|
@@ -599,6 +600,8 @@ describe('EVM Family', () => {
|
|
|
599
600
|
['blast_sepolia', CHAIN_ID.BLAST_SEPOLIA],
|
|
600
601
|
['base', CHAIN_ID.BASE],
|
|
601
602
|
['base_sepolia', CHAIN_ID.BASE_SEPOLIA],
|
|
603
|
+
['shape', CHAIN_ID.SHAPE],
|
|
604
|
+
['boba', CHAIN_ID.BOBA],
|
|
602
605
|
])('should query the OP-stack gas oracle for %s (not return 0)', async (_name, chainId) => {
|
|
603
606
|
const api = createLedgerNodeApi({ ...ledgerConfig, chainId }, testLogger)
|
|
604
607
|
jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { NodeApi } from '
|
|
4
|
+
import type { NodeApi } from '../../node/types'
|
|
5
5
|
|
|
6
6
|
export function mockNodeApi(overrides: Partial<jest.Mocked<NodeApi>> = {}): jest.Mocked<NodeApi> {
|
|
7
7
|
return {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../../config'
|
|
5
5
|
import type { PerformActionRequest } from 'ethers'
|
|
6
6
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
7
7
|
import BigNumber from 'bignumber.js'
|
|
8
8
|
import { FeeData, FetchRequest, JsonRpcProvider, Network, Transaction } from 'ethers'
|
|
9
|
-
import { CHAIN_ID } from '
|
|
10
|
-
import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '
|
|
9
|
+
import { CHAIN_ID } from '../../../config'
|
|
10
|
+
import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '../../../errors'
|
|
11
11
|
import {
|
|
12
12
|
createMockEvmConfigInfo,
|
|
13
13
|
mkExternalNode,
|
|
14
14
|
testLogger,
|
|
15
|
-
} from '
|
|
15
|
+
} from '../../../fixtures/context.fixtures'
|
|
16
16
|
import {
|
|
17
17
|
mkBlock,
|
|
18
18
|
mkTransactionReceipt,
|
|
19
19
|
mkTransactionResponse,
|
|
20
|
-
} from '
|
|
20
|
+
} from '../../../fixtures/ethers.fixtures'
|
|
21
21
|
import {
|
|
22
22
|
createNodeApi,
|
|
23
23
|
DEFAULT_RETRIES_RPC_METHODS,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
SYSTEM_ADDRESS,
|
|
28
28
|
WETH_DEPOSIT_TOPIC,
|
|
29
29
|
ERC20_MINT_TOPIC,
|
|
30
|
-
} from '
|
|
30
|
+
} from '../../node/rpc.common'
|
|
31
31
|
|
|
32
32
|
const evmConfig = createMockEvmConfigInfo({
|
|
33
33
|
chainId: 1,
|
|
@@ -346,6 +346,7 @@ describe('EVM Family', () => {
|
|
|
346
346
|
hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
|
|
347
347
|
nonce: 123,
|
|
348
348
|
gasPrice: '789',
|
|
349
|
+
gasLimit: '123',
|
|
349
350
|
gasUsed: '122',
|
|
350
351
|
value: '456',
|
|
351
352
|
status: 1,
|
|
@@ -1117,6 +1118,48 @@ describe('EVM Family', () => {
|
|
|
1117
1118
|
expect(result.gasPrice).toEqual(new BigNumber('20000000000'))
|
|
1118
1119
|
})
|
|
1119
1120
|
|
|
1121
|
+
describe('forceLegacyTransactions', () => {
|
|
1122
|
+
// Sparse fee market: the node reports a 1,000,000 wei gas price, a zero
|
|
1123
|
+
// eth_maxPriorityFeePerGas and zero feeHistory rewards, and the latest block
|
|
1124
|
+
// still carries a baseFeePerGas.
|
|
1125
|
+
beforeEach(() => {
|
|
1126
|
+
config = createMockEvmConfigInfo({
|
|
1127
|
+
chainId: 1,
|
|
1128
|
+
node: mkExternalNode({ uri: 'my-rpc.com' }),
|
|
1129
|
+
forceLegacyTransactions: true,
|
|
1130
|
+
minGasPrice: '2000000',
|
|
1131
|
+
})
|
|
1132
|
+
})
|
|
1133
|
+
|
|
1134
|
+
it('prices an EIP-1559 request as legacy at the minGasPrice floor', async () => {
|
|
1135
|
+
const sendSpy = jest.spyOn(JsonRpcProvider.prototype, 'send')
|
|
1136
|
+
jest
|
|
1137
|
+
.spyOn(JsonRpcProvider.prototype, 'getFeeData')
|
|
1138
|
+
.mockResolvedValueOnce(new FeeData(BigInt('1000000'), 0n, 0n))
|
|
1139
|
+
|
|
1140
|
+
const result = await nodeApi.getFeeData(config, eip1559Tx)
|
|
1141
|
+
|
|
1142
|
+
expect(result).toEqual({
|
|
1143
|
+
maxFeePerGas: null,
|
|
1144
|
+
maxPriorityFeePerGas: null,
|
|
1145
|
+
gasPrice: new BigNumber('2000000'),
|
|
1146
|
+
nextBaseFee: null,
|
|
1147
|
+
})
|
|
1148
|
+
expect(sendSpy).not.toHaveBeenCalledWith('eth_feeHistory', expect.anything())
|
|
1149
|
+
expect(sendSpy).not.toHaveBeenCalledWith('eth_maxPriorityFeePerGas', expect.anything())
|
|
1150
|
+
})
|
|
1151
|
+
|
|
1152
|
+
it('follows the node gas price when it is above the minGasPrice floor', async () => {
|
|
1153
|
+
jest
|
|
1154
|
+
.spyOn(JsonRpcProvider.prototype, 'getFeeData')
|
|
1155
|
+
.mockResolvedValueOnce(new FeeData(BigInt('3000000'), 0n, 0n))
|
|
1156
|
+
|
|
1157
|
+
const result = await nodeApi.getFeeData(config, eip1559Tx)
|
|
1158
|
+
|
|
1159
|
+
expect(result.gasPrice).toEqual(new BigNumber('3000000'))
|
|
1160
|
+
})
|
|
1161
|
+
})
|
|
1162
|
+
|
|
1120
1163
|
it('should return the expected payload for an EIP1559 tx when network returns 0 priority fee for 0G', async () => {
|
|
1121
1164
|
jest.spyOn(JsonRpcProvider.prototype, 'send').mockImplementationOnce(async (method) => {
|
|
1122
1165
|
if (method === 'eth_feeHistory') {
|
|
@@ -1272,6 +1315,8 @@ describe('EVM Family', () => {
|
|
|
1272
1315
|
from: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d',
|
|
1273
1316
|
to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
|
|
1274
1317
|
gasPrice: 0n,
|
|
1318
|
+
gasLimit: 21000n,
|
|
1319
|
+
nonce: 5,
|
|
1275
1320
|
}),
|
|
1276
1321
|
],
|
|
1277
1322
|
})
|
|
@@ -1289,6 +1334,8 @@ describe('EVM Family', () => {
|
|
|
1289
1334
|
from: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d',
|
|
1290
1335
|
to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
|
|
1291
1336
|
gasPrice: '0',
|
|
1337
|
+
gasLimit: '21000',
|
|
1338
|
+
nonce: 5,
|
|
1292
1339
|
},
|
|
1293
1340
|
],
|
|
1294
1341
|
transactionHashes: ['0xtx1'],
|
|
@@ -1348,6 +1395,8 @@ describe('EVM Family', () => {
|
|
|
1348
1395
|
from: '0x993aad80e425c646dab305381ff105169feedf67',
|
|
1349
1396
|
to: '0x0000000000000000000000000000000000010003',
|
|
1350
1397
|
type: '0xff',
|
|
1398
|
+
gas: '0x11e1a300',
|
|
1399
|
+
nonce: '0x2a',
|
|
1351
1400
|
},
|
|
1352
1401
|
],
|
|
1353
1402
|
}
|
|
@@ -1366,6 +1415,8 @@ describe('EVM Family', () => {
|
|
|
1366
1415
|
from: '0x993aad80e425c646dab305381ff105169feedf67',
|
|
1367
1416
|
to: '0x0000000000000000000000000000000000010003',
|
|
1368
1417
|
gasPrice: '0',
|
|
1418
|
+
gasLimit: '300000000',
|
|
1419
|
+
nonce: 42,
|
|
1369
1420
|
},
|
|
1370
1421
|
],
|
|
1371
1422
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { isExternalNodeConfig, isLedgerNodeConfig } from '
|
|
4
|
+
import { isExternalNodeConfig, isLedgerNodeConfig } from '../../node/types'
|
|
5
5
|
|
|
6
6
|
describe('EVM Family', () => {
|
|
7
7
|
describe('network/node/types.ts', () => {
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
mkEtherscanExplorer,
|
|
8
8
|
mkExternalNode,
|
|
9
9
|
testLogger,
|
|
10
|
-
} from '
|
|
11
|
-
import { nodeSourcesFromList } from '
|
|
10
|
+
} from '../../../fixtures/context.fixtures'
|
|
11
|
+
import { nodeSourcesFromList } from '../../../nodeSources'
|
|
12
|
+
import { withNodeSources } from '../../node/withNodeSources'
|
|
12
13
|
import { mockNodeApi } from './node.fixtures'
|
|
13
|
-
import { withNodeSources } from './withNodeSources'
|
|
14
14
|
|
|
15
15
|
jest.mock('axios')
|
|
16
16
|
const mockAxiosGet = jest.mocked(axios.get)
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
5
|
-
import { RateLimitError } from '
|
|
6
|
-
import { withRetries } from '
|
|
5
|
+
import { RateLimitError } from '../../errors'
|
|
6
|
+
import { withRetries } from '../withRetries'
|
|
7
7
|
|
|
8
8
|
jest.mock('@ledgerhq/coin-module-framework/promises')
|
|
9
9
|
jest.mocked(delay).mockResolvedValue(undefined)
|