@ledgerhq/coin-evm 5.3.6 → 5.3.9

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/lib/adapters/etherscan.d.ts.map +1 -1
  3. package/lib/adapters/etherscan.js +2 -1
  4. package/lib/adapters/etherscan.js.map +1 -1
  5. package/lib/logic/getBlock.js +2 -2
  6. package/lib/logic/getBlock.js.map +1 -1
  7. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  8. package/lib/network/explorer/etherscan.js +23 -5
  9. package/lib/network/explorer/etherscan.js.map +1 -1
  10. package/lib/network/node/rpc.common.d.ts.map +1 -1
  11. package/lib/network/node/rpc.common.js +30 -6
  12. package/lib/network/node/rpc.common.js.map +1 -1
  13. package/lib/network/node/types.d.ts +3 -1
  14. package/lib/network/node/types.d.ts.map +1 -1
  15. package/lib/network/node/types.js.map +1 -1
  16. package/lib/types/etherscan.d.ts +2 -0
  17. package/lib/types/etherscan.d.ts.map +1 -1
  18. package/lib-es/adapters/etherscan.d.ts.map +1 -1
  19. package/lib-es/adapters/etherscan.js +2 -1
  20. package/lib-es/adapters/etherscan.js.map +1 -1
  21. package/lib-es/logic/getBlock.js +2 -2
  22. package/lib-es/logic/getBlock.js.map +1 -1
  23. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  24. package/lib-es/network/explorer/etherscan.js +23 -5
  25. package/lib-es/network/explorer/etherscan.js.map +1 -1
  26. package/lib-es/network/node/rpc.common.d.ts.map +1 -1
  27. package/lib-es/network/node/rpc.common.js +30 -6
  28. package/lib-es/network/node/rpc.common.js.map +1 -1
  29. package/lib-es/network/node/types.d.ts +3 -1
  30. package/lib-es/network/node/types.d.ts.map +1 -1
  31. package/lib-es/network/node/types.js.map +1 -1
  32. package/lib-es/types/etherscan.d.ts +2 -0
  33. package/lib-es/types/etherscan.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/src/adapters/etherscan.test.ts +67 -0
  36. package/src/adapters/etherscan.ts +3 -1
  37. package/src/api/getBlock.integ.test.ts +1 -1
  38. package/src/api/index.avalanche_c_chain_fuji.integ.test.ts +1 -1
  39. package/src/api/index.integ.test.ts +7 -4
  40. package/src/api/index.linea.integ.test.ts +1 -1
  41. package/src/api/index.monad_testnet.integ.test.ts +1 -1
  42. package/src/api/index.optimism.integ.test.ts +30 -1
  43. package/src/api/index.rsk.integ.test.ts +1 -1
  44. package/src/api/index.shape.integ.test.ts +1 -1
  45. package/src/api/index.somnia.integ.test.ts +40 -0
  46. package/src/api/index.zksync.integ.test.ts +6 -2
  47. package/src/logic/getBlock.test.ts +49 -0
  48. package/src/logic/getBlock.ts +3 -2
  49. package/src/network/explorer/etherscan.test.ts +339 -90
  50. package/src/network/explorer/etherscan.ts +32 -6
  51. package/src/network/node/rpc.common.ts +35 -6
  52. package/src/network/node/rpc.test.ts +73 -0
  53. package/src/network/node/types.ts +10 -1
  54. package/src/staking/validators.integ.test.ts +1 -1
  55. package/src/types/etherscan.ts +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"etherscan.d.ts","sourceRoot":"","sources":["../../src/types/etherscan.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,KAAK,CAAC,EA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@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/coin-evm",
3
- "version": "5.3.6",
3
+ "version": "5.3.9",
4
4
  "description": "Ledger EVM Coin integration",
5
5
  "keywords": [
6
6
  "Ledger",
@@ -633,6 +633,73 @@ describe('EVM Family', () => {
633
633
  expect(result).toHaveLength(1)
634
634
  expect(result[0].senders).toEqual([])
635
635
  })
636
+
637
+ // Verbatim payload of the Etherscan V2 txlist entry for this Optimism transaction, which reports the L1
638
+ // fee as `L1FeesPaid` (alongside L1Gas / L1GasPrice / L1FeeScalar) rather than `l1Fee`.
639
+ it('adds L1FeesPaid to fees when the OP-stack explorer includes it', () => {
640
+ const etherscanOp: EtherscanOperation = {
641
+ blockNumber: '112432857',
642
+ timeStamp: '1700464491',
643
+ hash: '0xda5ae7eb3215c9e3d45f22731a432cf2ce93cc9cbcb619c67cfd26a0ec3e295b',
644
+ nonce: '0',
645
+ blockHash: '0xeff1cd92a1ba4bebfbbb5b7e2d23b3c73741e9bca60e0c93f3150ce6804a18f3',
646
+ transactionIndex: '5',
647
+ from: '0x83802741df938c6cd94c46481cadba5b1b0c2f70',
648
+ to: '0x7f5c764cbc14f9669b88837ca1490cca17c31607',
649
+ value: '0',
650
+ gas: '53343',
651
+ gasPrice: '105794858',
652
+ isError: '0',
653
+ txreceipt_status: '1',
654
+ contractAddress: '',
655
+ cumulativeGasUsed: '1803272',
656
+ gasUsed: '53343',
657
+ confirmations: '44469401',
658
+ methodId: '0x095ea7b3',
659
+ functionName: 'approve(address _spender, uint256 _value)',
660
+ L1FeesPaid: '95394812830580',
661
+ }
662
+
663
+ const address = '0x83802741df938c6cd94c46481cadba5b1b0c2f70'
664
+ const result = etherscanOperationToOperations(address, 'optimism', etherscanOp)
665
+
666
+ expect(result).toHaveLength(1)
667
+ // fees = gasUsed * gasPrice + L1FeesPaid
668
+ expect(result[0].tx.fees).toEqual(53343n * 105_794_858n + 95_394_812_830_580n)
669
+ })
670
+
671
+ it('fees are unaffected when L1FeesPaid is absent (non-OP chains)', () => {
672
+ const etherscanOp: EtherscanOperation = {
673
+ blockNumber: '14923692',
674
+ timeStamp: '1654646570',
675
+ hash: '0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338',
676
+ nonce: '7',
677
+ blockHash: '0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282',
678
+ transactionIndex: '27',
679
+ from: '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e',
680
+ to: '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e',
681
+ value: '0',
682
+ gas: '6000000',
683
+ gasPrice: '125521409858',
684
+ isError: '0',
685
+ txreceipt_status: '1',
686
+ contractAddress: '',
687
+ cumulativeGasUsed: '1977481',
688
+ gasUsed: '57168',
689
+ confirmations: '122471',
690
+ methodId: '0x',
691
+ functionName: '',
692
+ // L1FeesPaid absent
693
+ }
694
+
695
+ const result = etherscanOperationToOperations(
696
+ '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e',
697
+ 'ethereum',
698
+ etherscanOp
699
+ )
700
+
701
+ expect(result[0].tx.fees).toEqual(57168n * 125521409858n)
702
+ })
636
703
  })
637
704
 
638
705
  describe('etherscanERC20EventToOperations', () => {
@@ -65,7 +65,9 @@ export const etherscanOperationToOperations = (
65
65
  const from = safeEncodeEIP55(etherscanOp.from)
66
66
  const to = safeEncodeEIP55(etherscanOp.to) || safeEncodeEIP55(etherscanOp.contractAddress)
67
67
  const value = safeBigInt(etherscanOp.value)
68
- const fees = safeBigInt(etherscanOp.gasUsed) * safeBigInt(etherscanOp.gasPrice)
68
+ const fees =
69
+ safeBigInt(etherscanOp.gasUsed) * safeBigInt(etherscanOp.gasPrice) +
70
+ safeBigInt(etherscanOp.L1FeesPaid ?? '0')
69
71
  const failed = etherscanOp.isError === '1'
70
72
  const senders = from ? [from] : []
71
73
  const recipients = to ? [to] : []
@@ -148,7 +148,7 @@ describe('getBlock ERC20 transfers', () => {
148
148
  name: 'zkSync Era',
149
149
  node: {
150
150
  type: 'external',
151
- uri: 'https://mainnet.era.zksync.io',
151
+ uri: 'https://zksync.coin.ledger.com',
152
152
  },
153
153
  explorer: {
154
154
  type: 'none',
@@ -11,7 +11,7 @@ describe('EVM Avalanche C-Chain Fuji', () => {
11
11
  const config: Partial<EvmConfigInfo> = {
12
12
  node: {
13
13
  type: 'external',
14
- uri: 'https://api.avax-test.network/ext/bc/C/rpc',
14
+ uri: 'https://avalanche-fuji-c-chain-rpc.publicnode.com',
15
15
  },
16
16
  explorer: {
17
17
  type: 'etherscan',
@@ -343,7 +343,10 @@ describe.each([
343
343
  createMockEvmConfigInfo({
344
344
  chainId: 10,
345
345
  node: mkExternalNode({ uri: 'https://mainnet.optimism.io' }),
346
- explorer: { type: 'blockscout' as const, uri: 'https://optimism.blockscout.com/api' },
346
+ explorer: {
347
+ type: 'blockscout' as const,
348
+ uri: 'https://proxyblockscout.api.live.ledger.com/10/api',
349
+ },
347
350
  })
348
351
  )
349
352
  const result = await module.getBalance(context, '0x1CDDb825910426644e00e769072Ce1Ea7d4e34BB')
@@ -953,7 +956,7 @@ describe('EVM Api (Moonbeam Network)', () => {
953
956
  const context = createMockEvmContext(
954
957
  createMockEvmConfigInfo({
955
958
  chainId: 1284,
956
- node: mkExternalNode({ uri: 'https://rpc.api.moonbeam.network' }),
959
+ node: mkExternalNode({ uri: 'https://moonbeam.coin.ledger.com' }),
957
960
  explorer: mkEtherscanExplorer({
958
961
  uri: 'https://proxyetherscan.api.live.ledger.com/v2/api/1284',
959
962
  }),
@@ -1003,7 +1006,7 @@ describe('EVM Api (SEI Network)', () => {
1003
1006
  const context = createMockEvmContext(
1004
1007
  createMockEvmConfigInfo({
1005
1008
  chainId: 1329,
1006
- node: mkExternalNode({ uri: 'https://sei-evm-rpc.publicnode.com' }),
1009
+ node: mkExternalNode({ uri: 'https://sei-evm.coin.ledger.com' }),
1007
1010
  explorer: mkEtherscanExplorer({
1008
1011
  uri: 'https://proxyetherscan.api.live.ledger.com/v2/api/1329',
1009
1012
  }),
@@ -1133,7 +1136,7 @@ describe('EVM Api (Zero Gravity)', () => {
1133
1136
  const context = createMockEvmContext(
1134
1137
  createMockEvmConfigInfo({
1135
1138
  chainId: 16661,
1136
- node: mkExternalNode({ uri: 'https://evmrpc.0g.ai' }),
1139
+ node: mkExternalNode({ uri: 'https://zero-gravity.coin.ledger.com' }),
1137
1140
  explorer: {
1138
1141
  type: 'etherscan' as const,
1139
1142
  uri: 'https://chainscan.0g.ai/open/api',
@@ -30,7 +30,7 @@ describe('Linea (etherscan explorer)', () => {
30
30
  name: 'Linea',
31
31
  node: {
32
32
  type: 'external',
33
- uri: 'https://rpc.linea.build',
33
+ uri: 'https://linea.coin.ledger.com',
34
34
  },
35
35
  explorer: {
36
36
  type: 'etherscan',
@@ -9,7 +9,7 @@ describe('EVM Api (Monad Testnet)', () => {
9
9
  let module: ReturnType<typeof createApi>
10
10
 
11
11
  const config: Partial<EvmConfigInfo> = {
12
- node: { type: 'external', uri: 'https://testnet-rpc.monad.xyz' },
12
+ node: { type: 'external', uri: 'https://monad-testnet.coin.ledger.com' },
13
13
  explorer: {
14
14
  type: 'etherscan',
15
15
  uri: 'https://proxyetherscan.api.live.ledger.com/v2/api/10143',
@@ -12,7 +12,7 @@ describe('EVM Optimism Network', () => {
12
12
  const config: Partial<EvmConfigInfo> = {
13
13
  node: {
14
14
  type: 'external',
15
- uri: 'https://mainnet.optimism.io',
15
+ uri: 'https://optimism.coin.ledger.com',
16
16
  },
17
17
  explorer: {
18
18
  type: 'etherscan',
@@ -23,6 +23,19 @@ describe('EVM Optimism Network', () => {
23
23
  module = createApi('optimism')
24
24
  })
25
25
 
26
+ describe('getBlock fee correctness', () => {
27
+ /**
28
+ * Fees must take into account optimism's L1 fee: fee = gasUsed × gasPrice + l1Fee
29
+ */
30
+ it('fee for 0xda5ae7eb… includes l1Fee so it matches on-chain balance arithmetic', async () => {
31
+ const result = await module.getBlock(createMockEvmContext(config), 112432857)
32
+ const fees = result.transactions.find(
33
+ (t) => t.hash === '0xda5ae7eb3215c9e3d45f22731a432cf2ce93cc9cbcb619c67cfd26a0ec3e295b'
34
+ )?.fees
35
+ expect(fees).toEqual(101_038_227_940_874n)
36
+ })
37
+ })
38
+
26
39
  // this test is skipped until a RPC provider supporting trace_block is setup for optimism
27
40
  describe.skip('getBlock', () => {
28
41
  it('returns block with more than 10 transactions for height 144931340', async () => {
@@ -52,6 +65,22 @@ describe('EVM Optimism Network', () => {
52
65
  })
53
66
 
54
67
  describe('listOperations', () => {
68
+ /**
69
+ * Fees must take into account optimism's L1 fee: fee = gasUsed × gasPrice + l1Fee
70
+ */
71
+ it('fee for 0xda5ae7eb… includes l1Fee so it matches on-chain balance arithmetic', async () => {
72
+ const { items } = await module.listOperations(
73
+ createMockEvmContext(config),
74
+ '0x83802741df938c6cd94c46481cadba5b1b0c2f70',
75
+ { minHeight: 112432857, order: 'asc', limit: 5 }
76
+ )
77
+
78
+ const fees = items.find(
79
+ (o) => o.tx.hash === '0xda5ae7eb3215c9e3d45f22731a432cf2ce93cc9cbcb619c67cfd26a0ec3e295b'
80
+ )?.tx.fees
81
+ expect(fees).toEqual(101_038_227_940_874n)
82
+ })
83
+
55
84
  /**
56
85
  * Internal transactions should be returned for accounts that receive ETH via internal transactions (e.g., from
57
86
  * smart contract interactions).
@@ -15,7 +15,7 @@ describe('EVM RSK Network', () => {
15
15
  },
16
16
  explorer: {
17
17
  type: 'blockscout',
18
- uri: 'https://rootstock.blockscout.com/api',
18
+ uri: 'https://proxyblockscout.api.live.ledger.com/30/api',
19
19
  },
20
20
  }
21
21
  beforeAll(() => {
@@ -17,7 +17,7 @@ describe('Shape (external node)', () => {
17
17
  },
18
18
  explorer: {
19
19
  type: 'blockscout',
20
- uri: 'https://shapescan.xyz/api',
20
+ uri: 'https://proxyblockscout.api.live.ledger.com/360/api',
21
21
  },
22
22
  supportedTokens: ['erc721', 'erc1155'],
23
23
  }
@@ -0,0 +1,40 @@
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { EvmConfigInfo } from '../config'
5
+ import { createMockEvmContext } from '../fixtures/context.fixtures'
6
+ import { createApi } from './index'
7
+
8
+ describe('EVM Api (Somnia)', () => {
9
+ let module: ReturnType<typeof createApi>
10
+
11
+ const config: Partial<EvmConfigInfo> = {
12
+ node: { type: 'external', uri: 'https://api.infra.mainnet.somnia.network' },
13
+ explorer: { type: 'blockscout', uri: 'https://explorer.somnia.network/api/' },
14
+ }
15
+
16
+ beforeAll(() => {
17
+ module = createApi('somnia')
18
+ })
19
+
20
+ describe('listOperations', () => {
21
+ it('keeps returning token operations on pages after the first when scanning from genesis', async () => {
22
+ const context = createMockEvmContext(config)
23
+ const address = '0x51d5ea8E6F98A73F823938Ff5731383aa92b0605'
24
+ const options = { minHeight: 0, order: 'asc' as const, limit: 3 }
25
+
26
+ const firstPage = await module.listOperations(context, address, options)
27
+ expect(firstPage.items.length).toBeGreaterThan(0)
28
+ expect(typeof firstPage.next).toBe('string')
29
+
30
+ const secondPage = await module.listOperations(context, address, {
31
+ ...options,
32
+ cursor: firstPage.next,
33
+ })
34
+
35
+ // The regression: without re-querying the token endpoint this page is native-only.
36
+ const erc20Ops = secondPage.items.filter((op) => op.asset.type === 'erc20')
37
+ expect(erc20Ops.length).toBeGreaterThan(0)
38
+ })
39
+ })
40
+ })
@@ -25,8 +25,12 @@ describe('ZkSync (blockscout explorer)', () => {
25
25
  const { items } = await module.listOperations(
26
26
  createMockEvmContext({
27
27
  chainId: 324,
28
- node: mkExternalNode({ uri: 'https://mainnet.era.zksync.io', retries: 0 }),
29
- explorer: { type: 'blockscout', uri: 'https://zksync.blockscout.com/api', retries: 0 },
28
+ node: mkExternalNode({ uri: 'https://zksync.coin.ledger.com', retries: 0 }),
29
+ explorer: {
30
+ type: 'blockscout',
31
+ uri: 'https://proxyblockscout.api.live.ledger.com/324/api',
32
+ retries: 0,
33
+ },
30
34
  }),
31
35
  ADDRESS,
32
36
  { minHeight: 0, order: 'asc', limit: 1 }
@@ -1145,6 +1145,55 @@ describe('getBlock', () => {
1145
1145
  expect(result.transactions[0].fees).toEqual(21000n * 1000000000n)
1146
1146
  })
1147
1147
 
1148
+ it('adds l1Fee to fees when bulk receipt includes l1Fee (OP-stack bulk path)', async () => {
1149
+ setCoinConfig(() => createMockEvmCoinConfig({ chainId: 1, node: mkExternalNode() }))
1150
+ const gasUsed = 21000n
1151
+ const gasPrice = '1000000000'
1152
+ const l1Fee = '95394812830580'
1153
+ const mockGetNodeApi = jest.mocked(getNodeApi)
1154
+ mockGetNodeApi.mockReturnValue(
1155
+ mockNodeApi({
1156
+ getBlockByHeight: jest.fn().mockResolvedValueOnce(
1157
+ makeNodeBlock({
1158
+ transactions: [makeNodeBlockTx({ hash: '0xtx1', gasPrice })],
1159
+ })
1160
+ ),
1161
+ getBlockReceipts: jest.fn().mockResolvedValueOnce([
1162
+ makeNodeBlockReceipt({
1163
+ hash: '0xtx1',
1164
+ gasUsed: gasUsed.toString(),
1165
+ gasPrice,
1166
+ l1Fee,
1167
+ erc20Transfers: [],
1168
+ }),
1169
+ ]),
1170
+ getTransaction: jest.fn(),
1171
+ })
1172
+ )
1173
+ const result = await getBlock(createContext(), 'optimism', 12345)
1174
+ expect(result.transactions[0].fees).toEqual(gasUsed * BigInt(gasPrice) + BigInt(l1Fee))
1175
+ })
1176
+
1177
+ it('adds l1Fee to fees when getTransaction returns l1Fee (OP-stack per-tx fallback path)', async () => {
1178
+ setCoinConfig(() => createMockEvmCoinConfig({ chainId: 1, node: mkExternalNode() }))
1179
+ const gasUsed = '21000'
1180
+ const gasPrice = '1000000000'
1181
+ const l1Fee = '95394812830580'
1182
+ const mockGetNodeApi = jest.mocked(getNodeApi)
1183
+ mockGetNodeApi.mockReturnValue(
1184
+ mockNodeApi({
1185
+ getBlockByHeight: jest
1186
+ .fn()
1187
+ .mockResolvedValueOnce(makeNodeBlock({ transactionHashes: ['0xtx1'] })),
1188
+ getTransaction: jest
1189
+ .fn()
1190
+ .mockResolvedValueOnce(makeNodeTxInfo({ hash: '0xtx1', gasUsed, gasPrice, l1Fee })),
1191
+ })
1192
+ )
1193
+ const result = await getBlock(createContext(), 'optimism', 12345)
1194
+ expect(result.transactions[0].fees).toEqual(BigInt(gasUsed) * BigInt(gasPrice) + BigInt(l1Fee))
1195
+ })
1196
+
1148
1197
  describe('zkSync L1→L2 priority transactions (receipt type 0xff)', () => {
1149
1198
  const USER = '0xbEB30f27e61eFFF46Aa27dcE18E23ee8D5A7c6a4'
1150
1199
  const L2_BASE_TOKEN = '0x000000000000000000000000000000000000800A'
@@ -192,7 +192,7 @@ function prefetchedTransactionToBlockTransaction(
192
192
  // (the node layer provides `0` when the raw `eth_getBlockByNumber(_, true)` payload omits it).
193
193
  const receiptGasPrice = BigInt(receipt.gasPrice)
194
194
  const gasPrice = receiptGasPrice > 0n ? receiptGasPrice : BigInt(tx.gasPrice)
195
- const fees = BigInt(receipt.gasUsed) * gasPrice
195
+ const fees = BigInt(receipt.gasUsed) * gasPrice + (receipt.l1Fee ? BigInt(receipt.l1Fee) : 0n)
196
196
  const operations = rpcTransactionToBlockOperations({
197
197
  from: tx.from,
198
198
  to: tx.to,
@@ -220,7 +220,8 @@ async function getTransactionFromHash(
220
220
  const txInfo = await nodeApi.getTransaction(currencyId, txHash)
221
221
 
222
222
  const failed = txInfo.status === 0
223
- const fees = BigInt(txInfo.gasUsed) * BigInt(txInfo.gasPrice)
223
+ const fees =
224
+ BigInt(txInfo.gasUsed) * BigInt(txInfo.gasPrice) + (txInfo.l1Fee ? BigInt(txInfo.l1Fee) : 0n)
224
225
 
225
226
  const rawOperations = rpcTransactionToBlockOperations(txInfo)
226
227
  const operations = applyChainSpecificCorrections(currencyId, rawOperations, txInfo.type)