@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
@@ -256,7 +256,6 @@ describe('EVM Family', () => {
256
256
  await LEDGER_API.getOperations(
257
257
  config,
258
258
  testLogger,
259
- 'ethereum',
260
259
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
261
260
  0,
262
261
  undefined,
@@ -291,7 +290,6 @@ describe('EVM Family', () => {
291
290
  await LEDGER_API.getOperations(
292
291
  config,
293
292
  testLogger,
294
- 'ethereum',
295
293
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
296
294
  0,
297
295
  undefined,
@@ -315,7 +313,6 @@ describe('EVM Family', () => {
315
313
  const response = await LEDGER_API.getOperations(
316
314
  config,
317
315
  testLogger,
318
- 'ethereum',
319
316
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
320
317
  0,
321
318
  undefined,
@@ -537,7 +534,6 @@ describe('EVM Family', () => {
537
534
  const response = await LEDGER_API.getOperations(
538
535
  config,
539
536
  testLogger,
540
- 'ethereum',
541
537
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
542
538
  0,
543
539
  undefined,
@@ -571,7 +567,6 @@ describe('EVM Family', () => {
571
567
  const response = await LEDGER_API.getOperations(
572
568
  config,
573
569
  testLogger,
574
- 'ethereum',
575
570
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
576
571
  0,
577
572
  undefined,
@@ -629,7 +624,6 @@ describe('EVM Family', () => {
629
624
  const response = await LEDGER_API.getOperations(
630
625
  config,
631
626
  testLogger,
632
- 'ethereum',
633
627
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
634
628
  0,
635
629
  undefined,
@@ -650,7 +644,6 @@ describe('EVM Family', () => {
650
644
  const response = await LEDGER_API.getOperations(
651
645
  config,
652
646
  testLogger,
653
- 'ethereum',
654
647
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
655
648
  0,
656
649
  undefined,
@@ -671,7 +664,6 @@ describe('EVM Family', () => {
671
664
  const response = await LEDGER_API.getOperations(
672
665
  config,
673
666
  testLogger,
674
- 'ethereum',
675
667
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
676
668
  0,
677
669
  undefined,
@@ -692,7 +684,6 @@ describe('EVM Family', () => {
692
684
  const response = await LEDGER_API.getOperations(
693
685
  config,
694
686
  testLogger,
695
- 'ethereum',
696
687
  '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
697
688
  0,
698
689
  undefined,
@@ -772,17 +763,7 @@ describe('EVM Family', () => {
772
763
  const request = mockRateLimitedExplorer()
773
764
 
774
765
  await expect(
775
- LEDGER_API.getOperations(
776
- config,
777
- testLogger,
778
- 'ethereum',
779
- ADDR,
780
- 0,
781
- undefined,
782
- undefined,
783
- 2,
784
- 'desc'
785
- )
766
+ LEDGER_API.getOperations(config, testLogger, ADDR, 0, undefined, undefined, 2, 'desc')
786
767
  ).rejects.toBeInstanceOf(RateLimitError)
787
768
  // Same rule the exhaustive walk follows: a rate limit is not transient, so it must not
788
769
  // consume the retry budget.
@@ -798,17 +779,7 @@ describe('EVM Family', () => {
798
779
  })
799
780
 
800
781
  await expect(
801
- LEDGER_API.getOperations(
802
- noRetries,
803
- testLogger,
804
- 'ethereum',
805
- ADDR,
806
- 0,
807
- undefined,
808
- undefined,
809
- 2,
810
- 'desc'
811
- )
782
+ LEDGER_API.getOperations(noRetries, testLogger, ADDR, 0, undefined, undefined, 2, 'desc')
812
783
  ).rejects.toThrow('explorer down')
813
784
  expect(request).toHaveBeenCalledTimes(1)
814
785
  })
@@ -821,7 +792,6 @@ describe('EVM Family', () => {
821
792
  const response = await LEDGER_API.getOperations(
822
793
  config,
823
794
  testLogger,
824
- 'ethereum',
825
795
  ADDR,
826
796
  0,
827
797
  undefined,
@@ -865,7 +835,6 @@ describe('EVM Family', () => {
865
835
  const page1 = await LEDGER_API.getOperations(
866
836
  config,
867
837
  testLogger,
868
- 'ethereum',
869
838
  ADDR,
870
839
  0,
871
840
  undefined,
@@ -879,7 +848,6 @@ describe('EVM Family', () => {
879
848
  const page2 = await LEDGER_API.getOperations(
880
849
  config,
881
850
  testLogger,
882
- 'ethereum',
883
851
  ADDR,
884
852
  0,
885
853
  undefined,
@@ -902,7 +870,6 @@ describe('EVM Family', () => {
902
870
  const page3 = await LEDGER_API.getOperations(
903
871
  config,
904
872
  testLogger,
905
- 'ethereum',
906
873
  ADDR,
907
874
  0,
908
875
  undefined,
@@ -919,33 +886,13 @@ describe('EVM Family', () => {
919
886
  .spyOn(axios, 'request')
920
887
  .mockResolvedValue({ data: { data: [pagedRecord(50, 'h50')], token: '' } })
921
888
 
922
- await LEDGER_API.getOperations(
923
- config,
924
- testLogger,
925
- 'ethereum',
926
- ADDR,
927
- 0,
928
- undefined,
929
- '60:h60',
930
- 5,
931
- 'desc'
932
- )
889
+ await LEDGER_API.getOperations(config, testLogger, ADDR, 0, undefined, '60:h60', 5, 'desc')
933
890
  expect(request).toHaveBeenLastCalledWith(
934
891
  expect.objectContaining({ params: expect.objectContaining({ to_height: 60 }) })
935
892
  )
936
893
 
937
894
  request.mockClear()
938
- await LEDGER_API.getOperations(
939
- config,
940
- testLogger,
941
- 'ethereum',
942
- ADDR,
943
- 0,
944
- undefined,
945
- '60:h60',
946
- 5,
947
- 'asc'
948
- )
895
+ await LEDGER_API.getOperations(config, testLogger, ADDR, 0, undefined, '60:h60', 5, 'asc')
949
896
  expect(request).toHaveBeenLastCalledWith(
950
897
  expect.objectContaining({ params: expect.objectContaining({ from_height: 60 }) })
951
898
  )
@@ -957,51 +904,21 @@ describe('EVM Family', () => {
957
904
  .mockResolvedValue({ data: { data: [], token: '' } })
958
905
 
959
906
  // No cursor: toBlock alone is the ceiling.
960
- await LEDGER_API.getOperations(
961
- config,
962
- testLogger,
963
- 'ethereum',
964
- ADDR,
965
- 0,
966
- 77,
967
- undefined,
968
- 5,
969
- 'desc'
970
- )
907
+ await LEDGER_API.getOperations(config, testLogger, ADDR, 0, 77, undefined, 5, 'desc')
971
908
  expect(request).toHaveBeenLastCalledWith(
972
909
  expect.objectContaining({ params: expect.objectContaining({ to_height: 77 }) })
973
910
  )
974
911
 
975
912
  // Cursor height (40) is more restrictive than toBlock (100).
976
913
  request.mockClear()
977
- await LEDGER_API.getOperations(
978
- config,
979
- testLogger,
980
- 'ethereum',
981
- ADDR,
982
- 0,
983
- 100,
984
- '40:hx',
985
- 5,
986
- 'desc'
987
- )
914
+ await LEDGER_API.getOperations(config, testLogger, ADDR, 0, 100, '40:hx', 5, 'desc')
988
915
  expect(request).toHaveBeenLastCalledWith(
989
916
  expect.objectContaining({ params: expect.objectContaining({ to_height: 40 }) })
990
917
  )
991
918
 
992
919
  // toBlock (30) is more restrictive than the cursor height (40).
993
920
  request.mockClear()
994
- await LEDGER_API.getOperations(
995
- config,
996
- testLogger,
997
- 'ethereum',
998
- ADDR,
999
- 0,
1000
- 30,
1001
- '40:hx',
1002
- 5,
1003
- 'desc'
1004
- )
921
+ await LEDGER_API.getOperations(config, testLogger, ADDR, 0, 30, '40:hx', 5, 'desc')
1005
922
  expect(request).toHaveBeenLastCalledWith(
1006
923
  expect.objectContaining({ params: expect.objectContaining({ to_height: 30 }) })
1007
924
  )
@@ -1020,7 +937,6 @@ describe('EVM Family', () => {
1020
937
  const response = await LEDGER_API.getOperations(
1021
938
  config,
1022
939
  testLogger,
1023
- 'ethereum',
1024
940
  ADDR,
1025
941
  0,
1026
942
  undefined,
@@ -1053,7 +969,6 @@ describe('EVM Family', () => {
1053
969
  const response = await LEDGER_API.getOperations(
1054
970
  config,
1055
971
  testLogger,
1056
- 'ethereum',
1057
972
  ADDR,
1058
973
  0,
1059
974
  undefined,
@@ -1101,7 +1016,6 @@ describe('EVM Family', () => {
1101
1016
  const page1 = await LEDGER_API.getOperations(
1102
1017
  config,
1103
1018
  testLogger,
1104
- 'ethereum',
1105
1019
  ADDR,
1106
1020
  0,
1107
1021
  undefined,
@@ -1130,7 +1044,6 @@ describe('EVM Family', () => {
1130
1044
  const page2 = await LEDGER_API.getOperations(
1131
1045
  config,
1132
1046
  testLogger,
1133
- 'ethereum',
1134
1047
  ADDR,
1135
1048
  0,
1136
1049
  undefined,
@@ -1166,7 +1079,6 @@ describe('EVM Family', () => {
1166
1079
  LEDGER_API.getOperations(
1167
1080
  config,
1168
1081
  testLogger,
1169
- 'ethereum',
1170
1082
  ADDR,
1171
1083
  0,
1172
1084
  undefined,
@@ -1186,7 +1098,6 @@ describe('EVM Family', () => {
1186
1098
  LEDGER_API.getOperations(
1187
1099
  config,
1188
1100
  testLogger,
1189
- 'ethereum',
1190
1101
  ADDR,
1191
1102
  0,
1192
1103
  undefined,
@@ -1201,17 +1112,7 @@ describe('EVM Family', () => {
1201
1112
  const request = jest.spyOn(axios, 'request').mockRejectedValue(new Error('network error'))
1202
1113
 
1203
1114
  await expect(
1204
- LEDGER_API.getOperations(
1205
- config,
1206
- testLogger,
1207
- 'ethereum',
1208
- ADDR,
1209
- 0,
1210
- undefined,
1211
- undefined,
1212
- 5,
1213
- 'desc'
1214
- )
1115
+ LEDGER_API.getOperations(config, testLogger, ADDR, 0, undefined, undefined, 5, 'desc')
1215
1116
  ).rejects.toThrow('network error')
1216
1117
 
1217
1118
  expect(request).toHaveBeenCalledTimes(LEDGER_API.DEFAULT_RETRIES_API + 1)
@@ -1232,7 +1133,6 @@ describe('EVM Family', () => {
1232
1133
  const response = await LEDGER_API.getOperations(
1233
1134
  config,
1234
1135
  testLogger,
1235
- 'ethereum',
1236
1136
  ADDR,
1237
1137
  0,
1238
1138
  undefined,
@@ -1256,7 +1156,6 @@ describe('EVM Family', () => {
1256
1156
  await LEDGER_API.getOperations(
1257
1157
  config,
1258
1158
  testLogger,
1259
- 'ethereum',
1260
1159
  ADDR,
1261
1160
  0,
1262
1161
  undefined,
@@ -1276,7 +1175,6 @@ describe('EVM Family', () => {
1276
1175
  const response = await LEDGER_API.getOperations(
1277
1176
  config,
1278
1177
  testLogger,
1279
- 'ethereum',
1280
1178
  ADDR,
1281
1179
  0,
1282
1180
  undefined,
@@ -1312,7 +1210,7 @@ describe('EVM Family', () => {
1312
1210
  config = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'anything' }) })
1313
1211
 
1314
1212
  await expect(
1315
- LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1213
+ LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1316
1214
  ).rejects.toBeInstanceOf(LedgerExplorerUsedIncorrectly)
1317
1215
  })
1318
1216
 
@@ -1320,7 +1218,7 @@ describe('EVM Family', () => {
1320
1218
  const request = mockRateLimitedExplorer()
1321
1219
 
1322
1220
  await expect(
1323
- LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1221
+ LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1324
1222
  ).rejects.toBeInstanceOf(RateLimitError)
1325
1223
  expect(request).toHaveBeenCalledTimes(1)
1326
1224
  })
@@ -1346,7 +1244,7 @@ describe('EVM Family', () => {
1346
1244
  throw new Error('should not be called again')
1347
1245
  })
1348
1246
 
1349
- const assets = await LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1247
+ const assets = await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1350
1248
 
1351
1249
  expect(assets).toEqual([
1352
1250
  { type: 'erc20', assetReference: eip55.encode(CONTRACT_1), assetOwner: ADDR },
@@ -1364,16 +1262,10 @@ describe('EVM Family', () => {
1364
1262
  data: { data: pages, token: null },
1365
1263
  }))
1366
1264
 
1367
- const discovered = await LEDGER_API.discoverTokenAssets(
1368
- config,
1369
- testLogger,
1370
- 'ethereum',
1371
- ADDR
1372
- )
1265
+ const discovered = await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1373
1266
  const opsResult = await LEDGER_API.getOperations(
1374
1267
  config,
1375
1268
  testLogger,
1376
- 'ethereum',
1377
1269
  ADDR,
1378
1270
  0,
1379
1271
  undefined,
@@ -1405,7 +1297,7 @@ describe('EVM Family', () => {
1405
1297
  },
1406
1298
  }))
1407
1299
 
1408
- const assets = await LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1300
+ const assets = await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1409
1301
 
1410
1302
  expect(assets).toEqual([])
1411
1303
  })
@@ -1427,7 +1319,7 @@ describe('EVM Family', () => {
1427
1319
  .spyOn(axios, 'request')
1428
1320
  .mockResolvedValue({ data: { data: [], token: '' } })
1429
1321
 
1430
- await LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1322
+ await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1431
1323
 
1432
1324
  expect(request).toHaveBeenCalledWith(
1433
1325
  expect.objectContaining({
@@ -1441,12 +1333,12 @@ describe('EVM Family', () => {
1441
1333
  .spyOn(axios, 'request')
1442
1334
  .mockResolvedValue({ data: { data: [], token: '' } })
1443
1335
 
1444
- await LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1336
+ await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1445
1337
  expect(request).toHaveBeenCalledWith(
1446
1338
  expect.objectContaining({ params: expect.objectContaining({ from_height: 0 }) })
1447
1339
  )
1448
1340
 
1449
- await LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR, 42)
1341
+ await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR, 42)
1450
1342
  expect(request).toHaveBeenCalledWith(
1451
1343
  expect.objectContaining({ params: expect.objectContaining({ from_height: 42 }) })
1452
1344
  )
@@ -1461,7 +1353,7 @@ describe('EVM Family', () => {
1461
1353
  throw new Error('should not be called again')
1462
1354
  })
1463
1355
 
1464
- await LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1356
+ await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1465
1357
 
1466
1358
  expect(request).toHaveBeenCalledTimes(2)
1467
1359
  })
@@ -1474,7 +1366,7 @@ describe('EVM Family', () => {
1474
1366
  throw new Error('should not be called again')
1475
1367
  })
1476
1368
 
1477
- await LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1369
+ await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1478
1370
 
1479
1371
  expect(request).toHaveBeenCalledTimes(1)
1480
1372
  })
@@ -1488,7 +1380,7 @@ describe('EVM Family', () => {
1488
1380
  throw new Error('should not be called again')
1489
1381
  })
1490
1382
 
1491
- await LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1383
+ await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1492
1384
 
1493
1385
  expect(request).toHaveBeenCalledTimes(2)
1494
1386
  })
@@ -1496,9 +1388,9 @@ describe('EVM Family', () => {
1496
1388
  it('propagates after DEFAULT_RETRIES_API attempts on a page that keeps failing, without returning a partial list', async () => {
1497
1389
  const request = jest.spyOn(axios, 'request').mockRejectedValue(new Error('network error'))
1498
1390
 
1499
- await expect(
1500
- LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1501
- ).rejects.toThrow('network error')
1391
+ await expect(LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)).rejects.toThrow(
1392
+ 'network error'
1393
+ )
1502
1394
 
1503
1395
  expect(request).toHaveBeenCalledTimes(LEDGER_API.DEFAULT_RETRIES_API + 1)
1504
1396
  })
@@ -1514,7 +1406,7 @@ describe('EVM Family', () => {
1514
1406
  call += 1
1515
1407
  return { data: { data: [page], token: call < pages.length ? `p${call}` : '' } }
1516
1408
  })
1517
- return LEDGER_API.discoverTokenAssets(config, testLogger, 'ethereum', ADDR)
1409
+ return LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
1518
1410
  }
1519
1411
 
1520
1412
  const smallWalk = await runWith(2)
@@ -351,7 +351,6 @@ type AdaptedLedgerOperations = {
351
351
  function adaptLedgerRecords(
352
352
  config: EvmConfigInfo,
353
353
  logger: Logger,
354
- currencyId: string,
355
354
  address: string,
356
355
  records: LedgerExplorerOperation[]
357
356
  ): AdaptedLedgerOperations {
@@ -366,7 +365,7 @@ function adaptLedgerRecords(
366
365
  nativeContractsSet.has(contract.toLowerCase())
367
366
 
368
367
  for (const ledgerOp of records) {
369
- const coinOps = ledgerOperationToOperations(address, currencyId, ledgerOp, logger)
368
+ const coinOps = ledgerOperationToOperations(address, config.chainId, ledgerOp, logger)
370
369
 
371
370
  const erc20TransferEvents =
372
371
  nativeContractsSet.size === 0
@@ -411,7 +410,6 @@ function adaptLedgerRecords(
411
410
  export const getOperations: ExplorerApi['getOperations'] = async (
412
411
  config,
413
412
  logger,
414
- currencyId,
415
413
  address,
416
414
  fromBlock,
417
415
  toBlock,
@@ -463,7 +461,7 @@ export const getOperations: ExplorerApi['getOperations'] = async (
463
461
  }
464
462
 
465
463
  return {
466
- ...adaptLedgerRecords(config, logger, currencyId, address, records),
464
+ ...adaptLedgerRecords(config, logger, address, records),
467
465
  nextPagingToken,
468
466
  }
469
467
  }
@@ -481,7 +479,6 @@ export const getOperations: ExplorerApi['getOperations'] = async (
481
479
  export const discoverTokenAssets: ExplorerApi['discoverTokenAssets'] = async (
482
480
  config,
483
481
  logger,
484
- _currencyId,
485
482
  address,
486
483
  fromBlock
487
484
  ) => {
@@ -17,7 +17,6 @@ export type ExplorerApi = {
17
17
  getOperations: (
18
18
  config: EvmConfigInfo,
19
19
  logger: Logger,
20
- currencyId: string,
21
20
  address: string,
22
21
  fromBlock: number,
23
22
  toBlock: number | undefined,
@@ -46,7 +45,6 @@ export type ExplorerApi = {
46
45
  discoverTokenAssets: (
47
46
  config: EvmConfigInfo,
48
47
  logger: Logger,
49
- currencyId: string,
50
48
  address: string,
51
49
  fromBlock?: number
52
50
  ) => Promise<AssetInfo[]>
@@ -29,27 +29,22 @@ describe('createExplorerProxyNodeApi', () => {
29
29
 
30
30
  describe('unsupported methods', () => {
31
31
  it.each([
32
- ['call', () => api.call('eth', { to: '0x', data: '0x' })],
33
- ['getCoinBalance', () => api.getCoinBalance('eth', '0x')],
34
- ['getTokenBalance', () => api.getTokenBalance('eth', '0x', '0x')],
35
- ['getTokenAllowance', () => api.getTokenAllowance('eth', '0x', '0x', '0x')],
36
- ['getTransactionCount', () => api.getTransactionCount('eth', '0x')],
32
+ ['call', () => api.call({ to: '0x', data: '0x' })],
33
+ ['getCoinBalance', () => api.getCoinBalance('0x')],
34
+ ['getTokenBalance', () => api.getTokenBalance('0x', '0x')],
35
+ ['getTokenAllowance', () => api.getTokenAllowance('0x', '0x', '0x')],
36
+ ['getTransactionCount', () => api.getTransactionCount('0x')],
37
37
  [
38
38
  'getGasEstimation',
39
- () => api.getGasEstimation('eth', '0x', { amount: new BigNumber(0), recipient: '0x' }),
39
+ () => api.getGasEstimation('0x', { amount: new BigNumber(0), recipient: '0x' }),
40
40
  ],
41
41
  [
42
42
  'getFeeData',
43
- () =>
44
- api.getFeeData(
45
- createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() }),
46
- 'eth',
47
- {}
48
- ),
43
+ () => api.getFeeData(createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() }), {}),
49
44
  ],
50
- ['broadcastTransaction', () => api.broadcastTransaction('eth', '0x')],
51
- ['getOptimismAdditionalFees', () => api.getOptimismAdditionalFees('eth', '0x')],
52
- ['getScrollAdditionalFees', () => api.getScrollAdditionalFees('eth', '0x')],
45
+ ['broadcastTransaction', () => api.broadcastTransaction('0x')],
46
+ ['getOptimismAdditionalFees', () => api.getOptimismAdditionalFees('0x')],
47
+ ['getScrollAdditionalFees', () => api.getScrollAdditionalFees('0x')],
53
48
  ] as const)(
54
49
  '%s rejects immediately with "not supported by explorer proxy"',
55
50
  async (_name, invoke) => {
@@ -61,7 +56,7 @@ describe('createExplorerProxyNodeApi', () => {
61
56
 
62
57
  describe('getBlockByHeight', () => {
63
58
  it('throws before hitting the network when height is a BlockFinalizationTag', async () => {
64
- await expect(api.getBlockByHeight('eth', 'latest')).rejects.toThrow(
59
+ await expect(api.getBlockByHeight('latest')).rejects.toThrow(
65
60
  'explorer proxy only supports numeric heights'
66
61
  )
67
62
  expect(mockAxiosGet).not.toHaveBeenCalled()
@@ -69,7 +64,7 @@ describe('createExplorerProxyNodeApi', () => {
69
64
 
70
65
  it('throws when the proxy returns null (block not found or malformed)', async () => {
71
66
  mockAxiosGet.mockResolvedValueOnce({ data: { result: null } })
72
- await expect(api.getBlockByHeight('eth', 1)).rejects.toThrow(
67
+ await expect(api.getBlockByHeight(1)).rejects.toThrow(
73
68
  'explorer proxy returned no result for block 1'
74
69
  )
75
70
  })
@@ -86,7 +81,7 @@ describe('createExplorerProxyNodeApi', () => {
86
81
  },
87
82
  },
88
83
  })
89
- const result = await api.getBlockByHeight('eth', 1)
84
+ const result = await api.getBlockByHeight(1)
90
85
  expect(result.hash).toBe('0xdeadbeef')
91
86
  expect(result.height).toBe(1)
92
87
  expect(result.transactionHashes).toEqual(['0xhash1'])
@@ -94,7 +89,7 @@ describe('createExplorerProxyNodeApi', () => {
94
89
 
95
90
  it('propagates network errors as a throw (via the null path)', async () => {
96
91
  mockAxiosGet.mockRejectedValueOnce(new Error('ECONNREFUSED'))
97
- await expect(api.getBlockByHeight('eth', 1)).rejects.toThrow(
92
+ await expect(api.getBlockByHeight(1)).rejects.toThrow(
98
93
  'explorer proxy returned no result for block 1'
99
94
  )
100
95
  })
@@ -105,7 +100,7 @@ describe('createExplorerProxyNodeApi', () => {
105
100
  mockAxiosGet
106
101
  .mockResolvedValueOnce({ data: { result: null } })
107
102
  .mockResolvedValueOnce({ data: { result: null } })
108
- await expect(api.getTransaction('eth', TX_HASH)).rejects.toThrow(
103
+ await expect(api.getTransaction(TX_HASH)).rejects.toThrow(
109
104
  `explorer proxy returned no result for tx ${TX_HASH}`
110
105
  )
111
106
  })
@@ -140,7 +135,7 @@ describe('createExplorerProxyNodeApi', () => {
140
135
  },
141
136
  },
142
137
  })
143
- const result = await api.getTransaction('eth', TX_HASH)
138
+ const result = await api.getTransaction(TX_HASH)
144
139
  expect(result.hash).toBe(TX_HASH)
145
140
  expect(result.status).toBe(1)
146
141
  expect(result.erc20Transfers).toEqual([])
@@ -148,7 +143,7 @@ describe('createExplorerProxyNodeApi', () => {
148
143
 
149
144
  it('propagates network errors as a throw (via the null path)', async () => {
150
145
  mockAxiosGet.mockRejectedValue(new Error('ECONNREFUSED'))
151
- await expect(api.getTransaction('eth', TX_HASH)).rejects.toThrow(
146
+ await expect(api.getTransaction(TX_HASH)).rejects.toThrow(
152
147
  `explorer proxy returned no result for tx ${TX_HASH}`
153
148
  )
154
149
  })
@@ -276,17 +276,17 @@ export function createExplorerProxyNodeApi(
276
276
  logger: Logger
277
277
  ): NodeApi {
278
278
  return {
279
- call: (_c, _p) => notSupported('call'),
280
- getCoinBalance: (_c, _a) => notSupported('getCoinBalance'),
281
- getTokenBalance: (_c, _a, _ca) => notSupported('getTokenBalance'),
282
- getTokenAllowance: (_c, _o, _ca, _s) => notSupported('getTokenAllowance'),
283
- getTransactionCount: (_c, _a) => notSupported('getTransactionCount'),
284
- getGasEstimation: (_c, _a, _t) => notSupported('getGasEstimation'),
285
- getFeeData: (_cfg, _c, _t) => notSupported('getFeeData'),
286
- broadcastTransaction: (_c, _tx) => notSupported('broadcastTransaction'),
287
- getOptimismAdditionalFees: (_c, _t) => notSupported('getOptimismAdditionalFees'),
288
- getScrollAdditionalFees: (_c, _t) => notSupported('getScrollAdditionalFees'),
289
- getBlockByHeight: async (_c, height) => {
279
+ call: (_p) => notSupported('call'),
280
+ getCoinBalance: (_a) => notSupported('getCoinBalance'),
281
+ getTokenBalance: (_a, _ca) => notSupported('getTokenBalance'),
282
+ getTokenAllowance: (_o, _ca, _s) => notSupported('getTokenAllowance'),
283
+ getTransactionCount: (_a) => notSupported('getTransactionCount'),
284
+ getGasEstimation: (_a, _t) => notSupported('getGasEstimation'),
285
+ getFeeData: (_cfg, _t) => notSupported('getFeeData'),
286
+ broadcastTransaction: (_tx) => notSupported('broadcastTransaction'),
287
+ getOptimismAdditionalFees: (_t) => notSupported('getOptimismAdditionalFees'),
288
+ getScrollAdditionalFees: (_t) => notSupported('getScrollAdditionalFees'),
289
+ getBlockByHeight: async (height) => {
290
290
  if (typeof height !== 'number')
291
291
  throw new Error('EVM getBlockByHeight: explorer proxy only supports numeric heights')
292
292
  const result = await getBlockFromExplorerProxy(explorerUri, height, explorerRetries, logger)
@@ -296,7 +296,7 @@ export function createExplorerProxyNodeApi(
296
296
  )
297
297
  return result
298
298
  },
299
- getTransaction: async (_c, hash) => {
299
+ getTransaction: async (hash) => {
300
300
  const result = await getTransactionFromExplorerProxy(
301
301
  explorerUri,
302
302
  hash,