@ledgerhq/coin-evm 5.3.1 → 5.3.3

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 (255) hide show
  1. package/.oxlintrc.json +3 -13
  2. package/CHANGELOG.md +13 -0
  3. package/lib/adapters/blockOperations.d.ts +2 -2
  4. package/lib/adapters/blockOperations.d.ts.map +1 -1
  5. package/lib/adapters/blockOperations.js.map +1 -1
  6. package/lib/api/index.d.ts +1 -1
  7. package/lib/api/index.d.ts.map +1 -1
  8. package/lib/config.d.ts +1 -1
  9. package/lib/config.d.ts.map +1 -1
  10. package/lib/logic/combine.d.ts +2 -1
  11. package/lib/logic/combine.d.ts.map +1 -1
  12. package/lib/logic/combine.js.map +1 -1
  13. package/lib/logic/common.d.ts +2 -1
  14. package/lib/logic/common.d.ts.map +1 -1
  15. package/lib/logic/common.js.map +1 -1
  16. package/lib/logic/craftTransaction.d.ts +1 -1
  17. package/lib/logic/craftTransaction.d.ts.map +1 -1
  18. package/lib/logic/craftTransaction.js.map +1 -1
  19. package/lib/logic/craftTransactionData.d.ts +1 -1
  20. package/lib/logic/craftTransactionData.d.ts.map +1 -1
  21. package/lib/logic/estimateFees.d.ts +1 -1
  22. package/lib/logic/estimateFees.d.ts.map +1 -1
  23. package/lib/logic/estimateFees.js.map +1 -1
  24. package/lib/logic/getBalance.d.ts +1 -1
  25. package/lib/logic/getBalance.d.ts.map +1 -1
  26. package/lib/logic/getBalance.js.map +1 -1
  27. package/lib/logic/getBlock.d.ts +1 -1
  28. package/lib/logic/getBlock.d.ts.map +1 -1
  29. package/lib/logic/getBlock.js.map +1 -1
  30. package/lib/logic/getStakes.d.ts +1 -1
  31. package/lib/logic/getStakes.d.ts.map +1 -1
  32. package/lib/logic/internalTransactionsFetcher.d.ts +1 -1
  33. package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
  34. package/lib/logic/internalTransactionsFetcher.js.map +1 -1
  35. package/lib/logic/validateIntent.d.ts +1 -1
  36. package/lib/logic/validateIntent.d.ts.map +1 -1
  37. package/lib/logic/validateIntent.js.map +1 -1
  38. package/lib/logic.d.ts +1 -1
  39. package/lib/logic.d.ts.map +1 -1
  40. package/lib/network/explorer/etherscan.d.ts +4 -4
  41. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  42. package/lib/network/explorer/etherscan.js.map +1 -1
  43. package/lib/network/explorer/index.d.ts +2 -2
  44. package/lib/network/explorer/index.d.ts.map +1 -1
  45. package/lib/network/explorer/index.js.map +1 -1
  46. package/lib/network/explorer/ledger.d.ts +2 -2
  47. package/lib/network/explorer/ledger.d.ts.map +1 -1
  48. package/lib/network/explorer/ledger.js.map +1 -1
  49. package/lib/network/explorer/none.d.ts +1 -1
  50. package/lib/network/explorer/none.d.ts.map +1 -1
  51. package/lib/network/explorer/none.js.map +1 -1
  52. package/lib/network/explorer/types.d.ts +1 -1
  53. package/lib/network/explorer/types.d.ts.map +1 -1
  54. package/lib/network/gasTracker/index.d.ts +2 -2
  55. package/lib/network/gasTracker/index.d.ts.map +1 -1
  56. package/lib/network/gasTracker/index.js.map +1 -1
  57. package/lib/network/gasTracker/ledger.d.ts +3 -3
  58. package/lib/network/gasTracker/ledger.d.ts.map +1 -1
  59. package/lib/network/gasTracker/ledger.js.map +1 -1
  60. package/lib/network/gasTracker/types.d.ts +2 -2
  61. package/lib/network/gasTracker/types.d.ts.map +1 -1
  62. package/lib/network/node/ledger.d.ts +2 -2
  63. package/lib/network/node/ledger.d.ts.map +1 -1
  64. package/lib/network/node/ledger.js.map +1 -1
  65. package/lib/network/node/rpc.common.d.ts +1 -1
  66. package/lib/network/node/rpc.common.d.ts.map +1 -1
  67. package/lib/network/node/rpc.common.js.map +1 -1
  68. package/lib/network/node/types.d.ts +3 -3
  69. package/lib/network/node/types.d.ts.map +1 -1
  70. package/lib/staking/validators/monad.d.ts +2 -1
  71. package/lib/staking/validators/monad.d.ts.map +1 -1
  72. package/lib/staking/validators/monad.js.map +1 -1
  73. package/lib/staking/validators/monadResolver.d.ts +2 -1
  74. package/lib/staking/validators/monadResolver.d.ts.map +1 -1
  75. package/lib/staking/validators/monadResolver.js.map +1 -1
  76. package/lib/staking/validators/somnia.d.ts.map +1 -1
  77. package/lib/staking/validators/somnia.js.map +1 -1
  78. package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
  79. package/lib/staking/validators/zero_gravity.js.map +1 -1
  80. package/lib/types/assets.d.ts +1 -1
  81. package/lib/types/assets.d.ts.map +1 -1
  82. package/lib/types/transaction.d.ts +1 -1
  83. package/lib/types/transaction.d.ts.map +1 -1
  84. package/lib-es/adapters/blockOperations.d.ts +2 -2
  85. package/lib-es/adapters/blockOperations.d.ts.map +1 -1
  86. package/lib-es/adapters/blockOperations.js.map +1 -1
  87. package/lib-es/api/index.d.ts +1 -1
  88. package/lib-es/api/index.d.ts.map +1 -1
  89. package/lib-es/config.d.ts +1 -1
  90. package/lib-es/config.d.ts.map +1 -1
  91. package/lib-es/logic/combine.d.ts +2 -1
  92. package/lib-es/logic/combine.d.ts.map +1 -1
  93. package/lib-es/logic/combine.js.map +1 -1
  94. package/lib-es/logic/common.d.ts +2 -1
  95. package/lib-es/logic/common.d.ts.map +1 -1
  96. package/lib-es/logic/common.js +1 -1
  97. package/lib-es/logic/common.js.map +1 -1
  98. package/lib-es/logic/craftTransaction.d.ts +1 -1
  99. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  100. package/lib-es/logic/craftTransaction.js.map +1 -1
  101. package/lib-es/logic/craftTransactionData.d.ts +1 -1
  102. package/lib-es/logic/craftTransactionData.d.ts.map +1 -1
  103. package/lib-es/logic/estimateFees.d.ts +1 -1
  104. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  105. package/lib-es/logic/estimateFees.js.map +1 -1
  106. package/lib-es/logic/getBalance.d.ts +1 -1
  107. package/lib-es/logic/getBalance.d.ts.map +1 -1
  108. package/lib-es/logic/getBalance.js.map +1 -1
  109. package/lib-es/logic/getBlock.d.ts +1 -1
  110. package/lib-es/logic/getBlock.d.ts.map +1 -1
  111. package/lib-es/logic/getBlock.js.map +1 -1
  112. package/lib-es/logic/getStakes.d.ts +1 -1
  113. package/lib-es/logic/getStakes.d.ts.map +1 -1
  114. package/lib-es/logic/internalTransactionsFetcher.d.ts +1 -1
  115. package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
  116. package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
  117. package/lib-es/logic/validateIntent.d.ts +1 -1
  118. package/lib-es/logic/validateIntent.d.ts.map +1 -1
  119. package/lib-es/logic/validateIntent.js.map +1 -1
  120. package/lib-es/logic.d.ts +1 -1
  121. package/lib-es/logic.d.ts.map +1 -1
  122. package/lib-es/network/explorer/etherscan.d.ts +4 -4
  123. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  124. package/lib-es/network/explorer/etherscan.js.map +1 -1
  125. package/lib-es/network/explorer/index.d.ts +2 -2
  126. package/lib-es/network/explorer/index.d.ts.map +1 -1
  127. package/lib-es/network/explorer/index.js.map +1 -1
  128. package/lib-es/network/explorer/ledger.d.ts +2 -2
  129. package/lib-es/network/explorer/ledger.d.ts.map +1 -1
  130. package/lib-es/network/explorer/ledger.js.map +1 -1
  131. package/lib-es/network/explorer/none.d.ts +1 -1
  132. package/lib-es/network/explorer/none.d.ts.map +1 -1
  133. package/lib-es/network/explorer/none.js.map +1 -1
  134. package/lib-es/network/explorer/types.d.ts +1 -1
  135. package/lib-es/network/explorer/types.d.ts.map +1 -1
  136. package/lib-es/network/gasTracker/index.d.ts +2 -2
  137. package/lib-es/network/gasTracker/index.d.ts.map +1 -1
  138. package/lib-es/network/gasTracker/index.js.map +1 -1
  139. package/lib-es/network/gasTracker/ledger.d.ts +3 -3
  140. package/lib-es/network/gasTracker/ledger.d.ts.map +1 -1
  141. package/lib-es/network/gasTracker/ledger.js +1 -1
  142. package/lib-es/network/gasTracker/ledger.js.map +1 -1
  143. package/lib-es/network/gasTracker/types.d.ts +2 -2
  144. package/lib-es/network/gasTracker/types.d.ts.map +1 -1
  145. package/lib-es/network/node/ledger.d.ts +2 -2
  146. package/lib-es/network/node/ledger.d.ts.map +1 -1
  147. package/lib-es/network/node/ledger.js.map +1 -1
  148. package/lib-es/network/node/rpc.common.d.ts +1 -1
  149. package/lib-es/network/node/rpc.common.d.ts.map +1 -1
  150. package/lib-es/network/node/rpc.common.js +1 -1
  151. package/lib-es/network/node/rpc.common.js.map +1 -1
  152. package/lib-es/network/node/types.d.ts +3 -3
  153. package/lib-es/network/node/types.d.ts.map +1 -1
  154. package/lib-es/staking/validators/monad.d.ts +2 -1
  155. package/lib-es/staking/validators/monad.d.ts.map +1 -1
  156. package/lib-es/staking/validators/monad.js.map +1 -1
  157. package/lib-es/staking/validators/monadResolver.d.ts +2 -1
  158. package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
  159. package/lib-es/staking/validators/monadResolver.js.map +1 -1
  160. package/lib-es/staking/validators/somnia.d.ts.map +1 -1
  161. package/lib-es/staking/validators/somnia.js.map +1 -1
  162. package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
  163. package/lib-es/staking/validators/zero_gravity.js.map +1 -1
  164. package/lib-es/types/assets.d.ts +1 -1
  165. package/lib-es/types/assets.d.ts.map +1 -1
  166. package/lib-es/types/transaction.d.ts +1 -1
  167. package/lib-es/types/transaction.d.ts.map +1 -1
  168. package/package.json +2 -2
  169. package/src/adapters/blockOperations.test.ts +29 -31
  170. package/src/adapters/blockOperations.ts +3 -2
  171. package/src/adapters/etherscan.test.ts +7 -7
  172. package/src/adapters/ledger.test.ts +2 -2
  173. package/src/api/getBlock.integ.test.ts +1 -1
  174. package/src/api/index.fantom.integ.test.ts +1 -1
  175. package/src/api/index.flare.integ.test.ts +2 -14
  176. package/src/api/index.integ.test.ts +330 -246
  177. package/src/api/index.linea.integ.test.ts +1 -1
  178. package/src/api/index.optimism.integ.test.ts +1 -1
  179. package/src/api/index.shape.integ.test.ts +1 -1
  180. package/src/api/index.ts +1 -1
  181. package/src/config.ts +1 -1
  182. package/src/fixtures/context.fixtures.ts +79 -1
  183. package/src/fixtures/ethers.fixtures.ts +26 -0
  184. package/src/fixtures/ledger.fixtures.ts +1 -1
  185. package/src/internalTxSources.test.ts +3 -6
  186. package/src/logic/broadcast.integ.test.ts +6 -18
  187. package/src/logic/broadcast.test.ts +19 -31
  188. package/src/logic/broadcastSource.test.ts +6 -7
  189. package/src/logic/combine.test.ts +2 -2
  190. package/src/logic/combine.ts +2 -1
  191. package/src/logic/common.test.ts +120 -112
  192. package/src/logic/common.ts +2 -7
  193. package/src/logic/craftTransaction.test.ts +163 -200
  194. package/src/logic/craftTransaction.ts +3 -2
  195. package/src/logic/craftTransactionData.test.ts +6 -6
  196. package/src/logic/craftTransactionData.ts +1 -1
  197. package/src/logic/estimateFees.test.ts +19 -15
  198. package/src/logic/estimateFees.ts +6 -3
  199. package/src/logic/getBalance.test.ts +16 -15
  200. package/src/logic/getBalance.ts +4 -3
  201. package/src/logic/getBlock.test.ts +379 -388
  202. package/src/logic/getBlock.ts +3 -2
  203. package/src/logic/getBlockInfo.test.ts +7 -9
  204. package/src/logic/getNextSequence.test.ts +5 -5
  205. package/src/logic/getStakes.test.ts +35 -35
  206. package/src/logic/getStakes.ts +1 -1
  207. package/src/logic/internalTransactionsFetcher.test.ts +26 -24
  208. package/src/logic/internalTransactionsFetcher.ts +1 -1
  209. package/src/logic/lastBlock.test.ts +29 -20
  210. package/src/logic/listOperations.test.ts +44 -40
  211. package/src/logic/validateIntent.test.ts +152 -101
  212. package/src/logic/validateIntent.ts +4 -2
  213. package/src/logic.test.ts +13 -18
  214. package/src/logic.ts +1 -1
  215. package/src/network/explorer/etherscan.test.ts +6 -6
  216. package/src/network/explorer/etherscan.ts +12 -10
  217. package/src/network/explorer/index.test.ts +52 -22
  218. package/src/network/explorer/index.ts +2 -2
  219. package/src/network/explorer/ledger.test.ts +17 -5
  220. package/src/network/explorer/ledger.ts +3 -2
  221. package/src/network/explorer/none.ts +2 -1
  222. package/src/network/explorer/types.ts +1 -1
  223. package/src/network/gasTracker/index.test.ts +14 -8
  224. package/src/network/gasTracker/index.ts +2 -2
  225. package/src/network/gasTracker/ledger.test.ts +34 -29
  226. package/src/network/gasTracker/ledger.ts +5 -7
  227. package/src/network/gasTracker/types.ts +2 -2
  228. package/src/network/node/index.memoization.test.ts +25 -31
  229. package/src/network/node/index.test.ts +14 -25
  230. package/src/network/node/ledger.test.ts +45 -60
  231. package/src/network/node/ledger.ts +6 -5
  232. package/src/network/node/node.fixtures.ts +0 -2
  233. package/src/network/node/rpc.common.ts +14 -14
  234. package/src/network/node/rpc.test.ts +153 -184
  235. package/src/network/node/types.ts +3 -3
  236. package/src/staking/detectOperationType.test.ts +1 -1
  237. package/src/staking/encoder.test.ts +14 -22
  238. package/src/staking/logic.test.ts +20 -14
  239. package/src/staking/operations/index.test.ts +29 -29
  240. package/src/staking/prepareIntents.test.ts +26 -20
  241. package/src/staking/redelegations.test.ts +50 -33
  242. package/src/staking/rewards.test.ts +29 -17
  243. package/src/staking/rewardsFromReceipt.test.ts +20 -21
  244. package/src/staking/transactionData.test.ts +23 -23
  245. package/src/staking/validators/monad.test.ts +65 -24
  246. package/src/staking/validators/monad.ts +2 -1
  247. package/src/staking/validators/monadResolver.ts +2 -1
  248. package/src/staking/validators/somnia.test.ts +21 -13
  249. package/src/staking/validators/somnia.ts +2 -1
  250. package/src/staking/validators/zero_gravity.test.ts +118 -48
  251. package/src/staking/validators/zero_gravity.ts +2 -1
  252. package/src/staking/validators.integ.test.ts +13 -25
  253. package/src/staking/validators.test.ts +7 -2
  254. package/src/types/assets.ts +1 -1
  255. package/src/types/transaction.ts +1 -1
@@ -1,13 +1,13 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { AssertionError, fail } from 'assert'
5
4
  import { delay } from '@ledgerhq/coin-module-framework/promises'
6
5
  import axios from 'axios'
7
6
  import BigNumber from 'bignumber.js'
8
7
  import { Transaction } from 'ethers'
9
8
  import { DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
10
9
  import { GasEstimationError } from '../../errors'
10
+ import { createMockEvmConfigInfo } from '../../fixtures/context.fixtures'
11
11
  import { getGasOptions } from '../gasTracker/ledger'
12
12
  import { createLedgerNodeApi } from './ledger'
13
13
 
@@ -19,9 +19,9 @@ jest.mock('../gasTracker/ledger', () => ({
19
19
  getGasOptions: jest.fn(),
20
20
  }))
21
21
 
22
- const mockGetGasOptions = getGasOptions as jest.Mock
22
+ const mockGetGasOptions = jest.mocked(getGasOptions)
23
23
 
24
- ;(delay as jest.Mock).mockImplementation(
24
+ jest.mocked(delay).mockImplementation(
25
25
  () => new Promise((resolve) => setTimeout(resolve, 1)) // mocking the delay supposed to happen after each try
26
26
  )
27
27
 
@@ -149,15 +149,7 @@ describe('EVM Family', () => {
149
149
  }
150
150
  return { data: {} }
151
151
  })
152
- try {
153
- await api.getTransaction(currencyId, '0xHash')
154
- fail('Promise should have been rejected')
155
- } catch (e) {
156
- if (e instanceof AssertionError) {
157
- throw e
158
- }
159
- expect(e).toBeInstanceOf(SpyError)
160
- }
152
+ await expect(api.getTransaction(currencyId, '0xHash')).rejects.toBeInstanceOf(SpyError)
161
153
  })
162
154
  })
163
155
 
@@ -290,15 +282,9 @@ describe('EVM Family', () => {
290
282
  throw new Error()
291
283
  })
292
284
 
293
- try {
294
- await api.getGasEstimation(currencyId, address, {} as any)
295
- fail('Promise should have been rejected')
296
- } catch (e) {
297
- if (e instanceof AssertionError) {
298
- throw e
299
- }
300
- expect(e).toBeInstanceOf(GasEstimationError)
301
- }
285
+ await expect(
286
+ api.getGasEstimation(currencyId, address, { amount: new BigNumber(0), recipient: '0x0' })
287
+ ).rejects.toBeInstanceOf(GasEstimationError)
302
288
  })
303
289
 
304
290
  it('should throw GasEstimationError if request throws ECONNABORTED', async () => {
@@ -307,34 +293,17 @@ describe('EVM Family', () => {
307
293
  .spyOn(axios, 'request')
308
294
  .mockImplementation(() => Promise.reject({ code: 'ECONNABORTED' }))
309
295
 
310
- try {
311
- await api.getGasEstimation(currencyId, address, {} as any)
312
- fail('Promise should have been rejected')
313
- } catch (e) {
314
- if (e instanceof AssertionError) {
315
- throw e
316
- }
317
- expect(e).toBeInstanceOf(GasEstimationError)
318
- }
296
+ await expect(
297
+ api.getGasEstimation(currencyId, address, { amount: new BigNumber(0), recipient: '0x0' })
298
+ ).rejects.toBeInstanceOf(GasEstimationError)
319
299
  })
320
300
 
321
301
  it('should return the expected payload', async () => {
322
302
  const api = createLedgerNodeApi(ledgerConfig)
323
- jest.spyOn(axios, 'request').mockImplementation(async ({ data: transaction }) => {
324
- return (transaction as any)?.data?.length > 2
325
- ? {
326
- data: {
327
- to: '0xBob',
328
- estimated_gas_limit: '1000000',
329
- },
330
- }
331
- : {
332
- data: {
333
- to: '0xBob',
334
- estimated_gas_limit: '789',
335
- },
336
- }
337
- })
303
+ jest
304
+ .spyOn(axios, 'request')
305
+ .mockResolvedValueOnce({ data: { to: '0xBob', estimated_gas_limit: '789' } })
306
+ .mockResolvedValueOnce({ data: { to: '0xBob', estimated_gas_limit: '1000000' } })
338
307
 
339
308
  const transaction = {
340
309
  family: 'evm',
@@ -385,18 +354,30 @@ describe('EVM Family', () => {
385
354
  },
386
355
  }))
387
356
 
388
- const slowFeeData = await api.getFeeData({} as any, currencyId, {
389
- type: 2,
390
- feesStrategy: 'slow',
391
- } as any)
392
- const mediumFeeData = await api.getFeeData({} as any, currencyId, {
393
- type: 2,
394
- feesStrategy: 'medium',
395
- } as any)
396
- const fastFeeData = await api.getFeeData({} as any, currencyId, {
397
- type: 2,
398
- feesStrategy: 'fast',
399
- })
357
+ const slowFeeData = await api.getFeeData(
358
+ createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
359
+ currencyId,
360
+ {
361
+ type: 2,
362
+ feesStrategy: 'slow',
363
+ }
364
+ )
365
+ const mediumFeeData = await api.getFeeData(
366
+ createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
367
+ currencyId,
368
+ {
369
+ type: 2,
370
+ feesStrategy: 'medium',
371
+ }
372
+ )
373
+ const fastFeeData = await api.getFeeData(
374
+ createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
375
+ currencyId,
376
+ {
377
+ type: 2,
378
+ feesStrategy: 'fast',
379
+ }
380
+ )
400
381
 
401
382
  expect(slowFeeData).toEqual({
402
383
  maxFeePerGas: new BigNumber(1),
@@ -441,7 +422,11 @@ describe('EVM Family', () => {
441
422
  },
442
423
  }))
443
424
 
444
- const feeData = await api.getFeeData({} as any, currencyId, { type: 2 } as any)
425
+ const feeData = await api.getFeeData(
426
+ createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
427
+ currencyId,
428
+ { type: 2 }
429
+ )
445
430
 
446
431
  expect(feeData).toEqual({
447
432
  maxFeePerGas: new BigNumber(5),
@@ -579,7 +564,7 @@ describe('EVM Family', () => {
579
564
  describe('getOptimismAdditionalFees', () => {
580
565
  it('should return 0 for an incompatible currency', async () => {
581
566
  const api = createLedgerNodeApi(ledgerConfig)
582
- expect(await api.getOptimismAdditionalFees(currencyId, {} as any)).toEqual(new BigNumber(0))
567
+ expect(await api.getOptimismAdditionalFees(currencyId, '')).toEqual(new BigNumber(0))
583
568
  })
584
569
 
585
570
  it('should return the expected payload', async () => {
@@ -659,7 +644,7 @@ describe('EVM Family', () => {
659
644
  describe('getScrollAdditionalFees', () => {
660
645
  it('should return 0 for an incompatible currency', async () => {
661
646
  const api = createLedgerNodeApi(ledgerConfig)
662
- expect(await api.getScrollAdditionalFees(currencyId, {} as any)).toEqual(new BigNumber(0))
647
+ expect(await api.getScrollAdditionalFees(currencyId, '')).toEqual(new BigNumber(0))
663
648
  })
664
649
 
665
650
  it('should return the expected payload', async () => {
@@ -1,21 +1,22 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import type { BlockFinalizationTag, LedgerNodeConfig } from '../../config'
5
+ import type { LedgerExplorerOperation } from '../../types'
6
+ import type { BlockByHeightResult, EvmCallParams, NodeApi, TransactionInfo } from './types'
7
+ import type { Batcher } from '@ledgerhq/live-network/batcher/types'
8
+ import type { AxiosRequestConfig } from 'axios'
4
9
  import { makeBatcher } from '@ledgerhq/live-network/batcher/index'
5
- import { Batcher } from '@ledgerhq/live-network/batcher/types'
6
10
  import { log } from '@ledgerhq/logs'
7
- import axios, { AxiosRequestConfig } from 'axios'
11
+ import axios from 'axios'
8
12
  import BigNumber from 'bignumber.js'
9
13
  import { ethers } from 'ethers'
10
14
  import ERC20Abi from '../../abis/erc20.abi.json'
11
15
  import OptimismGasPriceOracleAbi from '../../abis/optimismGasPriceOracle.abi.json'
12
- import { BlockFinalizationTag, LedgerNodeConfig } from '../../config'
13
16
  import { GasEstimationError } from '../../errors'
14
- import { LedgerExplorerOperation } from '../../types'
15
17
  import { normalizeAddress, padHexString, safeEncodeEIP55 } from '../../utils'
16
18
  import { getGasOptions } from '../gasTracker/ledger'
17
19
  import { withRetries } from '../withRetries'
18
- import { BlockByHeightResult, EvmCallParams, NodeApi, TransactionInfo } from './types'
19
20
 
20
21
  const LEDGER_TIMEOUT = 10_000 // 10s for network call timeout
21
22
  const LEDGER_TIME_BETWEEN_TRIES = 200 // 200ms between 2 calls
@@ -15,8 +15,6 @@ export function mockNodeApi(overrides: Partial<jest.Mocked<NodeApi>> = {}): jest
15
15
  broadcastTransaction: jest.fn(),
16
16
  getBlockByHeight: jest.fn(),
17
17
  getBlockReceipts: jest.fn(),
18
- traceBlockErigon: jest.fn(),
19
- traceBlockGeth: jest.fn(),
20
18
  getOptimismAdditionalFees: jest.fn(),
21
19
  getScrollAdditionalFees: jest.fn(),
22
20
  ...overrides,
@@ -2,6 +2,19 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import type { BlockFinalizationTag, EvmConfigInfo, ExternalNodeConfig } from '../../config'
5
+ import type { FeeHistory, FeeData } from '../../types'
6
+ import type {
7
+ NodeApi,
8
+ ERC20Transfer,
9
+ PrefetchedBlockTransaction,
10
+ LogWithAddress,
11
+ TransactionReceipt,
12
+ TraceBlockItem,
13
+ TransactionInfo,
14
+ BlockByHeightResult,
15
+ BlockReceiptInfo,
16
+ EvmCallParams,
17
+ } from './types'
5
18
  /** ⚠️ keep this order of import. @see https://docs.ethers.io/v5/cookbook/react-native/#cookbook-reactnative ⚠️ */
6
19
  import { makeLRUCache } from '@ledgerhq/live-network/cache'
7
20
  import { log } from '@ledgerhq/logs'
@@ -11,7 +24,6 @@ import ERC20Abi from '../../abis/erc20.abi.json'
11
24
  import OptimismGasPriceOracleAbi from '../../abis/optimismGasPriceOracle.abi.json'
12
25
  import ScrollGasPriceOracleAbi from '../../abis/scrollGasPriceOracle.abi.json'
13
26
  import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '../../errors'
14
- import { FeeHistory, FeeData } from '../../types'
15
27
  import { isSmartContractInput, safeEncodeEIP55, normalizeAddress } from '../../utils'
16
28
  import { withRetries } from '../withRetries'
17
29
  import { gethCallTracerToTraceBlockItems } from './gethCallTracerToTraceBlockItems'
@@ -21,19 +33,7 @@ import {
21
33
  isUnsupportedRpcMethodErrorMsg,
22
34
  isUnsupportedRpcMethodError,
23
35
  } from './rpc.errors'
24
- import {
25
- NodeApi,
26
- ERC20Transfer,
27
- PrefetchedBlockTransaction,
28
- LogWithAddress,
29
- TransactionReceipt,
30
- TraceBlockItem,
31
- isTraceBlockItem,
32
- TransactionInfo,
33
- BlockByHeightResult,
34
- BlockReceiptInfo,
35
- EvmCallParams,
36
- } from './types'
36
+ import { isTraceBlockItem } from './types'
37
37
 
38
38
  /**
39
39
  * ERC20 Transfer event topic: keccak256("Transfer(address,address,uint256)")