@ledgerhq/coin-evm 10.0.0 → 15.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 (505) hide show
  1. package/.oxlintrc.json +2 -6
  2. package/CHANGELOG.md +54 -0
  3. package/docs/getBlock-internal-txs-schema.md +2 -2
  4. package/docs/network/node/index.md +1 -1
  5. package/lib/abis/index.d.ts +8 -0
  6. package/lib/abis/index.d.ts.map +1 -1
  7. package/lib/abis/index.js +30 -0
  8. package/lib/abis/index.js.map +1 -1
  9. package/lib/adapters/blockOperations.js +2 -2
  10. package/lib/adapters/blockOperations.js.map +1 -1
  11. package/lib/adapters/etherscan.d.ts +2 -1
  12. package/lib/adapters/etherscan.d.ts.map +1 -1
  13. package/lib/adapters/etherscan.js +2 -2
  14. package/lib/adapters/etherscan.js.map +1 -1
  15. package/lib/adapters/ledger.d.ts +2 -1
  16. package/lib/adapters/ledger.d.ts.map +1 -1
  17. package/lib/adapters/ledger.js +2 -2
  18. package/lib/adapters/ledger.js.map +1 -1
  19. package/lib/api/index.d.ts.map +1 -1
  20. package/lib/api/index.js +3 -2
  21. package/lib/api/index.js.map +1 -1
  22. package/lib/chains.d.ts +94 -0
  23. package/lib/chains.d.ts.map +1 -0
  24. package/lib/chains.js +98 -0
  25. package/lib/chains.js.map +1 -0
  26. package/lib/config.d.ts +4 -1
  27. package/lib/config.d.ts.map +1 -1
  28. package/lib/config.js +3 -1
  29. package/lib/config.js.map +1 -1
  30. package/lib/internalTxSources.d.ts.map +1 -1
  31. package/lib/internalTxSources.js +21 -3
  32. package/lib/internalTxSources.js.map +1 -1
  33. package/lib/logic/broadcast.js +2 -2
  34. package/lib/logic/broadcast.js.map +1 -1
  35. package/lib/logic/common.d.ts +1 -1
  36. package/lib/logic/common.d.ts.map +1 -1
  37. package/lib/logic/common.js +22 -14
  38. package/lib/logic/common.js.map +1 -1
  39. package/lib/logic/craftTransaction.d.ts.map +1 -1
  40. package/lib/logic/craftTransaction.js +7 -4
  41. package/lib/logic/craftTransaction.js.map +1 -1
  42. package/lib/logic/estimateFees.d.ts.map +1 -1
  43. package/lib/logic/estimateFees.js +11 -8
  44. package/lib/logic/estimateFees.js.map +1 -1
  45. package/lib/logic/getBalance.d.ts.map +1 -1
  46. package/lib/logic/getBalance.js +9 -9
  47. package/lib/logic/getBalance.js.map +1 -1
  48. package/lib/logic/getBlock.d.ts.map +1 -1
  49. package/lib/logic/getBlock.js +17 -17
  50. package/lib/logic/getBlock.js.map +1 -1
  51. package/lib/logic/getBlockInfo.js +2 -2
  52. package/lib/logic/getBlockInfo.js.map +1 -1
  53. package/lib/logic/getNextSequence.d.ts.map +1 -1
  54. package/lib/logic/getNextSequence.js +1 -1
  55. package/lib/logic/getNextSequence.js.map +1 -1
  56. package/lib/logic/getStakes.d.ts.map +1 -1
  57. package/lib/logic/getStakes.js +10 -10
  58. package/lib/logic/getStakes.js.map +1 -1
  59. package/lib/logic/internalTransactionsFetcher.d.ts +2 -2
  60. package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
  61. package/lib/logic/internalTransactionsFetcher.js +9 -9
  62. package/lib/logic/internalTransactionsFetcher.js.map +1 -1
  63. package/lib/logic/lastBlock.js +2 -2
  64. package/lib/logic/lastBlock.js.map +1 -1
  65. package/lib/logic/listOperations.d.ts.map +1 -1
  66. package/lib/logic/listOperations.js +1 -1
  67. package/lib/logic/listOperations.js.map +1 -1
  68. package/lib/logic/predicates.d.ts +17 -0
  69. package/lib/logic/predicates.d.ts.map +1 -0
  70. package/lib/logic/predicates.js +126 -0
  71. package/lib/logic/predicates.js.map +1 -0
  72. package/lib/logic/validateIntent.d.ts.map +1 -1
  73. package/lib/logic/validateIntent.js +9 -9
  74. package/lib/logic/validateIntent.js.map +1 -1
  75. package/lib/logic.d.ts +1 -1
  76. package/lib/logic.d.ts.map +1 -1
  77. package/lib/logic.js +14 -13
  78. package/lib/logic.js.map +1 -1
  79. package/lib/network/explorer/etherscan.d.ts +2 -3
  80. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  81. package/lib/network/explorer/etherscan.js +6 -8
  82. package/lib/network/explorer/etherscan.js.map +1 -1
  83. package/lib/network/explorer/ledger.d.ts.map +1 -1
  84. package/lib/network/explorer/ledger.js +5 -5
  85. package/lib/network/explorer/ledger.js.map +1 -1
  86. package/lib/network/explorer/types.d.ts +2 -2
  87. package/lib/network/explorer/types.d.ts.map +1 -1
  88. package/lib/network/explorer/types.js +11 -1
  89. package/lib/network/explorer/types.js.map +1 -1
  90. package/lib/network/gasTracker/ledger.d.ts.map +1 -1
  91. package/lib/network/gasTracker/ledger.js +1 -3
  92. package/lib/network/gasTracker/ledger.js.map +1 -1
  93. package/lib/network/node/explorerProxy.d.ts.map +1 -1
  94. package/lib/network/node/explorerProxy.js +22 -17
  95. package/lib/network/node/explorerProxy.js.map +1 -1
  96. package/lib/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
  97. package/lib/network/node/gethCallTracerToTraceBlockItems.js +10 -12
  98. package/lib/network/node/gethCallTracerToTraceBlockItems.js.map +1 -1
  99. package/lib/network/node/index.d.ts +1 -1
  100. package/lib/network/node/index.d.ts.map +1 -1
  101. package/lib/network/node/index.js +7 -7
  102. package/lib/network/node/index.js.map +1 -1
  103. package/lib/network/node/ledger.d.ts +3 -1
  104. package/lib/network/node/ledger.d.ts.map +1 -1
  105. package/lib/network/node/ledger.js +38 -24
  106. package/lib/network/node/ledger.js.map +1 -1
  107. package/lib/network/node/rpc.common.d.ts +1 -1
  108. package/lib/network/node/rpc.common.d.ts.map +1 -1
  109. package/lib/network/node/rpc.common.js +104 -103
  110. package/lib/network/node/rpc.common.js.map +1 -1
  111. package/lib/network/node/types.d.ts +21 -22
  112. package/lib/network/node/types.d.ts.map +1 -1
  113. package/lib/network/node/types.js +0 -27
  114. package/lib/network/node/types.js.map +1 -1
  115. package/lib/network/node/withNodeSources.d.ts.map +1 -1
  116. package/lib/network/node/withNodeSources.js +15 -15
  117. package/lib/network/node/withNodeSources.js.map +1 -1
  118. package/lib/nodeSources.d.ts.map +1 -1
  119. package/lib/nodeSources.js +11 -3
  120. package/lib/nodeSources.js.map +1 -1
  121. package/lib/staking/abis.d.ts +3 -2
  122. package/lib/staking/abis.d.ts.map +1 -1
  123. package/lib/staking/abis.js +10 -9
  124. package/lib/staking/abis.js.map +1 -1
  125. package/lib/staking/contracts.d.ts +3 -2
  126. package/lib/staking/contracts.d.ts.map +1 -1
  127. package/lib/staking/contracts.js +12 -13
  128. package/lib/staking/contracts.js.map +1 -1
  129. package/lib/staking/detectOperationType.d.ts +2 -4
  130. package/lib/staking/detectOperationType.d.ts.map +1 -1
  131. package/lib/staking/detectOperationType.js +22 -21
  132. package/lib/staking/detectOperationType.js.map +1 -1
  133. package/lib/staking/encoder.d.ts +2 -1
  134. package/lib/staking/encoder.d.ts.map +1 -1
  135. package/lib/staking/encoder.js +8 -8
  136. package/lib/staking/encoder.js.map +1 -1
  137. package/lib/staking/fetchers.d.ts +2 -1
  138. package/lib/staking/fetchers.d.ts.map +1 -1
  139. package/lib/staking/fetchers.js +27 -27
  140. package/lib/staking/fetchers.js.map +1 -1
  141. package/lib/staking/logic.d.ts +6 -6
  142. package/lib/staking/logic.d.ts.map +1 -1
  143. package/lib/staking/logic.js +14 -13
  144. package/lib/staking/logic.js.map +1 -1
  145. package/lib/staking/operations/index.d.ts +2 -1
  146. package/lib/staking/operations/index.d.ts.map +1 -1
  147. package/lib/staking/operations/index.js +39 -20
  148. package/lib/staking/operations/index.js.map +1 -1
  149. package/lib/staking/prepareIntents.d.ts +1 -1
  150. package/lib/staking/prepareIntents.d.ts.map +1 -1
  151. package/lib/staking/prepareIntents.js +14 -12
  152. package/lib/staking/prepareIntents.js.map +1 -1
  153. package/lib/staking/redelegations.d.ts +4 -4
  154. package/lib/staking/redelegations.d.ts.map +1 -1
  155. package/lib/staking/redelegations.js +22 -27
  156. package/lib/staking/redelegations.js.map +1 -1
  157. package/lib/staking/rewards.d.ts +1 -1
  158. package/lib/staking/rewards.d.ts.map +1 -1
  159. package/lib/staking/rewards.js +2 -2
  160. package/lib/staking/rewards.js.map +1 -1
  161. package/lib/staking/rewardsFromReceipt.d.ts +2 -1
  162. package/lib/staking/rewardsFromReceipt.d.ts.map +1 -1
  163. package/lib/staking/rewardsFromReceipt.js +2 -2
  164. package/lib/staking/rewardsFromReceipt.js.map +1 -1
  165. package/lib/staking/transactionData.d.ts +2 -1
  166. package/lib/staking/transactionData.d.ts.map +1 -1
  167. package/lib/staking/transactionData.js +6 -6
  168. package/lib/staking/transactionData.js.map +1 -1
  169. package/lib/staking/unbondings.d.ts +1 -1
  170. package/lib/staking/unbondings.d.ts.map +1 -1
  171. package/lib/staking/unbondings.js +2 -2
  172. package/lib/staking/unbondings.js.map +1 -1
  173. package/lib/staking/utils.d.ts.map +1 -1
  174. package/lib/staking/utils.js +22 -27
  175. package/lib/staking/utils.js.map +1 -1
  176. package/lib/staking/validators/index.d.ts +14 -14
  177. package/lib/staking/validators/index.d.ts.map +1 -1
  178. package/lib/staking/validators/index.js +39 -38
  179. package/lib/staking/validators/index.js.map +1 -1
  180. package/lib/staking/validators/monad.d.ts +5 -5
  181. package/lib/staking/validators/monad.d.ts.map +1 -1
  182. package/lib/staking/validators/monad.js +44 -37
  183. package/lib/staking/validators/monad.js.map +1 -1
  184. package/lib/staking/validators/monadResolver.d.ts +1 -1
  185. package/lib/staking/validators/monadResolver.d.ts.map +1 -1
  186. package/lib/staking/validators/monadResolver.js +7 -6
  187. package/lib/staking/validators/monadResolver.js.map +1 -1
  188. package/lib/staking/validators/sei.js +2 -2
  189. package/lib/staking/validators/sei.js.map +1 -1
  190. package/lib/staking/validators/somnia.d.ts +4 -4
  191. package/lib/staking/validators/somnia.d.ts.map +1 -1
  192. package/lib/staking/validators/somnia.js +25 -24
  193. package/lib/staking/validators/somnia.js.map +1 -1
  194. package/lib/staking/validators/types.d.ts +1 -1
  195. package/lib/staking/validators/types.d.ts.map +1 -1
  196. package/lib/staking/validators/zero_gravity.d.ts +1 -1
  197. package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
  198. package/lib/staking/validators/zero_gravity.js +10 -9
  199. package/lib/staking/validators/zero_gravity.js.map +1 -1
  200. package/lib/types/staking.d.ts +5 -6
  201. package/lib/types/staking.d.ts.map +1 -1
  202. package/lib-es/abis/index.d.ts +8 -0
  203. package/lib-es/abis/index.d.ts.map +1 -1
  204. package/lib-es/abis/index.js +29 -0
  205. package/lib-es/abis/index.js.map +1 -1
  206. package/lib-es/adapters/blockOperations.js +1 -1
  207. package/lib-es/adapters/blockOperations.js.map +1 -1
  208. package/lib-es/adapters/etherscan.d.ts +2 -1
  209. package/lib-es/adapters/etherscan.d.ts.map +1 -1
  210. package/lib-es/adapters/etherscan.js +2 -2
  211. package/lib-es/adapters/etherscan.js.map +1 -1
  212. package/lib-es/adapters/ledger.d.ts +2 -1
  213. package/lib-es/adapters/ledger.d.ts.map +1 -1
  214. package/lib-es/adapters/ledger.js +2 -2
  215. package/lib-es/adapters/ledger.js.map +1 -1
  216. package/lib-es/api/index.d.ts.map +1 -1
  217. package/lib-es/api/index.js +3 -2
  218. package/lib-es/api/index.js.map +1 -1
  219. package/lib-es/chains.d.ts +94 -0
  220. package/lib-es/chains.d.ts.map +1 -0
  221. package/lib-es/chains.js +95 -0
  222. package/lib-es/chains.js.map +1 -0
  223. package/lib-es/config.d.ts +4 -1
  224. package/lib-es/config.d.ts.map +1 -1
  225. package/lib-es/config.js +1 -0
  226. package/lib-es/config.js.map +1 -1
  227. package/lib-es/internalTxSources.d.ts.map +1 -1
  228. package/lib-es/internalTxSources.js +21 -3
  229. package/lib-es/internalTxSources.js.map +1 -1
  230. package/lib-es/logic/broadcast.js +2 -2
  231. package/lib-es/logic/broadcast.js.map +1 -1
  232. package/lib-es/logic/common.d.ts +1 -1
  233. package/lib-es/logic/common.d.ts.map +1 -1
  234. package/lib-es/logic/common.js +22 -14
  235. package/lib-es/logic/common.js.map +1 -1
  236. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  237. package/lib-es/logic/craftTransaction.js +7 -4
  238. package/lib-es/logic/craftTransaction.js.map +1 -1
  239. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  240. package/lib-es/logic/estimateFees.js +11 -8
  241. package/lib-es/logic/estimateFees.js.map +1 -1
  242. package/lib-es/logic/getBalance.d.ts.map +1 -1
  243. package/lib-es/logic/getBalance.js +9 -9
  244. package/lib-es/logic/getBalance.js.map +1 -1
  245. package/lib-es/logic/getBlock.d.ts.map +1 -1
  246. package/lib-es/logic/getBlock.js +18 -18
  247. package/lib-es/logic/getBlock.js.map +1 -1
  248. package/lib-es/logic/getBlockInfo.js +2 -2
  249. package/lib-es/logic/getBlockInfo.js.map +1 -1
  250. package/lib-es/logic/getNextSequence.d.ts.map +1 -1
  251. package/lib-es/logic/getNextSequence.js +1 -1
  252. package/lib-es/logic/getNextSequence.js.map +1 -1
  253. package/lib-es/logic/getStakes.d.ts.map +1 -1
  254. package/lib-es/logic/getStakes.js +10 -10
  255. package/lib-es/logic/getStakes.js.map +1 -1
  256. package/lib-es/logic/internalTransactionsFetcher.d.ts +2 -2
  257. package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
  258. package/lib-es/logic/internalTransactionsFetcher.js +9 -9
  259. package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
  260. package/lib-es/logic/lastBlock.js +2 -2
  261. package/lib-es/logic/lastBlock.js.map +1 -1
  262. package/lib-es/logic/listOperations.d.ts.map +1 -1
  263. package/lib-es/logic/listOperations.js +1 -1
  264. package/lib-es/logic/listOperations.js.map +1 -1
  265. package/lib-es/logic/predicates.d.ts +17 -0
  266. package/lib-es/logic/predicates.d.ts.map +1 -0
  267. package/lib-es/logic/predicates.js +114 -0
  268. package/lib-es/logic/predicates.js.map +1 -0
  269. package/lib-es/logic/validateIntent.d.ts.map +1 -1
  270. package/lib-es/logic/validateIntent.js +9 -9
  271. package/lib-es/logic/validateIntent.js.map +1 -1
  272. package/lib-es/logic.d.ts +1 -1
  273. package/lib-es/logic.d.ts.map +1 -1
  274. package/lib-es/logic.js +14 -13
  275. package/lib-es/logic.js.map +1 -1
  276. package/lib-es/network/explorer/etherscan.d.ts +2 -3
  277. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  278. package/lib-es/network/explorer/etherscan.js +6 -8
  279. package/lib-es/network/explorer/etherscan.js.map +1 -1
  280. package/lib-es/network/explorer/ledger.d.ts.map +1 -1
  281. package/lib-es/network/explorer/ledger.js +5 -5
  282. package/lib-es/network/explorer/ledger.js.map +1 -1
  283. package/lib-es/network/explorer/types.d.ts +2 -2
  284. package/lib-es/network/explorer/types.d.ts.map +1 -1
  285. package/lib-es/network/explorer/types.js +11 -1
  286. package/lib-es/network/explorer/types.js.map +1 -1
  287. package/lib-es/network/gasTracker/ledger.d.ts.map +1 -1
  288. package/lib-es/network/gasTracker/ledger.js +1 -3
  289. package/lib-es/network/gasTracker/ledger.js.map +1 -1
  290. package/lib-es/network/node/explorerProxy.d.ts.map +1 -1
  291. package/lib-es/network/node/explorerProxy.js +22 -17
  292. package/lib-es/network/node/explorerProxy.js.map +1 -1
  293. package/lib-es/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
  294. package/lib-es/network/node/gethCallTracerToTraceBlockItems.js +4 -6
  295. package/lib-es/network/node/gethCallTracerToTraceBlockItems.js.map +1 -1
  296. package/lib-es/network/node/index.d.ts +1 -1
  297. package/lib-es/network/node/index.d.ts.map +1 -1
  298. package/lib-es/network/node/index.js +7 -7
  299. package/lib-es/network/node/index.js.map +1 -1
  300. package/lib-es/network/node/ledger.d.ts +3 -1
  301. package/lib-es/network/node/ledger.d.ts.map +1 -1
  302. package/lib-es/network/node/ledger.js +38 -24
  303. package/lib-es/network/node/ledger.js.map +1 -1
  304. package/lib-es/network/node/rpc.common.d.ts +1 -1
  305. package/lib-es/network/node/rpc.common.d.ts.map +1 -1
  306. package/lib-es/network/node/rpc.common.js +102 -101
  307. package/lib-es/network/node/rpc.common.js.map +1 -1
  308. package/lib-es/network/node/types.d.ts +21 -22
  309. package/lib-es/network/node/types.d.ts.map +1 -1
  310. package/lib-es/network/node/types.js +0 -25
  311. package/lib-es/network/node/types.js.map +1 -1
  312. package/lib-es/network/node/withNodeSources.d.ts.map +1 -1
  313. package/lib-es/network/node/withNodeSources.js +15 -15
  314. package/lib-es/network/node/withNodeSources.js.map +1 -1
  315. package/lib-es/nodeSources.d.ts.map +1 -1
  316. package/lib-es/nodeSources.js +11 -3
  317. package/lib-es/nodeSources.js.map +1 -1
  318. package/lib-es/staking/abis.d.ts +3 -2
  319. package/lib-es/staking/abis.d.ts.map +1 -1
  320. package/lib-es/staking/abis.js +10 -9
  321. package/lib-es/staking/abis.js.map +1 -1
  322. package/lib-es/staking/contracts.d.ts +3 -2
  323. package/lib-es/staking/contracts.d.ts.map +1 -1
  324. package/lib-es/staking/contracts.js +12 -13
  325. package/lib-es/staking/contracts.js.map +1 -1
  326. package/lib-es/staking/detectOperationType.d.ts +2 -4
  327. package/lib-es/staking/detectOperationType.d.ts.map +1 -1
  328. package/lib-es/staking/detectOperationType.js +22 -21
  329. package/lib-es/staking/detectOperationType.js.map +1 -1
  330. package/lib-es/staking/encoder.d.ts +2 -1
  331. package/lib-es/staking/encoder.d.ts.map +1 -1
  332. package/lib-es/staking/encoder.js +8 -8
  333. package/lib-es/staking/encoder.js.map +1 -1
  334. package/lib-es/staking/fetchers.d.ts +2 -1
  335. package/lib-es/staking/fetchers.d.ts.map +1 -1
  336. package/lib-es/staking/fetchers.js +27 -27
  337. package/lib-es/staking/fetchers.js.map +1 -1
  338. package/lib-es/staking/logic.d.ts +6 -6
  339. package/lib-es/staking/logic.d.ts.map +1 -1
  340. package/lib-es/staking/logic.js +14 -13
  341. package/lib-es/staking/logic.js.map +1 -1
  342. package/lib-es/staking/operations/index.d.ts +2 -1
  343. package/lib-es/staking/operations/index.d.ts.map +1 -1
  344. package/lib-es/staking/operations/index.js +39 -20
  345. package/lib-es/staking/operations/index.js.map +1 -1
  346. package/lib-es/staking/prepareIntents.d.ts +1 -1
  347. package/lib-es/staking/prepareIntents.d.ts.map +1 -1
  348. package/lib-es/staking/prepareIntents.js +13 -11
  349. package/lib-es/staking/prepareIntents.js.map +1 -1
  350. package/lib-es/staking/redelegations.d.ts +4 -4
  351. package/lib-es/staking/redelegations.d.ts.map +1 -1
  352. package/lib-es/staking/redelegations.js +19 -24
  353. package/lib-es/staking/redelegations.js.map +1 -1
  354. package/lib-es/staking/rewards.d.ts +1 -1
  355. package/lib-es/staking/rewards.d.ts.map +1 -1
  356. package/lib-es/staking/rewards.js +2 -2
  357. package/lib-es/staking/rewards.js.map +1 -1
  358. package/lib-es/staking/rewardsFromReceipt.d.ts +2 -1
  359. package/lib-es/staking/rewardsFromReceipt.d.ts.map +1 -1
  360. package/lib-es/staking/rewardsFromReceipt.js +2 -2
  361. package/lib-es/staking/rewardsFromReceipt.js.map +1 -1
  362. package/lib-es/staking/transactionData.d.ts +2 -1
  363. package/lib-es/staking/transactionData.d.ts.map +1 -1
  364. package/lib-es/staking/transactionData.js +6 -6
  365. package/lib-es/staking/transactionData.js.map +1 -1
  366. package/lib-es/staking/unbondings.d.ts +1 -1
  367. package/lib-es/staking/unbondings.d.ts.map +1 -1
  368. package/lib-es/staking/unbondings.js +2 -2
  369. package/lib-es/staking/unbondings.js.map +1 -1
  370. package/lib-es/staking/utils.d.ts.map +1 -1
  371. package/lib-es/staking/utils.js +20 -25
  372. package/lib-es/staking/utils.js.map +1 -1
  373. package/lib-es/staking/validators/index.d.ts +14 -14
  374. package/lib-es/staking/validators/index.d.ts.map +1 -1
  375. package/lib-es/staking/validators/index.js +39 -38
  376. package/lib-es/staking/validators/index.js.map +1 -1
  377. package/lib-es/staking/validators/monad.d.ts +5 -5
  378. package/lib-es/staking/validators/monad.d.ts.map +1 -1
  379. package/lib-es/staking/validators/monad.js +43 -36
  380. package/lib-es/staking/validators/monad.js.map +1 -1
  381. package/lib-es/staking/validators/monadResolver.d.ts +1 -1
  382. package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
  383. package/lib-es/staking/validators/monadResolver.js +6 -5
  384. package/lib-es/staking/validators/monadResolver.js.map +1 -1
  385. package/lib-es/staking/validators/sei.js +2 -2
  386. package/lib-es/staking/validators/sei.js.map +1 -1
  387. package/lib-es/staking/validators/somnia.d.ts +4 -4
  388. package/lib-es/staking/validators/somnia.d.ts.map +1 -1
  389. package/lib-es/staking/validators/somnia.js +24 -23
  390. package/lib-es/staking/validators/somnia.js.map +1 -1
  391. package/lib-es/staking/validators/types.d.ts +1 -1
  392. package/lib-es/staking/validators/types.d.ts.map +1 -1
  393. package/lib-es/staking/validators/zero_gravity.d.ts +1 -1
  394. package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
  395. package/lib-es/staking/validators/zero_gravity.js +9 -8
  396. package/lib-es/staking/validators/zero_gravity.js.map +1 -1
  397. package/lib-es/types/staking.d.ts +5 -6
  398. package/lib-es/types/staking.d.ts.map +1 -1
  399. package/package.json +2 -2
  400. package/src/abis/index.test.ts +36 -0
  401. package/src/abis/index.ts +30 -0
  402. package/src/adapters/blockOperations.ts +1 -1
  403. package/src/adapters/etherscan.test.ts +34 -38
  404. package/src/adapters/etherscan.ts +3 -2
  405. package/src/adapters/ledger.test.ts +49 -22
  406. package/src/adapters/ledger.ts +3 -2
  407. package/src/api/getBlock.integ.test.ts +2 -1
  408. package/src/api/index.monad_testnet.integ.test.ts +2 -2
  409. package/src/api/index.ts +4 -3
  410. package/src/chains.test.ts +12 -0
  411. package/src/chains.ts +97 -0
  412. package/src/config.ts +5 -1
  413. package/src/fixtures/staking.fixtures.ts +13 -0
  414. package/src/internalTxSources.ts +20 -3
  415. package/src/logic/broadcast.ts +2 -2
  416. package/src/logic/common.ts +23 -14
  417. package/src/logic/craftTransaction.ts +6 -5
  418. package/src/logic/estimateFees.ts +10 -25
  419. package/src/logic/getBalance.ts +7 -13
  420. package/src/logic/getBlock.ts +22 -19
  421. package/src/logic/getBlockInfo.ts +2 -2
  422. package/src/logic/getNextSequence.ts +1 -4
  423. package/src/logic/getStakes.ts +11 -12
  424. package/src/logic/internalTransactionsFetcher.ts +7 -9
  425. package/src/logic/lastBlock.ts +2 -2
  426. package/src/logic/listOperations.ts +0 -1
  427. package/src/logic/predicates.ts +124 -0
  428. package/src/logic/tests/broadcast.test.ts +4 -4
  429. package/src/logic/tests/broadcastSource.test.ts +0 -3
  430. package/src/logic/tests/common.test.ts +17 -33
  431. package/src/logic/tests/craftTransaction.test.ts +13 -6
  432. package/src/logic/tests/estimateFees.test.ts +16 -7
  433. package/src/logic/tests/getBalance.test.ts +17 -33
  434. package/src/logic/tests/getBlock.test.ts +69 -75
  435. package/src/logic/tests/getBlockInfo.test.ts +1 -1
  436. package/src/logic/tests/getNextSequence.test.ts +1 -1
  437. package/src/logic/tests/getStakes.test.ts +28 -16
  438. package/src/logic/tests/internalTransactionsFetcher.test.ts +5 -5
  439. package/src/logic/tests/lastBlock.test.ts +3 -6
  440. package/src/logic/tests/listOperations.test.ts +3 -4
  441. package/src/logic/tests/validateIntent.test.ts +16 -3
  442. package/src/logic/validateIntent.ts +8 -10
  443. package/src/logic.test.ts +12 -4
  444. package/src/logic.ts +13 -13
  445. package/src/network/explorer/etherscan.test.ts +9 -58
  446. package/src/network/explorer/etherscan.ts +8 -24
  447. package/src/network/explorer/index.test.ts +1 -1
  448. package/src/network/explorer/ledger.test.ts +44 -146
  449. package/src/network/explorer/ledger.ts +2 -5
  450. package/src/network/explorer/types.ts +12 -5
  451. package/src/network/gasTracker/ledger.ts +1 -4
  452. package/src/network/node/explorerProxy.test.ts +17 -22
  453. package/src/network/node/explorerProxy.ts +23 -20
  454. package/src/network/node/gethCallTracerToTraceBlockItems.test.ts +1 -1
  455. package/src/network/node/gethCallTracerToTraceBlockItems.ts +6 -9
  456. package/src/network/node/index.memoization.test.ts +29 -22
  457. package/src/network/node/index.test.ts +1 -3
  458. package/src/network/node/index.ts +11 -8
  459. package/src/network/node/ledger.test.ts +63 -69
  460. package/src/network/node/ledger.ts +39 -38
  461. package/src/network/node/rpc.common.ts +134 -158
  462. package/src/network/node/rpc.test.ts +201 -110
  463. package/src/network/node/types.ts +17 -64
  464. package/src/network/node/withNodeSources.test.ts +7 -9
  465. package/src/network/node/withNodeSources.ts +23 -26
  466. package/src/nodeSources.ts +11 -3
  467. package/src/staking/abis.test.ts +24 -28
  468. package/src/staking/abis.ts +12 -10
  469. package/src/staking/contracts.test.ts +20 -8
  470. package/src/staking/contracts.ts +13 -14
  471. package/src/staking/detectOperationType.test.ts +16 -13
  472. package/src/staking/detectOperationType.ts +24 -22
  473. package/src/staking/encoder.test.ts +38 -27
  474. package/src/staking/encoder.ts +9 -8
  475. package/src/staking/fetchers.ts +28 -39
  476. package/src/staking/logic.test.ts +34 -32
  477. package/src/staking/logic.ts +14 -14
  478. package/src/staking/operations/index.test.ts +48 -39
  479. package/src/staking/operations/index.ts +43 -21
  480. package/src/staking/prepareIntents.test.ts +14 -34
  481. package/src/staking/prepareIntents.ts +12 -14
  482. package/src/staking/redelegations.test.ts +73 -131
  483. package/src/staking/redelegations.ts +13 -31
  484. package/src/staking/rewards.test.ts +19 -21
  485. package/src/staking/rewards.ts +1 -2
  486. package/src/staking/rewardsFromReceipt.test.ts +9 -8
  487. package/src/staking/rewardsFromReceipt.ts +3 -2
  488. package/src/staking/transactionData.test.ts +35 -25
  489. package/src/staking/transactionData.ts +7 -6
  490. package/src/staking/unbondings.test.ts +26 -20
  491. package/src/staking/unbondings.ts +1 -2
  492. package/src/staking/utils.ts +19 -26
  493. package/src/staking/validators/index.ts +45 -51
  494. package/src/staking/validators/monad.test.ts +52 -54
  495. package/src/staking/validators/monad.ts +42 -40
  496. package/src/staking/validators/monadResolver.ts +4 -5
  497. package/src/staking/validators/sei.ts +2 -2
  498. package/src/staking/validators/somnia.test.ts +22 -19
  499. package/src/staking/validators/somnia.ts +23 -29
  500. package/src/staking/validators/types.ts +0 -1
  501. package/src/staking/validators/zero_gravity.test.ts +34 -49
  502. package/src/staking/validators/zero_gravity.ts +7 -12
  503. package/src/staking/validators.integ.test.ts +3 -5
  504. package/src/staking/validators.test.ts +56 -53
  505. package/src/types/staking.ts +3 -6
package/src/chains.ts ADDED
@@ -0,0 +1,97 @@
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * The EVM networks coin-evm supports, valued by their EIP-155 chain id.
6
+ */
7
+ export const CHAIN_ID = {
8
+ ETHEREUM: 1,
9
+ EXPANSE: 2,
10
+ UBIQ: 8,
11
+ OPTIMISM: 10,
12
+ FLARE: 14,
13
+ SONGBIRD: 19,
14
+ CRONOS: 25,
15
+ RSK: 30,
16
+ TELOS_EVM: 40,
17
+ LUKSO: 42,
18
+ BSC: 56,
19
+ SYSCOIN: 57,
20
+ GOCHAIN: 60,
21
+ ETHEREUM_CLASSIC: 61,
22
+ ELLAISM: 64,
23
+ MIX: 76,
24
+ TOMO: 88,
25
+ POA: 99,
26
+ VELAS_EVM: 106,
27
+ THUNDERCORE: 108,
28
+ UNICHAIN: 130,
29
+ POLYGON: 137,
30
+ MONAD: 143,
31
+ SONIC: 146,
32
+ BITTORRENT: 199,
33
+ DEXON: 237,
34
+ ENERGY_WEB: 246,
35
+ FANTOM: 250,
36
+ HPB: 269,
37
+ BOBA: 288,
38
+ ZKSYNC_SEPOLIA: 300,
39
+ ZKSYNC: 324,
40
+ SHAPE: 360,
41
+ ASTAR: 592,
42
+ CALLISTO: 820,
43
+ WANCHAIN: 888,
44
+ HYPEREVM: 999,
45
+ KLAYTN_BAOBAB: 1001,
46
+ METIS: 1088,
47
+ POLYGON_ZK_EVM: 1101,
48
+ CORE: 1116,
49
+ MOONBEAM: 1284,
50
+ MOONRIVER: 1285,
51
+ UNICHAIN_SEPOLIA: 1301,
52
+ SEI_EVM: 1329,
53
+ POLYGON_ZK_EVM_TESTNET: 1442,
54
+ STORY: 1514,
55
+ ATHEIOS: 1620,
56
+ ETHERGEM: 1987,
57
+ REOSC: 2894,
58
+ ROBINHOOD: 4663,
59
+ MANTLE: 5000,
60
+ MANTLE_SEPOLIA: 5003,
61
+ SOMNIA: 5031,
62
+ ARC: 5042,
63
+ KLAYTN: 8217,
64
+ BASE: 8453,
65
+ MONAD_TESTNET: 10143,
66
+ ZERO_GRAVITY: 16661,
67
+ ETHERSOCIAL: 31102,
68
+ ADI: 36900,
69
+ ARBITRUM: 42161,
70
+ CELO: 42220,
71
+ ETHERLINK: 42793,
72
+ AVALANCHE_C_CHAIN_FUJI: 43113,
73
+ AVALANCHE_C_CHAIN: 43114,
74
+ ROBINHOOD_TESTNET: 46630,
75
+ SONIC_BLAZE: 57054,
76
+ LINEA_SEPOLIA: 59141,
77
+ LINEA: 59144,
78
+ POLYGON_AMOY: 80002,
79
+ BERACHAIN: 80094,
80
+ BLAST: 81457,
81
+ BASE_SEPOLIA: 84532,
82
+ AKROMA: 200625,
83
+ BITLAYER: 200901,
84
+ ARBITRUM_SEPOLIA: 421614,
85
+ SCROLL: 534352,
86
+ ETHEREUM_HOODI: 560048,
87
+ ETHER1: 1313114,
88
+ ARC_TESTNET: 5042002,
89
+ MUSICOIN: 7762959,
90
+ ETHEREUM_SEPOLIA: 11155111,
91
+ OPTIMISM_SEPOLIA: 11155420,
92
+ BLAST_SEPOLIA: 168587773,
93
+ NEON_EVM: 245022934,
94
+ PIRL: 3125659152,
95
+ } as const
96
+
97
+ export type ChainId = (typeof CHAIN_ID)[keyof typeof CHAIN_ID]
package/src/config.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import type { ChainId } from './chains'
4
5
  import type { InternalTxSourceList } from './internalTxSources'
5
6
  import type { NodeSourceList } from './nodeSources'
6
7
  import type { Context, CurrencyConfig } from '@ledgerhq/coin-module-framework/config'
7
8
 
9
+ export { CHAIN_ID } from './chains'
10
+ export type { ChainId } from './chains'
11
+
8
12
  export type { InternalTxSource, InternalTxSourceList, NonEmptySource } from './internalTxSources'
9
13
  export {
10
14
  DEFAULT_INTERNAL_TX_SOURCES,
@@ -27,7 +31,7 @@ export const DEFAULT_LEDGER_EXPLORER_URI = 'https://explorers.api.live.ledger.co
27
31
  export const DEFAULT_EIP1559_BASE_FEE_MULTIPLIER = 1.6
28
32
 
29
33
  export type EvmConfig = {
30
- chainId: number
34
+ chainId: ChainId
31
35
  node:
32
36
  | {
33
37
  type: 'external'
@@ -0,0 +1,13 @@
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { ChainId } from '../config'
5
+ import type { StakingContractConfig } from '../types/staking'
6
+ import { STAKING_CONTRACTS } from '../staking/contracts'
7
+
8
+ /** The staking contract config of a chain that is expected to have one (registries are partial). */
9
+ export const requireStakingContract = (chainId: ChainId): StakingContractConfig => {
10
+ const config = STAKING_CONTRACTS[chainId]
11
+ if (!config) throw new Error(`No staking contract config for chain ${chainId}`)
12
+ return config
13
+ }
@@ -31,7 +31,8 @@ export function internalTxSourcesFromList(sources: readonly string[]): InternalT
31
31
  throw new Error('internalTxSources: at least one source is required')
32
32
  }
33
33
  const seen = new Set<string>()
34
- sources.forEach((source, index) => {
34
+ const validated: InternalTxSource[] = []
35
+ for (const [index, source] of sources.entries()) {
35
36
  if (!isInternalTxSource(source)) {
36
37
  throw new Error(`internalTxSources: invalid source "${source}"`)
37
38
  }
@@ -42,8 +43,24 @@ export function internalTxSourcesFromList(sources: readonly string[]): InternalT
42
43
  if (seen.has(source)) throw new Error(`internalTxSources: duplicate source "${source}"`)
43
44
  seen.add(source)
44
45
  }
45
- })
46
- return Object.freeze([...sources]) as unknown as InternalTxSourceList
46
+ validated.push(source)
47
+ }
48
+ const frozen = Object.freeze(validated)
49
+ if (isInternalTxSourceList(frozen)) return frozen
50
+ throw new Error('internalTxSources: invalid list')
51
+ }
52
+
53
+ function isInternalTxSourceList(
54
+ sources: readonly InternalTxSource[]
55
+ ): sources is InternalTxSourceList {
56
+ if (sources.length === 0) return false
57
+ const seen = new Set<string>()
58
+ for (const [index, source] of sources.entries()) {
59
+ if (source === 'empty') return index === sources.length - 1
60
+ if (seen.has(source)) return false
61
+ seen.add(source)
62
+ }
63
+ return true
47
64
  }
48
65
 
49
66
  export const DEFAULT_INTERNAL_TX_SOURCES = internalTxSourcesFromList([
@@ -17,8 +17,8 @@ export async function broadcast(
17
17
  }
18
18
  ): Promise<string> {
19
19
  const config = await context.config(currencyId)
20
- const nodeApi = getNodeApi(config, currencyId, context.logger)
21
- return await nodeApi.broadcastTransaction(currencyId, signature, broadcastConfig)
20
+ const nodeApi = getNodeApi(config, context.logger)
21
+ return await nodeApi.broadcastTransaction(signature, broadcastConfig)
22
22
  }
23
23
 
24
24
  export default broadcast
@@ -21,9 +21,10 @@ import { getNodeApi } from '../network/node'
21
21
  import { buildStakingTransactionParams, prepareStakingIntent, STAKING_CONTRACTS } from '../staking'
22
22
  import { isNative, TransactionTypes } from '../types'
23
23
  import { getErc20Data } from './getErc20Data'
24
+ import { isRecord } from './predicates'
24
25
 
25
26
  export function isApiGasOptions(options: unknown): options is ApiGasOptions {
26
- if (!options || typeof options !== 'object') return false
27
+ if (!isRecord(options)) return false
27
28
 
28
29
  return (
29
30
  'slow' in options &&
@@ -36,7 +37,7 @@ export function isApiGasOptions(options: unknown): options is ApiGasOptions {
36
37
  }
37
38
 
38
39
  export function isApiFeeData(fees: unknown): fees is ApiFeeData {
39
- if (!fees || typeof fees !== 'object') return false
40
+ if (!isRecord(fees)) return false
40
41
 
41
42
  const isBigIntOrNull = (value: unknown): boolean => value === null || typeof value === 'bigint'
42
43
 
@@ -101,6 +102,15 @@ export function getCallData(intent: TransactionIntent<MemoNotSupported, BufferTx
101
102
  : getErc20Data(intent.recipient, intent.amount)
102
103
  }
103
104
 
105
+ function transactionRecipient(
106
+ asset: TransactionIntent<MemoNotSupported, BufferTxData>['asset'],
107
+ recipient: string
108
+ ): string {
109
+ if (isNative(asset)) return recipient
110
+ if (typeof asset.assetReference === 'string') return asset.assetReference
111
+ throw new Error('token asset is missing assetReference')
112
+ }
113
+
104
114
  function buildSendTxParams(intent: TransactionIntent<MemoNotSupported, BufferTxData>): {
105
115
  to: string
106
116
  data: Buffer
@@ -108,14 +118,14 @@ function buildSendTxParams(intent: TransactionIntent<MemoNotSupported, BufferTxD
108
118
  } {
109
119
  const { amount, asset, recipient } = intent
110
120
  return {
111
- to: isNative(asset) ? recipient : (asset.assetReference as string),
121
+ to: transactionRecipient(asset, recipient),
112
122
  data: getCallData(intent),
113
123
  value: isNative(asset) ? amount : 0n,
114
124
  }
115
125
  }
116
126
 
117
127
  async function estimateGas(
118
- currencyId: string,
128
+ config: EvmConfigInfo,
119
129
  node: ReturnType<typeof getNodeApi>,
120
130
  sender: string,
121
131
  params: { to: string; data: Buffer; value: bigint },
@@ -126,7 +136,7 @@ async function estimateGas(
126
136
  // trying to send more token asset than available.
127
137
  // Fallback to an estimation of 0 to not break the UI.
128
138
  return node
129
- .getGasEstimation(currencyId, sender, {
139
+ .getGasEstimation(sender, {
130
140
  amount: BigNumber(params.value.toString()),
131
141
  recipient: params.to,
132
142
  data: params.data,
@@ -135,15 +145,15 @@ async function estimateGas(
135
145
  if (!isStakingTransactionIntent(transactionIntent)) return new BigNumber(0)
136
146
  // Retry staking gas estimation with the chain min calldata unit (LIVE-32750).
137
147
  // Rebuild calldata + value to keep `msg.value` consistent with calldata-encoded amounts (e.g. Somnia).
138
- const minUnit = STAKING_CONTRACTS[currencyId]?.calldataAmountScale ?? 1n
148
+ const minUnit = STAKING_CONTRACTS[config.chainId]?.calldataAmountScale ?? 1n
139
149
  // Reuse the already-prepared staking intent (enrichment done above) and only
140
150
  // override the amount, so we don't repeat the async on-chain lookups.
141
- const retry = buildStakingTransactionParams(currencyId, {
151
+ const retry = buildStakingTransactionParams(config, {
142
152
  ...(preparedStakingIntent ?? transactionIntent),
143
153
  amount: minUnit,
144
154
  })
145
155
  return node
146
- .getGasEstimation(currencyId, sender, {
156
+ .getGasEstimation(sender, {
147
157
  amount: new BigNumber(retry.value.toString()),
148
158
  recipient: retry.to,
149
159
  data: retry.data,
@@ -154,27 +164,26 @@ async function estimateGas(
154
164
 
155
165
  export async function prepareUnsignedTxParams(
156
166
  config: EvmConfigInfo,
157
- currencyId: string,
158
167
  transactionIntent: TransactionIntent<MemoNotSupported, BufferTxData>,
159
168
  logger: Logger,
160
169
  customFeesParameters?: FeeEstimation['parameters']
161
170
  ): Promise<TransactionLikeWithPreparedParams> {
162
171
  const { sender, type } = transactionIntent
163
172
  const transactionType = getTransactionType(type)
164
- const node = getNodeApi(config, currencyId, logger)
173
+ const node = getNodeApi(config, logger)
165
174
  const isSend = isSendTransactionIntent(transactionIntent)
166
175
 
167
176
  // Prepare staking intents once (can require async on-chain lookups). See: LIVE-32750
168
177
  const preparedStakingIntent = isSend
169
178
  ? undefined
170
- : await prepareStakingIntent(config, currencyId, transactionIntent, logger)
179
+ : await prepareStakingIntent(config, transactionIntent, logger)
171
180
 
172
181
  const { to, data, value } = isSend
173
182
  ? buildSendTxParams(transactionIntent)
174
- : buildStakingTransactionParams(currencyId, preparedStakingIntent ?? transactionIntent)
183
+ : buildStakingTransactionParams(config, preparedStakingIntent ?? transactionIntent)
175
184
 
176
185
  const stakingGasMultiplier = isStakingTransactionIntent(transactionIntent)
177
- ? (STAKING_CONTRACTS[currencyId]?.gasMultiplier?.({ mode: transactionIntent.mode }) ??
186
+ ? (STAKING_CONTRACTS[config.chainId]?.gasMultiplier?.({ mode: transactionIntent.mode }) ??
178
187
  new BigNumber(1))
179
188
  : new BigNumber(1)
180
189
 
@@ -188,7 +197,7 @@ export async function prepareUnsignedTxParams(
188
197
  ? BigNumber(customGasLimit.toString())
189
198
  : (
190
199
  await estimateGas(
191
- currencyId,
200
+ config,
192
201
  node,
193
202
  sender,
194
203
  { to, data, value },
@@ -6,7 +6,6 @@ import type {
6
6
  BufferTxData,
7
7
  CraftedTransaction,
8
8
  FeeEstimation,
9
- FeesStrategy,
10
9
  MemoNotSupported,
11
10
  TransactionIntent,
12
11
  } from '@ledgerhq/coin-module-framework/api/types'
@@ -17,6 +16,7 @@ import { getNodeApi } from '../network/node'
17
16
  import { TransactionTypes } from '../types'
18
17
  import { prepareUnsignedTxParams } from './common'
19
18
  import { getNextSequence } from './getNextSequence'
19
+ import { isFeesStrategy } from './predicates'
20
20
 
21
21
  export async function craftTransaction(
22
22
  context: EvmContext,
@@ -32,7 +32,6 @@ export async function craftTransaction(
32
32
  const config = await context.config(currencyId)
33
33
  const { type, to, data, value, gasLimit } = await prepareUnsignedTxParams(
34
34
  config,
35
- currencyId,
36
35
  transactionIntent,
37
36
  context.logger,
38
37
  customFees?.parameters
@@ -80,10 +79,12 @@ export async function craftTransaction(
80
79
  }
81
80
 
82
81
  if (!hasFeeData) {
83
- const node = getNodeApi(config, currencyId, context.logger)
84
- const feeData = await node.getFeeData(config, currencyId, {
82
+ const node = getNodeApi(config, context.logger)
83
+ const feeData = await node.getFeeData(config, {
85
84
  type,
86
- feesStrategy: customFees?.parameters?.feesStrategy as FeesStrategy | undefined,
85
+ feesStrategy: isFeesStrategy(customFees?.parameters?.feesStrategy)
86
+ ? customFees.parameters.feesStrategy
87
+ : undefined,
87
88
  })
88
89
 
89
90
  if (type === TransactionTypes.legacy && feeData.gasPrice) {
@@ -7,7 +7,6 @@ import type { ApiFeeData, ApiGasOptions, FeeData, GasOptions } from '../types'
7
7
  import type {
8
8
  BufferTxData,
9
9
  FeeEstimation,
10
- FeesStrategy,
11
10
  MemoNotSupported,
12
11
  TransactionIntent,
13
12
  } from '@ledgerhq/coin-module-framework/api/index'
@@ -23,12 +22,12 @@ import { STAKING_CONTRACTS } from '../staking'
23
22
  import { TransactionTypes } from '../types'
24
23
  import { getTransactionType, prepareUnsignedTxParams } from './common'
25
24
  import { getNextSequence } from './getNextSequence'
25
+ import { isFeesStrategy } from './predicates'
26
26
 
27
27
  const SEND_MAX_L1_FEE_BUFFER = new BigNumber(2)
28
28
 
29
29
  async function computeAdditionalFees(
30
30
  config: EvmConfigInfo,
31
- currencyId: string,
32
31
  unsignedTransaction: TransactionLike,
33
32
  logger: Logger
34
33
  ): Promise<BigNumber | undefined> {
@@ -43,12 +42,7 @@ async function computeAdditionalFees(
43
42
  }
44
43
 
45
44
  try {
46
- return await getAdditionalLayer2Fees(
47
- config,
48
- currencyId,
49
- Transaction.from(transaction).serialized,
50
- logger
51
- )
45
+ return await getAdditionalLayer2Fees(config, Transaction.from(transaction).serialized, logger)
52
46
  } catch {
53
47
  return new BigNumber(0)
54
48
  }
@@ -159,7 +153,9 @@ export async function estimateFees(
159
153
  finalFeeData: FeeData
160
154
  finalGasOptions?: GasOptions
161
155
  }> => {
162
- const feesStrategy = customFeesParameters?.feesStrategy as FeesStrategy | undefined
156
+ const feesStrategy = isFeesStrategy(customFeesParameters?.feesStrategy)
157
+ ? customFeesParameters.feesStrategy
158
+ : undefined
163
159
 
164
160
  if (feesStrategy === 'custom') {
165
161
  return { finalFeeData: extractFeeData(customFeesParameters) }
@@ -181,8 +177,8 @@ export async function estimateFees(
181
177
  return { finalFeeData: remoteGasOptions[feesStrategy], finalGasOptions: remoteGasOptions }
182
178
  }
183
179
 
184
- const node = getNodeApi(config, currencyId, context.logger)
185
- const feeData = await node.getFeeData(config, currencyId, {
180
+ const node = getNodeApi(config, context.logger)
181
+ const feeData = await node.getFeeData(config, {
186
182
  type: txType,
187
183
  feesStrategy,
188
184
  })
@@ -194,13 +190,7 @@ export async function estimateFees(
194
190
  // all independent network calls and sequencing them triples the latency.
195
191
  const [{ to, data, value, gasLimit }, nonce, { finalFeeData, finalGasOptions }] =
196
192
  await Promise.all([
197
- prepareUnsignedTxParams(
198
- config,
199
- currencyId,
200
- transactionIntent,
201
- context.logger,
202
- customFeesParameters
203
- ),
193
+ prepareUnsignedTxParams(config, transactionIntent, context.logger, customFeesParameters),
204
194
  noncePromise,
205
195
  feeDataPromise,
206
196
  ])
@@ -238,19 +228,14 @@ export async function estimateFees(
238
228
  value,
239
229
  chainId,
240
230
  }
241
- const rawAdditionalFees = await computeAdditionalFees(
242
- config,
243
- currencyId,
244
- unsignedTransaction,
245
- context.logger
246
- )
231
+ const rawAdditionalFees = await computeAdditionalFees(config, unsignedTransaction, context.logger)
247
232
  const additionalFees =
248
233
  transactionIntent.useAllAmount && rawAdditionalFees
249
234
  ? rawAdditionalFees.multipliedBy(SEND_MAX_L1_FEE_BUFFER).integerValue(BigNumber.ROUND_CEIL)
250
235
  : rawAdditionalFees
251
236
 
252
237
  // delegate send-max: expose reserve/scale so the bridge can compute the amount (it has the balance)
253
- const stakingConfig = STAKING_CONTRACTS[currencyId]
238
+ const stakingConfig = STAKING_CONTRACTS[config.chainId]
254
239
  const delegateMaxParams =
255
240
  transactionIntent.useAllAmount &&
256
241
  isStakingIntent(transactionIntent) &&
@@ -27,24 +27,20 @@ export async function getBalance(
27
27
  options?: BalanceOptions
28
28
  ): Promise<Balance[]> {
29
29
  const config = await context.config(currencyId)
30
- const nodeApi = getNodeApi(config, currencyId, context.logger)
30
+ const nodeApi = getNodeApi(config, context.logger)
31
31
  const explorerApi = getExplorerApi(config)
32
32
 
33
33
  const [nativeBalance, tokensBalances] = await Promise.all([
34
- getNativeBalance(currencyId, address, nodeApi),
34
+ getNativeBalance(address, nodeApi),
35
35
  getTokenBalances(context, currencyId, address, nodeApi, explorerApi, config, options),
36
36
  ])
37
37
 
38
38
  return [nativeBalance].concat(tokensBalances)
39
39
  }
40
40
 
41
- async function getNativeBalance(
42
- currencyId: string,
43
- address: string,
44
- nodeApi: NodeApi
45
- ): Promise<Balance> {
41
+ async function getNativeBalance(address: string, nodeApi: NodeApi): Promise<Balance> {
46
42
  // Get native balance for the first element array
47
- const nativeBalance = await nodeApi.getCoinBalance(currencyId, address)
43
+ const nativeBalance = await nodeApi.getCoinBalance(address)
48
44
 
49
45
  return {
50
46
  asset: { type: 'native' },
@@ -73,7 +69,7 @@ async function getTokenBalances(
73
69
  // list into `{ value: 0n }` for every already-known sub-account, which would silently display
74
70
  // a held token's balance as zero — so the explorer's own error is left to propagate, never
75
71
  // swallowed into an empty result.
76
- const extractKnownValIds = STAKING_CONFIG[currencyId]?.extractKnownValIds
72
+ const extractKnownValIds = STAKING_CONFIG[config.chainId]?.extractKnownValIds
77
73
 
78
74
  let discoveredAssets: AssetInfo[]
79
75
  let knownValidatorIds: string[] | undefined
@@ -82,7 +78,6 @@ async function getTokenBalances(
82
78
  const ops = await explorerApi.getOperations(
83
79
  config,
84
80
  context.logger,
85
- currencyId,
86
81
  address,
87
82
  0,
88
83
  undefined,
@@ -90,7 +85,7 @@ async function getTokenBalances(
90
85
  undefined,
91
86
  undefined
92
87
  )
93
- knownValidatorIds = extractKnownValIds(currencyId, ops.lastCoinOperations, context.logger)
88
+ knownValidatorIds = extractKnownValIds(config.chainId, ops.lastCoinOperations, context.logger)
94
89
 
95
90
  discoveredAssets = []
96
91
  for (const operation of ops.lastTokenOperations) {
@@ -106,7 +101,6 @@ async function getTokenBalances(
106
101
  discoveredAssets = await explorerApi.discoverTokenAssets(
107
102
  config,
108
103
  context.logger,
109
- currencyId,
110
104
  address,
111
105
  scanMinHeight
112
106
  )
@@ -163,7 +157,7 @@ async function getTokenBalances(
163
157
  chunk.map(async (contract) => {
164
158
  const asset = assets.get(contract)
165
159
  if (asset === undefined) throw new Error(`No asset defined for contract ${contract}`)
166
- const balance = await nodeApi.getTokenBalance(currencyId, address, contract)
160
+ const balance = await nodeApi.getTokenBalance(address, contract)
167
161
  return { asset, value: BigInt(balance.toFixed(0)) }
168
162
  })
169
163
  )
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import type { EvmContext } from '../config'
4
+ import type { ChainId, EvmContext } from '../config'
5
5
  import type { BlockReceiptInfo, PrefetchedBlockTransaction } from '../network/node/types'
6
6
  import type { InternalTxsByHash } from './internalTransactionsFetcher'
7
7
  import type {
@@ -14,7 +14,7 @@ import type {
14
14
  import type { Logger } from '@ledgerhq/coin-module-framework/config'
15
15
  import { promiseAllBatched } from '@ledgerhq/coin-module-framework/promises'
16
16
  import { rpcTransactionToBlockOperations } from '../adapters/blockOperations'
17
- import { DEFAULT_INTERNAL_TX_SOURCES } from '../config'
17
+ import { CHAIN_ID, DEFAULT_INTERNAL_TX_SOURCES } from '../config'
18
18
  import { UnsupportedRpcMethodError } from '../errors'
19
19
  import { buildSmartContractDetails, safeEncodeEIP55 } from '../logic-public'
20
20
  import { getNodeApi } from '../network/node'
@@ -35,17 +35,16 @@ export async function getBlock(
35
35
  // per `getBlockInternalTxsSources`) in parallel with the receipts, and merge them into the
36
36
  // block transactions
37
37
  const config = await context.config(currencyId)
38
- const nodeApi = getNodeApi(config, currencyId, context.logger)
38
+ const nodeApi = getNodeApi(config, context.logger)
39
39
  const internalTxSources = config.getBlockInternalTxsSources ?? DEFAULT_INTERNAL_TX_SOURCES
40
40
  const fetchInternalTxs = createInternalTransactionsFetcher(
41
41
  config,
42
42
  nodeApi,
43
- currencyId,
44
43
  internalTxSources,
45
44
  context.logger
46
45
  )
47
46
 
48
- const result = await nodeApi.getBlockByHeight(currencyId, height, true)
47
+ const result = await nodeApi.getBlockByHeight(height, true)
49
48
 
50
49
  const info: BlockInfo = {
51
50
  height: result.height,
@@ -68,7 +67,8 @@ export async function getBlock(
68
67
  // source that is one metered `txlistinternal` call per empty block.
69
68
  const [transactions, internalTxs] = await Promise.all([
70
69
  getTransactionsFromNode(
71
- currencyId,
70
+ config.chainId,
71
+ config.name,
72
72
  transactionHashes,
73
73
  nodeApi,
74
74
  result.height,
@@ -125,7 +125,8 @@ function mergeInternalTransactions(
125
125
  }
126
126
 
127
127
  async function getTransactionsFromNode(
128
- currencyId: string,
128
+ chainId: ChainId,
129
+ chainName: string,
129
130
  transactionHashes: string[],
130
131
  nodeApi: ReturnType<typeof getNodeApi>,
131
132
  blockHeight: number,
@@ -135,7 +136,8 @@ async function getTransactionsFromNode(
135
136
  if (transactionHashes.length === 0) return []
136
137
 
137
138
  const bulkTransactions = await getTransactionsFromPrefetchedData(
138
- currencyId,
139
+ chainId,
140
+ chainName,
139
141
  blockHeight,
140
142
  prefetchedTransactions,
141
143
  nodeApi,
@@ -154,14 +156,15 @@ async function getTransactionsFromNode(
154
156
  const transactionResults = await promiseAllBatched(
155
157
  MAX_CONCURRENCY,
156
158
  transactionHashes,
157
- (txHash: string) => getTransactionFromHash(currencyId, txHash, nodeApi, logger)
159
+ (txHash: string) => getTransactionFromHash(chainId, txHash, nodeApi, logger)
158
160
  )
159
161
 
160
162
  return transactionResults.filter((tx): tx is BlockTransaction => tx !== null)
161
163
  }
162
164
 
163
165
  async function getTransactionsFromPrefetchedData(
164
- currencyId: string,
166
+ chainId: ChainId,
167
+ chainName: string,
165
168
  blockHeight: number,
166
169
  prefetchedTransactions: PrefetchedBlockTransaction[] | undefined,
167
170
  nodeApi: ReturnType<typeof getNodeApi>,
@@ -171,7 +174,7 @@ async function getTransactionsFromPrefetchedData(
171
174
  return null
172
175
 
173
176
  try {
174
- const receipts = await nodeApi.getBlockReceipts(currencyId, blockHeight)
177
+ const receipts = await nodeApi.getBlockReceipts(blockHeight)
175
178
  const receiptsByHash = new Map(receipts.map((receipt) => [receipt.hash, receipt]))
176
179
 
177
180
  const transactions: BlockTransaction[] = []
@@ -182,7 +185,7 @@ async function getTransactionsFromPrefetchedData(
182
185
  transactions.push({
183
186
  ...blockTx,
184
187
  operations: applyChainSpecificCorrections(
185
- currencyId,
188
+ chainId,
186
189
  blockTx.operations,
187
190
  receipt.type,
188
191
  logger
@@ -196,7 +199,7 @@ async function getTransactionsFromPrefetchedData(
196
199
  throw error
197
200
 
198
201
  logger('warn', 'EVM getBlock fallback: eth_getBlockReceipts unsupported', {
199
- currencyId,
202
+ currency: chainName,
200
203
  blockHeight,
201
204
  error: error.rawError,
202
205
  })
@@ -239,19 +242,19 @@ function prefetchedTransactionToBlockTransaction(
239
242
  }
240
243
 
241
244
  async function getTransactionFromHash(
242
- currencyId: string,
245
+ chainId: ChainId,
243
246
  txHash: string,
244
247
  nodeApi: ReturnType<typeof getNodeApi>,
245
248
  logger: Logger
246
249
  ): Promise<BlockTransaction | null> {
247
- const txInfo = await nodeApi.getTransaction(currencyId, txHash)
250
+ const txInfo = await nodeApi.getTransaction(txHash)
248
251
 
249
252
  const failed = txInfo.status === 0
250
253
  const fees =
251
254
  BigInt(txInfo.gasUsed) * BigInt(txInfo.gasPrice) + (txInfo.l1Fee ? BigInt(txInfo.l1Fee) : 0n)
252
255
 
253
256
  const rawOperations = rpcTransactionToBlockOperations(txInfo, logger)
254
- const operations = applyChainSpecificCorrections(currencyId, rawOperations, txInfo.type, logger)
257
+ const operations = applyChainSpecificCorrections(chainId, rawOperations, txInfo.type, logger)
255
258
 
256
259
  const details = buildSmartContractDetails(txInfo.to, txInfo.input, logger, txInfo.contractAddress)
257
260
 
@@ -266,13 +269,13 @@ async function getTransactionFromHash(
266
269
  }
267
270
 
268
271
  function applyChainSpecificCorrections(
269
- currencyId: string,
272
+ chainId: ChainId,
270
273
  operations: BlockOperation[],
271
274
  receiptType: number | undefined,
272
275
  logger: Logger
273
276
  ): BlockOperation[] {
274
- switch (currencyId) {
275
- case 'zksync':
277
+ switch (chainId) {
278
+ case CHAIN_ID.ZKSYNC:
276
279
  return rewriteZkSyncL1ToL2DepositOps(operations, receiptType, logger)
277
280
  default:
278
281
  return operations
@@ -11,8 +11,8 @@ export async function getBlockInfo(
11
11
  height: number
12
12
  ): Promise<BlockInfo> {
13
13
  const config = await context.config(currencyId)
14
- const api = getNodeApi(config, currencyId, context.logger)
15
- const result = await api.getBlockByHeight(currencyId, height)
14
+ const api = getNodeApi(config, context.logger)
15
+ const result = await api.getBlockByHeight(height)
16
16
 
17
17
  const blockInfo: BlockInfo = {
18
18
  height: result.height,
@@ -10,9 +10,6 @@ export async function getNextSequence(
10
10
  address: string
11
11
  ): Promise<bigint> {
12
12
  const config = await context.config(currencyId)
13
- const txCount = await getNodeApi(config, currencyId, context.logger).getTransactionCount(
14
- currencyId,
15
- address
16
- )
13
+ const txCount = await getNodeApi(config, context.logger).getTransactionCount(address)
17
14
  return typeof txCount === 'number' ? BigInt(txCount) : txCount
18
15
  }