@ledgerhq/coin-evm 10.1.0 → 15.2.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 (463) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/docs/getBlock-internal-txs-schema.md +2 -2
  3. package/docs/network/node/index.md +1 -1
  4. package/lib/adapters/etherscan.d.ts +2 -1
  5. package/lib/adapters/etherscan.d.ts.map +1 -1
  6. package/lib/adapters/etherscan.js +16 -2
  7. package/lib/adapters/etherscan.js.map +1 -1
  8. package/lib/adapters/ledger.d.ts +2 -1
  9. package/lib/adapters/ledger.d.ts.map +1 -1
  10. package/lib/adapters/ledger.js +4 -2
  11. package/lib/adapters/ledger.js.map +1 -1
  12. package/lib/api/index.d.ts.map +1 -1
  13. package/lib/api/index.js +1 -2
  14. package/lib/api/index.js.map +1 -1
  15. package/lib/chains.d.ts +95 -0
  16. package/lib/chains.d.ts.map +1 -0
  17. package/lib/chains.js +99 -0
  18. package/lib/chains.js.map +1 -0
  19. package/lib/config.d.ts +4 -1
  20. package/lib/config.d.ts.map +1 -1
  21. package/lib/config.js +3 -1
  22. package/lib/config.js.map +1 -1
  23. package/lib/logic/broadcast.js +2 -2
  24. package/lib/logic/broadcast.js.map +1 -1
  25. package/lib/logic/common.d.ts +1 -1
  26. package/lib/logic/common.d.ts.map +1 -1
  27. package/lib/logic/common.js +11 -11
  28. package/lib/logic/common.js.map +1 -1
  29. package/lib/logic/craftTransaction.d.ts.map +1 -1
  30. package/lib/logic/craftTransaction.js +3 -3
  31. package/lib/logic/craftTransaction.js.map +1 -1
  32. package/lib/logic/estimateFees.d.ts.map +1 -1
  33. package/lib/logic/estimateFees.js +7 -7
  34. package/lib/logic/estimateFees.js.map +1 -1
  35. package/lib/logic/getBalance.d.ts.map +1 -1
  36. package/lib/logic/getBalance.js +9 -9
  37. package/lib/logic/getBalance.js.map +1 -1
  38. package/lib/logic/getBlock.d.ts.map +1 -1
  39. package/lib/logic/getBlock.js +38 -21
  40. package/lib/logic/getBlock.js.map +1 -1
  41. package/lib/logic/getBlockInfo.js +2 -2
  42. package/lib/logic/getBlockInfo.js.map +1 -1
  43. package/lib/logic/getNextSequence.d.ts.map +1 -1
  44. package/lib/logic/getNextSequence.js +1 -1
  45. package/lib/logic/getNextSequence.js.map +1 -1
  46. package/lib/logic/getStakes.d.ts.map +1 -1
  47. package/lib/logic/getStakes.js +10 -10
  48. package/lib/logic/getStakes.js.map +1 -1
  49. package/lib/logic/internalTransactionsFetcher.d.ts +2 -2
  50. package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
  51. package/lib/logic/internalTransactionsFetcher.js +8 -8
  52. package/lib/logic/internalTransactionsFetcher.js.map +1 -1
  53. package/lib/logic/lastBlock.js +2 -2
  54. package/lib/logic/lastBlock.js.map +1 -1
  55. package/lib/logic/listOperations.d.ts.map +1 -1
  56. package/lib/logic/listOperations.js +3 -1
  57. package/lib/logic/listOperations.js.map +1 -1
  58. package/lib/logic/validateIntent.d.ts.map +1 -1
  59. package/lib/logic/validateIntent.js +9 -9
  60. package/lib/logic/validateIntent.js.map +1 -1
  61. package/lib/logic.d.ts +1 -1
  62. package/lib/logic.d.ts.map +1 -1
  63. package/lib/logic.js +14 -13
  64. package/lib/logic.js.map +1 -1
  65. package/lib/network/explorer/etherscan.d.ts +2 -3
  66. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  67. package/lib/network/explorer/etherscan.js +6 -8
  68. package/lib/network/explorer/etherscan.js.map +1 -1
  69. package/lib/network/explorer/ledger.d.ts.map +1 -1
  70. package/lib/network/explorer/ledger.js +5 -5
  71. package/lib/network/explorer/ledger.js.map +1 -1
  72. package/lib/network/explorer/types.d.ts +2 -2
  73. package/lib/network/explorer/types.d.ts.map +1 -1
  74. package/lib/network/explorer/types.js.map +1 -1
  75. package/lib/network/node/explorerProxy.d.ts.map +1 -1
  76. package/lib/network/node/explorerProxy.js +14 -12
  77. package/lib/network/node/explorerProxy.js.map +1 -1
  78. package/lib/network/node/index.d.ts +1 -1
  79. package/lib/network/node/index.d.ts.map +1 -1
  80. package/lib/network/node/index.js +7 -7
  81. package/lib/network/node/index.js.map +1 -1
  82. package/lib/network/node/ledger.d.ts +3 -1
  83. package/lib/network/node/ledger.d.ts.map +1 -1
  84. package/lib/network/node/ledger.js +32 -22
  85. package/lib/network/node/ledger.js.map +1 -1
  86. package/lib/network/node/rpc.common.d.ts +1 -1
  87. package/lib/network/node/rpc.common.d.ts.map +1 -1
  88. package/lib/network/node/rpc.common.js +67 -39
  89. package/lib/network/node/rpc.common.js.map +1 -1
  90. package/lib/network/node/types.d.ts +18 -16
  91. package/lib/network/node/types.d.ts.map +1 -1
  92. package/lib/network/node/types.js.map +1 -1
  93. package/lib/network/node/withNodeSources.d.ts.map +1 -1
  94. package/lib/network/node/withNodeSources.js +15 -15
  95. package/lib/network/node/withNodeSources.js.map +1 -1
  96. package/lib/staking/abis.d.ts +3 -2
  97. package/lib/staking/abis.d.ts.map +1 -1
  98. package/lib/staking/abis.js +10 -9
  99. package/lib/staking/abis.js.map +1 -1
  100. package/lib/staking/contracts.d.ts +3 -2
  101. package/lib/staking/contracts.d.ts.map +1 -1
  102. package/lib/staking/contracts.js +11 -10
  103. package/lib/staking/contracts.js.map +1 -1
  104. package/lib/staking/detectOperationType.d.ts +2 -1
  105. package/lib/staking/detectOperationType.d.ts.map +1 -1
  106. package/lib/staking/detectOperationType.js +7 -7
  107. package/lib/staking/detectOperationType.js.map +1 -1
  108. package/lib/staking/encoder.d.ts +2 -1
  109. package/lib/staking/encoder.d.ts.map +1 -1
  110. package/lib/staking/encoder.js +8 -8
  111. package/lib/staking/encoder.js.map +1 -1
  112. package/lib/staking/fetchers.d.ts +2 -1
  113. package/lib/staking/fetchers.d.ts.map +1 -1
  114. package/lib/staking/fetchers.js +27 -27
  115. package/lib/staking/fetchers.js.map +1 -1
  116. package/lib/staking/logic.d.ts +6 -6
  117. package/lib/staking/logic.d.ts.map +1 -1
  118. package/lib/staking/logic.js +14 -13
  119. package/lib/staking/logic.js.map +1 -1
  120. package/lib/staking/operations/index.d.ts +2 -1
  121. package/lib/staking/operations/index.d.ts.map +1 -1
  122. package/lib/staking/operations/index.js +30 -28
  123. package/lib/staking/operations/index.js.map +1 -1
  124. package/lib/staking/prepareIntents.d.ts +1 -1
  125. package/lib/staking/prepareIntents.d.ts.map +1 -1
  126. package/lib/staking/prepareIntents.js +11 -10
  127. package/lib/staking/prepareIntents.js.map +1 -1
  128. package/lib/staking/redelegations.d.ts +4 -4
  129. package/lib/staking/redelegations.d.ts.map +1 -1
  130. package/lib/staking/redelegations.js +18 -20
  131. package/lib/staking/redelegations.js.map +1 -1
  132. package/lib/staking/rewards.d.ts +1 -1
  133. package/lib/staking/rewards.d.ts.map +1 -1
  134. package/lib/staking/rewards.js +2 -2
  135. package/lib/staking/rewards.js.map +1 -1
  136. package/lib/staking/rewardsFromReceipt.d.ts +2 -1
  137. package/lib/staking/rewardsFromReceipt.d.ts.map +1 -1
  138. package/lib/staking/rewardsFromReceipt.js +2 -2
  139. package/lib/staking/rewardsFromReceipt.js.map +1 -1
  140. package/lib/staking/transactionData.d.ts +2 -1
  141. package/lib/staking/transactionData.d.ts.map +1 -1
  142. package/lib/staking/transactionData.js +6 -6
  143. package/lib/staking/transactionData.js.map +1 -1
  144. package/lib/staking/unbondings.d.ts +1 -1
  145. package/lib/staking/unbondings.d.ts.map +1 -1
  146. package/lib/staking/unbondings.js +2 -2
  147. package/lib/staking/unbondings.js.map +1 -1
  148. package/lib/staking/validators/index.d.ts +14 -14
  149. package/lib/staking/validators/index.d.ts.map +1 -1
  150. package/lib/staking/validators/index.js +39 -38
  151. package/lib/staking/validators/index.js.map +1 -1
  152. package/lib/staking/validators/monad.d.ts +5 -5
  153. package/lib/staking/validators/monad.d.ts.map +1 -1
  154. package/lib/staking/validators/monad.js +31 -33
  155. package/lib/staking/validators/monad.js.map +1 -1
  156. package/lib/staking/validators/monadResolver.d.ts +1 -1
  157. package/lib/staking/validators/monadResolver.d.ts.map +1 -1
  158. package/lib/staking/validators/monadResolver.js +4 -4
  159. package/lib/staking/validators/monadResolver.js.map +1 -1
  160. package/lib/staking/validators/sei.js +2 -2
  161. package/lib/staking/validators/sei.js.map +1 -1
  162. package/lib/staking/validators/somnia.d.ts +4 -4
  163. package/lib/staking/validators/somnia.d.ts.map +1 -1
  164. package/lib/staking/validators/somnia.js +22 -22
  165. package/lib/staking/validators/somnia.js.map +1 -1
  166. package/lib/staking/validators/types.d.ts +1 -1
  167. package/lib/staking/validators/types.d.ts.map +1 -1
  168. package/lib/staking/validators/zero_gravity.d.ts +1 -1
  169. package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
  170. package/lib/staking/validators/zero_gravity.js +7 -7
  171. package/lib/staking/validators/zero_gravity.js.map +1 -1
  172. package/lib/types/staking.d.ts +5 -6
  173. package/lib/types/staking.d.ts.map +1 -1
  174. package/lib-es/adapters/etherscan.d.ts +2 -1
  175. package/lib-es/adapters/etherscan.d.ts.map +1 -1
  176. package/lib-es/adapters/etherscan.js +16 -2
  177. package/lib-es/adapters/etherscan.js.map +1 -1
  178. package/lib-es/adapters/ledger.d.ts +2 -1
  179. package/lib-es/adapters/ledger.d.ts.map +1 -1
  180. package/lib-es/adapters/ledger.js +4 -2
  181. package/lib-es/adapters/ledger.js.map +1 -1
  182. package/lib-es/api/index.d.ts.map +1 -1
  183. package/lib-es/api/index.js +1 -2
  184. package/lib-es/api/index.js.map +1 -1
  185. package/lib-es/chains.d.ts +95 -0
  186. package/lib-es/chains.d.ts.map +1 -0
  187. package/lib-es/chains.js +96 -0
  188. package/lib-es/chains.js.map +1 -0
  189. package/lib-es/config.d.ts +4 -1
  190. package/lib-es/config.d.ts.map +1 -1
  191. package/lib-es/config.js +1 -0
  192. package/lib-es/config.js.map +1 -1
  193. package/lib-es/logic/broadcast.js +2 -2
  194. package/lib-es/logic/broadcast.js.map +1 -1
  195. package/lib-es/logic/common.d.ts +1 -1
  196. package/lib-es/logic/common.d.ts.map +1 -1
  197. package/lib-es/logic/common.js +11 -11
  198. package/lib-es/logic/common.js.map +1 -1
  199. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  200. package/lib-es/logic/craftTransaction.js +3 -3
  201. package/lib-es/logic/craftTransaction.js.map +1 -1
  202. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  203. package/lib-es/logic/estimateFees.js +7 -7
  204. package/lib-es/logic/estimateFees.js.map +1 -1
  205. package/lib-es/logic/getBalance.d.ts.map +1 -1
  206. package/lib-es/logic/getBalance.js +9 -9
  207. package/lib-es/logic/getBalance.js.map +1 -1
  208. package/lib-es/logic/getBlock.d.ts.map +1 -1
  209. package/lib-es/logic/getBlock.js +39 -22
  210. package/lib-es/logic/getBlock.js.map +1 -1
  211. package/lib-es/logic/getBlockInfo.js +2 -2
  212. package/lib-es/logic/getBlockInfo.js.map +1 -1
  213. package/lib-es/logic/getNextSequence.d.ts.map +1 -1
  214. package/lib-es/logic/getNextSequence.js +1 -1
  215. package/lib-es/logic/getNextSequence.js.map +1 -1
  216. package/lib-es/logic/getStakes.d.ts.map +1 -1
  217. package/lib-es/logic/getStakes.js +10 -10
  218. package/lib-es/logic/getStakes.js.map +1 -1
  219. package/lib-es/logic/internalTransactionsFetcher.d.ts +2 -2
  220. package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
  221. package/lib-es/logic/internalTransactionsFetcher.js +8 -8
  222. package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
  223. package/lib-es/logic/lastBlock.js +2 -2
  224. package/lib-es/logic/lastBlock.js.map +1 -1
  225. package/lib-es/logic/listOperations.d.ts.map +1 -1
  226. package/lib-es/logic/listOperations.js +3 -1
  227. package/lib-es/logic/listOperations.js.map +1 -1
  228. package/lib-es/logic/validateIntent.d.ts.map +1 -1
  229. package/lib-es/logic/validateIntent.js +9 -9
  230. package/lib-es/logic/validateIntent.js.map +1 -1
  231. package/lib-es/logic.d.ts +1 -1
  232. package/lib-es/logic.d.ts.map +1 -1
  233. package/lib-es/logic.js +14 -13
  234. package/lib-es/logic.js.map +1 -1
  235. package/lib-es/network/explorer/etherscan.d.ts +2 -3
  236. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  237. package/lib-es/network/explorer/etherscan.js +6 -8
  238. package/lib-es/network/explorer/etherscan.js.map +1 -1
  239. package/lib-es/network/explorer/ledger.d.ts.map +1 -1
  240. package/lib-es/network/explorer/ledger.js +5 -5
  241. package/lib-es/network/explorer/ledger.js.map +1 -1
  242. package/lib-es/network/explorer/types.d.ts +2 -2
  243. package/lib-es/network/explorer/types.d.ts.map +1 -1
  244. package/lib-es/network/explorer/types.js.map +1 -1
  245. package/lib-es/network/node/explorerProxy.d.ts.map +1 -1
  246. package/lib-es/network/node/explorerProxy.js +14 -12
  247. package/lib-es/network/node/explorerProxy.js.map +1 -1
  248. package/lib-es/network/node/index.d.ts +1 -1
  249. package/lib-es/network/node/index.d.ts.map +1 -1
  250. package/lib-es/network/node/index.js +7 -7
  251. package/lib-es/network/node/index.js.map +1 -1
  252. package/lib-es/network/node/ledger.d.ts +3 -1
  253. package/lib-es/network/node/ledger.d.ts.map +1 -1
  254. package/lib-es/network/node/ledger.js +32 -22
  255. package/lib-es/network/node/ledger.js.map +1 -1
  256. package/lib-es/network/node/rpc.common.d.ts +1 -1
  257. package/lib-es/network/node/rpc.common.d.ts.map +1 -1
  258. package/lib-es/network/node/rpc.common.js +67 -39
  259. package/lib-es/network/node/rpc.common.js.map +1 -1
  260. package/lib-es/network/node/types.d.ts +18 -16
  261. package/lib-es/network/node/types.d.ts.map +1 -1
  262. package/lib-es/network/node/types.js.map +1 -1
  263. package/lib-es/network/node/withNodeSources.d.ts.map +1 -1
  264. package/lib-es/network/node/withNodeSources.js +15 -15
  265. package/lib-es/network/node/withNodeSources.js.map +1 -1
  266. package/lib-es/staking/abis.d.ts +3 -2
  267. package/lib-es/staking/abis.d.ts.map +1 -1
  268. package/lib-es/staking/abis.js +10 -9
  269. package/lib-es/staking/abis.js.map +1 -1
  270. package/lib-es/staking/contracts.d.ts +3 -2
  271. package/lib-es/staking/contracts.d.ts.map +1 -1
  272. package/lib-es/staking/contracts.js +11 -10
  273. package/lib-es/staking/contracts.js.map +1 -1
  274. package/lib-es/staking/detectOperationType.d.ts +2 -1
  275. package/lib-es/staking/detectOperationType.d.ts.map +1 -1
  276. package/lib-es/staking/detectOperationType.js +7 -7
  277. package/lib-es/staking/detectOperationType.js.map +1 -1
  278. package/lib-es/staking/encoder.d.ts +2 -1
  279. package/lib-es/staking/encoder.d.ts.map +1 -1
  280. package/lib-es/staking/encoder.js +8 -8
  281. package/lib-es/staking/encoder.js.map +1 -1
  282. package/lib-es/staking/fetchers.d.ts +2 -1
  283. package/lib-es/staking/fetchers.d.ts.map +1 -1
  284. package/lib-es/staking/fetchers.js +27 -27
  285. package/lib-es/staking/fetchers.js.map +1 -1
  286. package/lib-es/staking/logic.d.ts +6 -6
  287. package/lib-es/staking/logic.d.ts.map +1 -1
  288. package/lib-es/staking/logic.js +14 -13
  289. package/lib-es/staking/logic.js.map +1 -1
  290. package/lib-es/staking/operations/index.d.ts +2 -1
  291. package/lib-es/staking/operations/index.d.ts.map +1 -1
  292. package/lib-es/staking/operations/index.js +30 -28
  293. package/lib-es/staking/operations/index.js.map +1 -1
  294. package/lib-es/staking/prepareIntents.d.ts +1 -1
  295. package/lib-es/staking/prepareIntents.d.ts.map +1 -1
  296. package/lib-es/staking/prepareIntents.js +11 -10
  297. package/lib-es/staking/prepareIntents.js.map +1 -1
  298. package/lib-es/staking/redelegations.d.ts +4 -4
  299. package/lib-es/staking/redelegations.d.ts.map +1 -1
  300. package/lib-es/staking/redelegations.js +18 -20
  301. package/lib-es/staking/redelegations.js.map +1 -1
  302. package/lib-es/staking/rewards.d.ts +1 -1
  303. package/lib-es/staking/rewards.d.ts.map +1 -1
  304. package/lib-es/staking/rewards.js +2 -2
  305. package/lib-es/staking/rewards.js.map +1 -1
  306. package/lib-es/staking/rewardsFromReceipt.d.ts +2 -1
  307. package/lib-es/staking/rewardsFromReceipt.d.ts.map +1 -1
  308. package/lib-es/staking/rewardsFromReceipt.js +2 -2
  309. package/lib-es/staking/rewardsFromReceipt.js.map +1 -1
  310. package/lib-es/staking/transactionData.d.ts +2 -1
  311. package/lib-es/staking/transactionData.d.ts.map +1 -1
  312. package/lib-es/staking/transactionData.js +6 -6
  313. package/lib-es/staking/transactionData.js.map +1 -1
  314. package/lib-es/staking/unbondings.d.ts +1 -1
  315. package/lib-es/staking/unbondings.d.ts.map +1 -1
  316. package/lib-es/staking/unbondings.js +2 -2
  317. package/lib-es/staking/unbondings.js.map +1 -1
  318. package/lib-es/staking/validators/index.d.ts +14 -14
  319. package/lib-es/staking/validators/index.d.ts.map +1 -1
  320. package/lib-es/staking/validators/index.js +39 -38
  321. package/lib-es/staking/validators/index.js.map +1 -1
  322. package/lib-es/staking/validators/monad.d.ts +5 -5
  323. package/lib-es/staking/validators/monad.d.ts.map +1 -1
  324. package/lib-es/staking/validators/monad.js +31 -33
  325. package/lib-es/staking/validators/monad.js.map +1 -1
  326. package/lib-es/staking/validators/monadResolver.d.ts +1 -1
  327. package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
  328. package/lib-es/staking/validators/monadResolver.js +4 -4
  329. package/lib-es/staking/validators/monadResolver.js.map +1 -1
  330. package/lib-es/staking/validators/sei.js +2 -2
  331. package/lib-es/staking/validators/sei.js.map +1 -1
  332. package/lib-es/staking/validators/somnia.d.ts +4 -4
  333. package/lib-es/staking/validators/somnia.d.ts.map +1 -1
  334. package/lib-es/staking/validators/somnia.js +22 -22
  335. package/lib-es/staking/validators/somnia.js.map +1 -1
  336. package/lib-es/staking/validators/types.d.ts +1 -1
  337. package/lib-es/staking/validators/types.d.ts.map +1 -1
  338. package/lib-es/staking/validators/zero_gravity.d.ts +1 -1
  339. package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
  340. package/lib-es/staking/validators/zero_gravity.js +7 -7
  341. package/lib-es/staking/validators/zero_gravity.js.map +1 -1
  342. package/lib-es/types/staking.d.ts +5 -6
  343. package/lib-es/types/staking.d.ts.map +1 -1
  344. package/package.json +2 -2
  345. package/src/adapters/etherscan.test.ts +91 -43
  346. package/src/adapters/etherscan.ts +18 -2
  347. package/src/adapters/ledger.test.ts +106 -31
  348. package/src/adapters/ledger.ts +5 -2
  349. package/src/api/index.ts +1 -2
  350. package/src/api/{getBlock.integ.test.ts → tests/getBlock.integ.test.ts} +5 -4
  351. package/src/api/{index.arbitrum.integ.test.ts → tests/index.arbitrum.integ.test.ts} +3 -3
  352. package/src/api/{index.arc.integ.test.ts → tests/index.arc.integ.test.ts} +3 -3
  353. package/src/api/{index.avalanche_c_chain_fuji.integ.test.ts → tests/index.avalanche_c_chain_fuji.integ.test.ts} +3 -3
  354. package/src/api/{index.cronos.integ.test.ts → tests/index.cronos.integ.test.ts} +3 -3
  355. package/src/api/{index.flare.integ.test.ts → tests/index.flare.integ.test.ts} +3 -3
  356. package/src/api/{index.integ.test.ts → tests/index.integ.test.ts} +3 -3
  357. package/src/api/{index.linea.integ.test.ts → tests/index.linea.integ.test.ts} +3 -3
  358. package/src/api/{index.monad_testnet.integ.test.ts → tests/index.monad_testnet.integ.test.ts} +6 -6
  359. package/src/api/{index.optimism.integ.test.ts → tests/index.optimism.integ.test.ts} +3 -3
  360. package/src/api/{index.rsk.integ.test.ts → tests/index.rsk.integ.test.ts} +3 -3
  361. package/src/api/{index.shape.integ.test.ts → tests/index.shape.integ.test.ts} +3 -3
  362. package/src/api/{index.somnia.integ.test.ts → tests/index.somnia.integ.test.ts} +3 -3
  363. package/src/api/{index.test.ts → tests/index.test.ts} +4 -4
  364. package/src/api/{index.zksync.integ.test.ts → tests/index.zksync.integ.test.ts} +2 -2
  365. package/src/chains.test.ts +12 -0
  366. package/src/chains.ts +98 -0
  367. package/src/config.ts +5 -1
  368. package/src/fixtures/staking.fixtures.ts +13 -0
  369. package/src/logic/broadcast.ts +2 -2
  370. package/src/logic/common.ts +10 -11
  371. package/src/logic/craftTransaction.ts +2 -3
  372. package/src/logic/estimateFees.ts +6 -23
  373. package/src/logic/getBalance.ts +7 -13
  374. package/src/logic/getBlock.ts +59 -23
  375. package/src/logic/getBlockInfo.ts +2 -2
  376. package/src/logic/getNextSequence.ts +1 -4
  377. package/src/logic/getStakes.ts +11 -12
  378. package/src/logic/internalTransactionsFetcher.ts +6 -8
  379. package/src/logic/lastBlock.ts +2 -2
  380. package/src/logic/listOperations.ts +2 -1
  381. package/src/logic/tests/broadcast.test.ts +5 -5
  382. package/src/logic/tests/broadcastSource.test.ts +1 -4
  383. package/src/logic/tests/common.test.ts +18 -34
  384. package/src/logic/tests/craftTransaction.test.ts +14 -7
  385. package/src/logic/tests/estimateFees.test.ts +17 -8
  386. package/src/logic/tests/getBalance.test.ts +18 -34
  387. package/src/logic/tests/getBlock.test.ts +195 -80
  388. package/src/logic/tests/getBlockInfo.test.ts +2 -2
  389. package/src/logic/tests/getNextSequence.test.ts +2 -2
  390. package/src/logic/tests/getStakes.test.ts +28 -16
  391. package/src/logic/tests/internalTransactionsFetcher.test.ts +6 -6
  392. package/src/logic/tests/lastBlock.test.ts +4 -7
  393. package/src/logic/tests/listOperations.test.ts +8 -7
  394. package/src/logic/tests/validateIntent.test.ts +49 -3
  395. package/src/logic/validateIntent.ts +8 -10
  396. package/src/logic.test.ts +13 -5
  397. package/src/logic.ts +13 -13
  398. package/src/network/explorer/etherscan.ts +8 -24
  399. package/src/network/explorer/ledger.ts +2 -5
  400. package/src/network/explorer/types.ts +0 -2
  401. package/src/network/node/explorerProxy.ts +14 -12
  402. package/src/network/node/index.ts +11 -8
  403. package/src/network/node/ledger.ts +32 -34
  404. package/src/network/node/rpc.common.ts +79 -86
  405. package/src/network/node/types.ts +16 -31
  406. package/src/network/node/withNodeSources.ts +23 -26
  407. package/src/network/{explorer → tests/explorer}/etherscan.test.ts +16 -65
  408. package/src/network/{explorer → tests/explorer}/index.test.ts +8 -8
  409. package/src/network/{explorer → tests/explorer}/ledger.test.ts +34 -142
  410. package/src/network/{explorer → tests/explorer}/types.test.ts +1 -1
  411. package/src/network/{gasTracker → tests/gasTracker}/index.test.ts +3 -3
  412. package/src/network/{gasTracker → tests/gasTracker}/ledger.test.ts +4 -4
  413. package/src/network/{gasTracker → tests/gasTracker}/types.test.ts +1 -1
  414. package/src/network/{node → tests/node}/explorerProxy.test.ts +22 -24
  415. package/src/network/{node → tests/node}/gethCallTracerToTraceBlockItems.test.ts +4 -4
  416. package/src/network/tests/node/index.memoization.test.ts +70 -0
  417. package/src/network/{node → tests/node}/index.test.ts +4 -6
  418. package/src/network/{node → tests/node}/ledger.test.ts +69 -74
  419. package/src/network/{node → tests/node}/node.fixtures.ts +1 -1
  420. package/src/network/{node → tests/node}/rpc.errors.test.ts +1 -1
  421. package/src/network/{node → tests/node}/rpc.test.ts +100 -119
  422. package/src/network/{node → tests/node}/types.test.ts +1 -1
  423. package/src/network/{node → tests/node}/withNodeSources.test.ts +10 -12
  424. package/src/network/{withRetries.test.ts → tests/withRetries.test.ts} +2 -2
  425. package/src/staking/abis.test.ts +24 -28
  426. package/src/staking/abis.ts +12 -10
  427. package/src/staking/contracts.test.ts +20 -8
  428. package/src/staking/contracts.ts +12 -11
  429. package/src/staking/detectOperationType.test.ts +16 -13
  430. package/src/staking/detectOperationType.ts +9 -8
  431. package/src/staking/encoder.test.ts +38 -27
  432. package/src/staking/encoder.ts +9 -8
  433. package/src/staking/fetchers.ts +28 -39
  434. package/src/staking/logic.test.ts +34 -32
  435. package/src/staking/logic.ts +14 -14
  436. package/src/staking/operations/index.test.ts +48 -39
  437. package/src/staking/operations/index.ts +31 -28
  438. package/src/staking/prepareIntents.test.ts +14 -34
  439. package/src/staking/prepareIntents.ts +10 -13
  440. package/src/staking/redelegations.test.ts +73 -131
  441. package/src/staking/redelegations.ts +12 -26
  442. package/src/staking/rewards.test.ts +19 -21
  443. package/src/staking/rewards.ts +1 -2
  444. package/src/staking/rewardsFromReceipt.test.ts +9 -8
  445. package/src/staking/rewardsFromReceipt.ts +3 -2
  446. package/src/staking/transactionData.test.ts +35 -25
  447. package/src/staking/transactionData.ts +7 -6
  448. package/src/staking/unbondings.test.ts +26 -20
  449. package/src/staking/unbondings.ts +1 -2
  450. package/src/staking/validators/index.ts +45 -51
  451. package/src/staking/validators/monad.test.ts +52 -54
  452. package/src/staking/validators/monad.ts +31 -37
  453. package/src/staking/validators/monadResolver.ts +2 -4
  454. package/src/staking/validators/sei.ts +2 -2
  455. package/src/staking/validators/somnia.test.ts +22 -19
  456. package/src/staking/validators/somnia.ts +20 -27
  457. package/src/staking/validators/types.ts +0 -1
  458. package/src/staking/validators/zero_gravity.test.ts +34 -49
  459. package/src/staking/validators/zero_gravity.ts +5 -11
  460. package/src/staking/validators.integ.test.ts +3 -5
  461. package/src/staking/validators.test.ts +56 -53
  462. package/src/types/staking.ts +3 -6
  463. package/src/network/node/index.memoization.test.ts +0 -63
@@ -7,12 +7,12 @@ import {
7
7
  createMockEvmConfigInfo,
8
8
  mkExternalNode,
9
9
  testLogger,
10
- } from '../../fixtures/context.fixtures'
10
+ } from '../../../fixtures/context.fixtures'
11
11
  import {
12
12
  createExplorerProxyNodeApi,
13
13
  getBlockFromExplorerProxy,
14
14
  getTransactionFromExplorerProxy,
15
- } from './explorerProxy'
15
+ } from '../../node/explorerProxy'
16
16
 
17
17
  jest.mock('axios')
18
18
  const mockAxiosGet = jest.mocked(axios.get)
@@ -29,27 +29,22 @@ describe('createExplorerProxyNodeApi', () => {
29
29
 
30
30
  describe('unsupported methods', () => {
31
31
  it.each([
32
- ['call', () => api.call('eth', { to: '0x', data: '0x' })],
33
- ['getCoinBalance', () => api.getCoinBalance('eth', '0x')],
34
- ['getTokenBalance', () => api.getTokenBalance('eth', '0x', '0x')],
35
- ['getTokenAllowance', () => api.getTokenAllowance('eth', '0x', '0x', '0x')],
36
- ['getTransactionCount', () => api.getTransactionCount('eth', '0x')],
32
+ ['call', () => api.call({ to: '0x', data: '0x' })],
33
+ ['getCoinBalance', () => api.getCoinBalance('0x')],
34
+ ['getTokenBalance', () => api.getTokenBalance('0x', '0x')],
35
+ ['getTokenAllowance', () => api.getTokenAllowance('0x', '0x', '0x')],
36
+ ['getTransactionCount', () => api.getTransactionCount('0x')],
37
37
  [
38
38
  'getGasEstimation',
39
- () => api.getGasEstimation('eth', '0x', { amount: new BigNumber(0), recipient: '0x' }),
39
+ () => api.getGasEstimation('0x', { amount: new BigNumber(0), recipient: '0x' }),
40
40
  ],
41
41
  [
42
42
  'getFeeData',
43
- () =>
44
- api.getFeeData(
45
- createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() }),
46
- 'eth',
47
- {}
48
- ),
43
+ () => api.getFeeData(createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() }), {}),
49
44
  ],
50
- ['broadcastTransaction', () => api.broadcastTransaction('eth', '0x')],
51
- ['getOptimismAdditionalFees', () => api.getOptimismAdditionalFees('eth', '0x')],
52
- ['getScrollAdditionalFees', () => api.getScrollAdditionalFees('eth', '0x')],
45
+ ['broadcastTransaction', () => api.broadcastTransaction('0x')],
46
+ ['getOptimismAdditionalFees', () => api.getOptimismAdditionalFees('0x')],
47
+ ['getScrollAdditionalFees', () => api.getScrollAdditionalFees('0x')],
53
48
  ] as const)(
54
49
  '%s rejects immediately with "not supported by explorer proxy"',
55
50
  async (_name, invoke) => {
@@ -61,7 +56,7 @@ describe('createExplorerProxyNodeApi', () => {
61
56
 
62
57
  describe('getBlockByHeight', () => {
63
58
  it('throws before hitting the network when height is a BlockFinalizationTag', async () => {
64
- await expect(api.getBlockByHeight('eth', 'latest')).rejects.toThrow(
59
+ await expect(api.getBlockByHeight('latest')).rejects.toThrow(
65
60
  'explorer proxy only supports numeric heights'
66
61
  )
67
62
  expect(mockAxiosGet).not.toHaveBeenCalled()
@@ -69,7 +64,7 @@ describe('createExplorerProxyNodeApi', () => {
69
64
 
70
65
  it('throws when the proxy returns null (block not found or malformed)', async () => {
71
66
  mockAxiosGet.mockResolvedValueOnce({ data: { result: null } })
72
- await expect(api.getBlockByHeight('eth', 1)).rejects.toThrow(
67
+ await expect(api.getBlockByHeight(1)).rejects.toThrow(
73
68
  'explorer proxy returned no result for block 1'
74
69
  )
75
70
  })
@@ -86,7 +81,7 @@ describe('createExplorerProxyNodeApi', () => {
86
81
  },
87
82
  },
88
83
  })
89
- const result = await api.getBlockByHeight('eth', 1)
84
+ const result = await api.getBlockByHeight(1)
90
85
  expect(result.hash).toBe('0xdeadbeef')
91
86
  expect(result.height).toBe(1)
92
87
  expect(result.transactionHashes).toEqual(['0xhash1'])
@@ -94,7 +89,7 @@ describe('createExplorerProxyNodeApi', () => {
94
89
 
95
90
  it('propagates network errors as a throw (via the null path)', async () => {
96
91
  mockAxiosGet.mockRejectedValueOnce(new Error('ECONNREFUSED'))
97
- await expect(api.getBlockByHeight('eth', 1)).rejects.toThrow(
92
+ await expect(api.getBlockByHeight(1)).rejects.toThrow(
98
93
  'explorer proxy returned no result for block 1'
99
94
  )
100
95
  })
@@ -105,7 +100,7 @@ describe('createExplorerProxyNodeApi', () => {
105
100
  mockAxiosGet
106
101
  .mockResolvedValueOnce({ data: { result: null } })
107
102
  .mockResolvedValueOnce({ data: { result: null } })
108
- await expect(api.getTransaction('eth', TX_HASH)).rejects.toThrow(
103
+ await expect(api.getTransaction(TX_HASH)).rejects.toThrow(
109
104
  `explorer proxy returned no result for tx ${TX_HASH}`
110
105
  )
111
106
  })
@@ -120,6 +115,7 @@ describe('createExplorerProxyNodeApi', () => {
120
115
  blockHash: '0xblockhash',
121
116
  nonce: '0x1',
122
117
  gasPrice: '0x3b9aca00',
118
+ gas: '0x11e72',
123
119
  value: '0x0',
124
120
  from: '0xaabbcc0000000000000000000000000000000001',
125
121
  to: '0xaabbcc0000000000000000000000000000000002',
@@ -140,15 +136,17 @@ describe('createExplorerProxyNodeApi', () => {
140
136
  },
141
137
  },
142
138
  })
143
- const result = await api.getTransaction('eth', TX_HASH)
139
+ const result = await api.getTransaction(TX_HASH)
144
140
  expect(result.hash).toBe(TX_HASH)
145
141
  expect(result.status).toBe(1)
146
142
  expect(result.erc20Transfers).toEqual([])
143
+ expect(result.gasLimit).toBe('73330')
144
+ expect(result.nonce).toBe(1)
147
145
  })
148
146
 
149
147
  it('propagates network errors as a throw (via the null path)', async () => {
150
148
  mockAxiosGet.mockRejectedValue(new Error('ECONNREFUSED'))
151
- await expect(api.getTransaction('eth', TX_HASH)).rejects.toThrow(
149
+ await expect(api.getTransaction(TX_HASH)).rejects.toThrow(
152
150
  `explorer proxy returned no result for tx ${TX_HASH}`
153
151
  )
154
152
  })
@@ -1,10 +1,10 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import type { TraceBlockItem } from './types'
5
- import { isTraceBlockItem } from '../../logic/predicates'
6
- import { gethCallTracerToTraceBlockItems } from './gethCallTracerToTraceBlockItems'
7
- import flareBlock0x36ffc39CallTracerTrace from './resources/flare-0x36ffc39-debug-trace-block-call-tracer.json'
4
+ import type { TraceBlockItem } from '../../node/types'
5
+ import { isTraceBlockItem } from '../../../logic/predicates'
6
+ import { gethCallTracerToTraceBlockItems } from '../../node/gethCallTracerToTraceBlockItems'
7
+ import flareBlock0x36ffc39CallTracerTrace from '../../node/resources/flare-0x36ffc39-debug-trace-block-call-tracer.json'
8
8
 
9
9
  describe('gethCallTracerToTraceBlockItems', () => {
10
10
  const blockNumber = 12345
@@ -0,0 +1,70 @@
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { CHAIN_ID } from '../../../config'
5
+ import {
6
+ createMockEvmConfigInfo,
7
+ mkExternalNode,
8
+ testLogger,
9
+ } from '../../../fixtures/context.fixtures'
10
+ import { getNodeApi } from '../../node/index'
11
+
12
+ describe('getNodeApi memoization', () => {
13
+ it('should return the same NodeApi instance for same chain and retries (memoization)', () => {
14
+ const config = createMockEvmConfigInfo({
15
+ chainId: CHAIN_ID.ETHEREUM,
16
+ node: mkExternalNode(),
17
+ })
18
+ expect(getNodeApi(config, testLogger)).toBe(getNodeApi(config, testLogger))
19
+ })
20
+
21
+ it('should return cached NodeApi on subsequent calls (createNodeApi called once)', () => {
22
+ const config = createMockEvmConfigInfo({
23
+ chainId: CHAIN_ID.ETHEREUM,
24
+ node: mkExternalNode(),
25
+ })
26
+ const cachedInstance = getNodeApi(config, testLogger)
27
+
28
+ expect(getNodeApi(config, testLogger)).toBe(cachedInstance)
29
+ expect(getNodeApi(config, testLogger)).toBe(cachedInstance)
30
+ })
31
+
32
+ it('should return different NodeApi instances for different retries', () => {
33
+ const node1 = getNodeApi(
34
+ createMockEvmConfigInfo({
35
+ chainId: CHAIN_ID.ETHEREUM,
36
+ node: mkExternalNode({ uri: 'u', retries: 2 }),
37
+ }),
38
+ testLogger
39
+ )
40
+ const node2 = getNodeApi(
41
+ createMockEvmConfigInfo({
42
+ chainId: CHAIN_ID.ETHEREUM,
43
+ node: mkExternalNode({ uri: 'u', retries: 5 }),
44
+ }),
45
+ testLogger
46
+ )
47
+ expect(node1).not.toBe(node2)
48
+ })
49
+
50
+ it('should return different NodeApi instances for different uris', () => {
51
+ const node1 = getNodeApi(
52
+ createMockEvmConfigInfo({ chainId: CHAIN_ID.ETHEREUM, node: mkExternalNode({ uri: 'u1' }) }),
53
+ testLogger
54
+ )
55
+ const node2 = getNodeApi(
56
+ createMockEvmConfigInfo({ chainId: CHAIN_ID.ETHEREUM, node: mkExternalNode({ uri: 'u2' }) }),
57
+ testLogger
58
+ )
59
+
60
+ expect(node1).not.toBe(node2)
61
+ })
62
+
63
+ it('should return different NodeApi instances for different chains sharing a node', () => {
64
+ const node = mkExternalNode({ uri: 'u1' })
65
+ const ethereum = createMockEvmConfigInfo({ chainId: CHAIN_ID.ETHEREUM, node })
66
+ const bsc = createMockEvmConfigInfo({ chainId: CHAIN_ID.BSC, node })
67
+
68
+ expect(getNodeApi(ethereum, testLogger)).not.toBe(getNodeApi(bsc, testLogger))
69
+ })
70
+ })
@@ -1,14 +1,14 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { UnknownNode } from '../../errors'
4
+ import { UnknownNode } from '../../../errors'
5
5
  import {
6
6
  createMockEvmConfigInfo,
7
7
  mkExternalNode,
8
8
  mkLedgerNode,
9
9
  testLogger,
10
- } from '../../fixtures/context.fixtures'
11
- import { getNodeApi } from './index'
10
+ } from '../../../fixtures/context.fixtures'
11
+ import { getNodeApi } from '../../node/index'
12
12
 
13
13
  describe('EVM Family', () => {
14
14
  describe('network/node/index.ts', () => {
@@ -16,13 +16,12 @@ describe('EVM Family', () => {
16
16
  it('should throw when requesting a non existing node type', () => {
17
17
  const config = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
18
18
  Object.assign(config, { node: { type: 'anything', uri: 'notworking' } })
19
- expect(() => getNodeApi(config, 'not-existing', testLogger)).toThrow(UnknownNode)
19
+ expect(() => getNodeApi(config, testLogger)).toThrow(UnknownNode)
20
20
  })
21
21
 
22
22
  it('should return the rpc api', () => {
23
23
  const node = getNodeApi(
24
24
  createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'working' }) }),
25
- 'external',
26
25
  testLogger
27
26
  )
28
27
 
@@ -44,7 +43,6 @@ describe('EVM Family', () => {
44
43
  it('should return the ledger api', () => {
45
44
  const node = getNodeApi(
46
45
  createMockEvmConfigInfo({ chainId: 1, node: mkLedgerNode({ explorerId: 'eth' }) }),
47
- 'ledger-supported',
48
46
  testLogger
49
47
  )
50
48
 
@@ -5,17 +5,17 @@ import { delay } from '@ledgerhq/coin-module-framework/promises'
5
5
  import axios from 'axios'
6
6
  import BigNumber from 'bignumber.js'
7
7
  import { Transaction } from 'ethers'
8
- import { DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
9
- import { GasEstimationError } from '../../errors'
10
- import { createMockEvmConfigInfo, testLogger } from '../../fixtures/context.fixtures'
11
- import { getGasOptions } from '../gasTracker/ledger'
12
- import { createLedgerNodeApi } from './ledger'
8
+ import { CHAIN_ID, DEFAULT_LEDGER_EXPLORER_URI } from '../../../config'
9
+ import { GasEstimationError } from '../../../errors'
10
+ import { createMockEvmConfigInfo, testLogger } from '../../../fixtures/context.fixtures'
11
+ import { getGasOptions } from '../../gasTracker/ledger'
12
+ import { createLedgerNodeApi } from '../../node/ledger'
13
13
 
14
14
  jest.useFakeTimers({ doNotFake: ['setTimeout'] })
15
15
 
16
16
  jest.mock('axios')
17
17
  jest.mock('@ledgerhq/coin-module-framework/promises')
18
- jest.mock('../gasTracker/ledger', () => ({
18
+ jest.mock('../../gasTracker/ledger', () => ({
19
19
  getGasOptions: jest.fn(),
20
20
  }))
21
21
 
@@ -25,10 +25,10 @@ jest.mocked(delay).mockImplementation(
25
25
  () => new Promise((resolve) => setTimeout(resolve, 1)) // mocking the delay supposed to happen after each try
26
26
  )
27
27
 
28
- const currencyId = 'ethereum'
29
28
  const address = '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d'
30
29
 
31
30
  const ledgerConfig = {
31
+ chainId: CHAIN_ID.ETHEREUM,
32
32
  type: 'ledger' as const,
33
33
  explorerId: 'eth' as const,
34
34
  retries: 2,
@@ -60,7 +60,7 @@ describe('EVM Family', () => {
60
60
  ],
61
61
  }))
62
62
 
63
- const result = await api.call(currencyId, { to: USDC, data: DECIMALS_SELECTOR })
63
+ const result = await api.call({ to: USDC, data: DECIMALS_SELECTOR })
64
64
 
65
65
  expect(result).toEqual(DECIMALS_RESPONSE)
66
66
  expect(spy).toHaveBeenCalledWith(
@@ -83,7 +83,7 @@ describe('EVM Family', () => {
83
83
  ],
84
84
  }))
85
85
 
86
- await api.call(currencyId, { to: USDC, data: DECIMALS_SELECTOR, block: 123 })
86
+ await api.call({ to: USDC, data: DECIMALS_SELECTOR, block: 123 })
87
87
 
88
88
  expect(spy).toHaveBeenCalledWith(
89
89
  expect.objectContaining({
@@ -103,7 +103,7 @@ describe('EVM Family', () => {
103
103
  ],
104
104
  }))
105
105
 
106
- await expect(api.call(currencyId, { to: USDC, data: DECIMALS_SELECTOR })).rejects.toThrow(
106
+ await expect(api.call({ to: USDC, data: DECIMALS_SELECTOR })).rejects.toThrow(
107
107
  'EVM call failed'
108
108
  )
109
109
  })
@@ -133,7 +133,7 @@ describe('EVM Family', () => {
133
133
  },
134
134
  }
135
135
  })
136
- const response = await api.getTransaction(currencyId, '0xHash')
136
+ const response = await api.getTransaction('0xHash')
137
137
  expect(response.hash).toEqual('0xabc')
138
138
  expect(spy).toHaveBeenCalledTimes(3)
139
139
  })
@@ -149,7 +149,7 @@ describe('EVM Family', () => {
149
149
  }
150
150
  return { data: {} }
151
151
  })
152
- await expect(api.getTransaction(currencyId, '0xHash')).rejects.toBeInstanceOf(SpyError)
152
+ await expect(api.getTransaction('0xHash')).rejects.toBeInstanceOf(SpyError)
153
153
  })
154
154
  })
155
155
 
@@ -201,9 +201,10 @@ describe('EVM Family', () => {
201
201
  },
202
202
  }))
203
203
 
204
- const response = await api.getTransaction(currencyId, '0xHash')
204
+ const response = await api.getTransaction('0xHash')
205
205
  expect(response).toEqual({
206
206
  gasPrice: '83953611012',
207
+ gasLimit: '32000',
207
208
  gasUsed: '21000',
208
209
  value: '70494048649554430',
209
210
  hash: '0x8d5ef4d7673fbfa6a4755cdfdb913742c47c7fdac2d214046387bbcbf10957c9',
@@ -244,7 +245,7 @@ describe('EVM Family', () => {
244
245
  data: { balance: '6969' },
245
246
  }))
246
247
 
247
- expect(await api.getCoinBalance(currencyId, '0xkvn')).toEqual(new BigNumber('6969'))
248
+ expect(await api.getCoinBalance('0xkvn')).toEqual(new BigNumber('6969'))
248
249
  })
249
250
  })
250
251
 
@@ -258,9 +259,7 @@ describe('EVM Family', () => {
258
259
  ],
259
260
  }))
260
261
 
261
- expect(await api.getTokenBalance(currencyId, '0xusdc', '0xkvn')).toEqual(
262
- new BigNumber('6969')
263
- )
262
+ expect(await api.getTokenBalance('0xusdc', '0xkvn')).toEqual(new BigNumber('6969'))
264
263
  })
265
264
  })
266
265
 
@@ -271,7 +270,7 @@ describe('EVM Family', () => {
271
270
  data: { address: '0xkvn', nonce: 123 },
272
271
  }))
273
272
 
274
- expect(await api.getTransactionCount(currencyId, '0xkvn')).toEqual(123)
273
+ expect(await api.getTransactionCount('0xkvn')).toEqual(123)
275
274
  })
276
275
  })
277
276
 
@@ -283,7 +282,7 @@ describe('EVM Family', () => {
283
282
  })
284
283
 
285
284
  await expect(
286
- api.getGasEstimation(currencyId, address, { amount: new BigNumber(0), recipient: '0x0' })
285
+ api.getGasEstimation(address, { amount: new BigNumber(0), recipient: '0x0' })
287
286
  ).rejects.toBeInstanceOf(GasEstimationError)
288
287
  })
289
288
 
@@ -294,7 +293,7 @@ describe('EVM Family', () => {
294
293
  .mockImplementation(() => Promise.reject({ code: 'ECONNABORTED' }))
295
294
 
296
295
  await expect(
297
- api.getGasEstimation(currencyId, address, { amount: new BigNumber(0), recipient: '0x0' })
296
+ api.getGasEstimation(address, { amount: new BigNumber(0), recipient: '0x0' })
298
297
  ).rejects.toBeInstanceOf(GasEstimationError)
299
298
  })
300
299
 
@@ -321,10 +320,8 @@ describe('EVM Family', () => {
321
320
  data: Buffer.from('ffff', 'hex'),
322
321
  }
323
322
 
324
- expect(await api.getGasEstimation(currencyId, address, transaction)).toEqual(
325
- new BigNumber(789)
326
- )
327
- expect(await api.getGasEstimation(currencyId, address, transactionWithData)).toEqual(
323
+ expect(await api.getGasEstimation(address, transaction)).toEqual(new BigNumber(789))
324
+ expect(await api.getGasEstimation(address, transactionWithData)).toEqual(
328
325
  new BigNumber(1_000_000)
329
326
  )
330
327
  })
@@ -356,7 +353,6 @@ describe('EVM Family', () => {
356
353
 
357
354
  const slowFeeData = await api.getFeeData(
358
355
  createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
359
- currencyId,
360
356
  {
361
357
  type: 2,
362
358
  feesStrategy: 'slow',
@@ -364,7 +360,6 @@ describe('EVM Family', () => {
364
360
  )
365
361
  const mediumFeeData = await api.getFeeData(
366
362
  createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
367
- currencyId,
368
363
  {
369
364
  type: 2,
370
365
  feesStrategy: 'medium',
@@ -372,7 +367,6 @@ describe('EVM Family', () => {
372
367
  )
373
368
  const fastFeeData = await api.getFeeData(
374
369
  createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
375
- currencyId,
376
370
  {
377
371
  type: 2,
378
372
  feesStrategy: 'fast',
@@ -424,7 +418,6 @@ describe('EVM Family', () => {
424
418
 
425
419
  const feeData = await api.getFeeData(
426
420
  createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
427
- currencyId,
428
421
  { type: 2 }
429
422
  )
430
423
 
@@ -446,7 +439,7 @@ describe('EVM Family', () => {
446
439
  },
447
440
  }))
448
441
 
449
- expect(await api.broadcastTransaction(currencyId, '0xSigneTx')).toEqual('0xHash')
442
+ expect(await api.broadcastTransaction('0xSigneTx')).toEqual('0xHash')
450
443
  })
451
444
 
452
445
  it('should include mevProtected=true in the request parameters when specified', async () => {
@@ -457,7 +450,7 @@ describe('EVM Family', () => {
457
450
  },
458
451
  }))
459
452
 
460
- await api.broadcastTransaction(currencyId, '0xSignedTx', { mevProtected: true })
453
+ await api.broadcastTransaction('0xSignedTx', { mevProtected: true })
461
454
 
462
455
  expect(mockRequest).toHaveBeenCalledWith(
463
456
  expect.objectContaining({
@@ -478,7 +471,7 @@ describe('EVM Family', () => {
478
471
  },
479
472
  }))
480
473
 
481
- await api.broadcastTransaction(currencyId, '0xSignedTx', {
474
+ await api.broadcastTransaction('0xSignedTx', {
482
475
  mevProtected: false,
483
476
  source: { type: 'live-app', name: 'test-manifest-id' },
484
477
  })
@@ -503,7 +496,7 @@ describe('EVM Family', () => {
503
496
  },
504
497
  }))
505
498
 
506
- await api.broadcastTransaction(currencyId, '0xSignedTx', { mevProtected: false })
499
+ await api.broadcastTransaction('0xSignedTx', { mevProtected: false })
507
500
 
508
501
  // ledgerConfig sets no clientVersion, so `{}` proves no source header was added.
509
502
  expect(mockRequest).toHaveBeenCalledWith(
@@ -544,14 +537,14 @@ describe('EVM Family', () => {
544
537
  }
545
538
  })
546
539
 
547
- expect(await api.getBlockByHeight(currencyId, 12)).toEqual({
540
+ expect(await api.getBlockByHeight(12)).toEqual({
548
541
  hash: '0xhash',
549
542
  height: 123,
550
543
  timestamp: Date.now(),
551
544
  parentHash: '0xparentHash',
552
545
  transactionHashes: ['0xTx1', '0xTx2'],
553
546
  })
554
- expect(await api.getBlockByHeight(currencyId, 'latest')).toEqual({
547
+ expect(await api.getBlockByHeight('latest')).toEqual({
555
548
  hash: '0xhashLatest',
556
549
  height: 456,
557
550
  timestamp: Date.now(),
@@ -564,11 +557,11 @@ describe('EVM Family', () => {
564
557
  describe('getOptimismAdditionalFees', () => {
565
558
  it('should return 0 for an incompatible currency', async () => {
566
559
  const api = createLedgerNodeApi(ledgerConfig, testLogger)
567
- expect(await api.getOptimismAdditionalFees(currencyId, '')).toEqual(new BigNumber(0))
560
+ expect(await api.getOptimismAdditionalFees('')).toEqual(new BigNumber(0))
568
561
  })
569
562
 
570
563
  it('should return the expected payload', async () => {
571
- const api = createLedgerNodeApi(ledgerConfig, testLogger)
564
+ const api = createLedgerNodeApi({ ...ledgerConfig, chainId: CHAIN_ID.OPTIMISM }, testLogger)
572
565
  jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
573
566
  data: [
574
567
  {
@@ -597,58 +590,60 @@ describe('EVM Family', () => {
597
590
  },
598
591
  })
599
592
 
600
- expect(await api.getOptimismAdditionalFees('optimism', transaction.serialized)).toEqual(
593
+ expect(await api.getOptimismAdditionalFees(transaction.serialized)).toEqual(
601
594
  new BigNumber('100000000')
602
595
  )
603
596
  })
604
597
 
605
- it.each(['blast', 'blast_sepolia', 'base', 'base_sepolia'])(
606
- 'should query the OP-stack gas oracle for %s (not return 0)',
607
- async (currencyId) => {
608
- const api = createLedgerNodeApi(ledgerConfig, testLogger)
609
- jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
610
- data: [
611
- {
612
- info: {
613
- contract: '0x420000000000000000000000000000000000000F',
614
- data: '0xSerializedTransaction',
615
- blockNumber: 123,
616
- },
617
- response: '100000000',
598
+ it.each([
599
+ ['blast', CHAIN_ID.BLAST],
600
+ ['blast_sepolia', CHAIN_ID.BLAST_SEPOLIA],
601
+ ['base', CHAIN_ID.BASE],
602
+ ['base_sepolia', CHAIN_ID.BASE_SEPOLIA],
603
+ ])('should query the OP-stack gas oracle for %s (not return 0)', async (_name, chainId) => {
604
+ const api = createLedgerNodeApi({ ...ledgerConfig, chainId }, testLogger)
605
+ jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
606
+ data: [
607
+ {
608
+ info: {
609
+ contract: '0x420000000000000000000000000000000000000F',
610
+ data: '0xSerializedTransaction',
611
+ blockNumber: 123,
618
612
  },
619
- ],
620
- }))
621
-
622
- const transaction = Transaction.from({
623
- to: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
624
- value: 1n,
625
- gasLimit: 2n,
626
- chainId: 1,
627
- nonce: 0,
628
- gasPrice: 3n,
629
- type: 0,
630
- signature: {
631
- r: '0xffffffffffffffffffffffffffffffffffffffff',
632
- s: '0xffffffffffffffffffffffffffffffffffffffff',
633
- v: 27,
613
+ response: '100000000',
634
614
  },
635
- })
615
+ ],
616
+ }))
636
617
 
637
- expect(await api.getOptimismAdditionalFees(currencyId, transaction.serialized)).toEqual(
638
- new BigNumber('100000000')
639
- )
640
- }
641
- )
618
+ const transaction = Transaction.from({
619
+ to: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
620
+ value: 1n,
621
+ gasLimit: 2n,
622
+ chainId: 1,
623
+ nonce: 0,
624
+ gasPrice: 3n,
625
+ type: 0,
626
+ signature: {
627
+ r: '0xffffffffffffffffffffffffffffffffffffffff',
628
+ s: '0xffffffffffffffffffffffffffffffffffffffff',
629
+ v: 27,
630
+ },
631
+ })
632
+
633
+ expect(await api.getOptimismAdditionalFees(transaction.serialized)).toEqual(
634
+ new BigNumber('100000000')
635
+ )
636
+ })
642
637
  })
643
638
 
644
639
  describe('getScrollAdditionalFees', () => {
645
640
  it('should return 0 for an incompatible currency', async () => {
646
641
  const api = createLedgerNodeApi(ledgerConfig, testLogger)
647
- expect(await api.getScrollAdditionalFees(currencyId, '')).toEqual(new BigNumber(0))
642
+ expect(await api.getScrollAdditionalFees('')).toEqual(new BigNumber(0))
648
643
  })
649
644
 
650
645
  it('should return the expected payload', async () => {
651
- const api = createLedgerNodeApi(ledgerConfig, testLogger)
646
+ const api = createLedgerNodeApi({ ...ledgerConfig, chainId: CHAIN_ID.SCROLL }, testLogger)
652
647
  jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
653
648
  data: [
654
649
  {
@@ -677,7 +672,7 @@ describe('EVM Family', () => {
677
672
  },
678
673
  })
679
674
 
680
- expect(await api.getScrollAdditionalFees('scroll', transaction.serialized)).toEqual(
675
+ expect(await api.getScrollAdditionalFees(transaction.serialized)).toEqual(
681
676
  new BigNumber('100000000')
682
677
  )
683
678
  })
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import type { NodeApi } from './types'
4
+ import type { NodeApi } from '../../node/types'
5
5
 
6
6
  export function mockNodeApi(overrides: Partial<jest.Mocked<NodeApi>> = {}): jest.Mocked<NodeApi> {
7
7
  return {
@@ -5,7 +5,7 @@ import {
5
5
  isRpcMethodNotAvailableOnChainError,
6
6
  isRpcMethodNotImplementedError,
7
7
  isUnsupportedRpcMethodErrorMsg,
8
- } from './rpc.errors'
8
+ } from '../../node/rpc.errors'
9
9
 
10
10
  describe('isRpcMethodNotImplementedError', () => {
11
11
  it.each([