@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,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import type { EvmContext } from '../../config'
4
+ import type { ChainId, EvmContext } from '../../config'
5
5
  import type {
6
6
  BlockByHeightResult,
7
7
  BlockReceiptInfo,
@@ -13,7 +13,7 @@ import type {
13
13
  } from '../../network/node/types'
14
14
  import type { EtherscanInternalTransaction } from '../../types'
15
15
  import type { BlockOperation } from '@ledgerhq/coin-module-framework/api/index'
16
- import { internalTxSourcesFromList } from '../../config'
16
+ import { CHAIN_ID, internalTxSourcesFromList } from '../../config'
17
17
  import { UnsupportedRpcMethodError } from '../../errors'
18
18
  import {
19
19
  createMockEvmConfigInfo,
@@ -26,13 +26,10 @@ import {
26
26
  import { safeEncodeEIP55 } from '../../logic-public'
27
27
  import { getInternalTransactionsByBlock } from '../../network/explorer/etherscan'
28
28
  import { getNodeApi } from '../../network/node'
29
- import { mockNodeApi } from '../../network/node/node.fixtures'
29
+ import { mockNodeApi } from '../../network/tests/node/node.fixtures'
30
30
  import { getBlock } from '../getBlock'
31
31
  import { dropRootTraceDuplicates } from '../rootTraceDedup'
32
32
 
33
- // fixme refactor this test
34
- // use builder function to build the mocked return values
35
-
36
33
  jest.mock('../../network/node')
37
34
  jest.mock('../../network/explorer/etherscan', () => ({
38
35
  getInternalTransactionsByBlock: jest.fn().mockResolvedValue([]),
@@ -43,6 +40,10 @@ describe('getBlock', () => {
43
40
  jest.clearAllMocks()
44
41
  })
45
42
 
43
+ function mockGetBlockNodeApi(nodeApi: ReturnType<typeof mockNodeApi>): void {
44
+ jest.mocked(getNodeApi).mockReturnValue(nodeApi)
45
+ }
46
+
46
47
  const address1 = '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d'
47
48
  const address2 = '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619'
48
49
  const erc20Address = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
@@ -148,13 +149,12 @@ describe('getBlock', () => {
148
149
  })
149
150
  )
150
151
 
151
- const mockGetNodeApi = jest.mocked(getNodeApi)
152
152
  const mockGetBlockByHeight = jest
153
153
  .fn()
154
154
  .mockResolvedValueOnce(makeNodeBlock({ transactions: [] }))
155
155
  const mockTraceBlockErigon = jest.fn()
156
156
 
157
- mockGetNodeApi.mockReturnValue(
157
+ mockGetBlockNodeApi(
158
158
  mockNodeApi({
159
159
  getBlockByHeight: mockGetBlockByHeight,
160
160
  getBlockReceipts: jest.fn(),
@@ -179,12 +179,11 @@ describe('getBlock', () => {
179
179
  })
180
180
  )
181
181
 
182
- const mockGetNodeApi = jest.mocked(getNodeApi)
183
182
  const mockGetBlockByHeight = jest
184
183
  .fn()
185
184
  .mockResolvedValueOnce(makeNodeBlock({ transactions: [makeNodeBlockTx({ hash: '0xtx1' })] }))
186
185
 
187
- mockGetNodeApi.mockReturnValue(
186
+ mockGetBlockNodeApi(
188
187
  mockNodeApi({
189
188
  getBlockByHeight: mockGetBlockByHeight,
190
189
  getBlockReceipts: jest.fn().mockResolvedValue([makeNodeBlockReceipt({ hash: '0xtx1' })]),
@@ -205,7 +204,6 @@ describe('getBlock', () => {
205
204
  createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
206
205
  )
207
206
 
208
- const mockGetNodeApi = jest.mocked(getNodeApi)
209
207
  const mockGetBlockByHeight = jest.fn()
210
208
  mockGetBlockByHeight.mockResolvedValueOnce(
211
209
  makeNodeBlock({
@@ -226,7 +224,7 @@ describe('getBlock', () => {
226
224
  }),
227
225
  ])
228
226
 
229
- mockGetNodeApi.mockReturnValue(
227
+ mockGetBlockNodeApi(
230
228
  mockNodeApi({
231
229
  getBlockByHeight: mockGetBlockByHeight,
232
230
  getBlockReceipts: mockGetBlockReceipts,
@@ -297,8 +295,8 @@ describe('getBlock', () => {
297
295
  )
298
296
 
299
297
  const calldata = '0xa9059cbb00000000'
300
- const mockGetNodeApi = jest.mocked(getNodeApi)
301
- mockGetNodeApi.mockReturnValue(
298
+
299
+ mockGetBlockNodeApi(
302
300
  mockNodeApi({
303
301
  getBlockByHeight: jest.fn().mockResolvedValueOnce(
304
302
  makeNodeBlock({
@@ -338,8 +336,8 @@ describe('getBlock', () => {
338
336
  )
339
337
 
340
338
  const initCode = '0x6001600055'
341
- const mockGetNodeApi = jest.mocked(getNodeApi)
342
- mockGetNodeApi.mockReturnValue(
339
+
340
+ mockGetBlockNodeApi(
343
341
  mockNodeApi({
344
342
  getBlockByHeight: jest.fn().mockResolvedValueOnce(
345
343
  makeNodeBlock({
@@ -382,8 +380,7 @@ describe('getBlock', () => {
382
380
  createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
383
381
  )
384
382
 
385
- const mockGetNodeApi = jest.mocked(getNodeApi)
386
- mockGetNodeApi.mockReturnValue(
383
+ mockGetBlockNodeApi(
387
384
  mockNodeApi({
388
385
  getBlockByHeight: jest.fn().mockResolvedValueOnce(
389
386
  makeNodeBlock({
@@ -404,10 +401,131 @@ describe('getBlock', () => {
404
401
 
405
402
  const result = await getBlock(context, '', 12345)
406
403
 
407
- expect({
408
- hash: result.transactions[0].hash,
409
- hasDetails: 'details' in result.transactions[0],
410
- }).toEqual({ hash: '0xtx1', hasDetails: false })
404
+ expect(result.transactions[0].details).not.toHaveProperty('contractInteraction')
405
+ })
406
+
407
+ it('adds the receipt gas price, the gas limit and the nonce to prefetched tx details', async () => {
408
+ const context = createMockEvmContext(
409
+ createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
410
+ )
411
+
412
+ mockGetBlockNodeApi(
413
+ mockNodeApi({
414
+ getBlockByHeight: jest.fn().mockResolvedValueOnce(
415
+ makeNodeBlock({
416
+ transactions: [
417
+ makeNodeBlockTx({
418
+ hash: '0xtx1',
419
+ gasPrice: '30000000000', // maxFeePerGas fallback of a type-2 tx: must NOT win
420
+ gasLimit: '73330',
421
+ nonce: 42,
422
+ }),
423
+ ],
424
+ })
425
+ ),
426
+ getBlockReceipts: jest
427
+ .fn()
428
+ .mockResolvedValueOnce([makeNodeBlockReceipt({ hash: '0xtx1', gasPrice: '1000000000' })]),
429
+ getTransaction: jest.fn(),
430
+ })
431
+ )
432
+
433
+ const result = await getBlock(context, '', 12345)
434
+
435
+ expect(result.transactions[0].details).toEqual({
436
+ gasPrice: '1000000000',
437
+ gasLimit: '73330',
438
+ sequence: 42,
439
+ })
440
+ })
441
+
442
+ it('adds the gas price, the gas limit and the nonce to contract details', async () => {
443
+ const context = createMockEvmContext(
444
+ createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
445
+ )
446
+
447
+ mockGetBlockNodeApi(
448
+ mockNodeApi({
449
+ getBlockByHeight: jest.fn().mockResolvedValueOnce(
450
+ makeNodeBlock({
451
+ transactions: [
452
+ makeNodeBlockTx({ hash: '0xtx1', input: '0xdeadbeef', gasLimit: '73330', nonce: 0 }),
453
+ ],
454
+ })
455
+ ),
456
+ getBlockReceipts: jest
457
+ .fn()
458
+ .mockResolvedValueOnce([makeNodeBlockReceipt({ hash: '0xtx1', gasPrice: '1000000000' })]),
459
+ getTransaction: jest.fn(),
460
+ })
461
+ )
462
+
463
+ const result = await getBlock(context, '', 12345)
464
+
465
+ expect(result.transactions[0].details).toEqual({
466
+ gasPrice: '1000000000',
467
+ gasLimit: '73330',
468
+ sequence: 0,
469
+ contractInteraction: 'SmartContractInteraction',
470
+ contractAddress: safeEncodeEIP55(address2, testLogger),
471
+ contractPayload: '0xdeadbeef',
472
+ })
473
+ })
474
+
475
+ it('omits the gas limit and the nonce when the prefetched tx does not report them', async () => {
476
+ const context = createMockEvmContext(
477
+ createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
478
+ )
479
+
480
+ mockGetBlockNodeApi(
481
+ mockNodeApi({
482
+ getBlockByHeight: jest
483
+ .fn()
484
+ .mockResolvedValueOnce(makeNodeBlock({ transactions: [makeNodeBlockTx()] })),
485
+ getBlockReceipts: jest.fn().mockResolvedValueOnce([makeNodeBlockReceipt()]),
486
+ getTransaction: jest.fn(),
487
+ })
488
+ )
489
+
490
+ const result = await getBlock(context, '', 12345)
491
+
492
+ expect(result.transactions[0].details).toEqual({ gasPrice: '20000000000' })
493
+ })
494
+
495
+ it('adds the gas price, the gas limit and the nonce when falling back to getTransaction', async () => {
496
+ const context = createMockEvmContext(
497
+ createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
498
+ )
499
+
500
+ mockGetBlockNodeApi(
501
+ mockNodeApi({
502
+ getBlockByHeight: jest
503
+ .fn()
504
+ .mockResolvedValueOnce(makeNodeBlock({ transactions: [makeNodeBlockTx()] })),
505
+ getBlockReceipts: jest.fn().mockRejectedValueOnce(
506
+ new UnsupportedRpcMethodError(
507
+ 'eth_getBlockReceipts is not supported by this RPC provider',
508
+ {
509
+ method: 'eth_getBlockReceipts',
510
+ rawError: { code: -32601 },
511
+ }
512
+ )
513
+ ),
514
+ getTransaction: jest
515
+ .fn()
516
+ .mockResolvedValueOnce(
517
+ makeNodeTxInfo({ gasPrice: '1000000000', gasLimit: '21000', nonce: 7 })
518
+ ),
519
+ })
520
+ )
521
+
522
+ const result = await getBlock(context, '', 12345)
523
+
524
+ expect(result.transactions[0].details).toEqual({
525
+ gasPrice: '1000000000',
526
+ gasLimit: '21000',
527
+ sequence: 7,
528
+ })
411
529
  })
412
530
 
413
531
  it('adds contract details when falling back to getTransaction with non-trivial input', async () => {
@@ -416,7 +534,7 @@ describe('getBlock', () => {
416
534
  )
417
535
 
418
536
  const calldata = '0xdeadbeef'
419
- const mockGetNodeApi = jest.mocked(getNodeApi)
537
+
420
538
  const mockGetBlockByHeight = jest.fn().mockResolvedValueOnce(
421
539
  makeNodeBlock({
422
540
  transactions: [makeNodeBlockTx({ hash: '0xtx1' })],
@@ -437,7 +555,7 @@ describe('getBlock', () => {
437
555
  })
438
556
  )
439
557
 
440
- mockGetNodeApi.mockReturnValue(
558
+ mockGetBlockNodeApi(
441
559
  mockNodeApi({
442
560
  getBlockByHeight: mockGetBlockByHeight,
443
561
  getBlockReceipts: mockGetBlockReceipts,
@@ -462,7 +580,6 @@ describe('getBlock', () => {
462
580
  createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
463
581
  )
464
582
 
465
- const mockGetNodeApi = jest.mocked(getNodeApi)
466
583
  const mockGetBlockByHeight = jest.fn().mockResolvedValueOnce(
467
584
  makeNodeBlock({
468
585
  hash: '0xabc123',
@@ -479,7 +596,7 @@ describe('getBlock', () => {
479
596
  .fn()
480
597
  .mockResolvedValueOnce(makeNodeTxInfo({ hash: '0xtx1', value: '1000' }))
481
598
 
482
- mockGetNodeApi.mockReturnValue(
599
+ mockGetBlockNodeApi(
483
600
  mockNodeApi({
484
601
  getBlockByHeight: mockGetBlockByHeight,
485
602
  getBlockReceipts: mockGetBlockReceipts,
@@ -499,8 +616,8 @@ describe('getBlock', () => {
499
616
  }),
500
617
  ]),
501
618
  })
502
- expect(mockGetBlockReceipts).toHaveBeenCalledWith(expect.anything(), 12345)
503
- expect(mockGetTransaction).toHaveBeenCalledWith(expect.anything(), '0xtx1')
619
+ expect(mockGetBlockReceipts).toHaveBeenCalledWith(12345)
620
+ expect(mockGetTransaction).toHaveBeenCalledWith('0xtx1')
504
621
  })
505
622
 
506
623
  it('falls back to per-transaction calls when prefetchTxs is not supported', async () => {
@@ -508,14 +625,13 @@ describe('getBlock', () => {
508
625
  createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
509
626
  )
510
627
 
511
- const mockGetNodeApi = jest.mocked(getNodeApi)
512
628
  const mockGetBlockByHeight = jest
513
629
  .fn()
514
630
  .mockResolvedValueOnce(makeNodeBlock({ hash: '0xabc123', transactionHashes: ['0xtx1'] }))
515
631
  const mockGetBlockReceipts = jest.fn()
516
632
  const mockGetTransaction = jest.fn().mockResolvedValueOnce(makeNodeTxInfo({ hash: '0xtx1' }))
517
633
 
518
- mockGetNodeApi.mockReturnValue(
634
+ mockGetBlockNodeApi(
519
635
  mockNodeApi({
520
636
  getBlockByHeight: mockGetBlockByHeight,
521
637
  getBlockReceipts: mockGetBlockReceipts,
@@ -535,9 +651,9 @@ describe('getBlock', () => {
535
651
  }),
536
652
  ]),
537
653
  })
538
- expect(mockGetBlockByHeight).toHaveBeenCalledWith(expect.anything(), 12345, true)
654
+ expect(mockGetBlockByHeight).toHaveBeenCalledWith(12345, true)
539
655
  expect(mockGetBlockReceipts).not.toHaveBeenCalled()
540
- expect(mockGetTransaction).toHaveBeenCalledWith(expect.anything(), '0xtx1')
656
+ expect(mockGetTransaction).toHaveBeenCalledWith('0xtx1')
541
657
  })
542
658
 
543
659
  it('does not fallback when getBlockReceipts fails for another reason', async () => {
@@ -545,7 +661,6 @@ describe('getBlock', () => {
545
661
  createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
546
662
  )
547
663
 
548
- const mockGetNodeApi = jest.mocked(getNodeApi)
549
664
  const mockGetBlockByHeight = jest.fn().mockResolvedValueOnce(
550
665
  makeNodeBlock({
551
666
  height: 12345,
@@ -556,7 +671,7 @@ describe('getBlock', () => {
556
671
  const mockGetBlockReceipts = jest.fn().mockRejectedValueOnce(serverError)
557
672
  const mockGetTransaction = jest.fn()
558
673
 
559
- mockGetNodeApi.mockReturnValue(
674
+ mockGetBlockNodeApi(
560
675
  mockNodeApi({
561
676
  getBlockByHeight: mockGetBlockByHeight,
562
677
  getBlockReceipts: mockGetBlockReceipts,
@@ -599,7 +714,6 @@ describe('getBlock', () => {
599
714
  })
600
715
  )
601
716
 
602
- const mockGetNodeApi = jest.mocked(getNodeApi)
603
717
  const mockGetBlockByHeight = jest.fn().mockResolvedValueOnce(
604
718
  makeNodeBlock({
605
719
  transactions: [makeNodeBlockTx({ hash: '0xtx1', value: '0' })],
@@ -609,7 +723,7 @@ describe('getBlock', () => {
609
723
  .fn()
610
724
  .mockResolvedValue([makeNodeBlockReceipt({ hash: '0xtx1', erc20Transfers: [] })])
611
725
 
612
- mockGetNodeApi.mockReturnValue(
726
+ mockGetBlockNodeApi(
613
727
  mockNodeApi({
614
728
  getBlockByHeight: mockGetBlockByHeight,
615
729
  getBlockReceipts: mockGetBlockReceipts,
@@ -674,8 +788,8 @@ describe('getBlock', () => {
674
788
  )
675
789
 
676
790
  const amount = 200000000000000000n
677
- const mockGetNodeApi = jest.mocked(getNodeApi)
678
- mockGetNodeApi.mockReturnValue(
791
+
792
+ mockGetBlockNodeApi(
679
793
  mockNodeApi({
680
794
  getBlockByHeight: jest.fn().mockResolvedValueOnce(
681
795
  makeNodeBlock({
@@ -725,8 +839,8 @@ describe('getBlock', () => {
725
839
  const coinAmount = 200000000000000000n
726
840
  const nestedAmount = 200000000000000000n
727
841
  const nestedRecipient = '0x330E16622F947CBBfA15aB2fdf83014EAa27eCd1'
728
- const mockGetNodeApi = jest.mocked(getNodeApi)
729
- mockGetNodeApi.mockReturnValue(
842
+
843
+ mockGetBlockNodeApi(
730
844
  mockNodeApi({
731
845
  getBlockByHeight: jest.fn().mockResolvedValueOnce(
732
846
  makeNodeBlock({
@@ -793,8 +907,8 @@ describe('getBlock', () => {
793
907
  action: makeNodeTraceAction({ from: address1, to: address2, value: amount.toString() }),
794
908
  }),
795
909
  ])
796
- const mockGetNodeApi = jest.mocked(getNodeApi)
797
- mockGetNodeApi.mockReturnValue(
910
+
911
+ mockGetBlockNodeApi(
798
912
  mockNodeApi({
799
913
  getBlockByHeight: jest.fn().mockResolvedValue(
800
914
  makeNodeBlock({
@@ -813,7 +927,7 @@ describe('getBlock', () => {
813
927
  const result = await getBlock(context, '', 12345)
814
928
 
815
929
  expect(mockGetInternalTransactionsByBlock).not.toHaveBeenCalled()
816
- expect(mockTraceBlock).toHaveBeenCalledWith(expect.anything(), 12345)
930
+ expect(mockTraceBlock).toHaveBeenCalledWith(12345)
817
931
 
818
932
  const encodedFrom = safeEncodeEIP55(address1, testLogger)
819
933
  const encodedTo = safeEncodeEIP55(address2, testLogger)
@@ -855,8 +969,8 @@ describe('getBlock', () => {
855
969
  }
856
970
  )
857
971
  const mockTraceBlock = jest.fn().mockRejectedValue(error)
858
- const mockGetNodeApi = jest.mocked(getNodeApi)
859
- mockGetNodeApi.mockReturnValue(
972
+
973
+ mockGetBlockNodeApi(
860
974
  mockNodeApi({
861
975
  getBlockByHeight: jest.fn().mockResolvedValue(
862
976
  makeNodeBlock({
@@ -874,7 +988,7 @@ describe('getBlock', () => {
874
988
  await expect(getBlock(context, '', 12345)).rejects.toThrow(error)
875
989
 
876
990
  expect(mockGetInternalTransactionsByBlock).not.toHaveBeenCalled()
877
- expect(mockTraceBlock).toHaveBeenCalledWith(expect.anything(), 12345)
991
+ expect(mockTraceBlock).toHaveBeenCalledWith(12345)
878
992
  })
879
993
 
880
994
  it('when explorer.getInternalTransactionsByBlock fails and node trace methods are undefined, returns block with no internal transactions', async () => {
@@ -886,8 +1000,7 @@ describe('getBlock', () => {
886
1000
  })
887
1001
  )
888
1002
 
889
- const mockGetNodeApi = jest.mocked(getNodeApi)
890
- mockGetNodeApi.mockReturnValue(
1003
+ mockGetBlockNodeApi(
891
1004
  mockNodeApi({
892
1005
  getBlockByHeight: jest.fn().mockResolvedValue(
893
1006
  makeNodeBlock({
@@ -934,8 +1047,8 @@ describe('getBlock', () => {
934
1047
  })
935
1048
 
936
1049
  const mockTraceBlock = jest.fn().mockResolvedValue([traceBlockItem])
937
- const mockGetNodeApi = jest.mocked(getNodeApi)
938
- mockGetNodeApi.mockReturnValue(
1050
+
1051
+ mockGetBlockNodeApi(
939
1052
  mockNodeApi({
940
1053
  getBlockByHeight: jest.fn().mockResolvedValue(
941
1054
  makeNodeBlock({
@@ -955,7 +1068,7 @@ describe('getBlock', () => {
955
1068
 
956
1069
  const result = await getBlock(context, '', 12345)
957
1070
 
958
- expect(mockTraceBlock).toHaveBeenCalledWith(expect.anything(), 12345)
1071
+ expect(mockTraceBlock).toHaveBeenCalledWith(12345)
959
1072
  const encodedFrom = safeEncodeEIP55(address1, testLogger)
960
1073
  const encodedTo = safeEncodeEIP55(address2, testLogger)
961
1074
  expect(result).toMatchObject({
@@ -1004,8 +1117,8 @@ describe('getBlock', () => {
1004
1117
  }
1005
1118
  )
1006
1119
  const mockTraceBlock = jest.fn().mockRejectedValue(error)
1007
- const mockGetNodeApi = jest.mocked(getNodeApi)
1008
- mockGetNodeApi.mockReturnValue(
1120
+
1121
+ mockGetBlockNodeApi(
1009
1122
  mockNodeApi({
1010
1123
  getBlockByHeight: jest.fn().mockResolvedValue(
1011
1124
  makeNodeBlock({
@@ -1026,7 +1139,7 @@ describe('getBlock', () => {
1026
1139
  await expect(getBlock(context, '', 12345)).rejects.toThrow(error)
1027
1140
 
1028
1141
  expect(mockGetInternalTransactionsByBlock).toHaveBeenCalledWith(expect.anything(), 12345)
1029
- expect(mockTraceBlock).toHaveBeenCalledWith(expect.anything(), 12345)
1142
+ expect(mockTraceBlock).toHaveBeenCalledWith(12345)
1030
1143
  })
1031
1144
 
1032
1145
  it('with default source list, propagates trace errors when explorer and both trace methods fail at runtime', async () => {
@@ -1048,8 +1161,8 @@ describe('getBlock', () => {
1048
1161
  )
1049
1162
  const mockTraceBlockErigon = jest.fn().mockRejectedValue(erigonError)
1050
1163
  const mockTraceBlockGeth = jest.fn().mockRejectedValue(gethError)
1051
- const mockGetNodeApi = jest.mocked(getNodeApi)
1052
- mockGetNodeApi.mockReturnValue(
1164
+
1165
+ mockGetBlockNodeApi(
1053
1166
  mockNodeApi({
1054
1167
  getBlockByHeight: jest.fn().mockResolvedValue(
1055
1168
  makeNodeBlock({
@@ -1071,8 +1184,8 @@ describe('getBlock', () => {
1071
1184
  await expect(getBlock(context, '', 12345)).rejects.toMatchObject({
1072
1185
  errors: [erigonError, gethError],
1073
1186
  })
1074
- expect(mockTraceBlockErigon).toHaveBeenCalledWith(expect.anything(), 12345)
1075
- expect(mockTraceBlockGeth).toHaveBeenCalledWith(expect.anything(), 12345)
1187
+ expect(mockTraceBlockErigon).toHaveBeenCalledWith(12345)
1188
+ expect(mockTraceBlockGeth).toHaveBeenCalledWith(12345)
1076
1189
  })
1077
1190
 
1078
1191
  it('with default source list, falls back from traceBlockErigon to traceBlockGeth when explorer fails', async () => {
@@ -1091,8 +1204,8 @@ describe('getBlock', () => {
1091
1204
  action: makeNodeTraceAction({ from: address1, to: address2, value: amount.toString() }),
1092
1205
  }),
1093
1206
  ])
1094
- const mockGetNodeApi = jest.mocked(getNodeApi)
1095
- mockGetNodeApi.mockReturnValue(
1207
+
1208
+ mockGetBlockNodeApi(
1096
1209
  mockNodeApi({
1097
1210
  getBlockByHeight: jest.fn().mockResolvedValue(
1098
1211
  makeNodeBlock({
@@ -1112,8 +1225,8 @@ describe('getBlock', () => {
1112
1225
 
1113
1226
  const result = await getBlock(context, '', 12345)
1114
1227
 
1115
- expect(mockTraceBlockErigon).toHaveBeenCalledWith(expect.anything(), 12345)
1116
- expect(mockTraceBlockGeth).toHaveBeenCalledWith(expect.anything(), 12345)
1228
+ expect(mockTraceBlockErigon).toHaveBeenCalledWith(12345)
1229
+ expect(mockTraceBlockGeth).toHaveBeenCalledWith(12345)
1117
1230
  const encodedFrom = safeEncodeEIP55(address1, testLogger)
1118
1231
  const encodedTo = safeEncodeEIP55(address2, testLogger)
1119
1232
  expect(result.transactions[0].operations).toEqual(
@@ -1150,8 +1263,8 @@ describe('getBlock', () => {
1150
1263
  { method: 'trace_block', rawError: { code: -32601 } }
1151
1264
  )
1152
1265
  const mockTraceBlockErigon = jest.fn().mockRejectedValue(erigonError)
1153
- const mockGetNodeApi = jest.mocked(getNodeApi)
1154
- mockGetNodeApi.mockReturnValue(
1266
+
1267
+ mockGetBlockNodeApi(
1155
1268
  mockNodeApi({
1156
1269
  getBlockByHeight: jest.fn().mockResolvedValue(
1157
1270
  makeNodeBlock({
@@ -1170,7 +1283,7 @@ describe('getBlock', () => {
1170
1283
  mockGetInternalTransactionsByBlock.mockRejectedValueOnce(new Error('explorer error'))
1171
1284
 
1172
1285
  await expect(getBlock(context, '', 12345)).rejects.toThrow(erigonError)
1173
- expect(mockTraceBlockErigon).toHaveBeenCalledWith(expect.anything(), 12345)
1286
+ expect(mockTraceBlockErigon).toHaveBeenCalledWith(12345)
1174
1287
  })
1175
1288
 
1176
1289
  it('uses prefetched tx gasPrice as fallback when Cronos receipt omits effectiveGasPrice and gasPrice', async () => {
@@ -1179,8 +1292,8 @@ describe('getBlock', () => {
1179
1292
  )
1180
1293
  const gasUsed = 21000n
1181
1294
  const txGasPrice = '568125000000'
1182
- const mockGetNodeApi = jest.mocked(getNodeApi)
1183
- mockGetNodeApi.mockReturnValue(
1295
+
1296
+ mockGetBlockNodeApi(
1184
1297
  mockNodeApi({
1185
1298
  getBlockByHeight: jest.fn().mockResolvedValueOnce(
1186
1299
  makeNodeBlock({
@@ -1209,8 +1322,8 @@ describe('getBlock', () => {
1209
1322
  const gasUsed = 21000n
1210
1323
  const receiptEffectiveGasPrice = '1000000000' // 1 Gwei — resolved from effectiveGasPrice by getBlockReceipts
1211
1324
  const txGasPrice = '568125000000' // higher value in the prefetched tx — must NOT win
1212
- const mockGetNodeApi = jest.mocked(getNodeApi)
1213
- mockGetNodeApi.mockReturnValue(
1325
+
1326
+ mockGetBlockNodeApi(
1214
1327
  mockNodeApi({
1215
1328
  getBlockByHeight: jest.fn().mockResolvedValueOnce(
1216
1329
  makeNodeBlock({
@@ -1239,8 +1352,8 @@ describe('getBlock', () => {
1239
1352
  const gasUsed = 21000n
1240
1353
  const gasPrice = '1000000000'
1241
1354
  const l1Fee = '95394812830580'
1242
- const mockGetNodeApi = jest.mocked(getNodeApi)
1243
- mockGetNodeApi.mockReturnValue(
1355
+
1356
+ mockGetBlockNodeApi(
1244
1357
  mockNodeApi({
1245
1358
  getBlockByHeight: jest.fn().mockResolvedValueOnce(
1246
1359
  makeNodeBlock({
@@ -1270,8 +1383,8 @@ describe('getBlock', () => {
1270
1383
  const gasUsed = '21000'
1271
1384
  const gasPrice = '1000000000'
1272
1385
  const l1Fee = '95394812830580'
1273
- const mockGetNodeApi = jest.mocked(getNodeApi)
1274
- mockGetNodeApi.mockReturnValue(
1386
+
1387
+ mockGetBlockNodeApi(
1275
1388
  mockNodeApi({
1276
1389
  getBlockByHeight: jest
1277
1390
  .fn()
@@ -1293,13 +1406,14 @@ describe('getBlock', () => {
1293
1406
 
1294
1407
  function buildZksyncMocks(
1295
1408
  txOverrides: Partial<PrefetchedBlockTransaction>,
1296
- receiptOverrides: Partial<BlockReceiptInfo>
1409
+ receiptOverrides: Partial<BlockReceiptInfo>,
1410
+ chainId: ChainId = CHAIN_ID.ZKSYNC
1297
1411
  ): EvmContext {
1298
1412
  const context = createMockEvmContext(
1299
- createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
1413
+ createMockEvmConfigInfo({ chainId, node: mkExternalNode() })
1300
1414
  )
1301
- const mockGetNodeApi = jest.mocked(getNodeApi)
1302
- mockGetNodeApi.mockReturnValue(
1415
+
1416
+ mockGetBlockNodeApi(
1303
1417
  mockNodeApi({
1304
1418
  getBlockByHeight: jest
1305
1419
  .fn()
@@ -1561,7 +1675,7 @@ describe('getBlock', () => {
1561
1675
  ])
1562
1676
  })
1563
1677
 
1564
- it('does not apply zkSync corrections to other currencies (e.g. ethereum) even when receipt type is 0xff', async () => {
1678
+ it('does not apply zkSync corrections to other chains (e.g. ethereum) even when the currency id is zksync and receipt type is 0xff', async () => {
1565
1679
  const context = buildZksyncMocks(
1566
1680
  { from: USER, to: USER, value: '270000000000000000' },
1567
1681
  {
@@ -1574,9 +1688,10 @@ describe('getBlock', () => {
1574
1688
  value: '270000000000000000',
1575
1689
  },
1576
1690
  ],
1577
- }
1691
+ },
1692
+ CHAIN_ID.ETHEREUM
1578
1693
  )
1579
- const result = await getBlock(context, 'ethereum', 12345)
1694
+ const result = await getBlock(context, 'zksync', 12345)
1580
1695
  expect(result.transactions[0].operations).toEqual([
1581
1696
  {
1582
1697
  type: 'transfer',
@@ -4,7 +4,7 @@
4
4
  import type { EvmConfigInfo } from '../../config'
5
5
  import { createMockEvmContext, mkExternalNode, mkLedgerNode } from '../../fixtures/context.fixtures'
6
6
  import { getNodeApi } from '../../network/node'
7
- import { mockNodeApi } from '../../network/node/node.fixtures'
7
+ import { mockNodeApi } from '../../network/tests/node/node.fixtures'
8
8
  import { getBlockInfo } from '../getBlockInfo'
9
9
 
10
10
  jest.mock('../../network/node', () => ({
@@ -20,7 +20,7 @@ describe('getBlockInfo', () => {
20
20
 
21
21
  beforeEach(() => {
22
22
  jest.clearAllMocks()
23
- mockGetNodeApi.mockImplementation((config: EvmConfigInfo, _currencyId: string) => {
23
+ mockGetNodeApi.mockImplementation((config: EvmConfigInfo) => {
24
24
  return config?.node?.type === 'ledger' ? ledgerMocks : externalMocks
25
25
  })
26
26
  })
@@ -4,7 +4,7 @@
4
4
  import type { EvmConfigInfo } from '../../config'
5
5
  import { createMockEvmContext, mkExternalNode, mkLedgerNode } from '../../fixtures/context.fixtures'
6
6
  import { getNodeApi } from '../../network/node'
7
- import { mockNodeApi } from '../../network/node/node.fixtures'
7
+ import { mockNodeApi } from '../../network/tests/node/node.fixtures'
8
8
  import { getNextSequence } from '../getNextSequence'
9
9
 
10
10
  jest.mock('../../network/node', () => ({
@@ -20,7 +20,7 @@ describe('getNextSequence', () => {
20
20
 
21
21
  beforeEach(() => {
22
22
  jest.clearAllMocks()
23
- mockGetNodeApi.mockImplementation((config: EvmConfigInfo, _currencyId: string) => {
23
+ mockGetNodeApi.mockImplementation((config: EvmConfigInfo) => {
24
24
  return config?.node?.type === 'ledger' ? ledgerMocks : externalMocks
25
25
  })
26
26
  })