@ledgerhq/coin-evm 10.1.0 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/CHANGELOG.md +42 -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 +2 -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 +2 -2
  11. package/lib/adapters/ledger.js.map +1 -1
  12. package/lib/api/index.js +1 -1
  13. package/lib/api/index.js.map +1 -1
  14. package/lib/chains.d.ts +94 -0
  15. package/lib/chains.d.ts.map +1 -0
  16. package/lib/chains.js +98 -0
  17. package/lib/chains.js.map +1 -0
  18. package/lib/config.d.ts +4 -1
  19. package/lib/config.d.ts.map +1 -1
  20. package/lib/config.js +3 -1
  21. package/lib/config.js.map +1 -1
  22. package/lib/logic/broadcast.js +2 -2
  23. package/lib/logic/broadcast.js.map +1 -1
  24. package/lib/logic/common.d.ts +1 -1
  25. package/lib/logic/common.d.ts.map +1 -1
  26. package/lib/logic/common.js +11 -11
  27. package/lib/logic/common.js.map +1 -1
  28. package/lib/logic/craftTransaction.d.ts.map +1 -1
  29. package/lib/logic/craftTransaction.js +3 -3
  30. package/lib/logic/craftTransaction.js.map +1 -1
  31. package/lib/logic/estimateFees.d.ts.map +1 -1
  32. package/lib/logic/estimateFees.js +7 -7
  33. package/lib/logic/estimateFees.js.map +1 -1
  34. package/lib/logic/getBalance.d.ts.map +1 -1
  35. package/lib/logic/getBalance.js +9 -9
  36. package/lib/logic/getBalance.js.map +1 -1
  37. package/lib/logic/getBlock.d.ts.map +1 -1
  38. package/lib/logic/getBlock.js +17 -17
  39. package/lib/logic/getBlock.js.map +1 -1
  40. package/lib/logic/getBlockInfo.js +2 -2
  41. package/lib/logic/getBlockInfo.js.map +1 -1
  42. package/lib/logic/getNextSequence.d.ts.map +1 -1
  43. package/lib/logic/getNextSequence.js +1 -1
  44. package/lib/logic/getNextSequence.js.map +1 -1
  45. package/lib/logic/getStakes.d.ts.map +1 -1
  46. package/lib/logic/getStakes.js +10 -10
  47. package/lib/logic/getStakes.js.map +1 -1
  48. package/lib/logic/internalTransactionsFetcher.d.ts +2 -2
  49. package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
  50. package/lib/logic/internalTransactionsFetcher.js +8 -8
  51. package/lib/logic/internalTransactionsFetcher.js.map +1 -1
  52. package/lib/logic/lastBlock.js +2 -2
  53. package/lib/logic/lastBlock.js.map +1 -1
  54. package/lib/logic/listOperations.d.ts.map +1 -1
  55. package/lib/logic/listOperations.js +1 -1
  56. package/lib/logic/listOperations.js.map +1 -1
  57. package/lib/logic/validateIntent.d.ts.map +1 -1
  58. package/lib/logic/validateIntent.js +9 -9
  59. package/lib/logic/validateIntent.js.map +1 -1
  60. package/lib/logic.d.ts +1 -1
  61. package/lib/logic.d.ts.map +1 -1
  62. package/lib/logic.js +14 -13
  63. package/lib/logic.js.map +1 -1
  64. package/lib/network/explorer/etherscan.d.ts +2 -3
  65. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  66. package/lib/network/explorer/etherscan.js +6 -8
  67. package/lib/network/explorer/etherscan.js.map +1 -1
  68. package/lib/network/explorer/ledger.d.ts.map +1 -1
  69. package/lib/network/explorer/ledger.js +5 -5
  70. package/lib/network/explorer/ledger.js.map +1 -1
  71. package/lib/network/explorer/types.d.ts +2 -2
  72. package/lib/network/explorer/types.d.ts.map +1 -1
  73. package/lib/network/explorer/types.js.map +1 -1
  74. package/lib/network/node/explorerProxy.js +12 -12
  75. package/lib/network/node/explorerProxy.js.map +1 -1
  76. package/lib/network/node/index.d.ts +1 -1
  77. package/lib/network/node/index.d.ts.map +1 -1
  78. package/lib/network/node/index.js +7 -7
  79. package/lib/network/node/index.js.map +1 -1
  80. package/lib/network/node/ledger.d.ts +3 -1
  81. package/lib/network/node/ledger.d.ts.map +1 -1
  82. package/lib/network/node/ledger.js +31 -22
  83. package/lib/network/node/ledger.js.map +1 -1
  84. package/lib/network/node/rpc.common.d.ts +1 -1
  85. package/lib/network/node/rpc.common.d.ts.map +1 -1
  86. package/lib/network/node/rpc.common.js +50 -39
  87. package/lib/network/node/rpc.common.js.map +1 -1
  88. package/lib/network/node/types.d.ts +15 -15
  89. package/lib/network/node/types.d.ts.map +1 -1
  90. package/lib/network/node/types.js.map +1 -1
  91. package/lib/network/node/withNodeSources.d.ts.map +1 -1
  92. package/lib/network/node/withNodeSources.js +15 -15
  93. package/lib/network/node/withNodeSources.js.map +1 -1
  94. package/lib/staking/abis.d.ts +3 -2
  95. package/lib/staking/abis.d.ts.map +1 -1
  96. package/lib/staking/abis.js +10 -9
  97. package/lib/staking/abis.js.map +1 -1
  98. package/lib/staking/contracts.d.ts +3 -2
  99. package/lib/staking/contracts.d.ts.map +1 -1
  100. package/lib/staking/contracts.js +11 -10
  101. package/lib/staking/contracts.js.map +1 -1
  102. package/lib/staking/detectOperationType.d.ts +2 -1
  103. package/lib/staking/detectOperationType.d.ts.map +1 -1
  104. package/lib/staking/detectOperationType.js +7 -7
  105. package/lib/staking/detectOperationType.js.map +1 -1
  106. package/lib/staking/encoder.d.ts +2 -1
  107. package/lib/staking/encoder.d.ts.map +1 -1
  108. package/lib/staking/encoder.js +8 -8
  109. package/lib/staking/encoder.js.map +1 -1
  110. package/lib/staking/fetchers.d.ts +2 -1
  111. package/lib/staking/fetchers.d.ts.map +1 -1
  112. package/lib/staking/fetchers.js +27 -27
  113. package/lib/staking/fetchers.js.map +1 -1
  114. package/lib/staking/logic.d.ts +6 -6
  115. package/lib/staking/logic.d.ts.map +1 -1
  116. package/lib/staking/logic.js +14 -13
  117. package/lib/staking/logic.js.map +1 -1
  118. package/lib/staking/operations/index.d.ts +2 -1
  119. package/lib/staking/operations/index.d.ts.map +1 -1
  120. package/lib/staking/operations/index.js +30 -28
  121. package/lib/staking/operations/index.js.map +1 -1
  122. package/lib/staking/prepareIntents.d.ts +1 -1
  123. package/lib/staking/prepareIntents.d.ts.map +1 -1
  124. package/lib/staking/prepareIntents.js +11 -10
  125. package/lib/staking/prepareIntents.js.map +1 -1
  126. package/lib/staking/redelegations.d.ts +4 -4
  127. package/lib/staking/redelegations.d.ts.map +1 -1
  128. package/lib/staking/redelegations.js +18 -20
  129. package/lib/staking/redelegations.js.map +1 -1
  130. package/lib/staking/rewards.d.ts +1 -1
  131. package/lib/staking/rewards.d.ts.map +1 -1
  132. package/lib/staking/rewards.js +2 -2
  133. package/lib/staking/rewards.js.map +1 -1
  134. package/lib/staking/rewardsFromReceipt.d.ts +2 -1
  135. package/lib/staking/rewardsFromReceipt.d.ts.map +1 -1
  136. package/lib/staking/rewardsFromReceipt.js +2 -2
  137. package/lib/staking/rewardsFromReceipt.js.map +1 -1
  138. package/lib/staking/transactionData.d.ts +2 -1
  139. package/lib/staking/transactionData.d.ts.map +1 -1
  140. package/lib/staking/transactionData.js +6 -6
  141. package/lib/staking/transactionData.js.map +1 -1
  142. package/lib/staking/unbondings.d.ts +1 -1
  143. package/lib/staking/unbondings.d.ts.map +1 -1
  144. package/lib/staking/unbondings.js +2 -2
  145. package/lib/staking/unbondings.js.map +1 -1
  146. package/lib/staking/validators/index.d.ts +14 -14
  147. package/lib/staking/validators/index.d.ts.map +1 -1
  148. package/lib/staking/validators/index.js +39 -38
  149. package/lib/staking/validators/index.js.map +1 -1
  150. package/lib/staking/validators/monad.d.ts +5 -5
  151. package/lib/staking/validators/monad.d.ts.map +1 -1
  152. package/lib/staking/validators/monad.js +31 -33
  153. package/lib/staking/validators/monad.js.map +1 -1
  154. package/lib/staking/validators/monadResolver.d.ts +1 -1
  155. package/lib/staking/validators/monadResolver.d.ts.map +1 -1
  156. package/lib/staking/validators/monadResolver.js +4 -4
  157. package/lib/staking/validators/monadResolver.js.map +1 -1
  158. package/lib/staking/validators/sei.js +2 -2
  159. package/lib/staking/validators/sei.js.map +1 -1
  160. package/lib/staking/validators/somnia.d.ts +4 -4
  161. package/lib/staking/validators/somnia.d.ts.map +1 -1
  162. package/lib/staking/validators/somnia.js +22 -22
  163. package/lib/staking/validators/somnia.js.map +1 -1
  164. package/lib/staking/validators/types.d.ts +1 -1
  165. package/lib/staking/validators/types.d.ts.map +1 -1
  166. package/lib/staking/validators/zero_gravity.d.ts +1 -1
  167. package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
  168. package/lib/staking/validators/zero_gravity.js +7 -7
  169. package/lib/staking/validators/zero_gravity.js.map +1 -1
  170. package/lib/types/staking.d.ts +5 -6
  171. package/lib/types/staking.d.ts.map +1 -1
  172. package/lib-es/adapters/etherscan.d.ts +2 -1
  173. package/lib-es/adapters/etherscan.d.ts.map +1 -1
  174. package/lib-es/adapters/etherscan.js +2 -2
  175. package/lib-es/adapters/etherscan.js.map +1 -1
  176. package/lib-es/adapters/ledger.d.ts +2 -1
  177. package/lib-es/adapters/ledger.d.ts.map +1 -1
  178. package/lib-es/adapters/ledger.js +2 -2
  179. package/lib-es/adapters/ledger.js.map +1 -1
  180. package/lib-es/api/index.js +1 -1
  181. package/lib-es/api/index.js.map +1 -1
  182. package/lib-es/chains.d.ts +94 -0
  183. package/lib-es/chains.d.ts.map +1 -0
  184. package/lib-es/chains.js +95 -0
  185. package/lib-es/chains.js.map +1 -0
  186. package/lib-es/config.d.ts +4 -1
  187. package/lib-es/config.d.ts.map +1 -1
  188. package/lib-es/config.js +1 -0
  189. package/lib-es/config.js.map +1 -1
  190. package/lib-es/logic/broadcast.js +2 -2
  191. package/lib-es/logic/broadcast.js.map +1 -1
  192. package/lib-es/logic/common.d.ts +1 -1
  193. package/lib-es/logic/common.d.ts.map +1 -1
  194. package/lib-es/logic/common.js +11 -11
  195. package/lib-es/logic/common.js.map +1 -1
  196. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  197. package/lib-es/logic/craftTransaction.js +3 -3
  198. package/lib-es/logic/craftTransaction.js.map +1 -1
  199. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  200. package/lib-es/logic/estimateFees.js +7 -7
  201. package/lib-es/logic/estimateFees.js.map +1 -1
  202. package/lib-es/logic/getBalance.d.ts.map +1 -1
  203. package/lib-es/logic/getBalance.js +9 -9
  204. package/lib-es/logic/getBalance.js.map +1 -1
  205. package/lib-es/logic/getBlock.d.ts.map +1 -1
  206. package/lib-es/logic/getBlock.js +18 -18
  207. package/lib-es/logic/getBlock.js.map +1 -1
  208. package/lib-es/logic/getBlockInfo.js +2 -2
  209. package/lib-es/logic/getBlockInfo.js.map +1 -1
  210. package/lib-es/logic/getNextSequence.d.ts.map +1 -1
  211. package/lib-es/logic/getNextSequence.js +1 -1
  212. package/lib-es/logic/getNextSequence.js.map +1 -1
  213. package/lib-es/logic/getStakes.d.ts.map +1 -1
  214. package/lib-es/logic/getStakes.js +10 -10
  215. package/lib-es/logic/getStakes.js.map +1 -1
  216. package/lib-es/logic/internalTransactionsFetcher.d.ts +2 -2
  217. package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
  218. package/lib-es/logic/internalTransactionsFetcher.js +8 -8
  219. package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
  220. package/lib-es/logic/lastBlock.js +2 -2
  221. package/lib-es/logic/lastBlock.js.map +1 -1
  222. package/lib-es/logic/listOperations.d.ts.map +1 -1
  223. package/lib-es/logic/listOperations.js +1 -1
  224. package/lib-es/logic/listOperations.js.map +1 -1
  225. package/lib-es/logic/validateIntent.d.ts.map +1 -1
  226. package/lib-es/logic/validateIntent.js +9 -9
  227. package/lib-es/logic/validateIntent.js.map +1 -1
  228. package/lib-es/logic.d.ts +1 -1
  229. package/lib-es/logic.d.ts.map +1 -1
  230. package/lib-es/logic.js +14 -13
  231. package/lib-es/logic.js.map +1 -1
  232. package/lib-es/network/explorer/etherscan.d.ts +2 -3
  233. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  234. package/lib-es/network/explorer/etherscan.js +6 -8
  235. package/lib-es/network/explorer/etherscan.js.map +1 -1
  236. package/lib-es/network/explorer/ledger.d.ts.map +1 -1
  237. package/lib-es/network/explorer/ledger.js +5 -5
  238. package/lib-es/network/explorer/ledger.js.map +1 -1
  239. package/lib-es/network/explorer/types.d.ts +2 -2
  240. package/lib-es/network/explorer/types.d.ts.map +1 -1
  241. package/lib-es/network/explorer/types.js.map +1 -1
  242. package/lib-es/network/node/explorerProxy.js +12 -12
  243. package/lib-es/network/node/explorerProxy.js.map +1 -1
  244. package/lib-es/network/node/index.d.ts +1 -1
  245. package/lib-es/network/node/index.d.ts.map +1 -1
  246. package/lib-es/network/node/index.js +7 -7
  247. package/lib-es/network/node/index.js.map +1 -1
  248. package/lib-es/network/node/ledger.d.ts +3 -1
  249. package/lib-es/network/node/ledger.d.ts.map +1 -1
  250. package/lib-es/network/node/ledger.js +31 -22
  251. package/lib-es/network/node/ledger.js.map +1 -1
  252. package/lib-es/network/node/rpc.common.d.ts +1 -1
  253. package/lib-es/network/node/rpc.common.d.ts.map +1 -1
  254. package/lib-es/network/node/rpc.common.js +50 -39
  255. package/lib-es/network/node/rpc.common.js.map +1 -1
  256. package/lib-es/network/node/types.d.ts +15 -15
  257. package/lib-es/network/node/types.d.ts.map +1 -1
  258. package/lib-es/network/node/types.js.map +1 -1
  259. package/lib-es/network/node/withNodeSources.d.ts.map +1 -1
  260. package/lib-es/network/node/withNodeSources.js +15 -15
  261. package/lib-es/network/node/withNodeSources.js.map +1 -1
  262. package/lib-es/staking/abis.d.ts +3 -2
  263. package/lib-es/staking/abis.d.ts.map +1 -1
  264. package/lib-es/staking/abis.js +10 -9
  265. package/lib-es/staking/abis.js.map +1 -1
  266. package/lib-es/staking/contracts.d.ts +3 -2
  267. package/lib-es/staking/contracts.d.ts.map +1 -1
  268. package/lib-es/staking/contracts.js +11 -10
  269. package/lib-es/staking/contracts.js.map +1 -1
  270. package/lib-es/staking/detectOperationType.d.ts +2 -1
  271. package/lib-es/staking/detectOperationType.d.ts.map +1 -1
  272. package/lib-es/staking/detectOperationType.js +7 -7
  273. package/lib-es/staking/detectOperationType.js.map +1 -1
  274. package/lib-es/staking/encoder.d.ts +2 -1
  275. package/lib-es/staking/encoder.d.ts.map +1 -1
  276. package/lib-es/staking/encoder.js +8 -8
  277. package/lib-es/staking/encoder.js.map +1 -1
  278. package/lib-es/staking/fetchers.d.ts +2 -1
  279. package/lib-es/staking/fetchers.d.ts.map +1 -1
  280. package/lib-es/staking/fetchers.js +27 -27
  281. package/lib-es/staking/fetchers.js.map +1 -1
  282. package/lib-es/staking/logic.d.ts +6 -6
  283. package/lib-es/staking/logic.d.ts.map +1 -1
  284. package/lib-es/staking/logic.js +14 -13
  285. package/lib-es/staking/logic.js.map +1 -1
  286. package/lib-es/staking/operations/index.d.ts +2 -1
  287. package/lib-es/staking/operations/index.d.ts.map +1 -1
  288. package/lib-es/staking/operations/index.js +30 -28
  289. package/lib-es/staking/operations/index.js.map +1 -1
  290. package/lib-es/staking/prepareIntents.d.ts +1 -1
  291. package/lib-es/staking/prepareIntents.d.ts.map +1 -1
  292. package/lib-es/staking/prepareIntents.js +11 -10
  293. package/lib-es/staking/prepareIntents.js.map +1 -1
  294. package/lib-es/staking/redelegations.d.ts +4 -4
  295. package/lib-es/staking/redelegations.d.ts.map +1 -1
  296. package/lib-es/staking/redelegations.js +18 -20
  297. package/lib-es/staking/redelegations.js.map +1 -1
  298. package/lib-es/staking/rewards.d.ts +1 -1
  299. package/lib-es/staking/rewards.d.ts.map +1 -1
  300. package/lib-es/staking/rewards.js +2 -2
  301. package/lib-es/staking/rewards.js.map +1 -1
  302. package/lib-es/staking/rewardsFromReceipt.d.ts +2 -1
  303. package/lib-es/staking/rewardsFromReceipt.d.ts.map +1 -1
  304. package/lib-es/staking/rewardsFromReceipt.js +2 -2
  305. package/lib-es/staking/rewardsFromReceipt.js.map +1 -1
  306. package/lib-es/staking/transactionData.d.ts +2 -1
  307. package/lib-es/staking/transactionData.d.ts.map +1 -1
  308. package/lib-es/staking/transactionData.js +6 -6
  309. package/lib-es/staking/transactionData.js.map +1 -1
  310. package/lib-es/staking/unbondings.d.ts +1 -1
  311. package/lib-es/staking/unbondings.d.ts.map +1 -1
  312. package/lib-es/staking/unbondings.js +2 -2
  313. package/lib-es/staking/unbondings.js.map +1 -1
  314. package/lib-es/staking/validators/index.d.ts +14 -14
  315. package/lib-es/staking/validators/index.d.ts.map +1 -1
  316. package/lib-es/staking/validators/index.js +39 -38
  317. package/lib-es/staking/validators/index.js.map +1 -1
  318. package/lib-es/staking/validators/monad.d.ts +5 -5
  319. package/lib-es/staking/validators/monad.d.ts.map +1 -1
  320. package/lib-es/staking/validators/monad.js +31 -33
  321. package/lib-es/staking/validators/monad.js.map +1 -1
  322. package/lib-es/staking/validators/monadResolver.d.ts +1 -1
  323. package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
  324. package/lib-es/staking/validators/monadResolver.js +4 -4
  325. package/lib-es/staking/validators/monadResolver.js.map +1 -1
  326. package/lib-es/staking/validators/sei.js +2 -2
  327. package/lib-es/staking/validators/sei.js.map +1 -1
  328. package/lib-es/staking/validators/somnia.d.ts +4 -4
  329. package/lib-es/staking/validators/somnia.d.ts.map +1 -1
  330. package/lib-es/staking/validators/somnia.js +22 -22
  331. package/lib-es/staking/validators/somnia.js.map +1 -1
  332. package/lib-es/staking/validators/types.d.ts +1 -1
  333. package/lib-es/staking/validators/types.d.ts.map +1 -1
  334. package/lib-es/staking/validators/zero_gravity.d.ts +1 -1
  335. package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
  336. package/lib-es/staking/validators/zero_gravity.js +7 -7
  337. package/lib-es/staking/validators/zero_gravity.js.map +1 -1
  338. package/lib-es/types/staking.d.ts +5 -6
  339. package/lib-es/types/staking.d.ts.map +1 -1
  340. package/package.json +1 -1
  341. package/src/adapters/etherscan.test.ts +34 -38
  342. package/src/adapters/etherscan.ts +3 -2
  343. package/src/adapters/ledger.test.ts +49 -22
  344. package/src/adapters/ledger.ts +3 -2
  345. package/src/api/getBlock.integ.test.ts +2 -1
  346. package/src/api/index.monad_testnet.integ.test.ts +2 -2
  347. package/src/api/index.ts +1 -1
  348. package/src/chains.test.ts +12 -0
  349. package/src/chains.ts +97 -0
  350. package/src/config.ts +5 -1
  351. package/src/fixtures/staking.fixtures.ts +13 -0
  352. package/src/logic/broadcast.ts +2 -2
  353. package/src/logic/common.ts +10 -11
  354. package/src/logic/craftTransaction.ts +2 -3
  355. package/src/logic/estimateFees.ts +6 -23
  356. package/src/logic/getBalance.ts +7 -13
  357. package/src/logic/getBlock.ts +22 -19
  358. package/src/logic/getBlockInfo.ts +2 -2
  359. package/src/logic/getNextSequence.ts +1 -4
  360. package/src/logic/getStakes.ts +11 -12
  361. package/src/logic/internalTransactionsFetcher.ts +6 -8
  362. package/src/logic/lastBlock.ts +2 -2
  363. package/src/logic/listOperations.ts +0 -1
  364. package/src/logic/tests/broadcast.test.ts +4 -4
  365. package/src/logic/tests/broadcastSource.test.ts +0 -3
  366. package/src/logic/tests/common.test.ts +17 -33
  367. package/src/logic/tests/craftTransaction.test.ts +13 -6
  368. package/src/logic/tests/estimateFees.test.ts +16 -7
  369. package/src/logic/tests/getBalance.test.ts +17 -33
  370. package/src/logic/tests/getBlock.test.ts +69 -75
  371. package/src/logic/tests/getBlockInfo.test.ts +1 -1
  372. package/src/logic/tests/getNextSequence.test.ts +1 -1
  373. package/src/logic/tests/getStakes.test.ts +28 -16
  374. package/src/logic/tests/internalTransactionsFetcher.test.ts +5 -5
  375. package/src/logic/tests/lastBlock.test.ts +3 -6
  376. package/src/logic/tests/listOperations.test.ts +3 -4
  377. package/src/logic/tests/validateIntent.test.ts +12 -2
  378. package/src/logic/validateIntent.ts +8 -10
  379. package/src/logic.test.ts +12 -4
  380. package/src/logic.ts +13 -13
  381. package/src/network/explorer/etherscan.test.ts +9 -58
  382. package/src/network/explorer/etherscan.ts +8 -24
  383. package/src/network/explorer/index.test.ts +1 -1
  384. package/src/network/explorer/ledger.test.ts +23 -131
  385. package/src/network/explorer/ledger.ts +2 -5
  386. package/src/network/explorer/types.ts +0 -2
  387. package/src/network/node/explorerProxy.test.ts +17 -22
  388. package/src/network/node/explorerProxy.ts +12 -12
  389. package/src/network/node/index.memoization.test.ts +29 -22
  390. package/src/network/node/index.test.ts +1 -3
  391. package/src/network/node/index.ts +11 -8
  392. package/src/network/node/ledger.test.ts +63 -69
  393. package/src/network/node/ledger.ts +31 -34
  394. package/src/network/node/rpc.common.ts +58 -86
  395. package/src/network/node/rpc.test.ts +86 -114
  396. package/src/network/node/types.ts +11 -29
  397. package/src/network/node/withNodeSources.test.ts +7 -9
  398. package/src/network/node/withNodeSources.ts +23 -26
  399. package/src/staking/abis.test.ts +24 -28
  400. package/src/staking/abis.ts +12 -10
  401. package/src/staking/contracts.test.ts +20 -8
  402. package/src/staking/contracts.ts +12 -11
  403. package/src/staking/detectOperationType.test.ts +16 -13
  404. package/src/staking/detectOperationType.ts +9 -8
  405. package/src/staking/encoder.test.ts +38 -27
  406. package/src/staking/encoder.ts +9 -8
  407. package/src/staking/fetchers.ts +28 -39
  408. package/src/staking/logic.test.ts +34 -32
  409. package/src/staking/logic.ts +14 -14
  410. package/src/staking/operations/index.test.ts +48 -39
  411. package/src/staking/operations/index.ts +31 -28
  412. package/src/staking/prepareIntents.test.ts +14 -34
  413. package/src/staking/prepareIntents.ts +10 -13
  414. package/src/staking/redelegations.test.ts +73 -131
  415. package/src/staking/redelegations.ts +12 -26
  416. package/src/staking/rewards.test.ts +19 -21
  417. package/src/staking/rewards.ts +1 -2
  418. package/src/staking/rewardsFromReceipt.test.ts +9 -8
  419. package/src/staking/rewardsFromReceipt.ts +3 -2
  420. package/src/staking/transactionData.test.ts +35 -25
  421. package/src/staking/transactionData.ts +7 -6
  422. package/src/staking/unbondings.test.ts +26 -20
  423. package/src/staking/unbondings.ts +1 -2
  424. package/src/staking/validators/index.ts +45 -51
  425. package/src/staking/validators/monad.test.ts +52 -54
  426. package/src/staking/validators/monad.ts +31 -37
  427. package/src/staking/validators/monadResolver.ts +2 -4
  428. package/src/staking/validators/sei.ts +2 -2
  429. package/src/staking/validators/somnia.test.ts +22 -19
  430. package/src/staking/validators/somnia.ts +20 -27
  431. package/src/staking/validators/types.ts +0 -1
  432. package/src/staking/validators/zero_gravity.test.ts +34 -49
  433. package/src/staking/validators/zero_gravity.ts +5 -11
  434. package/src/staking/validators.integ.test.ts +3 -5
  435. package/src/staking/validators.test.ts +56 -53
  436. package/src/types/staking.ts +3 -6
@@ -6,6 +6,7 @@ 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 { CHAIN_ID } from '../../config'
9
10
  import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '../../errors'
10
11
  import {
11
12
  createMockEvmConfigInfo,
@@ -28,8 +29,6 @@ import {
28
29
  ERC20_MINT_TOPIC,
29
30
  } from './rpc.common'
30
31
 
31
- const currencyId = 'my_new_chain'
32
-
33
32
  const evmConfig = createMockEvmConfigInfo({
34
33
  chainId: 1,
35
34
  name: 'My New Chain',
@@ -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({
@@ -729,7 +695,7 @@ describe('EVM Family', () => {
729
695
  .mockResolvedValueOnce('0x00000001')
730
696
 
731
697
  await expect(
732
- nodeApi.call(currencyId, {
698
+ nodeApi.call({
733
699
  to: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
734
700
  data: '0x1234',
735
701
  block: 42,
@@ -749,7 +715,6 @@ describe('EVM Family', () => {
749
715
  it('should return the expected payload', async () => {
750
716
  expect(
751
717
  await nodeApi.getCoinBalance(
752
- currencyId,
753
718
  '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
754
719
  )
755
720
  ).toEqual(new BigNumber(420))
@@ -761,7 +726,6 @@ describe('EVM Family', () => {
761
726
  it('should return the expected payload', async () => {
762
727
  expect(
763
728
  await nodeApi.getTokenBalance(
764
- currencyId,
765
729
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
766
730
  '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
767
731
  )
@@ -772,7 +736,7 @@ describe('EVM Family', () => {
772
736
  describe('getTransactionCount', () => {
773
737
  it('should return the expected payload', async () => {
774
738
  expect(
775
- await nodeApi.getTransactionCount(currencyId, '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d')
739
+ await nodeApi.getTransactionCount('0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d')
776
740
  ).toEqual(5)
777
741
  })
778
742
  })
@@ -788,7 +752,7 @@ describe('EVM Family', () => {
788
752
  return null
789
753
  })
790
754
  expect(
791
- await nodeApi.getGasEstimation(currencyId, address, {
755
+ await nodeApi.getGasEstimation(address, {
792
756
  recipient: '0x0000000000000000000000000000000000000000',
793
757
  amount: new BigNumber(2),
794
758
  data: Buffer.from(''),
@@ -807,7 +771,7 @@ describe('EVM Family', () => {
807
771
  })
808
772
 
809
773
  await expect(
810
- nodeApi.getGasEstimation(currencyId, address, {
774
+ nodeApi.getGasEstimation(address, {
811
775
  recipient: 'wrongAddress',
812
776
  amount: new BigNumber(1),
813
777
  data: Buffer.from(''),
@@ -847,7 +811,7 @@ describe('EVM Family', () => {
847
811
  }
848
812
  })
849
813
 
850
- expect(await nodeApi.getFeeData(config, currencyId, eip1559Tx)).toEqual({
814
+ expect(await nodeApi.getFeeData(config, eip1559Tx)).toEqual({
851
815
  maxFeePerGas: new BigNumber('6000000014'),
852
816
  maxPriorityFeePerGas: new BigNumber('5999999988'),
853
817
  gasPrice: null,
@@ -865,7 +829,7 @@ describe('EVM Family', () => {
865
829
  }
866
830
  })
867
831
 
868
- expect(await nodeApi.getFeeData(config, currencyId, eip1559Tx)).toEqual({
832
+ expect(await nodeApi.getFeeData(config, eip1559Tx)).toEqual({
869
833
  maxFeePerGas: new BigNumber('25000246'),
870
834
  maxPriorityFeePerGas: new BigNumber('25000000'),
871
835
  gasPrice: null,
@@ -888,9 +852,7 @@ describe('EVM Family', () => {
888
852
  }
889
853
  })
890
854
 
891
- await expect(nodeApi.getFeeData(config, currencyId, eip1559Tx)).rejects.toThrow(
892
- feeHistoryError.message
893
- )
855
+ await expect(nodeApi.getFeeData(config, eip1559Tx)).rejects.toThrow(feeHistoryError.message)
894
856
  expect(sendSpy).not.toHaveBeenCalledWith('eth_maxPriorityFeePerGas', expect.anything())
895
857
  })
896
858
 
@@ -909,7 +871,7 @@ describe('EVM Family', () => {
909
871
  }
910
872
  })
911
873
 
912
- await expect(nodeApi.getFeeData(config, currencyId, eip1559Tx)).rejects.toThrow('timeout')
874
+ await expect(nodeApi.getFeeData(config, eip1559Tx)).rejects.toThrow('timeout')
913
875
  })
914
876
 
915
877
  it('should return the expected payload for an EIP1559 tx when network returns 0 priority fee', async () => {
@@ -928,7 +890,7 @@ describe('EVM Family', () => {
928
890
  }
929
891
  })
930
892
 
931
- expect(await nodeApi.getFeeData(config, currencyId, eip1559Tx)).toEqual({
893
+ expect(await nodeApi.getFeeData(config, eip1559Tx)).toEqual({
932
894
  maxFeePerGas: new BigNumber('1000000026'),
933
895
  maxPriorityFeePerGas: new BigNumber(1e9),
934
896
  gasPrice: null,
@@ -951,7 +913,7 @@ describe('EVM Family', () => {
951
913
  it('defaults to 5 blocks (0x5) when not configured', async () => {
952
914
  const sendSpy = stubFeeHistory()
953
915
 
954
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
916
+ await nodeApi.getFeeData(config, eip1559Tx)
955
917
 
956
918
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x5', 'latest', [50]])
957
919
  })
@@ -959,7 +921,7 @@ describe('EVM Family', () => {
959
921
  it('defaults to the 50th percentile when feeHistoryRewardPercentile is not configured', async () => {
960
922
  const sendSpy = stubFeeHistory()
961
923
 
962
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
924
+ await nodeApi.getFeeData(config, eip1559Tx)
963
925
 
964
926
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x5', 'latest', [50]])
965
927
  })
@@ -980,7 +942,7 @@ describe('EVM Family', () => {
980
942
  })
981
943
  const sendSpy = stubFeeHistory()
982
944
 
983
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
945
+ await nodeApi.getFeeData(config, eip1559Tx)
984
946
 
985
947
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x5', 'latest', [expected]])
986
948
  }
@@ -995,7 +957,7 @@ describe('EVM Family', () => {
995
957
  })
996
958
  const sendSpy = stubFeeHistory()
997
959
 
998
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
960
+ await nodeApi.getFeeData(config, eip1559Tx)
999
961
 
1000
962
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x14', 'latest', [75]])
1001
963
  })
@@ -1016,7 +978,7 @@ describe('EVM Family', () => {
1016
978
  })
1017
979
  const sendSpy = stubFeeHistory()
1018
980
 
1019
- await nodeApi.getFeeData(config, currencyId, eip1559Tx)
981
+ await nodeApi.getFeeData(config, eip1559Tx)
1020
982
 
1021
983
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', [expectedHex, 'latest', [50]])
1022
984
  }
@@ -1044,7 +1006,7 @@ describe('EVM Family', () => {
1044
1006
  }
1045
1007
  })
1046
1008
 
1047
- await nodeApi.getFeeData(config, currencyId, legacyTx)
1009
+ await nodeApi.getFeeData(config, legacyTx)
1048
1010
 
1049
1011
  expect(sendSpy).not.toHaveBeenCalledWith('eth_feeHistory', expect.anything())
1050
1012
  })
@@ -1069,7 +1031,7 @@ describe('EVM Family', () => {
1069
1031
  }
1070
1032
  })
1071
1033
 
1072
- const result = await nodeApi.getFeeData(config, currencyId, eip1559Tx)
1034
+ const result = await nodeApi.getFeeData(config, eip1559Tx)
1073
1035
 
1074
1036
  expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x14', 'latest', [50]])
1075
1037
  expect(result.maxPriorityFeePerGas).toEqual(new BigNumber('20000000000'))
@@ -1094,7 +1056,7 @@ describe('EVM Family', () => {
1094
1056
  }
1095
1057
  })
1096
1058
 
1097
- const result = await nodeApi.getFeeData(config, currencyId, eip1559Tx)
1059
+ const result = await nodeApi.getFeeData(config, eip1559Tx)
1098
1060
 
1099
1061
  expect(result.maxPriorityFeePerGas).toEqual(new BigNumber('20000000000'))
1100
1062
  // maxFeePerGas = nextBaseFee * 2 + floored priority = 13*2 + 20e9
@@ -1119,7 +1081,7 @@ describe('EVM Family', () => {
1119
1081
  }
1120
1082
  })
1121
1083
 
1122
- const result = await nodeApi.getFeeData(config, currencyId, eip1559Tx)
1084
+ const result = await nodeApi.getFeeData(config, eip1559Tx)
1123
1085
 
1124
1086
  expect(result.maxPriorityFeePerGas).toEqual(new BigNumber('5000000000'))
1125
1087
  })
@@ -1150,7 +1112,7 @@ describe('EVM Family', () => {
1150
1112
  new FeeData(BigInt('1000000000'), 0n, 0n) // 1 Gwei
1151
1113
  )
1152
1114
 
1153
- const result = await nodeApi.getFeeData(config, currencyId, legacyTx)
1115
+ const result = await nodeApi.getFeeData(config, legacyTx)
1154
1116
 
1155
1117
  expect(result.gasPrice).toEqual(new BigNumber('20000000000'))
1156
1118
  })
@@ -1171,7 +1133,12 @@ describe('EVM Family', () => {
1171
1133
  }
1172
1134
  })
1173
1135
 
1174
- expect(await nodeApi.getFeeData(config, 'zero_gravity', eip1559Tx)).toEqual({
1136
+ const zeroGravityConfig = createMockEvmConfigInfo({
1137
+ chainId: CHAIN_ID.ZERO_GRAVITY,
1138
+ node: mkExternalNode({ uri: 'my-rpc.com' }),
1139
+ })
1140
+
1141
+ expect(await nodeApi.getFeeData(zeroGravityConfig, eip1559Tx)).toEqual({
1175
1142
  maxFeePerGas: new BigNumber('2000000026'),
1176
1143
  maxPriorityFeePerGas: new BigNumber(2e9),
1177
1144
  gasPrice: null,
@@ -1210,7 +1177,7 @@ describe('EVM Family', () => {
1210
1177
  }
1211
1178
  })
1212
1179
 
1213
- expect(await nodeApi.getFeeData(config, 'optimism', legacyTx)).toEqual({
1180
+ expect(await nodeApi.getFeeData(config, legacyTx)).toEqual({
1214
1181
  maxFeePerGas: null,
1215
1182
  maxPriorityFeePerGas: null,
1216
1183
  gasPrice: new BigNumber('666'),
@@ -1223,7 +1190,7 @@ describe('EVM Family', () => {
1223
1190
  it('should return the expected payload', async () => {
1224
1191
  const serializedTransaction =
1225
1192
  '0x02f873012d85010c388d0085077715912682520894c2907efcce4011c491bbeda8a0fa63ba7aab596c87038d7ea4c6800080c001a0bbffe7ba303ab03f697d64672c4a288ae863df8a62ffc67ba72872ce8c227f6fa01261e7c9f06af13631f03fad9b88d3c48931d353b6b41b4072fddcca5ec41629'
1226
- expect(await nodeApi.broadcastTransaction(currencyId, serializedTransaction)).toEqual(
1193
+ expect(await nodeApi.broadcastTransaction(serializedTransaction)).toEqual(
1227
1194
  '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
1228
1195
  )
1229
1196
  })
@@ -1232,7 +1199,7 @@ describe('EVM Family', () => {
1232
1199
  const serializedTransaction =
1233
1200
  '0x02f873012d85010c388d0085077715912682520894c2907efcce4011c491bbeda8a0fa63ba7aab596c87038d7ea4c6800080c001a0bbffe7ba303ab03f697d64672c4a288ae863df8a62ffc67ba72872ce8c227f6fa01261e7c9f06af13631f03fad9b88d3c48931d353b6b41b4072fddcca5ec41628'
1234
1201
 
1235
- await expect(nodeApi.broadcastTransaction(currencyId, serializedTransaction)).rejects.toThrow(
1202
+ await expect(nodeApi.broadcastTransaction(serializedTransaction)).rejects.toThrow(
1236
1203
  InsufficientFunds
1237
1204
  )
1238
1205
  })
@@ -1241,15 +1208,13 @@ describe('EVM Family', () => {
1241
1208
  const serializedTransaction =
1242
1209
  '0x02f873012d85010c388d0085077715912682520894c2907efcce4011c491bbeda8a0fa63ba7aab596c87038d7ea4c6800080c001a0bbffe7ba303ab03f697d64672c4a288ae863df8a62ffc67ba72872ce8c227f6fa01261e7c9f06af13631f03fad9b88d3c48931d353b6b41b4072fddcca5ec41625'
1243
1210
 
1244
- await expect(nodeApi.broadcastTransaction(currencyId, serializedTransaction)).rejects.toThrow(
1245
- 'any error'
1246
- )
1211
+ await expect(nodeApi.broadcastTransaction(serializedTransaction)).rejects.toThrow('any error')
1247
1212
  })
1248
1213
  })
1249
1214
 
1250
1215
  describe('getBlock', () => {
1251
1216
  it('should return the expected payload', async () => {
1252
- expect(await nodeApi.getBlockByHeight(currencyId, 0)).toEqual({
1217
+ expect(await nodeApi.getBlockByHeight(0)).toEqual({
1253
1218
  hash: '0x474dee0136108e9412e9d84197b468bb057a8dad0f2024fc55adebc4a28fa8c5',
1254
1219
  // for this specific assertion we can't use Date.now() directly because
1255
1220
  // the timestamp returned by ethers (and mocked at the beginning of
@@ -1271,7 +1236,7 @@ describe('EVM Family', () => {
1271
1236
  })
1272
1237
  )
1273
1238
 
1274
- await expect(nodeApi.getBlockByHeight(currencyId, 956855)).rejects.toThrow(
1239
+ await expect(nodeApi.getBlockByHeight(956855)).rejects.toThrow(
1275
1240
  'Block 956855 not found (the node returned an empty stub block)'
1276
1241
  )
1277
1242
  })
@@ -1286,7 +1251,7 @@ describe('EVM Family', () => {
1286
1251
  })
1287
1252
  )
1288
1253
 
1289
- await expect(nodeApi.getBlockByHeight(currencyId, 0)).resolves.toMatchObject({
1254
+ await expect(nodeApi.getBlockByHeight(0)).resolves.toMatchObject({
1290
1255
  height: 0,
1291
1256
  timestamp: 0,
1292
1257
  })
@@ -1312,7 +1277,7 @@ describe('EVM Family', () => {
1312
1277
  })
1313
1278
  )
1314
1279
 
1315
- expect(await nodeApi.getBlockByHeight(currencyId, 1, true)).toEqual({
1280
+ expect(await nodeApi.getBlockByHeight(1, true)).toEqual({
1316
1281
  hash: '0x474dee0136108e9412e9d84197b468bb057a8dad0f2024fc55adebc4a28fa8c5',
1317
1282
  timestamp: now * 1000,
1318
1283
  height: 1,
@@ -1349,7 +1314,7 @@ describe('EVM Family', () => {
1349
1314
  .spyOn(JsonRpcProvider.prototype, 'getBlock')
1350
1315
  .mockResolvedValueOnce(blockWithThrowingGetter)
1351
1316
 
1352
- expect(await nodeApi.getBlockByHeight(currencyId, 1, true)).toEqual({
1317
+ expect(await nodeApi.getBlockByHeight(1, true)).toEqual({
1353
1318
  hash: '0x474dee0136108e9412e9d84197b468bb057a8dad0f2024fc55adebc4a28fa8c5',
1354
1319
  timestamp: now * 1000,
1355
1320
  height: 1,
@@ -1388,7 +1353,7 @@ describe('EVM Family', () => {
1388
1353
  }
1389
1354
  })
1390
1355
 
1391
- expect(await nodeApi.getBlockByHeight(currencyId, 69174056, true)).toEqual({
1356
+ expect(await nodeApi.getBlockByHeight(69174056, true)).toEqual({
1392
1357
  hash: '0x9e5af7a45cf98e8f32d1233092d1714f21ab15e2d24263c3fd5bef091d4736af',
1393
1358
  timestamp: 1742556350000,
1394
1359
  height: 69174056,
@@ -1424,7 +1389,7 @@ describe('EVM Family', () => {
1424
1389
  throw new Error(`Method not mocked: ${method}`)
1425
1390
  })
1426
1391
 
1427
- expect(await nodeApi.getBlockReceipts!(currencyId, 1)).toEqual([
1392
+ expect(await nodeApi.getBlockReceipts!(1)).toEqual([
1428
1393
  {
1429
1394
  hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
1430
1395
  gasUsed: '500000',
@@ -1450,7 +1415,7 @@ describe('EVM Family', () => {
1450
1415
  }
1451
1416
  throw new Error(`Method not mocked: ${method}`)
1452
1417
  })
1453
- expect(await nodeApi.getBlockReceipts!(currencyId, 1)).toEqual([
1418
+ expect(await nodeApi.getBlockReceipts!(1)).toEqual([
1454
1419
  {
1455
1420
  hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
1456
1421
  gasUsed: '21000',
@@ -1478,7 +1443,7 @@ describe('EVM Family', () => {
1478
1443
  throw new Error(`Method not mocked: ${method}`)
1479
1444
  })
1480
1445
 
1481
- expect(await nodeApi.getBlockReceipts!(currencyId, 1)).toEqual([
1446
+ expect(await nodeApi.getBlockReceipts!(1)).toEqual([
1482
1447
  {
1483
1448
  hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
1484
1449
  gasUsed: '21000',
@@ -1518,7 +1483,7 @@ describe('EVM Family', () => {
1518
1483
  throw new Error(`Method not mocked: ${method}`)
1519
1484
  })
1520
1485
 
1521
- expect(await nodeApi.getBlockReceipts!(currencyId, 1)).toEqual([
1486
+ expect(await nodeApi.getBlockReceipts!(1)).toEqual([
1522
1487
  {
1523
1488
  hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
1524
1489
  gasUsed: '21000',
@@ -1562,7 +1527,7 @@ describe('EVM Family', () => {
1562
1527
  throw new Error(`Method not mocked: ${method}`)
1563
1528
  })
1564
1529
 
1565
- await expect(nodeApi.getBlockReceipts!(currencyId, 1)).rejects.toThrow(
1530
+ await expect(nodeApi.getBlockReceipts!(1)).rejects.toThrow(
1566
1531
  'Malformed eth_getBlockReceipts response at index 0'
1567
1532
  )
1568
1533
  })
@@ -1578,9 +1543,7 @@ describe('EVM Family', () => {
1578
1543
  throw new Error(`Method not mocked: ${method}`)
1579
1544
  })
1580
1545
 
1581
- await expect(nodeApi.getBlockReceipts!(currencyId, 1)).rejects.toBeInstanceOf(
1582
- UnsupportedRpcMethodError
1583
- )
1546
+ await expect(nodeApi.getBlockReceipts!(1)).rejects.toBeInstanceOf(UnsupportedRpcMethodError)
1584
1547
  })
1585
1548
 
1586
1549
  it('should throw UnsupportedRpcMethodError for nested responseBody code', async () => {
@@ -1600,9 +1563,7 @@ describe('EVM Family', () => {
1600
1563
  throw new Error(`Method not mocked: ${method}`)
1601
1564
  })
1602
1565
 
1603
- await expect(nodeApi.getBlockReceipts!(currencyId, 1)).rejects.toBeInstanceOf(
1604
- UnsupportedRpcMethodError
1605
- )
1566
+ await expect(nodeApi.getBlockReceipts!(1)).rejects.toBeInstanceOf(UnsupportedRpcMethodError)
1606
1567
  })
1607
1568
  })
1608
1569
 
@@ -1633,7 +1594,7 @@ describe('EVM Family', () => {
1633
1594
  throw new Error(`Method not mocked: ${method}`)
1634
1595
  })
1635
1596
 
1636
- const result = await nodeApi.traceBlockErigon!(currencyId, 120647648)
1597
+ const result = await nodeApi.traceBlockErigon!(120647648)
1637
1598
  expect(result).toEqual([traceItem])
1638
1599
  })
1639
1600
 
@@ -1666,7 +1627,7 @@ describe('EVM Family', () => {
1666
1627
  throw new Error(`Method not mocked: ${method}`)
1667
1628
  })
1668
1629
 
1669
- const err = await nodeApi.traceBlockErigon!(currencyId, 1).then(
1630
+ const err = await nodeApi.traceBlockErigon!(1).then(
1670
1631
  () => null,
1671
1632
  (e: unknown) => e
1672
1633
  )
@@ -1698,7 +1659,7 @@ describe('EVM Family', () => {
1698
1659
  throw new Error(`Method not mocked: ${method}`)
1699
1660
  })
1700
1661
 
1701
- const result = await nodeApi.traceBlockGeth!(currencyId, 42)
1662
+ const result = await nodeApi.traceBlockGeth!(42)
1702
1663
  expect(result).toEqual([
1703
1664
  {
1704
1665
  action: {
@@ -1736,7 +1697,7 @@ describe('EVM Family', () => {
1736
1697
  throw new Error(`Method not mocked: ${method}`)
1737
1698
  })
1738
1699
 
1739
- const err = await nodeApi.traceBlockGeth!(currencyId, 1).then(
1700
+ const err = await nodeApi.traceBlockGeth!(1).then(
1740
1701
  () => null,
1741
1702
  (e: unknown) => e
1742
1703
  )
@@ -1762,7 +1723,7 @@ describe('EVM Family', () => {
1762
1723
  throw new Error(`Method not mocked: ${method}`)
1763
1724
  })
1764
1725
 
1765
- const err = await nodeApi.traceBlockGeth!(currencyId, 1).then(
1726
+ const err = await nodeApi.traceBlockGeth!(1).then(
1766
1727
  () => null,
1767
1728
  (e: unknown) => e
1768
1729
  )
@@ -1774,9 +1735,17 @@ describe('EVM Family', () => {
1774
1735
 
1775
1736
  describe('getOptimismAdditionalFees', () => {
1776
1737
  it('should return the expected payload', async () => {
1738
+ const optimismNodeApi = createNodeApi(
1739
+ createMockEvmConfigInfo({
1740
+ chainId: CHAIN_ID.OPTIMISM,
1741
+ name: 'Optimism',
1742
+ node: mkExternalNode({ uri: 'http://test' }),
1743
+ }),
1744
+ { type: 'external', uri: 'http://test', retries: DEFAULT_RETRIES_RPC_METHODS },
1745
+ testLogger
1746
+ )
1777
1747
  expect(
1778
- await nodeApi.getOptimismAdditionalFees(
1779
- 'optimism',
1748
+ await optimismNodeApi.getOptimismAdditionalFees(
1780
1749
  // Build a serialized transaction, the exact same way we do in `estimateFees`
1781
1750
  Transaction.from({
1782
1751
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
@@ -1800,8 +1769,8 @@ describe('EVM Family', () => {
1800
1769
  it("should return 0 if the currency isn't optimism", async () => {
1801
1770
  expect(
1802
1771
  await nodeApi.getOptimismAdditionalFees(
1803
- currencyId,
1804
1772
  // Build a serialized transaction, the exact same way we do in `estimateFees`
1773
+ // (a distinct nonce: the cache is keyed by chain id and transaction)
1805
1774
  Transaction.from({
1806
1775
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
1807
1776
  maxFeePerGas: BigInt(new BigNumber('0x777159126').toFixed()),
@@ -1810,7 +1779,7 @@ describe('EVM Family', () => {
1810
1779
  gasLimit: 0n,
1811
1780
  type: 2,
1812
1781
  chainId: 1,
1813
- nonce: 52,
1782
+ nonce: 53,
1814
1783
  signature: {
1815
1784
  r: '0xffffffffffffffffffffffffffffffffffffffff',
1816
1785
  s: '0xffffffffffffffffffffffffffffffffffffffff',
@@ -1824,9 +1793,17 @@ describe('EVM Family', () => {
1824
1793
 
1825
1794
  describe('getScrollAdditionalFees', () => {
1826
1795
  it('should return the expected payload', async () => {
1796
+ const scrollNodeApi = createNodeApi(
1797
+ createMockEvmConfigInfo({
1798
+ chainId: CHAIN_ID.SCROLL,
1799
+ name: 'Scroll',
1800
+ node: mkExternalNode({ uri: 'http://test' }),
1801
+ }),
1802
+ { type: 'external', uri: 'http://test', retries: DEFAULT_RETRIES_RPC_METHODS },
1803
+ testLogger
1804
+ )
1827
1805
  expect(
1828
- await nodeApi.getScrollAdditionalFees(
1829
- 'scroll',
1806
+ await scrollNodeApi.getScrollAdditionalFees(
1830
1807
  // Build a serialized transaction, the exact same way we do in `estimateFees`
1831
1808
  Transaction.from({
1832
1809
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
@@ -1850,7 +1827,6 @@ describe('EVM Family', () => {
1850
1827
  it("should return 0 if the currency isn't optimism", async () => {
1851
1828
  expect(
1852
1829
  await nodeApi.getScrollAdditionalFees(
1853
- currencyId,
1854
1830
  // Build a serialized transaction, the exact same way we do in `estimateFees`
1855
1831
  Transaction.from({
1856
1832
  to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
@@ -1894,7 +1870,7 @@ describe('EVM Family', () => {
1894
1870
  .spyOn(JsonRpcProvider.prototype, 'getBalance')
1895
1871
  .mockResolvedValue(BigInt(100))
1896
1872
 
1897
- await nodeApi.getCoinBalance(currencyId, EIP1191_CHECKSUMMED_ADDRESS)
1873
+ await nodeApi.getCoinBalance(EIP1191_CHECKSUMMED_ADDRESS)
1898
1874
 
1899
1875
  expect(getBalanceSpy).toHaveBeenCalledWith(NORMALIZED_ADDRESS)
1900
1876
  })
@@ -1911,11 +1887,7 @@ describe('EVM Family', () => {
1911
1887
  .spyOn(JsonRpcProvider.prototype, 'call')
1912
1888
  .mockResolvedValue('0x0000000000000000000000000000000000000000000000000000000000000064')
1913
1889
 
1914
- await nodeApi.getTokenBalance(
1915
- currencyId,
1916
- EIP1191_CHECKSUMMED_ADDRESS,
1917
- EIP1191_TOKEN_ADDRESS
1918
- )
1890
+ await nodeApi.getTokenBalance(EIP1191_CHECKSUMMED_ADDRESS, EIP1191_TOKEN_ADDRESS)
1919
1891
 
1920
1892
  // The call should be made to the normalized contract address
1921
1893
  // and the data should contain the normalized account address
@@ -1935,7 +1907,7 @@ describe('EVM Family', () => {
1935
1907
  .spyOn(JsonRpcProvider.prototype, 'getTransactionCount')
1936
1908
  .mockResolvedValue(10)
1937
1909
 
1938
- await nodeApi.getTransactionCount(currencyId, EIP1191_CHECKSUMMED_ADDRESS)
1910
+ await nodeApi.getTransactionCount(EIP1191_CHECKSUMMED_ADDRESS)
1939
1911
 
1940
1912
  expect(getTransactionCountSpy).toHaveBeenCalledWith(NORMALIZED_ADDRESS, 'pending')
1941
1913
  })
@@ -1955,7 +1927,7 @@ describe('EVM Family', () => {
1955
1927
  return null
1956
1928
  })
1957
1929
 
1958
- await nodeApi.getGasEstimation(currencyId, address, {
1930
+ await nodeApi.getGasEstimation(address, {
1959
1931
  recipient: EIP1191_RECIPIENT,
1960
1932
  amount: new BigNumber(1000),
1961
1933
  data: Buffer.from(''),