@ledgerhq/coin-evm 5.4.0 → 7.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.
Files changed (342) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/docs/evm-family-integration-process/README.md +1 -1
  3. package/knip.json +2 -3
  4. package/lib/adapters/blockOperations.js +6 -6
  5. package/lib/adapters/blockOperations.js.map +1 -1
  6. package/lib/adapters/etherscan.js +23 -23
  7. package/lib/adapters/etherscan.js.map +1 -1
  8. package/lib/adapters/ledger.js +17 -17
  9. package/lib/adapters/ledger.js.map +1 -1
  10. package/lib/api/index.js +4 -4
  11. package/lib/api/index.js.map +1 -1
  12. package/lib/config.d.ts +21 -15
  13. package/lib/config.d.ts.map +1 -1
  14. package/lib/config.js +5 -25
  15. package/lib/config.js.map +1 -1
  16. package/lib/errors.d.ts +9 -0
  17. package/lib/errors.d.ts.map +1 -1
  18. package/lib/errors.js +15 -1
  19. package/lib/errors.js.map +1 -1
  20. package/lib/logic/broadcast.js +1 -1
  21. package/lib/logic/broadcast.js.map +1 -1
  22. package/lib/logic/common.d.ts +2 -1
  23. package/lib/logic/common.d.ts.map +1 -1
  24. package/lib/logic/common.js +4 -4
  25. package/lib/logic/common.js.map +1 -1
  26. package/lib/logic/craftTransaction.d.ts.map +1 -1
  27. package/lib/logic/craftTransaction.js +2 -2
  28. package/lib/logic/craftTransaction.js.map +1 -1
  29. package/lib/logic/estimateFees.d.ts.map +1 -1
  30. package/lib/logic/estimateFees.js +9 -9
  31. package/lib/logic/estimateFees.js.map +1 -1
  32. package/lib/logic/getBalance.d.ts.map +1 -1
  33. package/lib/logic/getBalance.js +50 -16
  34. package/lib/logic/getBalance.js.map +1 -1
  35. package/lib/logic/getBlock.d.ts.map +1 -1
  36. package/lib/logic/getBlock.js +19 -11
  37. package/lib/logic/getBlock.js.map +1 -1
  38. package/lib/logic/getBlockInfo.js +1 -1
  39. package/lib/logic/getBlockInfo.js.map +1 -1
  40. package/lib/logic/getNextSequence.d.ts.map +1 -1
  41. package/lib/logic/getNextSequence.js +1 -1
  42. package/lib/logic/getNextSequence.js.map +1 -1
  43. package/lib/logic/index.d.ts +2 -0
  44. package/lib/logic/index.d.ts.map +1 -1
  45. package/lib/logic/index.js +4 -0
  46. package/lib/logic/index.js.map +1 -1
  47. package/lib/logic/lastBlock.js +1 -1
  48. package/lib/logic/lastBlock.js.map +1 -1
  49. package/lib/logic/listOperations.d.ts.map +1 -1
  50. package/lib/logic/listOperations.js +10 -1
  51. package/lib/logic/listOperations.js.map +1 -1
  52. package/lib/logic/validateIntent.d.ts.map +1 -1
  53. package/lib/logic/validateIntent.js +12 -12
  54. package/lib/logic/validateIntent.js.map +1 -1
  55. package/lib/logic-public/index.d.ts +3 -0
  56. package/lib/logic-public/index.d.ts.map +1 -0
  57. package/lib/logic-public/index.js +19 -0
  58. package/lib/logic-public/index.js.map +1 -0
  59. package/lib/{utils.d.ts → logic-public/utils.d.ts} +0 -44
  60. package/lib/logic-public/utils.d.ts.map +1 -0
  61. package/lib/logic-public/utils.js +166 -0
  62. package/lib/logic-public/utils.js.map +1 -0
  63. package/lib/logic.d.ts +2 -1
  64. package/lib/logic.d.ts.map +1 -1
  65. package/lib/logic.js +3 -3
  66. package/lib/logic.js.map +1 -1
  67. package/lib/network/explorer/etherscan.d.ts +16 -3
  68. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  69. package/lib/network/explorer/etherscan.js +61 -6
  70. package/lib/network/explorer/etherscan.js.map +1 -1
  71. package/lib/network/explorer/ledger.d.ts +50 -4
  72. package/lib/network/explorer/ledger.d.ts.map +1 -1
  73. package/lib/network/explorer/ledger.js +286 -37
  74. package/lib/network/explorer/ledger.js.map +1 -1
  75. package/lib/network/explorer/none.d.ts +1 -0
  76. package/lib/network/explorer/none.d.ts.map +1 -1
  77. package/lib/network/explorer/none.js +4 -1
  78. package/lib/network/explorer/none.js.map +1 -1
  79. package/lib/network/explorer/types.d.ts +15 -2
  80. package/lib/network/explorer/types.d.ts.map +1 -1
  81. package/lib/network/explorer/types.js.map +1 -1
  82. package/lib/network/index.d.ts +5 -0
  83. package/lib/network/index.d.ts.map +1 -0
  84. package/lib/network/index.js +23 -0
  85. package/lib/network/index.js.map +1 -0
  86. package/lib/network/node/explorerProxy.d.ts +27 -0
  87. package/lib/network/node/explorerProxy.d.ts.map +1 -0
  88. package/lib/network/node/explorerProxy.js +262 -0
  89. package/lib/network/node/explorerProxy.js.map +1 -0
  90. package/lib/network/node/index.d.ts +2 -1
  91. package/lib/network/node/index.d.ts.map +1 -1
  92. package/lib/network/node/index.js +11 -10
  93. package/lib/network/node/index.js.map +1 -1
  94. package/lib/network/node/ledger.js +7 -7
  95. package/lib/network/node/ledger.js.map +1 -1
  96. package/lib/network/node/rpc.common.d.ts +2 -2
  97. package/lib/network/node/rpc.common.js +19 -19
  98. package/lib/network/node/rpc.common.js.map +1 -1
  99. package/lib/network/node/withNodeSources.d.ts +21 -0
  100. package/lib/network/node/withNodeSources.d.ts.map +1 -0
  101. package/lib/network/node/withNodeSources.js +78 -0
  102. package/lib/network/node/withNodeSources.js.map +1 -0
  103. package/lib/nodeSources.d.ts +15 -0
  104. package/lib/nodeSources.d.ts.map +1 -0
  105. package/lib/nodeSources.js +33 -0
  106. package/lib/nodeSources.js.map +1 -0
  107. package/lib/staking/contracts.js +1 -1
  108. package/lib/staking/contracts.js.map +1 -1
  109. package/lib/staking/fetchers.js +1 -1
  110. package/lib/staking/fetchers.js.map +1 -1
  111. package/lib/staking/operations/sei.js +1 -1
  112. package/lib/staking/operations/sei.js.map +1 -1
  113. package/lib/staking/prepareIntents.js +3 -3
  114. package/lib/staking/prepareIntents.js.map +1 -1
  115. package/lib/staking/rewards.js +1 -1
  116. package/lib/staking/rewards.js.map +1 -1
  117. package/lib/staking/transactionData.js +2 -2
  118. package/lib/staking/transactionData.js.map +1 -1
  119. package/lib/staking/utils.d.ts +45 -0
  120. package/lib/staking/utils.d.ts.map +1 -0
  121. package/lib/{utils.js → staking/utils.js} +5 -164
  122. package/lib/staking/utils.js.map +1 -0
  123. package/lib/staking/validators/sei.js +1 -1
  124. package/lib/staking/validators/sei.js.map +1 -1
  125. package/lib/types/staking.d.ts +2 -2
  126. package/lib-es/adapters/blockOperations.js +1 -1
  127. package/lib-es/adapters/blockOperations.js.map +1 -1
  128. package/lib-es/adapters/etherscan.js +1 -1
  129. package/lib-es/adapters/etherscan.js.map +1 -1
  130. package/lib-es/adapters/ledger.js +1 -1
  131. package/lib-es/adapters/ledger.js.map +1 -1
  132. package/lib-es/api/index.js +2 -2
  133. package/lib-es/api/index.js.map +1 -1
  134. package/lib-es/config.d.ts +21 -15
  135. package/lib-es/config.d.ts.map +1 -1
  136. package/lib-es/config.js +1 -21
  137. package/lib-es/config.js.map +1 -1
  138. package/lib-es/errors.d.ts +9 -0
  139. package/lib-es/errors.d.ts.map +1 -1
  140. package/lib-es/errors.js +13 -0
  141. package/lib-es/errors.js.map +1 -1
  142. package/lib-es/logic/broadcast.js +1 -1
  143. package/lib-es/logic/broadcast.js.map +1 -1
  144. package/lib-es/logic/common.d.ts +2 -1
  145. package/lib-es/logic/common.d.ts.map +1 -1
  146. package/lib-es/logic/common.js +3 -3
  147. package/lib-es/logic/common.js.map +1 -1
  148. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  149. package/lib-es/logic/craftTransaction.js +2 -2
  150. package/lib-es/logic/craftTransaction.js.map +1 -1
  151. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  152. package/lib-es/logic/estimateFees.js +6 -6
  153. package/lib-es/logic/estimateFees.js.map +1 -1
  154. package/lib-es/logic/getBalance.d.ts.map +1 -1
  155. package/lib-es/logic/getBalance.js +50 -16
  156. package/lib-es/logic/getBalance.js.map +1 -1
  157. package/lib-es/logic/getBlock.d.ts.map +1 -1
  158. package/lib-es/logic/getBlock.js +16 -8
  159. package/lib-es/logic/getBlock.js.map +1 -1
  160. package/lib-es/logic/getBlockInfo.js +1 -1
  161. package/lib-es/logic/getBlockInfo.js.map +1 -1
  162. package/lib-es/logic/getNextSequence.d.ts.map +1 -1
  163. package/lib-es/logic/getNextSequence.js +1 -1
  164. package/lib-es/logic/getNextSequence.js.map +1 -1
  165. package/lib-es/logic/index.d.ts +2 -0
  166. package/lib-es/logic/index.d.ts.map +1 -1
  167. package/lib-es/logic/index.js +4 -0
  168. package/lib-es/logic/index.js.map +1 -1
  169. package/lib-es/logic/lastBlock.js +1 -1
  170. package/lib-es/logic/lastBlock.js.map +1 -1
  171. package/lib-es/logic/listOperations.d.ts.map +1 -1
  172. package/lib-es/logic/listOperations.js +10 -1
  173. package/lib-es/logic/listOperations.js.map +1 -1
  174. package/lib-es/logic/validateIntent.d.ts.map +1 -1
  175. package/lib-es/logic/validateIntent.js +4 -4
  176. package/lib-es/logic/validateIntent.js.map +1 -1
  177. package/lib-es/logic-public/index.d.ts +3 -0
  178. package/lib-es/logic-public/index.d.ts.map +1 -0
  179. package/lib-es/logic-public/index.js +4 -0
  180. package/lib-es/logic-public/index.js.map +1 -0
  181. package/lib-es/{utils.d.ts → logic-public/utils.d.ts} +0 -44
  182. package/lib-es/logic-public/utils.d.ts.map +1 -0
  183. package/lib-es/logic-public/utils.js +150 -0
  184. package/lib-es/logic-public/utils.js.map +1 -0
  185. package/lib-es/logic.d.ts +2 -1
  186. package/lib-es/logic.d.ts.map +1 -1
  187. package/lib-es/logic.js +3 -3
  188. package/lib-es/logic.js.map +1 -1
  189. package/lib-es/network/explorer/etherscan.d.ts +16 -3
  190. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  191. package/lib-es/network/explorer/etherscan.js +60 -5
  192. package/lib-es/network/explorer/etherscan.js.map +1 -1
  193. package/lib-es/network/explorer/ledger.d.ts +50 -4
  194. package/lib-es/network/explorer/ledger.d.ts.map +1 -1
  195. package/lib-es/network/explorer/ledger.js +283 -37
  196. package/lib-es/network/explorer/ledger.js.map +1 -1
  197. package/lib-es/network/explorer/none.d.ts +1 -0
  198. package/lib-es/network/explorer/none.d.ts.map +1 -1
  199. package/lib-es/network/explorer/none.js +2 -0
  200. package/lib-es/network/explorer/none.js.map +1 -1
  201. package/lib-es/network/explorer/types.d.ts +15 -2
  202. package/lib-es/network/explorer/types.d.ts.map +1 -1
  203. package/lib-es/network/explorer/types.js.map +1 -1
  204. package/lib-es/network/index.d.ts +5 -0
  205. package/lib-es/network/index.d.ts.map +1 -0
  206. package/lib-es/network/index.js +7 -0
  207. package/lib-es/network/index.js.map +1 -0
  208. package/lib-es/network/node/explorerProxy.d.ts +27 -0
  209. package/lib-es/network/node/explorerProxy.d.ts.map +1 -0
  210. package/lib-es/network/node/explorerProxy.js +254 -0
  211. package/lib-es/network/node/explorerProxy.js.map +1 -0
  212. package/lib-es/network/node/index.d.ts +2 -1
  213. package/lib-es/network/node/index.d.ts.map +1 -1
  214. package/lib-es/network/node/index.js +11 -10
  215. package/lib-es/network/node/index.js.map +1 -1
  216. package/lib-es/network/node/ledger.js +1 -1
  217. package/lib-es/network/node/ledger.js.map +1 -1
  218. package/lib-es/network/node/rpc.common.d.ts +2 -2
  219. package/lib-es/network/node/rpc.common.js +3 -3
  220. package/lib-es/network/node/rpc.common.js.map +1 -1
  221. package/lib-es/network/node/withNodeSources.d.ts +21 -0
  222. package/lib-es/network/node/withNodeSources.d.ts.map +1 -0
  223. package/lib-es/network/node/withNodeSources.js +74 -0
  224. package/lib-es/network/node/withNodeSources.js.map +1 -0
  225. package/lib-es/nodeSources.d.ts +15 -0
  226. package/lib-es/nodeSources.d.ts.map +1 -0
  227. package/lib-es/nodeSources.js +28 -0
  228. package/lib-es/nodeSources.js.map +1 -0
  229. package/lib-es/staking/contracts.js +1 -1
  230. package/lib-es/staking/contracts.js.map +1 -1
  231. package/lib-es/staking/fetchers.js +1 -1
  232. package/lib-es/staking/fetchers.js.map +1 -1
  233. package/lib-es/staking/operations/sei.js +1 -1
  234. package/lib-es/staking/operations/sei.js.map +1 -1
  235. package/lib-es/staking/prepareIntents.js +1 -1
  236. package/lib-es/staking/prepareIntents.js.map +1 -1
  237. package/lib-es/staking/rewards.js +1 -1
  238. package/lib-es/staking/rewards.js.map +1 -1
  239. package/lib-es/staking/transactionData.js +1 -1
  240. package/lib-es/staking/transactionData.js.map +1 -1
  241. package/lib-es/staking/utils.d.ts +45 -0
  242. package/lib-es/staking/utils.d.ts.map +1 -0
  243. package/lib-es/{utils.js → staking/utils.js} +1 -147
  244. package/lib-es/staking/utils.js.map +1 -0
  245. package/lib-es/staking/validators/sei.js +1 -1
  246. package/lib-es/staking/validators/sei.js.map +1 -1
  247. package/lib-es/types/staking.d.ts +2 -2
  248. package/package.json +72 -7
  249. package/src/adapters/blockOperations.ts +1 -1
  250. package/src/adapters/etherscan.ts +1 -1
  251. package/src/adapters/ledger.ts +1 -1
  252. package/src/api/{index.arc_testnet.integ.test.ts → index.arc.integ.test.ts} +15 -12
  253. package/src/api/index.monad_testnet.integ.test.ts +95 -4
  254. package/src/api/index.ts +2 -2
  255. package/src/config.ts +22 -34
  256. package/src/errors.ts +13 -0
  257. package/src/fixtures/context.fixtures.ts +6 -1
  258. package/src/logic/broadcast.ts +1 -1
  259. package/src/logic/common.ts +4 -2
  260. package/src/logic/craftTransaction.ts +2 -1
  261. package/src/logic/estimateFees.ts +20 -6
  262. package/src/logic/getBalance.ts +72 -26
  263. package/src/logic/getBlock.ts +26 -14
  264. package/src/logic/getBlockInfo.ts +1 -1
  265. package/src/logic/getNextSequence.ts +4 -1
  266. package/src/logic/index.ts +4 -0
  267. package/src/logic/lastBlock.ts +1 -1
  268. package/src/logic/listOperations.ts +14 -1
  269. package/src/logic/tests/broadcast.integ.test.ts +53 -0
  270. package/src/logic/{broadcast.test.ts → tests/broadcast.test.ts} +7 -7
  271. package/src/logic/{broadcastSource.test.ts → tests/broadcastSource.test.ts} +6 -6
  272. package/src/logic/{combine.test.ts → tests/combine.test.ts} +1 -1
  273. package/src/logic/{common.test.ts → tests/common.test.ts} +45 -21
  274. package/src/logic/{computeGasLimit.test.ts → tests/computeGasLimit.test.ts} +2 -2
  275. package/src/logic/{craftTransaction.test.ts → tests/craftTransaction.test.ts} +7 -7
  276. package/src/logic/{craftTransactionData.test.ts → tests/craftTransactionData.test.ts} +4 -4
  277. package/src/logic/{estimateFees.test.ts → tests/estimateFees.test.ts} +12 -12
  278. package/src/logic/tests/getBalance.test.ts +602 -0
  279. package/src/logic/{getBlock.test.ts → tests/getBlock.test.ts} +182 -89
  280. package/src/logic/{getBlockInfo.test.ts → tests/getBlockInfo.test.ts} +8 -8
  281. package/src/logic/{getErc20Data.test.ts → tests/getErc20Data.test.ts} +1 -1
  282. package/src/logic/{getNextSequence.test.ts → tests/getNextSequence.test.ts} +7 -7
  283. package/src/logic/{getStakes.test.ts → tests/getStakes.test.ts} +13 -13
  284. package/src/logic/{internalTransactionsFetcher.test.ts → tests/internalTransactionsFetcher.test.ts} +8 -8
  285. package/src/logic/{lastBlock.test.ts → tests/lastBlock.test.ts} +7 -7
  286. package/src/logic/{listOperations.test.ts → tests/listOperations.test.ts} +125 -6
  287. package/src/logic/{validateAddress.test.ts → tests/validateAddress.test.ts} +1 -1
  288. package/src/logic/{validateIntent.test.ts → tests/validateIntent.test.ts} +80 -78
  289. package/src/logic/validateIntent.ts +7 -4
  290. package/src/logic-public/index.ts +18 -0
  291. package/src/{utils.test.ts → logic-public/tests/utils.test.ts} +1 -27
  292. package/src/logic-public/utils.ts +184 -0
  293. package/src/logic.test.ts +5 -59
  294. package/src/logic.ts +5 -3
  295. package/src/network/explorer/etherscan.test.ts +403 -195
  296. package/src/network/explorer/etherscan.ts +99 -10
  297. package/src/network/explorer/index.test.ts +27 -0
  298. package/src/network/explorer/ledger.test.ts +791 -62
  299. package/src/network/explorer/ledger.ts +426 -54
  300. package/src/network/explorer/none.ts +3 -0
  301. package/src/network/explorer/types.ts +29 -5
  302. package/src/network/index.ts +7 -0
  303. package/src/network/node/explorerProxy.test.ts +673 -0
  304. package/src/network/node/explorerProxy.ts +308 -0
  305. package/src/network/node/index.memoization.test.ts +22 -10
  306. package/src/network/node/index.test.ts +6 -3
  307. package/src/network/node/index.ts +11 -7
  308. package/src/network/node/ledger.ts +1 -1
  309. package/src/network/node/rpc.common.ts +3 -3
  310. package/src/network/node/rpc.test.ts +66 -105
  311. package/src/network/node/withNodeSources.test.ts +240 -0
  312. package/src/network/node/withNodeSources.ts +95 -0
  313. package/src/nodeSources.ts +38 -0
  314. package/src/staking/contracts.ts +1 -1
  315. package/src/staking/encoder.test.ts +1 -1
  316. package/src/staking/fetchers.ts +1 -1
  317. package/src/staking/operations/sei.ts +1 -1
  318. package/src/staking/prepareIntents.ts +1 -1
  319. package/src/staking/redelegations.test.ts +1 -1
  320. package/src/staking/rewards.test.ts +1 -1
  321. package/src/staking/rewards.ts +1 -1
  322. package/src/staking/transactionData.ts +1 -1
  323. package/src/staking/unbondings.test.ts +1 -1
  324. package/src/staking/utils.test.ts +25 -0
  325. package/src/{utils.ts → staking/utils.ts} +2 -182
  326. package/src/staking/validators/sei.ts +1 -1
  327. package/src/types/staking.ts +2 -2
  328. package/lib/constants.d.ts +0 -2
  329. package/lib/constants.d.ts.map +0 -1
  330. package/lib/constants.js +0 -11
  331. package/lib/constants.js.map +0 -1
  332. package/lib/utils.d.ts.map +0 -1
  333. package/lib/utils.js.map +0 -1
  334. package/lib-es/constants.d.ts +0 -2
  335. package/lib-es/constants.d.ts.map +0 -1
  336. package/lib-es/constants.js +0 -7
  337. package/lib-es/constants.js.map +0 -1
  338. package/lib-es/utils.d.ts.map +0 -1
  339. package/lib-es/utils.js.map +0 -1
  340. package/src/constants.ts +0 -9
  341. package/src/logic/broadcast.integ.test.ts +0 -46
  342. package/src/logic/getBalance.test.ts +0 -362
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/coin-evm",
3
- "version": "5.4.0",
3
+ "version": "7.0.0",
4
4
  "description": "Ledger EVM Coin integration",
5
5
  "keywords": [
6
6
  "Ledger",
@@ -28,6 +28,27 @@
28
28
  "lib-es/*": [
29
29
  "lib-es/*"
30
30
  ],
31
+ "abis": [
32
+ "lib/abis/index"
33
+ ],
34
+ "api": [
35
+ "lib/api/index"
36
+ ],
37
+ "logic": [
38
+ "lib/logic/index"
39
+ ],
40
+ "logic-public": [
41
+ "lib/logic-public/index"
42
+ ],
43
+ "network": [
44
+ "lib/network/index"
45
+ ],
46
+ "staking": [
47
+ "lib/staking/index"
48
+ ],
49
+ "types": [
50
+ "lib/types/index"
51
+ ],
31
52
  "*": [
32
53
  "lib/*"
33
54
  ]
@@ -36,10 +57,55 @@
36
57
  "exports": {
37
58
  "./lib/*": "./lib/*.js",
38
59
  "./lib-es/*": "./lib-es/*.js",
39
- "./*": {
40
- "@ledgerhq/source": "./src/*.ts",
41
- "require": "./lib/*.js",
42
- "default": "./lib-es/*.js"
60
+ "./logic-public": {
61
+ "@ledgerhq/source": "./src/logic-public/index.ts",
62
+ "require": "./lib/logic-public/index.js",
63
+ "default": "./lib-es/logic-public/index.js"
64
+ },
65
+ "./abis": {
66
+ "@ledgerhq/source": "./src/abis/index.ts",
67
+ "require": "./lib/abis/index.js",
68
+ "default": "./lib-es/abis/index.js"
69
+ },
70
+ "./api": {
71
+ "@ledgerhq/source": "./src/api/index.ts",
72
+ "require": "./lib/api/index.js",
73
+ "default": "./lib-es/api/index.js"
74
+ },
75
+ "./api/index": {
76
+ "@ledgerhq/source": "./src/api/index.ts",
77
+ "require": "./lib/api/index.js",
78
+ "default": "./lib-es/api/index.js"
79
+ },
80
+ "./config": {
81
+ "@ledgerhq/source": "./src/config.ts",
82
+ "require": "./lib/config.js",
83
+ "default": "./lib-es/config.js"
84
+ },
85
+ "./errors": {
86
+ "@ledgerhq/source": "./src/errors.ts",
87
+ "require": "./lib/errors.js",
88
+ "default": "./lib-es/errors.js"
89
+ },
90
+ "./logic": {
91
+ "@ledgerhq/source": "./src/logic/index.ts",
92
+ "require": "./lib/logic/index.js",
93
+ "default": "./lib-es/logic/index.js"
94
+ },
95
+ "./network": {
96
+ "@ledgerhq/source": "./src/network/index.ts",
97
+ "require": "./lib/network/index.js",
98
+ "default": "./lib-es/network/index.js"
99
+ },
100
+ "./types": {
101
+ "@ledgerhq/source": "./src/types/index.ts",
102
+ "require": "./lib/types/index.js",
103
+ "default": "./lib-es/types/index.js"
104
+ },
105
+ "./staking": {
106
+ "@ledgerhq/source": "./src/staking/index.ts",
107
+ "require": "./lib/staking/index.js",
108
+ "default": "./lib-es/staking/index.js"
43
109
  },
44
110
  "./package.json": "./package.json"
45
111
  },
@@ -51,7 +117,7 @@
51
117
  "eip55": "^2.1.1",
52
118
  "ethers": "6.15.0",
53
119
  "react-native-get-random-values": "^1.8.0",
54
- "@ledgerhq/coin-module-framework": "^9.1.0"
120
+ "@ledgerhq/coin-module-framework": "^9.2.0"
55
121
  },
56
122
  "peerDependencies": {
57
123
  "@ledgerhq/live-network": "^3.0.0",
@@ -76,7 +142,6 @@
76
142
  "prewatch": "pnpm build",
77
143
  "watch": "tsc --watch --project tsconfig.build.json",
78
144
  "watch:es": "tsc --watch --project tsconfig.build.json -m esnext --moduleResolution bundler --outDir lib-es",
79
- "doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
80
145
  "lint": "oxlint src",
81
146
  "lint:fix": "oxfmt src && oxlint src --fix --quiet",
82
147
  "typecheck": "tsc --noEmit --customConditions node",
@@ -8,8 +8,8 @@ import type {
8
8
  BlockOperation,
9
9
  TransferBlockOperation,
10
10
  } from '@ledgerhq/coin-module-framework/api/index'
11
+ import { safeEncodeEIP55 } from '../logic-public'
11
12
  import { isTraceBlockCallAction } from '../network/node/types'
12
- import { safeEncodeEIP55 } from '../utils'
13
13
  import { NON_VALUE_TRANSFER_CALL_TYPES } from './nonValueTransferCallTypes'
14
14
 
15
15
  /**
@@ -16,9 +16,9 @@ import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framewor
16
16
  import BigNumber from 'bignumber.js'
17
17
  import eip55 from 'eip55'
18
18
  import { InvalidExplorerResponse } from '../errors'
19
+ import { buildSmartContractDetails, safeBigInt, safeEncodeEIP55 } from '../logic-public'
19
20
  import { NO_TOKEN } from '../network/explorer/types'
20
21
  import { detectEvmStakingOperationType } from '../staking/detectOperationType'
21
- import { buildSmartContractDetails, safeBigInt, safeEncodeEIP55 } from '../utils'
22
22
  import { NON_VALUE_TRANSFER_CALL_TYPES } from './nonValueTransferCallTypes'
23
23
 
24
24
  /**
@@ -10,8 +10,8 @@ import type {
10
10
  } from '../types'
11
11
  import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
12
12
  import eip55 from 'eip55'
13
+ import { safeBigInt, safeEncodeEIP55 } from '../logic-public'
13
14
  import { detectEvmStakingOperationType } from '../staking/detectOperationType'
14
- import { safeBigInt, safeEncodeEIP55 } from '../utils'
15
15
 
16
16
  /**
17
17
  * Adapter to convert a Ledger Explorer operation
@@ -6,29 +6,32 @@ import type { Operation } from '@ledgerhq/coin-module-framework/api/types'
6
6
  import { createMockEvmContext } from '../fixtures/context.fixtures'
7
7
  import { createApi } from './index'
8
8
 
9
- // Arc testnet exposes its native unit (USDC) as an ERC20 at this fixed precompile
9
+ // Arc exposes its native unit (USDC) as an ERC20 at this fixed precompile
10
10
  // address. The explorer indexes native transfers as BOTH a native tx AND a synthetic
11
11
  // ERC20 Transfer event on this contract. We rely on the `nativeContracts` config
12
12
  // to skip the ERC20 side so the wallet doesn't double-count.
13
13
  const ARC_USDC_NATIVE_CONTRACT = '0x3600000000000000000000000000000000000000'
14
14
 
15
15
  // Address with on-chain native USDC activity in both directions (IN and OUT).
16
- const NATIVE_USDC_ADDRESS = '0x6b618ca7eadcd948266de6602f2f8f3452d1ad6c'
16
+ const NATIVE_USDC_ADDRESS = '0x40ae34b075169df3a738571005be709d9376aa04'
17
17
 
18
- describe('EVM Api (Arc Testnet)', () => {
18
+ describe('EVM Api (Arc)', () => {
19
19
  let module: ReturnType<typeof createApi>
20
20
  let operations: Operation[]
21
21
 
22
22
  const config: Partial<EvmConfigInfo> = {
23
- node: { type: 'external', uri: 'https://rpc.testnet.arc.network' },
23
+ node: {
24
+ type: 'external',
25
+ uri: 'https://arc.coin.ledger.com',
26
+ },
24
27
  explorer: {
25
28
  type: 'blockscout',
26
- uri: 'https://proxyblockscout.api.live.ledger.com/5042002/api',
29
+ uri: 'https://proxyblockscout.api.live.ledger.com/5042/api',
27
30
  },
28
31
  nativeContracts: [ARC_USDC_NATIVE_CONTRACT],
29
32
  }
30
33
  beforeAll(async () => {
31
- module = createApi('arc_testnet')
34
+ module = createApi('arc')
32
35
 
33
36
  const { items } = await module.listOperations(
34
37
  createMockEvmContext(config),
@@ -65,22 +68,22 @@ describe('EVM Api (Arc Testnet)', () => {
65
68
  })
66
69
 
67
70
  it('exposes the expected metadata on a known native USDC IN transfer', () => {
68
- // https://testnet.arcscan.app/tx/0xea849633c4a3ae7e63f53ebe6f2cb1adda76d1547285be754a2ecbef30a343bf
69
- // 20 USDC received from 0xd4c0b7… (18-decimal native units).
70
- const txHash = '0xea849633c4a3ae7e63f53ebe6f2cb1adda76d1547285be754a2ecbef30a343bf'
71
+ // https://arcscan.app/tx/0xb44d663b7ace5ddfecd432834ecaa5cd1221bf26b05566578cf674b977f037ca
72
+ // ~45.31835 USDC received from 0xe7ee2b3a… (18-decimal native units).
73
+ const txHash = '0xb44d663b7ace5ddfecd432834ecaa5cd1221bf26b05566578cf674b977f037ca'
71
74
 
72
75
  const operation = operations.find((op) => op.tx.hash.toLowerCase() === txHash)
73
76
  expect(operation).toMatchObject({
74
77
  type: 'IN',
75
- value: 20000000000000000000n,
78
+ value: 45318350000000000000n,
76
79
  asset: { type: 'native' },
77
80
  tx: expect.objectContaining({
78
81
  hash: txHash,
79
- block: expect.objectContaining({ height: 41845790 }),
82
+ block: expect.objectContaining({ height: 21177512 }),
80
83
  }),
81
84
  })
82
85
  expect(operation!.senders.map((s) => s.toLowerCase())).toEqual([
83
- '0xd4c0b787aa2ff9eb751bb515c877ebbf2daddaae',
86
+ '0xe7ee2b3a199d7afb2df80089138dff0f619153e8',
84
87
  ])
85
88
  expect(operation!.recipients.map((r) => r.toLowerCase())).toEqual([NATIVE_USDC_ADDRESS])
86
89
  })
@@ -1,20 +1,27 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import type { EvmConfigInfo } from '../config'
5
- import { createMockEvmContext } from '../fixtures/context.fixtures'
4
+ import {
5
+ createMockEvmConfigInfo,
6
+ createMockEvmContext,
7
+ testLogger,
8
+ } from '../fixtures/context.fixtures'
9
+ import { getNodeApi } from '../network/node'
10
+ import { nodeSourcesFromList } from '../nodeSources'
6
11
  import { createApi } from './index'
7
12
 
8
13
  describe('EVM Api (Monad Testnet)', () => {
9
14
  let module: ReturnType<typeof createApi>
10
15
 
11
- const config: Partial<EvmConfigInfo> = {
16
+ const config = createMockEvmConfigInfo({
17
+ chainId: 10143,
12
18
  node: { type: 'external', uri: 'https://monad-testnet.coin.ledger.com' },
13
19
  explorer: {
14
20
  type: 'etherscan',
15
21
  uri: 'https://proxyetherscan.api.live.ledger.com/v2/api/10143',
16
22
  },
17
- }
23
+ nodeSources: nodeSourcesFromList(['explorer-proxy', 'node']),
24
+ })
18
25
  beforeAll(() => {
19
26
  module = createApi('monad_testnet')
20
27
  })
@@ -46,4 +53,88 @@ describe('EVM Api (Monad Testnet)', () => {
46
53
  })
47
54
  })
48
55
  })
56
+
57
+ describe('getBlockInfo', () => {
58
+ /**
59
+ * Non-regression: the Monad Testnet RPC node is pruned and does not serve historical
60
+ * blocks. A call to /v1/monad_testnet/block/{height} used to return HTTP 500 with
61
+ * "Block N not found from @ledgerhq/coin-evm getBlockByHeight" for any block that
62
+ * predates the current pruning window.
63
+ *
64
+ * The fix falls back to the Etherscan explorer proxy (`module=proxy&action=eth_getBlockByNumber`)
65
+ * which is backed by an archive node and returns the real block hash.
66
+ *
67
+ * Block 14817811 surfaces via listOperations on 0x981a3e333eac954b4048dc2a2228de41868ea822.
68
+ */
69
+ it('returns a real block hash for a pruned block via explorer fallback', async () => {
70
+ const info = await module.getBlockInfo(createMockEvmContext(config), 14817811)
71
+
72
+ expect(info.height).toBe(14817811)
73
+ // A valid 32-byte block hash — exact value is not pinned because the Monad testnet
74
+ // can be reset, changing the canonical block at this height.
75
+ expect(info.hash).toMatch(/^0x[0-9a-f]{64}$/i)
76
+ expect(info.time).toBeInstanceOf(Date)
77
+ expect(info.time.getTime()).toBeGreaterThan(0)
78
+ })
79
+ })
80
+
81
+ describe('getBlock', () => {
82
+ /**
83
+ * Non-regression: getBlock is the full path backing GET /block/{height}.
84
+ * It calls getBlockByHeight (which may use the explorer proxy fallback) and then
85
+ * fetches transaction receipts via individual getTransaction calls (also wrapped).
86
+ * This test exercises the complete fallback chain on a pruned historical block
87
+ * that has at least one transaction.
88
+ *
89
+ * Block 14817811 is the pruned block surfaced by listOperations on
90
+ * 0x981a3e333eac954b4048dc2a2228de41868ea822 and is known to contain transactions.
91
+ */
92
+ it('returns block data with transactions for a pruned block via explorer fallback', async () => {
93
+ const ctx = createMockEvmContext(config)
94
+ const block = await module.getBlock(ctx, 14817811)
95
+
96
+ expect(block.info.height).toBe(14817811)
97
+ expect(block.info.hash).toMatch(/^0x[0-9a-f]{64}$/i)
98
+ expect(block.info.time).toBeInstanceOf(Date)
99
+ expect(block.info.time.getTime()).toBeGreaterThan(0)
100
+ expect(block.transactions.length).toBeGreaterThan(0)
101
+ })
102
+ })
103
+
104
+ describe('getTransaction', () => {
105
+ /**
106
+ * Non-regression: the Monad Testnet RPC node is pruned and cannot serve receipts for
107
+ * historical transactions. getTransaction used to throw "Transaction or receipt not found"
108
+ * for any tx in a pruned block.
109
+ *
110
+ * The fix falls back to the Etherscan explorer proxy using eth_getTransactionByHash +
111
+ * eth_getTransactionReceipt, both backed by an archive node.
112
+ *
113
+ * We derive a real tx hash from listOperations so the test stays self-contained.
114
+ */
115
+ it('returns transaction data for a tx in a pruned block via explorer fallback', async () => {
116
+ const ctx = createMockEvmContext(config)
117
+
118
+ // Get a tx hash from the known pruned address — any op hash is from a pruned block
119
+ const { items } = await module.listOperations(
120
+ ctx,
121
+ '0x981a3e333eac954b4048dc2a2228de41868ea822',
122
+ {
123
+ minHeight: 0,
124
+ order: 'asc',
125
+ limit: 5,
126
+ }
127
+ )
128
+ expect(items.length).toBeGreaterThan(0)
129
+ const txHash = items[0].tx.hash
130
+
131
+ const api = getNodeApi(config, 'monad_testnet', testLogger)
132
+ const txInfo = await api.getTransaction('monad_testnet', txHash)
133
+
134
+ expect(txInfo.hash).toBe(txHash)
135
+ expect(txInfo.from).toMatch(/^0x[A-Fa-f0-9]{40}$/i)
136
+ expect(txInfo.gasUsed).toMatch(/^\d+$/)
137
+ expect(typeof txInfo.nonce).toBe('number')
138
+ })
139
+ })
49
140
  })
package/src/api/index.ts CHANGED
@@ -23,6 +23,7 @@ import type {
23
23
  Validator,
24
24
  BalanceOptions,
25
25
  } from '@ledgerhq/coin-module-framework/api/index'
26
+ import { isHexString } from '../logic-public'
26
27
  import { craftTransactionData } from '../logic/craftTransactionData'
27
28
  import {
28
29
  broadcast,
@@ -40,7 +41,6 @@ import {
40
41
  import { validateAddress } from '../logic/validateAddress'
41
42
  import { getNodeApi } from '../network/node'
42
43
  import { getValidatorsPage } from '../staking/validators'
43
- import { isHexString } from '../utils'
44
44
 
45
45
  // NOTE Celo still relies on the EVM coin config and injects its own
46
46
  // while creating an unused instance of API
@@ -76,7 +76,7 @@ export function createApi(currencyId: string) {
76
76
  call: async (context: EvmContext, params: CallParams): Promise<string> => {
77
77
  const config = await context.config(currencyId)
78
78
  const callParams = parseCallParams(params)
79
- return getNodeApi(config, currencyId).call(currencyId, callParams)
79
+ return getNodeApi(config, currencyId, context.logger).call(currencyId, callParams)
80
80
  },
81
81
  combine: (
82
82
  _context: EvmContext,
package/src/config.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import type { InternalTxSourceList } from './internalTxSources'
5
+ import type { NodeSourceList } from './nodeSources'
5
6
  import type { Context, CurrencyConfig } from '@ledgerhq/coin-module-framework/config'
6
- import { log } from '@ledgerhq/logs'
7
7
 
8
8
  export type { InternalTxSource, InternalTxSourceList, NonEmptySource } from './internalTxSources'
9
9
  export {
@@ -12,6 +12,9 @@ export {
12
12
  isInternalTxSource,
13
13
  } from './internalTxSources'
14
14
 
15
+ export type { NodeSource, NodeSourceList } from './nodeSources'
16
+ export { DEFAULT_NODE_SOURCES, isNodeSource, nodeSourcesFromList } from './nodeSources'
17
+
15
18
  /**
16
19
  * Block finalization levels supported by EVM JSON-RPC API, used to fetch the latest block.
17
20
  */
@@ -51,6 +54,11 @@ export type EvmConfig = {
51
54
  * so that the underlying `limit + 1` request never exceeds `M`.
52
55
  */
53
56
  maxLimit?: number | undefined
57
+ /**
58
+ * Maximum extra pages `exhaustEndpoint` fetches to drain a boundary block before giving up.
59
+ * Defaults to `DEFAULT_MAX_BOUNDARY_EXHAUSTION_PAGES`.
60
+ */
61
+ maxBoundaryExhaustionPages?: number | undefined
54
62
  uri: string
55
63
  /** Number of retries for explorer API calls. Defaults to 8 if not set. Set to 0 for no retries. */
56
64
  retries?: number
@@ -135,6 +143,19 @@ export type EvmConfig = {
135
143
  * @see https://ledgerhq.atlassian.net/wiki/spaces/CF/pages/7297957892
136
144
  */
137
145
  getBlockInternalTxsSources?: InternalTxSourceList
146
+ /**
147
+ * Ordered list of node sources for read operations (`getBlockByHeight`, `getTransaction`).
148
+ * Sources are tried in order; the first successful result is returned.
149
+ * Built via `nodeSourcesFromList()`.
150
+ *
151
+ * - `'node'` — direct RPC call to the configured node
152
+ * - `'explorer-proxy'` — Etherscan-like explorer proxy (`module=proxy`); requires an
153
+ * Etherscan-like explorer to be configured
154
+ *
155
+ * Defaults to `['node']`. For chains with a pruned RPC node (e.g. monad_testnet),
156
+ * configure `['explorer-proxy', 'node']` to avoid a failed RPC round-trip.
157
+ */
158
+ nodeSources?: NodeSourceList
138
159
  }
139
160
 
140
161
  export type ExternalNodeConfig = Extract<EvmConfig['node'], { type: 'external' }>
@@ -146,40 +167,7 @@ export type EvmCoinConfig = {
146
167
  info: EvmConfigInfo
147
168
  }
148
169
 
149
- export type CoinConfig = (currencyId: string) => EvmCoinConfig
150
-
151
- let coinConfig: CoinConfig | undefined
152
-
153
- export const setCoinConfig = (config: CoinConfig): void => {
154
- coinConfig = config
155
- }
156
-
157
- export const getCoinConfig = (currencyId: string): EvmCoinConfig => {
158
- if (!coinConfig) {
159
- throw new Error('EVM module config not set')
160
- }
161
-
162
- return coinConfig(currencyId)
163
- }
164
-
165
170
  /**
166
171
  * The {@link Context} threaded through the coin-evm public API (ADR-019).
167
- *
168
- * NOTE: The EVM low layers still resolve configuration through the module-level singleton
169
- * (keyed by `currency.id`), so `context` is currently threaded for framework conformance but
170
- * the config it carries mirrors the singleton. `config`/`logger` are provided for completeness
171
- * and for callers that build a context explicitly.
172
172
  */
173
173
  export type EvmContext = Context<EvmConfigInfo>
174
-
175
- /**
176
- * Builds an {@link EvmContext} from the module-level singleton and `@ledgerhq/logs`.
177
- *
178
- * The returned `config` accessor reads from the singleton (`getCoinConfig`), preserving the
179
- * existing `setCoinConfig` side-effect flow used by external consumers of `createApi`.
180
- */
181
- export const createContext = (): EvmContext => ({
182
- config: async (currencyId?: string): Promise<EvmConfigInfo> =>
183
- getCoinConfig(currencyId ?? '').info,
184
- logger: (...args: unknown[]): void => log('coin-evm', args.map(String).join(' ')),
185
- })
package/src/errors.ts CHANGED
@@ -54,6 +54,19 @@ export class RateLimitError extends Error {
54
54
  }
55
55
  }
56
56
 
57
+ /**
58
+ * A single block holds more records than the Ledger explorer will ever serve in one page, and a
59
+ * height-plus-hash cursor has no per-block offset to page through it. Raised instead of silently
60
+ * reporting end of stream, which would be indistinguishable from a genuinely complete history.
61
+ */
62
+ export class UnpageableLedgerExplorerBlock extends Error {
63
+ override name = 'UnpageableLedgerExplorerBlock'
64
+ constructor(message?: string, fields?: Record<string, unknown>) {
65
+ super(message || 'UnpageableLedgerExplorerBlock')
66
+ if (fields) Object.assign(this, fields)
67
+ }
68
+ }
69
+
57
70
  // Node
58
71
  export class UnknownNode extends Error {
59
72
  override name = 'UnknownNode'
@@ -36,10 +36,12 @@ export const mkLedgerNode = (partial?: {
36
36
  export const mkEtherscanExplorer = (partial?: {
37
37
  uri?: string
38
38
  noCache?: boolean
39
+ retries?: number
39
40
  }): EvmConfig['explorer'] => ({
40
41
  type: 'etherscan',
41
42
  uri: partial?.uri ?? 'http://explorer.test',
42
43
  ...(typeof partial?.noCache === 'boolean' && { noCache: partial.noCache }),
44
+ ...(typeof partial?.retries === 'number' && { retries: partial.retries }),
43
45
  })
44
46
 
45
47
  /** Returns a Ledger explorer config for use in tests. */
@@ -75,7 +77,7 @@ export const createMockEvmConfigInfo = (
75
77
  /**
76
78
  * Builds an {@link EvmCoinConfig} for tests.
77
79
  *
78
- * Wraps {@link createMockEvmConfigInfo} in the `{ info }` shape expected by `setCoinConfig`.
80
+ * Wraps {@link createMockEvmConfigInfo} in the `{ info }` shape of {@link EvmCoinConfig}.
79
81
  */
80
82
  export const createMockEvmCoinConfig = (
81
83
  config: Pick<EvmConfigInfo, 'chainId' | 'node'> & Partial<Omit<EvmConfigInfo, 'chainId' | 'node'>>
@@ -100,3 +102,6 @@ export const createMockEvmContext = (config?: Partial<EvmConfigInfo>): EvmContex
100
102
 
101
103
  /** A ready-to-use mock {@link EvmContext} for tests that don't need a custom config. */
102
104
  export const mockEvmContext: EvmContext = createMockEvmContext()
105
+
106
+ /** A real logger for use in tests — emits to the @ledgerhq/logs sink instead of being a no-op. */
107
+ export const testLogger: Logger = log as unknown as Logger
@@ -17,7 +17,7 @@ export async function broadcast(
17
17
  }
18
18
  ): Promise<string> {
19
19
  const config = await context.config(currencyId)
20
- const nodeApi = getNodeApi(config, currencyId)
20
+ const nodeApi = getNodeApi(config, currencyId, context.logger)
21
21
  return await nodeApi.broadcastTransaction(currencyId, signature, broadcastConfig)
22
22
  }
23
23
 
@@ -9,16 +9,17 @@ import type {
9
9
  MemoNotSupported,
10
10
  TransactionIntent,
11
11
  } from '@ledgerhq/coin-module-framework/api/index'
12
+ import type { Logger } from '@ledgerhq/coin-module-framework/config'
12
13
  import {
13
14
  isSendTransactionIntent,
14
15
  isStakingTransactionIntent,
15
16
  } from '@ledgerhq/coin-module-framework/utils'
16
17
  import BigNumber from 'bignumber.js'
17
18
  import { ethers } from 'ethers'
19
+ import { isEthAddress } from '../logic-public'
18
20
  import { getNodeApi } from '../network/node'
19
21
  import { buildStakingTransactionParams, prepareStakingIntent, STAKING_CONTRACTS } from '../staking'
20
22
  import { isNative, TransactionTypes } from '../types'
21
- import { isEthAddress } from '../utils'
22
23
  import { getErc20Data } from './getErc20Data'
23
24
 
24
25
  export function isApiGasOptions(options: unknown): options is ApiGasOptions {
@@ -155,11 +156,12 @@ export async function prepareUnsignedTxParams(
155
156
  config: EvmConfigInfo,
156
157
  currencyId: string,
157
158
  transactionIntent: TransactionIntent<MemoNotSupported, BufferTxData>,
159
+ logger: Logger,
158
160
  customFeesParameters?: FeeEstimation['parameters']
159
161
  ): Promise<TransactionLikeWithPreparedParams> {
160
162
  const { sender, type } = transactionIntent
161
163
  const transactionType = getTransactionType(type)
162
- const node = getNodeApi(config, currencyId)
164
+ const node = getNodeApi(config, currencyId, logger)
163
165
  const isSend = isSendTransactionIntent(transactionIntent)
164
166
 
165
167
  // Prepare staking intents once (can require async on-chain lookups). See: LIVE-32750
@@ -34,6 +34,7 @@ export async function craftTransaction(
34
34
  config,
35
35
  currencyId,
36
36
  transactionIntent,
37
+ context.logger,
37
38
  customFees?.parameters
38
39
  )
39
40
 
@@ -79,7 +80,7 @@ export async function craftTransaction(
79
80
  }
80
81
 
81
82
  if (!hasFeeData) {
82
- const node = getNodeApi(config, currencyId)
83
+ const node = getNodeApi(config, currencyId, context.logger)
83
84
  const feeData = await node.getFeeData(config, currencyId, {
84
85
  type,
85
86
  feesStrategy: customFees?.parameters?.feesStrategy as FeesStrategy | undefined,
@@ -11,15 +11,16 @@ import type {
11
11
  MemoNotSupported,
12
12
  TransactionIntent,
13
13
  } from '@ledgerhq/coin-module-framework/api/index'
14
+ import type { Logger } from '@ledgerhq/coin-module-framework/config'
14
15
  import type { TransactionLike } from 'ethers'
15
16
  import BigNumber from 'bignumber.js'
16
17
  import { Transaction } from 'ethers'
17
18
  import { getAdditionalLayer2Fees } from '../logic'
19
+ import { isEthAddress, isStakingIntent } from '../logic-public'
18
20
  import { getGasTracker } from '../network/gasTracker'
19
21
  import { getNodeApi } from '../network/node'
20
22
  import { STAKING_CONTRACTS } from '../staking'
21
23
  import { TransactionTypes } from '../types'
22
- import { isEthAddress, isStakingIntent } from '../utils'
23
24
  import { getTransactionType, prepareUnsignedTxParams } from './common'
24
25
  import { getNextSequence } from './getNextSequence'
25
26
 
@@ -28,7 +29,8 @@ const SEND_MAX_L1_FEE_BUFFER = new BigNumber(2)
28
29
  async function computeAdditionalFees(
29
30
  config: EvmConfigInfo,
30
31
  currencyId: string,
31
- unsignedTransaction: TransactionLike
32
+ unsignedTransaction: TransactionLike,
33
+ logger: Logger
32
34
  ): Promise<BigNumber | undefined> {
33
35
  // Fake signature is added to get the best approximation possible for the gas on L1
34
36
  const transaction: TransactionLike = {
@@ -44,7 +46,8 @@ async function computeAdditionalFees(
44
46
  return await getAdditionalLayer2Fees(
45
47
  config,
46
48
  currencyId,
47
- Transaction.from(transaction).serialized
49
+ Transaction.from(transaction).serialized,
50
+ logger
48
51
  )
49
52
  } catch {
50
53
  return new BigNumber(0)
@@ -179,7 +182,7 @@ export async function estimateFees(
179
182
  return { finalFeeData: remoteGasOptions[feesStrategy], finalGasOptions: remoteGasOptions }
180
183
  }
181
184
 
182
- const node = getNodeApi(config, currencyId)
185
+ const node = getNodeApi(config, currencyId, context.logger)
183
186
  const feeData = await node.getFeeData(config, currencyId, {
184
187
  type: txType,
185
188
  feesStrategy,
@@ -192,7 +195,13 @@ export async function estimateFees(
192
195
  // all independent network calls and sequencing them triples the latency.
193
196
  const [{ to, data, value, gasLimit }, nonce, { finalFeeData, finalGasOptions }] =
194
197
  await Promise.all([
195
- prepareUnsignedTxParams(config, currencyId, transactionIntent, customFeesParameters),
198
+ prepareUnsignedTxParams(
199
+ config,
200
+ currencyId,
201
+ transactionIntent,
202
+ context.logger,
203
+ customFeesParameters
204
+ ),
196
205
  noncePromise,
197
206
  feeDataPromise,
198
207
  ])
@@ -230,7 +239,12 @@ export async function estimateFees(
230
239
  value,
231
240
  chainId,
232
241
  }
233
- const rawAdditionalFees = await computeAdditionalFees(config, currencyId, unsignedTransaction)
242
+ const rawAdditionalFees = await computeAdditionalFees(
243
+ config,
244
+ currencyId,
245
+ unsignedTransaction,
246
+ context.logger
247
+ )
234
248
  const additionalFees =
235
249
  transactionIntent.useAllAmount && rawAdditionalFees
236
250
  ? rawAdditionalFees.multipliedBy(SEND_MAX_L1_FEE_BUFFER).integerValue(BigNumber.ROUND_CEIL)