@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
@@ -1,22 +1,23 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import type { EvmConfigInfo } from '../../config'
4
+ import type { EvmConfigInfo } from '../../../config'
5
5
  import type { PerformActionRequest } from 'ethers'
6
6
  import { delay } from '@ledgerhq/coin-module-framework/promises'
7
7
  import BigNumber from 'bignumber.js'
8
8
  import { FeeData, FetchRequest, JsonRpcProvider, Network, Transaction } from 'ethers'
9
- import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '../../errors'
9
+ import { CHAIN_ID } from '../../../config'
10
+ import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '../../../errors'
10
11
  import {
11
12
  createMockEvmConfigInfo,
12
13
  mkExternalNode,
13
14
  testLogger,
14
- } from '../../fixtures/context.fixtures'
15
+ } from '../../../fixtures/context.fixtures'
15
16
  import {
16
17
  mkBlock,
17
18
  mkTransactionReceipt,
18
19
  mkTransactionResponse,
19
- } from '../../fixtures/ethers.fixtures'
20
+ } from '../../../fixtures/ethers.fixtures'
20
21
  import {
21
22
  createNodeApi,
22
23
  DEFAULT_RETRIES_RPC_METHODS,
@@ -26,9 +27,7 @@ import {
26
27
  SYSTEM_ADDRESS,
27
28
  WETH_DEPOSIT_TOPIC,
28
29
  ERC20_MINT_TOPIC,
29
- } from './rpc.common'
30
-
31
- const currencyId = 'my_new_chain'
30
+ } from '../../node/rpc.common'
32
31
 
33
32
  const evmConfig = createMockEvmConfigInfo({
34
33
  chainId: 1,
@@ -167,7 +166,7 @@ describe('EVM Family', () => {
167
166
  return true
168
167
  })
169
168
  const nodeConfig = { type: 'external' as const, uri: 'my-rpc.com', retries: 2 }
170
- const response = await withApi(evmConfig, currencyId, spy, nodeConfig)
169
+ const response = await withApi(evmConfig, spy, nodeConfig)
171
170
 
172
171
  expect(response).toBe(true)
173
172
  // it should fail 2 times and succeed on the next try
@@ -192,70 +191,43 @@ describe('EVM Family', () => {
192
191
  retries: DEFAULT_RETRIES_RPC_METHODS,
193
192
  }
194
193
 
195
- await expect(withApi(evmConfig, currencyId, spy, nodeConfig)).rejects.toThrow(SpyError)
194
+ await expect(withApi(evmConfig, spy, nodeConfig)).rejects.toThrow(SpyError)
196
195
  })
197
196
 
198
- it('provider cache should reuse the same JsonRpcProvider for the same currency id and same uri', async () => {
199
- const testCurrencyId = 'provider_cache_by_currency'
197
+ it('provider cache should reuse the same JsonRpcProvider for the same chain and same uri', async () => {
200
198
  const nodeConfig = { type: 'external' as const, uri: 'https://rpc-a.example', retries: 0 }
201
- const first = await withApi(
202
- evmConfig,
203
- testCurrencyId,
204
- (api) => Promise.resolve(api),
205
- nodeConfig
206
- )
207
- const second = await withApi(
208
- evmConfig,
209
- testCurrencyId,
210
- (api) => Promise.resolve(api),
211
- nodeConfig
212
- )
199
+ const first = await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig)
200
+ const second = await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig)
213
201
 
214
202
  expect(first).toBe(second)
215
203
  expect(first).toBeInstanceOf(JsonRpcProvider)
216
204
  })
217
205
 
218
- it('provider cache should use distinct JsonRpcProviders for the same currency id but different uri', async () => {
219
- const testCurrencyId = 'provider_cache_by_currency'
220
-
206
+ it('provider cache should use distinct JsonRpcProviders for the same chain but different uri', async () => {
221
207
  const nodeConfig1 = { type: 'external' as const, uri: 'https://rpc-a.example', retries: 0 }
222
- const first = await withApi(
223
- evmConfig,
224
- testCurrencyId,
225
- (api) => Promise.resolve(api),
226
- nodeConfig1
227
- )
208
+ const first = await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig1)
228
209
 
229
210
  const nodeConfig2 = { ...nodeConfig1, uri: 'https://rpc-b.example' }
230
- const second = await withApi(
231
- evmConfig,
232
- testCurrencyId,
233
- (api) => Promise.resolve(api),
234
- nodeConfig2
235
- )
211
+ const second = await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig2)
236
212
 
237
213
  expect(first).not.toBe(second)
238
214
  expect(first).toBeInstanceOf(JsonRpcProvider)
239
215
  expect(second).toBeInstanceOf(JsonRpcProvider)
240
216
  })
241
217
 
242
- it('provider cache should use distinct JsonRpcProviders for different currency ids', async () => {
218
+ it('provider cache should use distinct JsonRpcProviders for different chain ids', async () => {
243
219
  const nodeConfig = {
244
220
  type: 'external' as const,
245
221
  uri: 'https://shared-rpc.example',
246
222
  retries: 0,
247
223
  }
248
- const currencyIdOne = 'provider_cache_currency_one'
249
- const currencyIdTwo = 'provider_cache_currency_two'
250
224
  const p1 = await withApi(
251
- evmConfig,
252
- currencyIdOne,
225
+ { ...evmConfig, chainId: CHAIN_ID.ETHEREUM },
253
226
  (api) => Promise.resolve(api),
254
227
  nodeConfig
255
228
  )
256
229
  const p2 = await withApi(
257
- evmConfig,
258
- currencyIdTwo,
230
+ { ...evmConfig, chainId: CHAIN_ID.BSC },
259
231
  (api) => Promise.resolve(api),
260
232
  nodeConfig
261
233
  )
@@ -266,7 +238,6 @@ describe('EVM Family', () => {
266
238
  })
267
239
 
268
240
  it('should disable ethers built-in HTTP retries by setting maxAttempts: 1 on FetchRequest', async () => {
269
- const testCurrencyId = 'provider_fetch_throttle_test'
270
241
  const nodeConfig = {
271
242
  type: 'external' as const,
272
243
  uri: 'https://rpc-throttle-test.example',
@@ -275,7 +246,7 @@ describe('EVM Family', () => {
275
246
 
276
247
  const setThrottleParamsSpy = jest.spyOn(FetchRequest.prototype, 'setThrottleParams')
277
248
 
278
- await withApi(evmConfig, testCurrencyId, (api) => Promise.resolve(api), nodeConfig)
249
+ await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig)
279
250
 
280
251
  expect(setThrottleParamsSpy).toHaveBeenCalledWith({ maxAttempts: 1 })
281
252
  })
@@ -310,7 +281,6 @@ describe('EVM Family', () => {
310
281
  mockRawReceipt({ l1Fee: '0x56c2d5eea374' }) // 95394812830580
311
282
 
312
283
  const tx = await nodeApi.getTransaction(
313
- currencyId,
314
284
  '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
315
285
  )
316
286
 
@@ -319,7 +289,6 @@ describe('EVM Family', () => {
319
289
 
320
290
  it('should leave l1Fee undefined when the receipt has none (non OP-stack chains)', async () => {
321
291
  const tx = await nodeApi.getTransaction(
322
- currencyId,
323
292
  '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
324
293
  )
325
294
 
@@ -330,7 +299,6 @@ describe('EVM Family', () => {
330
299
  mockRawReceipt({ status: null, type: null })
331
300
 
332
301
  const tx = await nodeApi.getTransaction(
333
- currencyId,
334
302
  '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
335
303
  )
336
304
 
@@ -362,7 +330,6 @@ describe('EVM Family', () => {
362
330
 
363
331
  await expect(
364
332
  nodeApi.getTransaction(
365
- currencyId,
366
333
  '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
367
334
  )
368
335
  ).rejects.toThrow('Transaction or receipt not found')
@@ -371,7 +338,6 @@ describe('EVM Family', () => {
371
338
  it('should return the expected payload', async () => {
372
339
  expect(
373
340
  await nodeApi.getTransaction(
374
- currencyId,
375
341
  '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
376
342
  )
377
343
  ).toEqual({
@@ -380,6 +346,7 @@ describe('EVM Family', () => {
380
346
  hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
381
347
  nonce: 123,
382
348
  gasPrice: '789',
349
+ gasLimit: '123',
383
350
  gasUsed: '122',
384
351
  value: '456',
385
352
  status: 1,
@@ -729,7 +696,7 @@ describe('EVM Family', () => {
729
696
  .mockResolvedValueOnce('0x00000001')
730
697
 
731
698
  await expect(
732
- nodeApi.call(currencyId, {
699
+ nodeApi.call({
733
700
  to: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
734
701
  data: '0x1234',
735
702
  block: 42,
@@ -749,7 +716,6 @@ describe('EVM Family', () => {
749
716
  it('should return the expected payload', async () => {
750
717
  expect(
751
718
  await nodeApi.getCoinBalance(
752
- currencyId,
753
719
  '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
754
720
  )
755
721
  ).toEqual(new BigNumber(420))
@@ -761,7 +727,6 @@ describe('EVM Family', () => {
761
727
  it('should return the expected payload', async () => {
762
728
  expect(
763
729
  await nodeApi.getTokenBalance(
764
- currencyId,
765
730
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
766
731
  '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
767
732
  )
@@ -772,7 +737,7 @@ describe('EVM Family', () => {
772
737
  describe('getTransactionCount', () => {
773
738
  it('should return the expected payload', async () => {
774
739
  expect(
775
- await nodeApi.getTransactionCount(currencyId, '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d')
740
+ await nodeApi.getTransactionCount('0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d')
776
741
  ).toEqual(5)
777
742
  })
778
743
  })
@@ -788,7 +753,7 @@ describe('EVM Family', () => {
788
753
  return null
789
754
  })
790
755
  expect(
791
- await nodeApi.getGasEstimation(currencyId, address, {
756
+ await nodeApi.getGasEstimation(address, {
792
757
  recipient: '0x0000000000000000000000000000000000000000',
793
758
  amount: new BigNumber(2),
794
759
  data: Buffer.from(''),
@@ -807,7 +772,7 @@ describe('EVM Family', () => {
807
772
  })
808
773
 
809
774
  await expect(
810
- nodeApi.getGasEstimation(currencyId, address, {
775
+ nodeApi.getGasEstimation(address, {
811
776
  recipient: 'wrongAddress',
812
777
  amount: new BigNumber(1),
813
778
  data: Buffer.from(''),
@@ -847,7 +812,7 @@ describe('EVM Family', () => {
847
812
  }
848
813
  })
849
814
 
850
- expect(await nodeApi.getFeeData(config, currencyId, eip1559Tx)).toEqual({
815
+ expect(await nodeApi.getFeeData(config, eip1559Tx)).toEqual({
851
816
  maxFeePerGas: new BigNumber('6000000014'),
852
817
  maxPriorityFeePerGas: new BigNumber('5999999988'),
853
818
  gasPrice: null,
@@ -865,7 +830,7 @@ describe('EVM Family', () => {
865
830
  }
866
831
  })
867
832
 
868
- expect(await nodeApi.getFeeData(config, currencyId, eip1559Tx)).toEqual({
833
+ expect(await nodeApi.getFeeData(config, eip1559Tx)).toEqual({
869
834
  maxFeePerGas: new BigNumber('25000246'),
870
835
  maxPriorityFeePerGas: new BigNumber('25000000'),
871
836
  gasPrice: null,
@@ -888,9 +853,7 @@ describe('EVM Family', () => {
888
853
  }
889
854
  })
890
855
 
891
- await expect(nodeApi.getFeeData(config, currencyId, eip1559Tx)).rejects.toThrow(
892
- feeHistoryError.message
893
- )
856
+ await expect(nodeApi.getFeeData(config, eip1559Tx)).rejects.toThrow(feeHistoryError.message)
894
857
  expect(sendSpy).not.toHaveBeenCalledWith('eth_maxPriorityFeePerGas', expect.anything())
895
858
  })
896
859
 
@@ -909,7 +872,7 @@ describe('EVM Family', () => {
909
872
  }
910
873
  })
911
874
 
912
- await expect(nodeApi.getFeeData(config, currencyId, eip1559Tx)).rejects.toThrow('timeout')
875
+ await expect(nodeApi.getFeeData(config, eip1559Tx)).rejects.toThrow('timeout')
913
876
  })
914
877
 
915
878
  it('should return the expected payload for an EIP1559 tx when network returns 0 priority fee', async () => {
@@ -928,7 +891,7 @@ describe('EVM Family', () => {
928
891
  }
929
892
  })
930
893
 
931
- expect(await nodeApi.getFeeData(config, currencyId, eip1559Tx)).toEqual({
894
+ expect(await nodeApi.getFeeData(config, eip1559Tx)).toEqual({
932
895
  maxFeePerGas: new BigNumber('1000000026'),
933
896
  maxPriorityFeePerGas: new BigNumber(1e9),
934
897
  gasPrice: null,
@@ -951,7 +914,7 @@ describe('EVM Family', () => {
951
914
  it('defaults to 5 blocks (0x5) when not configured', async () => {
952
915
  const sendSpy = stubFeeHistory()
953
916
 
954
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
917
+ await nodeApi.getFeeData(config, eip1559Tx)
955
918
 
956
919
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x5', 'latest', [50]])
957
920
  })
@@ -959,7 +922,7 @@ describe('EVM Family', () => {
959
922
  it('defaults to the 50th percentile when feeHistoryRewardPercentile is not configured', async () => {
960
923
  const sendSpy = stubFeeHistory()
961
924
 
962
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
925
+ await nodeApi.getFeeData(config, eip1559Tx)
963
926
 
964
927
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x5', 'latest', [50]])
965
928
  })
@@ -980,7 +943,7 @@ describe('EVM Family', () => {
980
943
  })
981
944
  const sendSpy = stubFeeHistory()
982
945
 
983
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
946
+ await nodeApi.getFeeData(config, eip1559Tx)
984
947
 
985
948
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x5', 'latest', [expected]])
986
949
  }
@@ -995,7 +958,7 @@ describe('EVM Family', () => {
995
958
  })
996
959
  const sendSpy = stubFeeHistory()
997
960
 
998
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
961
+ await nodeApi.getFeeData(config, eip1559Tx)
999
962
 
1000
963
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x14', 'latest', [75]])
1001
964
  })
@@ -1016,7 +979,7 @@ describe('EVM Family', () => {
1016
979
  })
1017
980
  const sendSpy = stubFeeHistory()
1018
981
 
1019
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
982
+ await nodeApi.getFeeData(config, eip1559Tx)
1020
983
 
1021
984
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', [expectedHex, 'latest', [50]])
1022
985
  }
@@ -1044,7 +1007,7 @@ describe('EVM Family', () => {
1044
1007
  }
1045
1008
  })
1046
1009
 
1047
- await nodeApi.getFeeData(config, currencyId, legacyTx)
1010
+ await nodeApi.getFeeData(config, legacyTx)
1048
1011
 
1049
1012
  expect(sendSpy).not.toHaveBeenCalledWith('eth_feeHistory', expect.anything())
1050
1013
  })
@@ -1069,7 +1032,7 @@ describe('EVM Family', () => {
1069
1032
  }
1070
1033
  })
1071
1034
 
1072
- const result = await nodeApi.getFeeData(config, currencyId, eip1559Tx)
1035
+ const result = await nodeApi.getFeeData(config, eip1559Tx)
1073
1036
 
1074
1037
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x14', 'latest', [50]])
1075
1038
  expect(result.maxPriorityFeePerGas).toEqual(new BigNumber('20000000000'))
@@ -1094,7 +1057,7 @@ describe('EVM Family', () => {
1094
1057
  }
1095
1058
  })
1096
1059
 
1097
- const result = await nodeApi.getFeeData(config, currencyId, eip1559Tx)
1060
+ const result = await nodeApi.getFeeData(config, eip1559Tx)
1098
1061
 
1099
1062
  expect(result.maxPriorityFeePerGas).toEqual(new BigNumber('20000000000'))
1100
1063
  // maxFeePerGas = nextBaseFee * 2 + floored priority = 13*2 + 20e9
@@ -1119,7 +1082,7 @@ describe('EVM Family', () => {
1119
1082
  }
1120
1083
  })
1121
1084
 
1122
- const result = await nodeApi.getFeeData(config, currencyId, eip1559Tx)
1085
+ const result = await nodeApi.getFeeData(config, eip1559Tx)
1123
1086
 
1124
1087
  expect(result.maxPriorityFeePerGas).toEqual(new BigNumber('5000000000'))
1125
1088
  })
@@ -1150,7 +1113,7 @@ describe('EVM Family', () => {
1150
1113
  new FeeData(BigInt('1000000000'), 0n, 0n) // 1 Gwei
1151
1114
  )
1152
1115
 
1153
- const result = await nodeApi.getFeeData(config, currencyId, legacyTx)
1116
+ const result = await nodeApi.getFeeData(config, legacyTx)
1154
1117
 
1155
1118
  expect(result.gasPrice).toEqual(new BigNumber('20000000000'))
1156
1119
  })
@@ -1171,7 +1134,12 @@ describe('EVM Family', () => {
1171
1134
  }
1172
1135
  })
1173
1136
 
1174
- expect(await nodeApi.getFeeData(config, 'zero_gravity', eip1559Tx)).toEqual({
1137
+ const zeroGravityConfig = createMockEvmConfigInfo({
1138
+ chainId: CHAIN_ID.ZERO_GRAVITY,
1139
+ node: mkExternalNode({ uri: 'my-rpc.com' }),
1140
+ })
1141
+
1142
+ expect(await nodeApi.getFeeData(zeroGravityConfig, eip1559Tx)).toEqual({
1175
1143
  maxFeePerGas: new BigNumber('2000000026'),
1176
1144
  maxPriorityFeePerGas: new BigNumber(2e9),
1177
1145
  gasPrice: null,
@@ -1210,7 +1178,7 @@ describe('EVM Family', () => {
1210
1178
  }
1211
1179
  })
1212
1180
 
1213
- expect(await nodeApi.getFeeData(config, 'optimism', legacyTx)).toEqual({
1181
+ expect(await nodeApi.getFeeData(config, legacyTx)).toEqual({
1214
1182
  maxFeePerGas: null,
1215
1183
  maxPriorityFeePerGas: null,
1216
1184
  gasPrice: new BigNumber('666'),
@@ -1223,7 +1191,7 @@ describe('EVM Family', () => {
1223
1191
  it('should return the expected payload', async () => {
1224
1192
  const serializedTransaction =
1225
1193
  '0x02f873012d85010c388d0085077715912682520894c2907efcce4011c491bbeda8a0fa63ba7aab596c87038d7ea4c6800080c001a0bbffe7ba303ab03f697d64672c4a288ae863df8a62ffc67ba72872ce8c227f6fa01261e7c9f06af13631f03fad9b88d3c48931d353b6b41b4072fddcca5ec41629'
1226
- expect(await nodeApi.broadcastTransaction(currencyId, serializedTransaction)).toEqual(
1194
+ expect(await nodeApi.broadcastTransaction(serializedTransaction)).toEqual(
1227
1195
  '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
1228
1196
  )
1229
1197
  })
@@ -1232,7 +1200,7 @@ describe('EVM Family', () => {
1232
1200
  const serializedTransaction =
1233
1201
  '0x02f873012d85010c388d0085077715912682520894c2907efcce4011c491bbeda8a0fa63ba7aab596c87038d7ea4c6800080c001a0bbffe7ba303ab03f697d64672c4a288ae863df8a62ffc67ba72872ce8c227f6fa01261e7c9f06af13631f03fad9b88d3c48931d353b6b41b4072fddcca5ec41628'
1234
1202
 
1235
- await expect(nodeApi.broadcastTransaction(currencyId, serializedTransaction)).rejects.toThrow(
1203
+ await expect(nodeApi.broadcastTransaction(serializedTransaction)).rejects.toThrow(
1236
1204
  InsufficientFunds
1237
1205
  )
1238
1206
  })
@@ -1241,15 +1209,13 @@ describe('EVM Family', () => {
1241
1209
  const serializedTransaction =
1242
1210
  '0x02f873012d85010c388d0085077715912682520894c2907efcce4011c491bbeda8a0fa63ba7aab596c87038d7ea4c6800080c001a0bbffe7ba303ab03f697d64672c4a288ae863df8a62ffc67ba72872ce8c227f6fa01261e7c9f06af13631f03fad9b88d3c48931d353b6b41b4072fddcca5ec41625'
1243
1211
 
1244
- await expect(nodeApi.broadcastTransaction(currencyId, serializedTransaction)).rejects.toThrow(
1245
- 'any error'
1246
- )
1212
+ await expect(nodeApi.broadcastTransaction(serializedTransaction)).rejects.toThrow('any error')
1247
1213
  })
1248
1214
  })
1249
1215
 
1250
1216
  describe('getBlock', () => {
1251
1217
  it('should return the expected payload', async () => {
1252
- expect(await nodeApi.getBlockByHeight(currencyId, 0)).toEqual({
1218
+ expect(await nodeApi.getBlockByHeight(0)).toEqual({
1253
1219
  hash: '0x474dee0136108e9412e9d84197b468bb057a8dad0f2024fc55adebc4a28fa8c5',
1254
1220
  // for this specific assertion we can't use Date.now() directly because
1255
1221
  // the timestamp returned by ethers (and mocked at the beginning of
@@ -1271,7 +1237,7 @@ describe('EVM Family', () => {
1271
1237
  })
1272
1238
  )
1273
1239
 
1274
- await expect(nodeApi.getBlockByHeight(currencyId, 956855)).rejects.toThrow(
1240
+ await expect(nodeApi.getBlockByHeight(956855)).rejects.toThrow(
1275
1241
  'Block 956855 not found (the node returned an empty stub block)'
1276
1242
  )
1277
1243
  })
@@ -1286,7 +1252,7 @@ describe('EVM Family', () => {
1286
1252
  })
1287
1253
  )
1288
1254
 
1289
- await expect(nodeApi.getBlockByHeight(currencyId, 0)).resolves.toMatchObject({
1255
+ await expect(nodeApi.getBlockByHeight(0)).resolves.toMatchObject({
1290
1256
  height: 0,
1291
1257
  timestamp: 0,
1292
1258
  })
@@ -1307,12 +1273,14 @@ describe('EVM Family', () => {
1307
1273
  from: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d',
1308
1274
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
1309
1275
  gasPrice: 0n,
1276
+ gasLimit: 21000n,
1277
+ nonce: 5,
1310
1278
  }),
1311
1279
  ],
1312
1280
  })
1313
1281
  )
1314
1282
 
1315
- expect(await nodeApi.getBlockByHeight(currencyId, 1, true)).toEqual({
1283
+ expect(await nodeApi.getBlockByHeight(1, true)).toEqual({
1316
1284
  hash: '0x474dee0136108e9412e9d84197b468bb057a8dad0f2024fc55adebc4a28fa8c5',
1317
1285
  timestamp: now * 1000,
1318
1286
  height: 1,
@@ -1324,6 +1292,8 @@ describe('EVM Family', () => {
1324
1292
  from: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d',
1325
1293
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
1326
1294
  gasPrice: '0',
1295
+ gasLimit: '21000',
1296
+ nonce: 5,
1327
1297
  },
1328
1298
  ],
1329
1299
  transactionHashes: ['0xtx1'],
@@ -1349,7 +1319,7 @@ describe('EVM Family', () => {
1349
1319
  .spyOn(JsonRpcProvider.prototype, 'getBlock')
1350
1320
  .mockResolvedValueOnce(blockWithThrowingGetter)
1351
1321
 
1352
- expect(await nodeApi.getBlockByHeight(currencyId, 1, true)).toEqual({
1322
+ expect(await nodeApi.getBlockByHeight(1, true)).toEqual({
1353
1323
  hash: '0x474dee0136108e9412e9d84197b468bb057a8dad0f2024fc55adebc4a28fa8c5',
1354
1324
  timestamp: now * 1000,
1355
1325
  height: 1,
@@ -1383,12 +1353,14 @@ describe('EVM Family', () => {
1383
1353
  from: '0x993aad80e425c646dab305381ff105169feedf67',
1384
1354
  to: '0x0000000000000000000000000000000000010003',
1385
1355
  type: '0xff',
1356
+ gas: '0x11e1a300',
1357
+ nonce: '0x2a',
1386
1358
  },
1387
1359
  ],
1388
1360
  }
1389
1361
  })
1390
1362
 
1391
- expect(await nodeApi.getBlockByHeight(currencyId, 69174056, true)).toEqual({
1363
+ expect(await nodeApi.getBlockByHeight(69174056, true)).toEqual({
1392
1364
  hash: '0x9e5af7a45cf98e8f32d1233092d1714f21ab15e2d24263c3fd5bef091d4736af',
1393
1365
  timestamp: 1742556350000,
1394
1366
  height: 69174056,
@@ -1401,6 +1373,8 @@ describe('EVM Family', () => {
1401
1373
  from: '0x993aad80e425c646dab305381ff105169feedf67',
1402
1374
  to: '0x0000000000000000000000000000000000010003',
1403
1375
  gasPrice: '0',
1376
+ gasLimit: '300000000',
1377
+ nonce: 42,
1404
1378
  },
1405
1379
  ],
1406
1380
  })
@@ -1424,7 +1398,7 @@ describe('EVM Family', () => {
1424
1398
  throw new Error(`Method not mocked: ${method}`)
1425
1399
  })
1426
1400
 
1427
- expect(await nodeApi.getBlockReceipts!(currencyId, 1)).toEqual([
1401
+ expect(await nodeApi.getBlockReceipts!(1)).toEqual([
1428
1402
  {
1429
1403
  hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
1430
1404
  gasUsed: '500000',
@@ -1450,7 +1424,7 @@ describe('EVM Family', () => {
1450
1424
  }
1451
1425
  throw new Error(`Method not mocked: ${method}`)
1452
1426
  })
1453
- expect(await nodeApi.getBlockReceipts!(currencyId, 1)).toEqual([
1427
+ expect(await nodeApi.getBlockReceipts!(1)).toEqual([
1454
1428
  {
1455
1429
  hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
1456
1430
  gasUsed: '21000',
@@ -1478,7 +1452,7 @@ describe('EVM Family', () => {
1478
1452
  throw new Error(`Method not mocked: ${method}`)
1479
1453
  })
1480
1454
 
1481
- expect(await nodeApi.getBlockReceipts!(currencyId, 1)).toEqual([
1455
+ expect(await nodeApi.getBlockReceipts!(1)).toEqual([
1482
1456
  {
1483
1457
  hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
1484
1458
  gasUsed: '21000',
@@ -1518,7 +1492,7 @@ describe('EVM Family', () => {
1518
1492
  throw new Error(`Method not mocked: ${method}`)
1519
1493
  })
1520
1494
 
1521
- expect(await nodeApi.getBlockReceipts!(currencyId, 1)).toEqual([
1495
+ expect(await nodeApi.getBlockReceipts!(1)).toEqual([
1522
1496
  {
1523
1497
  hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
1524
1498
  gasUsed: '21000',
@@ -1562,7 +1536,7 @@ describe('EVM Family', () => {
1562
1536
  throw new Error(`Method not mocked: ${method}`)
1563
1537
  })
1564
1538
 
1565
- await expect(nodeApi.getBlockReceipts!(currencyId, 1)).rejects.toThrow(
1539
+ await expect(nodeApi.getBlockReceipts!(1)).rejects.toThrow(
1566
1540
  'Malformed eth_getBlockReceipts response at index 0'
1567
1541
  )
1568
1542
  })
@@ -1578,9 +1552,7 @@ describe('EVM Family', () => {
1578
1552
  throw new Error(`Method not mocked: ${method}`)
1579
1553
  })
1580
1554
 
1581
- await expect(nodeApi.getBlockReceipts!(currencyId, 1)).rejects.toBeInstanceOf(
1582
- UnsupportedRpcMethodError
1583
- )
1555
+ await expect(nodeApi.getBlockReceipts!(1)).rejects.toBeInstanceOf(UnsupportedRpcMethodError)
1584
1556
  })
1585
1557
 
1586
1558
  it('should throw UnsupportedRpcMethodError for nested responseBody code', async () => {
@@ -1600,9 +1572,7 @@ describe('EVM Family', () => {
1600
1572
  throw new Error(`Method not mocked: ${method}`)
1601
1573
  })
1602
1574
 
1603
- await expect(nodeApi.getBlockReceipts!(currencyId, 1)).rejects.toBeInstanceOf(
1604
- UnsupportedRpcMethodError
1605
- )
1575
+ await expect(nodeApi.getBlockReceipts!(1)).rejects.toBeInstanceOf(UnsupportedRpcMethodError)
1606
1576
  })
1607
1577
  })
1608
1578
 
@@ -1633,7 +1603,7 @@ describe('EVM Family', () => {
1633
1603
  throw new Error(`Method not mocked: ${method}`)
1634
1604
  })
1635
1605
 
1636
- const result = await nodeApi.traceBlockErigon!(currencyId, 120647648)
1606
+ const result = await nodeApi.traceBlockErigon!(120647648)
1637
1607
  expect(result).toEqual([traceItem])
1638
1608
  })
1639
1609
 
@@ -1666,7 +1636,7 @@ describe('EVM Family', () => {
1666
1636
  throw new Error(`Method not mocked: ${method}`)
1667
1637
  })
1668
1638
 
1669
- const err = await nodeApi.traceBlockErigon!(currencyId, 1).then(
1639
+ const err = await nodeApi.traceBlockErigon!(1).then(
1670
1640
  () => null,
1671
1641
  (e: unknown) => e
1672
1642
  )
@@ -1698,7 +1668,7 @@ describe('EVM Family', () => {
1698
1668
  throw new Error(`Method not mocked: ${method}`)
1699
1669
  })
1700
1670
 
1701
- const result = await nodeApi.traceBlockGeth!(currencyId, 42)
1671
+ const result = await nodeApi.traceBlockGeth!(42)
1702
1672
  expect(result).toEqual([
1703
1673
  {
1704
1674
  action: {
@@ -1736,7 +1706,7 @@ describe('EVM Family', () => {
1736
1706
  throw new Error(`Method not mocked: ${method}`)
1737
1707
  })
1738
1708
 
1739
- const err = await nodeApi.traceBlockGeth!(currencyId, 1).then(
1709
+ const err = await nodeApi.traceBlockGeth!(1).then(
1740
1710
  () => null,
1741
1711
  (e: unknown) => e
1742
1712
  )
@@ -1762,7 +1732,7 @@ describe('EVM Family', () => {
1762
1732
  throw new Error(`Method not mocked: ${method}`)
1763
1733
  })
1764
1734
 
1765
- const err = await nodeApi.traceBlockGeth!(currencyId, 1).then(
1735
+ const err = await nodeApi.traceBlockGeth!(1).then(
1766
1736
  () => null,
1767
1737
  (e: unknown) => e
1768
1738
  )
@@ -1774,9 +1744,17 @@ describe('EVM Family', () => {
1774
1744
 
1775
1745
  describe('getOptimismAdditionalFees', () => {
1776
1746
  it('should return the expected payload', async () => {
1747
+ const optimismNodeApi = createNodeApi(
1748
+ createMockEvmConfigInfo({
1749
+ chainId: CHAIN_ID.OPTIMISM,
1750
+ name: 'Optimism',
1751
+ node: mkExternalNode({ uri: 'http://test' }),
1752
+ }),
1753
+ { type: 'external', uri: 'http://test', retries: DEFAULT_RETRIES_RPC_METHODS },
1754
+ testLogger
1755
+ )
1777
1756
  expect(
1778
- await nodeApi.getOptimismAdditionalFees(
1779
- 'optimism',
1757
+ await optimismNodeApi.getOptimismAdditionalFees(
1780
1758
  // Build a serialized transaction, the exact same way we do in `estimateFees`
1781
1759
  Transaction.from({
1782
1760
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
@@ -1800,8 +1778,8 @@ describe('EVM Family', () => {
1800
1778
  it("should return 0 if the currency isn't optimism", async () => {
1801
1779
  expect(
1802
1780
  await nodeApi.getOptimismAdditionalFees(
1803
- currencyId,
1804
1781
  // Build a serialized transaction, the exact same way we do in `estimateFees`
1782
+ // (a distinct nonce: the cache is keyed by chain id and transaction)
1805
1783
  Transaction.from({
1806
1784
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
1807
1785
  maxFeePerGas: BigInt(new BigNumber('0x777159126').toFixed()),
@@ -1810,7 +1788,7 @@ describe('EVM Family', () => {
1810
1788
  gasLimit: 0n,
1811
1789
  type: 2,
1812
1790
  chainId: 1,
1813
- nonce: 52,
1791
+ nonce: 53,
1814
1792
  signature: {
1815
1793
  r: '0xffffffffffffffffffffffffffffffffffffffff',
1816
1794
  s: '0xffffffffffffffffffffffffffffffffffffffff',
@@ -1824,9 +1802,17 @@ describe('EVM Family', () => {
1824
1802
 
1825
1803
  describe('getScrollAdditionalFees', () => {
1826
1804
  it('should return the expected payload', async () => {
1805
+ const scrollNodeApi = createNodeApi(
1806
+ createMockEvmConfigInfo({
1807
+ chainId: CHAIN_ID.SCROLL,
1808
+ name: 'Scroll',
1809
+ node: mkExternalNode({ uri: 'http://test' }),
1810
+ }),
1811
+ { type: 'external', uri: 'http://test', retries: DEFAULT_RETRIES_RPC_METHODS },
1812
+ testLogger
1813
+ )
1827
1814
  expect(
1828
- await nodeApi.getScrollAdditionalFees(
1829
- 'scroll',
1815
+ await scrollNodeApi.getScrollAdditionalFees(
1830
1816
  // Build a serialized transaction, the exact same way we do in `estimateFees`
1831
1817
  Transaction.from({
1832
1818
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
@@ -1850,7 +1836,6 @@ describe('EVM Family', () => {
1850
1836
  it("should return 0 if the currency isn't optimism", async () => {
1851
1837
  expect(
1852
1838
  await nodeApi.getScrollAdditionalFees(
1853
- currencyId,
1854
1839
  // Build a serialized transaction, the exact same way we do in `estimateFees`
1855
1840
  Transaction.from({
1856
1841
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
@@ -1894,7 +1879,7 @@ describe('EVM Family', () => {
1894
1879
  .spyOn(JsonRpcProvider.prototype, 'getBalance')
1895
1880
  .mockResolvedValue(BigInt(100))
1896
1881
 
1897
- await nodeApi.getCoinBalance(currencyId, EIP1191_CHECKSUMMED_ADDRESS)
1882
+ await nodeApi.getCoinBalance(EIP1191_CHECKSUMMED_ADDRESS)
1898
1883
 
1899
1884
  expect(getBalanceSpy).toHaveBeenCalledWith(NORMALIZED_ADDRESS)
1900
1885
  })
@@ -1911,11 +1896,7 @@ describe('EVM Family', () => {
1911
1896
  .spyOn(JsonRpcProvider.prototype, 'call')
1912
1897
  .mockResolvedValue('0x0000000000000000000000000000000000000000000000000000000000000064')
1913
1898
 
1914
- await nodeApi.getTokenBalance(
1915
- currencyId,
1916
- EIP1191_CHECKSUMMED_ADDRESS,
1917
- EIP1191_TOKEN_ADDRESS
1918
- )
1899
+ await nodeApi.getTokenBalance(EIP1191_CHECKSUMMED_ADDRESS, EIP1191_TOKEN_ADDRESS)
1919
1900
 
1920
1901
  // The call should be made to the normalized contract address
1921
1902
  // and the data should contain the normalized account address
@@ -1935,7 +1916,7 @@ describe('EVM Family', () => {
1935
1916
  .spyOn(JsonRpcProvider.prototype, 'getTransactionCount')
1936
1917
  .mockResolvedValue(10)
1937
1918
 
1938
- await nodeApi.getTransactionCount(currencyId, EIP1191_CHECKSUMMED_ADDRESS)
1919
+ await nodeApi.getTransactionCount(EIP1191_CHECKSUMMED_ADDRESS)
1939
1920
 
1940
1921
  expect(getTransactionCountSpy).toHaveBeenCalledWith(NORMALIZED_ADDRESS, 'pending')
1941
1922
  })
@@ -1955,7 +1936,7 @@ describe('EVM Family', () => {
1955
1936
  return null
1956
1937
  })
1957
1938
 
1958
- await nodeApi.getGasEstimation(currencyId, address, {
1939
+ await nodeApi.getGasEstimation(address, {
1959
1940
  recipient: EIP1191_RECIPIENT,
1960
1941
  amount: new BigNumber(1000),
1961
1942
  data: Buffer.from(''),