@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
@@ -1,6 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import { CHAIN_ID } from '../../config'
4
5
  import {
5
6
  createMockEvmConfigInfo,
6
7
  mkExternalNode,
@@ -9,30 +10,38 @@ import {
9
10
  import { getNodeApi } from './index'
10
11
 
11
12
  describe('getNodeApi memoization', () => {
12
- it('should return the same NodeApi instance for same currency and retries (memoization)', () => {
13
- const config = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
14
- expect(getNodeApi(config, 'ethereum', testLogger)).toBe(
15
- getNodeApi(config, 'ethereum', testLogger)
16
- )
13
+ it('should return the same NodeApi instance for same chain and retries (memoization)', () => {
14
+ const config = createMockEvmConfigInfo({
15
+ chainId: CHAIN_ID.ETHEREUM,
16
+ node: mkExternalNode(),
17
+ })
18
+ expect(getNodeApi(config, testLogger)).toBe(getNodeApi(config, testLogger))
17
19
  })
18
20
 
19
21
  it('should return cached NodeApi on subsequent calls (createNodeApi called once)', () => {
20
- const config = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
21
- const cachedInstance = getNodeApi(config, 'cached_value_test', testLogger)
22
+ const config = createMockEvmConfigInfo({
23
+ chainId: CHAIN_ID.ETHEREUM,
24
+ node: mkExternalNode(),
25
+ })
26
+ const cachedInstance = getNodeApi(config, testLogger)
22
27
 
23
- expect(getNodeApi(config, 'cached_value_test', testLogger)).toBe(cachedInstance)
24
- expect(getNodeApi(config, 'cached_value_test', testLogger)).toBe(cachedInstance)
28
+ expect(getNodeApi(config, testLogger)).toBe(cachedInstance)
29
+ expect(getNodeApi(config, testLogger)).toBe(cachedInstance)
25
30
  })
26
31
 
27
32
  it('should return different NodeApi instances for different retries', () => {
28
33
  const node1 = getNodeApi(
29
- createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'u', retries: 2 }) }),
30
- 'ethereum',
34
+ createMockEvmConfigInfo({
35
+ chainId: CHAIN_ID.ETHEREUM,
36
+ node: mkExternalNode({ uri: 'u', retries: 2 }),
37
+ }),
31
38
  testLogger
32
39
  )
33
40
  const node2 = getNodeApi(
34
- createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'u', retries: 5 }) }),
35
- 'ethereum',
41
+ createMockEvmConfigInfo({
42
+ chainId: CHAIN_ID.ETHEREUM,
43
+ node: mkExternalNode({ uri: 'u', retries: 5 }),
44
+ }),
36
45
  testLogger
37
46
  )
38
47
  expect(node1).not.toBe(node2)
@@ -40,24 +49,22 @@ describe('getNodeApi memoization', () => {
40
49
 
41
50
  it('should return different NodeApi instances for different uris', () => {
42
51
  const node1 = getNodeApi(
43
- createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'u1' }) }),
44
- 'ethereum',
52
+ createMockEvmConfigInfo({ chainId: CHAIN_ID.ETHEREUM, node: mkExternalNode({ uri: 'u1' }) }),
45
53
  testLogger
46
54
  )
47
55
  const node2 = getNodeApi(
48
- createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'u2' }) }),
49
- 'ethereum',
56
+ createMockEvmConfigInfo({ chainId: CHAIN_ID.ETHEREUM, node: mkExternalNode({ uri: 'u2' }) }),
50
57
  testLogger
51
58
  )
52
59
 
53
60
  expect(node1).not.toBe(node2)
54
61
  })
55
62
 
56
- it('should return different NodeApi instances for different currencies', () => {
57
- const conf = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'u1' }) })
63
+ it('should return different NodeApi instances for different chains sharing a node', () => {
64
+ const node = mkExternalNode({ uri: 'u1' })
65
+ const ethereum = createMockEvmConfigInfo({ chainId: CHAIN_ID.ETHEREUM, node })
66
+ const bsc = createMockEvmConfigInfo({ chainId: CHAIN_ID.BSC, node })
58
67
 
59
- expect(getNodeApi(conf, 'ethereum1', testLogger)).not.toBe(
60
- getNodeApi(conf, 'ethereum2', testLogger)
61
- )
68
+ expect(getNodeApi(ethereum, testLogger)).not.toBe(getNodeApi(bsc, testLogger))
62
69
  })
63
70
  })
@@ -16,13 +16,12 @@ describe('EVM Family', () => {
16
16
  it('should throw when requesting a non existing node type', () => {
17
17
  const config = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
18
18
  Object.assign(config, { node: { type: 'anything', uri: 'notworking' } })
19
- expect(() => getNodeApi(config, 'not-existing', testLogger)).toThrow(UnknownNode)
19
+ expect(() => getNodeApi(config, testLogger)).toThrow(UnknownNode)
20
20
  })
21
21
 
22
22
  it('should return the rpc api', () => {
23
23
  const node = getNodeApi(
24
24
  createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'working' }) }),
25
- 'external',
26
25
  testLogger
27
26
  )
28
27
 
@@ -44,7 +43,6 @@ describe('EVM Family', () => {
44
43
  it('should return the ledger api', () => {
45
44
  const node = getNodeApi(
46
45
  createMockEvmConfigInfo({ chainId: 1, node: mkLedgerNode({ explorerId: 'eth' }) }),
47
- 'ledger-supported',
48
46
  testLogger
49
47
  )
50
48
 
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import type { EvmConfigInfo } from '../../config'
4
+ import type { ChainId, EvmConfigInfo } from '../../config'
5
5
  import type { NodeApi } from './types'
6
6
  import type { Logger } from '@ledgerhq/coin-module-framework/config'
7
7
  import { DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
@@ -13,23 +13,23 @@ import { withNodeSources } from './withNodeSources'
13
13
  /**
14
14
  * Memoized NodeApi instances for both ledger and external nodes.
15
15
  * Key includes all config dimensions that affect the API instance's behavior.
16
- * Unbounded growth is acceptable: the number of entries is at most (currencies × distinct
17
- * node configs). In practice there are few EVM chains and config is static per currency,
16
+ * Unbounded growth is acceptable: the number of entries is at most (chains × distinct
17
+ * node configs). In practice there are few EVM chains and config is static per chain,
18
18
  * so the cache stays small.
19
19
  */
20
20
  const nodeApiCache = new Map<string, NodeApi>()
21
21
 
22
22
  function cacheKey(
23
- currencyId: string,
23
+ chainId: ChainId,
24
24
  node: { type: string; [key: string]: unknown },
25
25
  explorerUri: string,
26
26
  clientVersion: string,
27
27
  nodeSources: string
28
28
  ): string {
29
- return `${currencyId}:${JSON.stringify(node)}:${explorerUri}:${clientVersion}:${nodeSources}`
29
+ return `${chainId}:${JSON.stringify(node)}:${explorerUri}:${clientVersion}:${nodeSources}`
30
30
  }
31
31
 
32
- export const getNodeApi = (config: EvmConfigInfo, currencyId: string, logger: Logger): NodeApi => {
32
+ export const getNodeApi = (config: EvmConfigInfo, logger: Logger): NodeApi => {
33
33
  const node = config?.node
34
34
  const type = node?.type
35
35
 
@@ -40,13 +40,16 @@ export const getNodeApi = (config: EvmConfigInfo, currencyId: string, logger: Lo
40
40
  const explorerUri = config.ledgerExplorerUri ?? DEFAULT_LEDGER_EXPLORER_URI
41
41
  const clientVersion = config.ledgerClientVersion ?? ''
42
42
  const nodeSources = JSON.stringify(config.nodeSources ?? ['node'])
43
- const key = cacheKey(currencyId, node, explorerUri, clientVersion, nodeSources)
43
+ const key = cacheKey(config.chainId, node, explorerUri, clientVersion, nodeSources)
44
44
 
45
45
  let api = nodeApiCache.get(key)
46
46
  if (api === undefined) {
47
47
  const raw =
48
48
  type === 'ledger'
49
- ? createLedgerNodeApi({ ...node, explorerUri, clientVersion }, logger)
49
+ ? createLedgerNodeApi(
50
+ { ...node, explorerUri, clientVersion, chainId: config.chainId },
51
+ logger
52
+ )
50
53
  : createNodeApi(config, node, logger)
51
54
  api = withNodeSources(raw, config, logger)
52
55
  nodeApiCache.set(key, api)
@@ -5,7 +5,7 @@ import { delay } from '@ledgerhq/coin-module-framework/promises'
5
5
  import axios from 'axios'
6
6
  import BigNumber from 'bignumber.js'
7
7
  import { Transaction } from 'ethers'
8
- import { DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
8
+ import { CHAIN_ID, DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
9
9
  import { GasEstimationError } from '../../errors'
10
10
  import { createMockEvmConfigInfo, testLogger } from '../../fixtures/context.fixtures'
11
11
  import { getGasOptions } from '../gasTracker/ledger'
@@ -25,10 +25,10 @@ jest.mocked(delay).mockImplementation(
25
25
  () => new Promise((resolve) => setTimeout(resolve, 1)) // mocking the delay supposed to happen after each try
26
26
  )
27
27
 
28
- const currencyId = 'ethereum'
29
28
  const address = '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d'
30
29
 
31
30
  const ledgerConfig = {
31
+ chainId: CHAIN_ID.ETHEREUM,
32
32
  type: 'ledger' as const,
33
33
  explorerId: 'eth' as const,
34
34
  retries: 2,
@@ -60,7 +60,7 @@ describe('EVM Family', () => {
60
60
  ],
61
61
  }))
62
62
 
63
- const result = await api.call(currencyId, { to: USDC, data: DECIMALS_SELECTOR })
63
+ const result = await api.call({ to: USDC, data: DECIMALS_SELECTOR })
64
64
 
65
65
  expect(result).toEqual(DECIMALS_RESPONSE)
66
66
  expect(spy).toHaveBeenCalledWith(
@@ -83,7 +83,7 @@ describe('EVM Family', () => {
83
83
  ],
84
84
  }))
85
85
 
86
- await api.call(currencyId, { to: USDC, data: DECIMALS_SELECTOR, block: 123 })
86
+ await api.call({ to: USDC, data: DECIMALS_SELECTOR, block: 123 })
87
87
 
88
88
  expect(spy).toHaveBeenCalledWith(
89
89
  expect.objectContaining({
@@ -103,7 +103,7 @@ describe('EVM Family', () => {
103
103
  ],
104
104
  }))
105
105
 
106
- await expect(api.call(currencyId, { to: USDC, data: DECIMALS_SELECTOR })).rejects.toThrow(
106
+ await expect(api.call({ to: USDC, data: DECIMALS_SELECTOR })).rejects.toThrow(
107
107
  'EVM call failed'
108
108
  )
109
109
  })
@@ -133,7 +133,7 @@ describe('EVM Family', () => {
133
133
  },
134
134
  }
135
135
  })
136
- const response = await api.getTransaction(currencyId, '0xHash')
136
+ const response = await api.getTransaction('0xHash')
137
137
  expect(response.hash).toEqual('0xabc')
138
138
  expect(spy).toHaveBeenCalledTimes(3)
139
139
  })
@@ -149,7 +149,7 @@ describe('EVM Family', () => {
149
149
  }
150
150
  return { data: {} }
151
151
  })
152
- await expect(api.getTransaction(currencyId, '0xHash')).rejects.toBeInstanceOf(SpyError)
152
+ await expect(api.getTransaction('0xHash')).rejects.toBeInstanceOf(SpyError)
153
153
  })
154
154
  })
155
155
 
@@ -201,7 +201,7 @@ describe('EVM Family', () => {
201
201
  },
202
202
  }))
203
203
 
204
- const response = await api.getTransaction(currencyId, '0xHash')
204
+ const response = await api.getTransaction('0xHash')
205
205
  expect(response).toEqual({
206
206
  gasPrice: '83953611012',
207
207
  gasUsed: '21000',
@@ -244,7 +244,7 @@ describe('EVM Family', () => {
244
244
  data: { balance: '6969' },
245
245
  }))
246
246
 
247
- expect(await api.getCoinBalance(currencyId, '0xkvn')).toEqual(new BigNumber('6969'))
247
+ expect(await api.getCoinBalance('0xkvn')).toEqual(new BigNumber('6969'))
248
248
  })
249
249
  })
250
250
 
@@ -258,9 +258,7 @@ describe('EVM Family', () => {
258
258
  ],
259
259
  }))
260
260
 
261
- expect(await api.getTokenBalance(currencyId, '0xusdc', '0xkvn')).toEqual(
262
- new BigNumber('6969')
263
- )
261
+ expect(await api.getTokenBalance('0xusdc', '0xkvn')).toEqual(new BigNumber('6969'))
264
262
  })
265
263
  })
266
264
 
@@ -271,7 +269,7 @@ describe('EVM Family', () => {
271
269
  data: { address: '0xkvn', nonce: 123 },
272
270
  }))
273
271
 
274
- expect(await api.getTransactionCount(currencyId, '0xkvn')).toEqual(123)
272
+ expect(await api.getTransactionCount('0xkvn')).toEqual(123)
275
273
  })
276
274
  })
277
275
 
@@ -283,7 +281,7 @@ describe('EVM Family', () => {
283
281
  })
284
282
 
285
283
  await expect(
286
- api.getGasEstimation(currencyId, address, { amount: new BigNumber(0), recipient: '0x0' })
284
+ api.getGasEstimation(address, { amount: new BigNumber(0), recipient: '0x0' })
287
285
  ).rejects.toBeInstanceOf(GasEstimationError)
288
286
  })
289
287
 
@@ -294,7 +292,7 @@ describe('EVM Family', () => {
294
292
  .mockImplementation(() => Promise.reject({ code: 'ECONNABORTED' }))
295
293
 
296
294
  await expect(
297
- api.getGasEstimation(currencyId, address, { amount: new BigNumber(0), recipient: '0x0' })
295
+ api.getGasEstimation(address, { amount: new BigNumber(0), recipient: '0x0' })
298
296
  ).rejects.toBeInstanceOf(GasEstimationError)
299
297
  })
300
298
 
@@ -321,10 +319,8 @@ describe('EVM Family', () => {
321
319
  data: Buffer.from('ffff', 'hex'),
322
320
  }
323
321
 
324
- expect(await api.getGasEstimation(currencyId, address, transaction)).toEqual(
325
- new BigNumber(789)
326
- )
327
- expect(await api.getGasEstimation(currencyId, address, transactionWithData)).toEqual(
322
+ expect(await api.getGasEstimation(address, transaction)).toEqual(new BigNumber(789))
323
+ expect(await api.getGasEstimation(address, transactionWithData)).toEqual(
328
324
  new BigNumber(1_000_000)
329
325
  )
330
326
  })
@@ -356,7 +352,6 @@ describe('EVM Family', () => {
356
352
 
357
353
  const slowFeeData = await api.getFeeData(
358
354
  createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
359
- currencyId,
360
355
  {
361
356
  type: 2,
362
357
  feesStrategy: 'slow',
@@ -364,7 +359,6 @@ describe('EVM Family', () => {
364
359
  )
365
360
  const mediumFeeData = await api.getFeeData(
366
361
  createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
367
- currencyId,
368
362
  {
369
363
  type: 2,
370
364
  feesStrategy: 'medium',
@@ -372,7 +366,6 @@ describe('EVM Family', () => {
372
366
  )
373
367
  const fastFeeData = await api.getFeeData(
374
368
  createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
375
- currencyId,
376
369
  {
377
370
  type: 2,
378
371
  feesStrategy: 'fast',
@@ -424,7 +417,6 @@ describe('EVM Family', () => {
424
417
 
425
418
  const feeData = await api.getFeeData(
426
419
  createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
427
- currencyId,
428
420
  { type: 2 }
429
421
  )
430
422
 
@@ -446,7 +438,7 @@ describe('EVM Family', () => {
446
438
  },
447
439
  }))
448
440
 
449
- expect(await api.broadcastTransaction(currencyId, '0xSigneTx')).toEqual('0xHash')
441
+ expect(await api.broadcastTransaction('0xSigneTx')).toEqual('0xHash')
450
442
  })
451
443
 
452
444
  it('should include mevProtected=true in the request parameters when specified', async () => {
@@ -457,7 +449,7 @@ describe('EVM Family', () => {
457
449
  },
458
450
  }))
459
451
 
460
- await api.broadcastTransaction(currencyId, '0xSignedTx', { mevProtected: true })
452
+ await api.broadcastTransaction('0xSignedTx', { mevProtected: true })
461
453
 
462
454
  expect(mockRequest).toHaveBeenCalledWith(
463
455
  expect.objectContaining({
@@ -478,7 +470,7 @@ describe('EVM Family', () => {
478
470
  },
479
471
  }))
480
472
 
481
- await api.broadcastTransaction(currencyId, '0xSignedTx', {
473
+ await api.broadcastTransaction('0xSignedTx', {
482
474
  mevProtected: false,
483
475
  source: { type: 'live-app', name: 'test-manifest-id' },
484
476
  })
@@ -503,7 +495,7 @@ describe('EVM Family', () => {
503
495
  },
504
496
  }))
505
497
 
506
- await api.broadcastTransaction(currencyId, '0xSignedTx', { mevProtected: false })
498
+ await api.broadcastTransaction('0xSignedTx', { mevProtected: false })
507
499
 
508
500
  // ledgerConfig sets no clientVersion, so `{}` proves no source header was added.
509
501
  expect(mockRequest).toHaveBeenCalledWith(
@@ -544,14 +536,14 @@ describe('EVM Family', () => {
544
536
  }
545
537
  })
546
538
 
547
- expect(await api.getBlockByHeight(currencyId, 12)).toEqual({
539
+ expect(await api.getBlockByHeight(12)).toEqual({
548
540
  hash: '0xhash',
549
541
  height: 123,
550
542
  timestamp: Date.now(),
551
543
  parentHash: '0xparentHash',
552
544
  transactionHashes: ['0xTx1', '0xTx2'],
553
545
  })
554
- expect(await api.getBlockByHeight(currencyId, 'latest')).toEqual({
546
+ expect(await api.getBlockByHeight('latest')).toEqual({
555
547
  hash: '0xhashLatest',
556
548
  height: 456,
557
549
  timestamp: Date.now(),
@@ -564,11 +556,11 @@ describe('EVM Family', () => {
564
556
  describe('getOptimismAdditionalFees', () => {
565
557
  it('should return 0 for an incompatible currency', async () => {
566
558
  const api = createLedgerNodeApi(ledgerConfig, testLogger)
567
- expect(await api.getOptimismAdditionalFees(currencyId, '')).toEqual(new BigNumber(0))
559
+ expect(await api.getOptimismAdditionalFees('')).toEqual(new BigNumber(0))
568
560
  })
569
561
 
570
562
  it('should return the expected payload', async () => {
571
- const api = createLedgerNodeApi(ledgerConfig, testLogger)
563
+ const api = createLedgerNodeApi({ ...ledgerConfig, chainId: CHAIN_ID.OPTIMISM }, testLogger)
572
564
  jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
573
565
  data: [
574
566
  {
@@ -597,58 +589,60 @@ describe('EVM Family', () => {
597
589
  },
598
590
  })
599
591
 
600
- expect(await api.getOptimismAdditionalFees('optimism', transaction.serialized)).toEqual(
592
+ expect(await api.getOptimismAdditionalFees(transaction.serialized)).toEqual(
601
593
  new BigNumber('100000000')
602
594
  )
603
595
  })
604
596
 
605
- it.each(['blast', 'blast_sepolia', 'base', 'base_sepolia'])(
606
- 'should query the OP-stack gas oracle for %s (not return 0)',
607
- async (currencyId) => {
608
- const api = createLedgerNodeApi(ledgerConfig, testLogger)
609
- jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
610
- data: [
611
- {
612
- info: {
613
- contract: '0x420000000000000000000000000000000000000F',
614
- data: '0xSerializedTransaction',
615
- blockNumber: 123,
616
- },
617
- response: '100000000',
597
+ it.each([
598
+ ['blast', CHAIN_ID.BLAST],
599
+ ['blast_sepolia', CHAIN_ID.BLAST_SEPOLIA],
600
+ ['base', CHAIN_ID.BASE],
601
+ ['base_sepolia', CHAIN_ID.BASE_SEPOLIA],
602
+ ])('should query the OP-stack gas oracle for %s (not return 0)', async (_name, chainId) => {
603
+ const api = createLedgerNodeApi({ ...ledgerConfig, chainId }, testLogger)
604
+ jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
605
+ data: [
606
+ {
607
+ info: {
608
+ contract: '0x420000000000000000000000000000000000000F',
609
+ data: '0xSerializedTransaction',
610
+ blockNumber: 123,
618
611
  },
619
- ],
620
- }))
621
-
622
- const transaction = Transaction.from({
623
- to: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
624
- value: 1n,
625
- gasLimit: 2n,
626
- chainId: 1,
627
- nonce: 0,
628
- gasPrice: 3n,
629
- type: 0,
630
- signature: {
631
- r: '0xffffffffffffffffffffffffffffffffffffffff',
632
- s: '0xffffffffffffffffffffffffffffffffffffffff',
633
- v: 27,
612
+ response: '100000000',
634
613
  },
635
- })
614
+ ],
615
+ }))
636
616
 
637
- expect(await api.getOptimismAdditionalFees(currencyId, transaction.serialized)).toEqual(
638
- new BigNumber('100000000')
639
- )
640
- }
641
- )
617
+ const transaction = Transaction.from({
618
+ to: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
619
+ value: 1n,
620
+ gasLimit: 2n,
621
+ chainId: 1,
622
+ nonce: 0,
623
+ gasPrice: 3n,
624
+ type: 0,
625
+ signature: {
626
+ r: '0xffffffffffffffffffffffffffffffffffffffff',
627
+ s: '0xffffffffffffffffffffffffffffffffffffffff',
628
+ v: 27,
629
+ },
630
+ })
631
+
632
+ expect(await api.getOptimismAdditionalFees(transaction.serialized)).toEqual(
633
+ new BigNumber('100000000')
634
+ )
635
+ })
642
636
  })
643
637
 
644
638
  describe('getScrollAdditionalFees', () => {
645
639
  it('should return 0 for an incompatible currency', async () => {
646
640
  const api = createLedgerNodeApi(ledgerConfig, testLogger)
647
- expect(await api.getScrollAdditionalFees(currencyId, '')).toEqual(new BigNumber(0))
641
+ expect(await api.getScrollAdditionalFees('')).toEqual(new BigNumber(0))
648
642
  })
649
643
 
650
644
  it('should return the expected payload', async () => {
651
- const api = createLedgerNodeApi(ledgerConfig, testLogger)
645
+ const api = createLedgerNodeApi({ ...ledgerConfig, chainId: CHAIN_ID.SCROLL }, testLogger)
652
646
  jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
653
647
  data: [
654
648
  {
@@ -677,7 +671,7 @@ describe('EVM Family', () => {
677
671
  },
678
672
  })
679
673
 
680
- expect(await api.getScrollAdditionalFees('scroll', transaction.serialized)).toEqual(
674
+ expect(await api.getScrollAdditionalFees(transaction.serialized)).toEqual(
681
675
  new BigNumber('100000000')
682
676
  )
683
677
  })