@ledgerhq/coin-evm 10.0.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 (505) hide show
  1. package/.oxlintrc.json +2 -6
  2. package/CHANGELOG.md +54 -0
  3. package/docs/getBlock-internal-txs-schema.md +2 -2
  4. package/docs/network/node/index.md +1 -1
  5. package/lib/abis/index.d.ts +8 -0
  6. package/lib/abis/index.d.ts.map +1 -1
  7. package/lib/abis/index.js +30 -0
  8. package/lib/abis/index.js.map +1 -1
  9. package/lib/adapters/blockOperations.js +2 -2
  10. package/lib/adapters/blockOperations.js.map +1 -1
  11. package/lib/adapters/etherscan.d.ts +2 -1
  12. package/lib/adapters/etherscan.d.ts.map +1 -1
  13. package/lib/adapters/etherscan.js +2 -2
  14. package/lib/adapters/etherscan.js.map +1 -1
  15. package/lib/adapters/ledger.d.ts +2 -1
  16. package/lib/adapters/ledger.d.ts.map +1 -1
  17. package/lib/adapters/ledger.js +2 -2
  18. package/lib/adapters/ledger.js.map +1 -1
  19. package/lib/api/index.d.ts.map +1 -1
  20. package/lib/api/index.js +3 -2
  21. package/lib/api/index.js.map +1 -1
  22. package/lib/chains.d.ts +94 -0
  23. package/lib/chains.d.ts.map +1 -0
  24. package/lib/chains.js +98 -0
  25. package/lib/chains.js.map +1 -0
  26. package/lib/config.d.ts +4 -1
  27. package/lib/config.d.ts.map +1 -1
  28. package/lib/config.js +3 -1
  29. package/lib/config.js.map +1 -1
  30. package/lib/internalTxSources.d.ts.map +1 -1
  31. package/lib/internalTxSources.js +21 -3
  32. package/lib/internalTxSources.js.map +1 -1
  33. package/lib/logic/broadcast.js +2 -2
  34. package/lib/logic/broadcast.js.map +1 -1
  35. package/lib/logic/common.d.ts +1 -1
  36. package/lib/logic/common.d.ts.map +1 -1
  37. package/lib/logic/common.js +22 -14
  38. package/lib/logic/common.js.map +1 -1
  39. package/lib/logic/craftTransaction.d.ts.map +1 -1
  40. package/lib/logic/craftTransaction.js +7 -4
  41. package/lib/logic/craftTransaction.js.map +1 -1
  42. package/lib/logic/estimateFees.d.ts.map +1 -1
  43. package/lib/logic/estimateFees.js +11 -8
  44. package/lib/logic/estimateFees.js.map +1 -1
  45. package/lib/logic/getBalance.d.ts.map +1 -1
  46. package/lib/logic/getBalance.js +9 -9
  47. package/lib/logic/getBalance.js.map +1 -1
  48. package/lib/logic/getBlock.d.ts.map +1 -1
  49. package/lib/logic/getBlock.js +17 -17
  50. package/lib/logic/getBlock.js.map +1 -1
  51. package/lib/logic/getBlockInfo.js +2 -2
  52. package/lib/logic/getBlockInfo.js.map +1 -1
  53. package/lib/logic/getNextSequence.d.ts.map +1 -1
  54. package/lib/logic/getNextSequence.js +1 -1
  55. package/lib/logic/getNextSequence.js.map +1 -1
  56. package/lib/logic/getStakes.d.ts.map +1 -1
  57. package/lib/logic/getStakes.js +10 -10
  58. package/lib/logic/getStakes.js.map +1 -1
  59. package/lib/logic/internalTransactionsFetcher.d.ts +2 -2
  60. package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
  61. package/lib/logic/internalTransactionsFetcher.js +9 -9
  62. package/lib/logic/internalTransactionsFetcher.js.map +1 -1
  63. package/lib/logic/lastBlock.js +2 -2
  64. package/lib/logic/lastBlock.js.map +1 -1
  65. package/lib/logic/listOperations.d.ts.map +1 -1
  66. package/lib/logic/listOperations.js +1 -1
  67. package/lib/logic/listOperations.js.map +1 -1
  68. package/lib/logic/predicates.d.ts +17 -0
  69. package/lib/logic/predicates.d.ts.map +1 -0
  70. package/lib/logic/predicates.js +126 -0
  71. package/lib/logic/predicates.js.map +1 -0
  72. package/lib/logic/validateIntent.d.ts.map +1 -1
  73. package/lib/logic/validateIntent.js +9 -9
  74. package/lib/logic/validateIntent.js.map +1 -1
  75. package/lib/logic.d.ts +1 -1
  76. package/lib/logic.d.ts.map +1 -1
  77. package/lib/logic.js +14 -13
  78. package/lib/logic.js.map +1 -1
  79. package/lib/network/explorer/etherscan.d.ts +2 -3
  80. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  81. package/lib/network/explorer/etherscan.js +6 -8
  82. package/lib/network/explorer/etherscan.js.map +1 -1
  83. package/lib/network/explorer/ledger.d.ts.map +1 -1
  84. package/lib/network/explorer/ledger.js +5 -5
  85. package/lib/network/explorer/ledger.js.map +1 -1
  86. package/lib/network/explorer/types.d.ts +2 -2
  87. package/lib/network/explorer/types.d.ts.map +1 -1
  88. package/lib/network/explorer/types.js +11 -1
  89. package/lib/network/explorer/types.js.map +1 -1
  90. package/lib/network/gasTracker/ledger.d.ts.map +1 -1
  91. package/lib/network/gasTracker/ledger.js +1 -3
  92. package/lib/network/gasTracker/ledger.js.map +1 -1
  93. package/lib/network/node/explorerProxy.d.ts.map +1 -1
  94. package/lib/network/node/explorerProxy.js +22 -17
  95. package/lib/network/node/explorerProxy.js.map +1 -1
  96. package/lib/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
  97. package/lib/network/node/gethCallTracerToTraceBlockItems.js +10 -12
  98. package/lib/network/node/gethCallTracerToTraceBlockItems.js.map +1 -1
  99. package/lib/network/node/index.d.ts +1 -1
  100. package/lib/network/node/index.d.ts.map +1 -1
  101. package/lib/network/node/index.js +7 -7
  102. package/lib/network/node/index.js.map +1 -1
  103. package/lib/network/node/ledger.d.ts +3 -1
  104. package/lib/network/node/ledger.d.ts.map +1 -1
  105. package/lib/network/node/ledger.js +38 -24
  106. package/lib/network/node/ledger.js.map +1 -1
  107. package/lib/network/node/rpc.common.d.ts +1 -1
  108. package/lib/network/node/rpc.common.d.ts.map +1 -1
  109. package/lib/network/node/rpc.common.js +104 -103
  110. package/lib/network/node/rpc.common.js.map +1 -1
  111. package/lib/network/node/types.d.ts +21 -22
  112. package/lib/network/node/types.d.ts.map +1 -1
  113. package/lib/network/node/types.js +0 -27
  114. package/lib/network/node/types.js.map +1 -1
  115. package/lib/network/node/withNodeSources.d.ts.map +1 -1
  116. package/lib/network/node/withNodeSources.js +15 -15
  117. package/lib/network/node/withNodeSources.js.map +1 -1
  118. package/lib/nodeSources.d.ts.map +1 -1
  119. package/lib/nodeSources.js +11 -3
  120. package/lib/nodeSources.js.map +1 -1
  121. package/lib/staking/abis.d.ts +3 -2
  122. package/lib/staking/abis.d.ts.map +1 -1
  123. package/lib/staking/abis.js +10 -9
  124. package/lib/staking/abis.js.map +1 -1
  125. package/lib/staking/contracts.d.ts +3 -2
  126. package/lib/staking/contracts.d.ts.map +1 -1
  127. package/lib/staking/contracts.js +12 -13
  128. package/lib/staking/contracts.js.map +1 -1
  129. package/lib/staking/detectOperationType.d.ts +2 -4
  130. package/lib/staking/detectOperationType.d.ts.map +1 -1
  131. package/lib/staking/detectOperationType.js +22 -21
  132. package/lib/staking/detectOperationType.js.map +1 -1
  133. package/lib/staking/encoder.d.ts +2 -1
  134. package/lib/staking/encoder.d.ts.map +1 -1
  135. package/lib/staking/encoder.js +8 -8
  136. package/lib/staking/encoder.js.map +1 -1
  137. package/lib/staking/fetchers.d.ts +2 -1
  138. package/lib/staking/fetchers.d.ts.map +1 -1
  139. package/lib/staking/fetchers.js +27 -27
  140. package/lib/staking/fetchers.js.map +1 -1
  141. package/lib/staking/logic.d.ts +6 -6
  142. package/lib/staking/logic.d.ts.map +1 -1
  143. package/lib/staking/logic.js +14 -13
  144. package/lib/staking/logic.js.map +1 -1
  145. package/lib/staking/operations/index.d.ts +2 -1
  146. package/lib/staking/operations/index.d.ts.map +1 -1
  147. package/lib/staking/operations/index.js +39 -20
  148. package/lib/staking/operations/index.js.map +1 -1
  149. package/lib/staking/prepareIntents.d.ts +1 -1
  150. package/lib/staking/prepareIntents.d.ts.map +1 -1
  151. package/lib/staking/prepareIntents.js +14 -12
  152. package/lib/staking/prepareIntents.js.map +1 -1
  153. package/lib/staking/redelegations.d.ts +4 -4
  154. package/lib/staking/redelegations.d.ts.map +1 -1
  155. package/lib/staking/redelegations.js +22 -27
  156. package/lib/staking/redelegations.js.map +1 -1
  157. package/lib/staking/rewards.d.ts +1 -1
  158. package/lib/staking/rewards.d.ts.map +1 -1
  159. package/lib/staking/rewards.js +2 -2
  160. package/lib/staking/rewards.js.map +1 -1
  161. package/lib/staking/rewardsFromReceipt.d.ts +2 -1
  162. package/lib/staking/rewardsFromReceipt.d.ts.map +1 -1
  163. package/lib/staking/rewardsFromReceipt.js +2 -2
  164. package/lib/staking/rewardsFromReceipt.js.map +1 -1
  165. package/lib/staking/transactionData.d.ts +2 -1
  166. package/lib/staking/transactionData.d.ts.map +1 -1
  167. package/lib/staking/transactionData.js +6 -6
  168. package/lib/staking/transactionData.js.map +1 -1
  169. package/lib/staking/unbondings.d.ts +1 -1
  170. package/lib/staking/unbondings.d.ts.map +1 -1
  171. package/lib/staking/unbondings.js +2 -2
  172. package/lib/staking/unbondings.js.map +1 -1
  173. package/lib/staking/utils.d.ts.map +1 -1
  174. package/lib/staking/utils.js +22 -27
  175. package/lib/staking/utils.js.map +1 -1
  176. package/lib/staking/validators/index.d.ts +14 -14
  177. package/lib/staking/validators/index.d.ts.map +1 -1
  178. package/lib/staking/validators/index.js +39 -38
  179. package/lib/staking/validators/index.js.map +1 -1
  180. package/lib/staking/validators/monad.d.ts +5 -5
  181. package/lib/staking/validators/monad.d.ts.map +1 -1
  182. package/lib/staking/validators/monad.js +44 -37
  183. package/lib/staking/validators/monad.js.map +1 -1
  184. package/lib/staking/validators/monadResolver.d.ts +1 -1
  185. package/lib/staking/validators/monadResolver.d.ts.map +1 -1
  186. package/lib/staking/validators/monadResolver.js +7 -6
  187. package/lib/staking/validators/monadResolver.js.map +1 -1
  188. package/lib/staking/validators/sei.js +2 -2
  189. package/lib/staking/validators/sei.js.map +1 -1
  190. package/lib/staking/validators/somnia.d.ts +4 -4
  191. package/lib/staking/validators/somnia.d.ts.map +1 -1
  192. package/lib/staking/validators/somnia.js +25 -24
  193. package/lib/staking/validators/somnia.js.map +1 -1
  194. package/lib/staking/validators/types.d.ts +1 -1
  195. package/lib/staking/validators/types.d.ts.map +1 -1
  196. package/lib/staking/validators/zero_gravity.d.ts +1 -1
  197. package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
  198. package/lib/staking/validators/zero_gravity.js +10 -9
  199. package/lib/staking/validators/zero_gravity.js.map +1 -1
  200. package/lib/types/staking.d.ts +5 -6
  201. package/lib/types/staking.d.ts.map +1 -1
  202. package/lib-es/abis/index.d.ts +8 -0
  203. package/lib-es/abis/index.d.ts.map +1 -1
  204. package/lib-es/abis/index.js +29 -0
  205. package/lib-es/abis/index.js.map +1 -1
  206. package/lib-es/adapters/blockOperations.js +1 -1
  207. package/lib-es/adapters/blockOperations.js.map +1 -1
  208. package/lib-es/adapters/etherscan.d.ts +2 -1
  209. package/lib-es/adapters/etherscan.d.ts.map +1 -1
  210. package/lib-es/adapters/etherscan.js +2 -2
  211. package/lib-es/adapters/etherscan.js.map +1 -1
  212. package/lib-es/adapters/ledger.d.ts +2 -1
  213. package/lib-es/adapters/ledger.d.ts.map +1 -1
  214. package/lib-es/adapters/ledger.js +2 -2
  215. package/lib-es/adapters/ledger.js.map +1 -1
  216. package/lib-es/api/index.d.ts.map +1 -1
  217. package/lib-es/api/index.js +3 -2
  218. package/lib-es/api/index.js.map +1 -1
  219. package/lib-es/chains.d.ts +94 -0
  220. package/lib-es/chains.d.ts.map +1 -0
  221. package/lib-es/chains.js +95 -0
  222. package/lib-es/chains.js.map +1 -0
  223. package/lib-es/config.d.ts +4 -1
  224. package/lib-es/config.d.ts.map +1 -1
  225. package/lib-es/config.js +1 -0
  226. package/lib-es/config.js.map +1 -1
  227. package/lib-es/internalTxSources.d.ts.map +1 -1
  228. package/lib-es/internalTxSources.js +21 -3
  229. package/lib-es/internalTxSources.js.map +1 -1
  230. package/lib-es/logic/broadcast.js +2 -2
  231. package/lib-es/logic/broadcast.js.map +1 -1
  232. package/lib-es/logic/common.d.ts +1 -1
  233. package/lib-es/logic/common.d.ts.map +1 -1
  234. package/lib-es/logic/common.js +22 -14
  235. package/lib-es/logic/common.js.map +1 -1
  236. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  237. package/lib-es/logic/craftTransaction.js +7 -4
  238. package/lib-es/logic/craftTransaction.js.map +1 -1
  239. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  240. package/lib-es/logic/estimateFees.js +11 -8
  241. package/lib-es/logic/estimateFees.js.map +1 -1
  242. package/lib-es/logic/getBalance.d.ts.map +1 -1
  243. package/lib-es/logic/getBalance.js +9 -9
  244. package/lib-es/logic/getBalance.js.map +1 -1
  245. package/lib-es/logic/getBlock.d.ts.map +1 -1
  246. package/lib-es/logic/getBlock.js +18 -18
  247. package/lib-es/logic/getBlock.js.map +1 -1
  248. package/lib-es/logic/getBlockInfo.js +2 -2
  249. package/lib-es/logic/getBlockInfo.js.map +1 -1
  250. package/lib-es/logic/getNextSequence.d.ts.map +1 -1
  251. package/lib-es/logic/getNextSequence.js +1 -1
  252. package/lib-es/logic/getNextSequence.js.map +1 -1
  253. package/lib-es/logic/getStakes.d.ts.map +1 -1
  254. package/lib-es/logic/getStakes.js +10 -10
  255. package/lib-es/logic/getStakes.js.map +1 -1
  256. package/lib-es/logic/internalTransactionsFetcher.d.ts +2 -2
  257. package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
  258. package/lib-es/logic/internalTransactionsFetcher.js +9 -9
  259. package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
  260. package/lib-es/logic/lastBlock.js +2 -2
  261. package/lib-es/logic/lastBlock.js.map +1 -1
  262. package/lib-es/logic/listOperations.d.ts.map +1 -1
  263. package/lib-es/logic/listOperations.js +1 -1
  264. package/lib-es/logic/listOperations.js.map +1 -1
  265. package/lib-es/logic/predicates.d.ts +17 -0
  266. package/lib-es/logic/predicates.d.ts.map +1 -0
  267. package/lib-es/logic/predicates.js +114 -0
  268. package/lib-es/logic/predicates.js.map +1 -0
  269. package/lib-es/logic/validateIntent.d.ts.map +1 -1
  270. package/lib-es/logic/validateIntent.js +9 -9
  271. package/lib-es/logic/validateIntent.js.map +1 -1
  272. package/lib-es/logic.d.ts +1 -1
  273. package/lib-es/logic.d.ts.map +1 -1
  274. package/lib-es/logic.js +14 -13
  275. package/lib-es/logic.js.map +1 -1
  276. package/lib-es/network/explorer/etherscan.d.ts +2 -3
  277. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  278. package/lib-es/network/explorer/etherscan.js +6 -8
  279. package/lib-es/network/explorer/etherscan.js.map +1 -1
  280. package/lib-es/network/explorer/ledger.d.ts.map +1 -1
  281. package/lib-es/network/explorer/ledger.js +5 -5
  282. package/lib-es/network/explorer/ledger.js.map +1 -1
  283. package/lib-es/network/explorer/types.d.ts +2 -2
  284. package/lib-es/network/explorer/types.d.ts.map +1 -1
  285. package/lib-es/network/explorer/types.js +11 -1
  286. package/lib-es/network/explorer/types.js.map +1 -1
  287. package/lib-es/network/gasTracker/ledger.d.ts.map +1 -1
  288. package/lib-es/network/gasTracker/ledger.js +1 -3
  289. package/lib-es/network/gasTracker/ledger.js.map +1 -1
  290. package/lib-es/network/node/explorerProxy.d.ts.map +1 -1
  291. package/lib-es/network/node/explorerProxy.js +22 -17
  292. package/lib-es/network/node/explorerProxy.js.map +1 -1
  293. package/lib-es/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
  294. package/lib-es/network/node/gethCallTracerToTraceBlockItems.js +4 -6
  295. package/lib-es/network/node/gethCallTracerToTraceBlockItems.js.map +1 -1
  296. package/lib-es/network/node/index.d.ts +1 -1
  297. package/lib-es/network/node/index.d.ts.map +1 -1
  298. package/lib-es/network/node/index.js +7 -7
  299. package/lib-es/network/node/index.js.map +1 -1
  300. package/lib-es/network/node/ledger.d.ts +3 -1
  301. package/lib-es/network/node/ledger.d.ts.map +1 -1
  302. package/lib-es/network/node/ledger.js +38 -24
  303. package/lib-es/network/node/ledger.js.map +1 -1
  304. package/lib-es/network/node/rpc.common.d.ts +1 -1
  305. package/lib-es/network/node/rpc.common.d.ts.map +1 -1
  306. package/lib-es/network/node/rpc.common.js +102 -101
  307. package/lib-es/network/node/rpc.common.js.map +1 -1
  308. package/lib-es/network/node/types.d.ts +21 -22
  309. package/lib-es/network/node/types.d.ts.map +1 -1
  310. package/lib-es/network/node/types.js +0 -25
  311. package/lib-es/network/node/types.js.map +1 -1
  312. package/lib-es/network/node/withNodeSources.d.ts.map +1 -1
  313. package/lib-es/network/node/withNodeSources.js +15 -15
  314. package/lib-es/network/node/withNodeSources.js.map +1 -1
  315. package/lib-es/nodeSources.d.ts.map +1 -1
  316. package/lib-es/nodeSources.js +11 -3
  317. package/lib-es/nodeSources.js.map +1 -1
  318. package/lib-es/staking/abis.d.ts +3 -2
  319. package/lib-es/staking/abis.d.ts.map +1 -1
  320. package/lib-es/staking/abis.js +10 -9
  321. package/lib-es/staking/abis.js.map +1 -1
  322. package/lib-es/staking/contracts.d.ts +3 -2
  323. package/lib-es/staking/contracts.d.ts.map +1 -1
  324. package/lib-es/staking/contracts.js +12 -13
  325. package/lib-es/staking/contracts.js.map +1 -1
  326. package/lib-es/staking/detectOperationType.d.ts +2 -4
  327. package/lib-es/staking/detectOperationType.d.ts.map +1 -1
  328. package/lib-es/staking/detectOperationType.js +22 -21
  329. package/lib-es/staking/detectOperationType.js.map +1 -1
  330. package/lib-es/staking/encoder.d.ts +2 -1
  331. package/lib-es/staking/encoder.d.ts.map +1 -1
  332. package/lib-es/staking/encoder.js +8 -8
  333. package/lib-es/staking/encoder.js.map +1 -1
  334. package/lib-es/staking/fetchers.d.ts +2 -1
  335. package/lib-es/staking/fetchers.d.ts.map +1 -1
  336. package/lib-es/staking/fetchers.js +27 -27
  337. package/lib-es/staking/fetchers.js.map +1 -1
  338. package/lib-es/staking/logic.d.ts +6 -6
  339. package/lib-es/staking/logic.d.ts.map +1 -1
  340. package/lib-es/staking/logic.js +14 -13
  341. package/lib-es/staking/logic.js.map +1 -1
  342. package/lib-es/staking/operations/index.d.ts +2 -1
  343. package/lib-es/staking/operations/index.d.ts.map +1 -1
  344. package/lib-es/staking/operations/index.js +39 -20
  345. package/lib-es/staking/operations/index.js.map +1 -1
  346. package/lib-es/staking/prepareIntents.d.ts +1 -1
  347. package/lib-es/staking/prepareIntents.d.ts.map +1 -1
  348. package/lib-es/staking/prepareIntents.js +13 -11
  349. package/lib-es/staking/prepareIntents.js.map +1 -1
  350. package/lib-es/staking/redelegations.d.ts +4 -4
  351. package/lib-es/staking/redelegations.d.ts.map +1 -1
  352. package/lib-es/staking/redelegations.js +19 -24
  353. package/lib-es/staking/redelegations.js.map +1 -1
  354. package/lib-es/staking/rewards.d.ts +1 -1
  355. package/lib-es/staking/rewards.d.ts.map +1 -1
  356. package/lib-es/staking/rewards.js +2 -2
  357. package/lib-es/staking/rewards.js.map +1 -1
  358. package/lib-es/staking/rewardsFromReceipt.d.ts +2 -1
  359. package/lib-es/staking/rewardsFromReceipt.d.ts.map +1 -1
  360. package/lib-es/staking/rewardsFromReceipt.js +2 -2
  361. package/lib-es/staking/rewardsFromReceipt.js.map +1 -1
  362. package/lib-es/staking/transactionData.d.ts +2 -1
  363. package/lib-es/staking/transactionData.d.ts.map +1 -1
  364. package/lib-es/staking/transactionData.js +6 -6
  365. package/lib-es/staking/transactionData.js.map +1 -1
  366. package/lib-es/staking/unbondings.d.ts +1 -1
  367. package/lib-es/staking/unbondings.d.ts.map +1 -1
  368. package/lib-es/staking/unbondings.js +2 -2
  369. package/lib-es/staking/unbondings.js.map +1 -1
  370. package/lib-es/staking/utils.d.ts.map +1 -1
  371. package/lib-es/staking/utils.js +20 -25
  372. package/lib-es/staking/utils.js.map +1 -1
  373. package/lib-es/staking/validators/index.d.ts +14 -14
  374. package/lib-es/staking/validators/index.d.ts.map +1 -1
  375. package/lib-es/staking/validators/index.js +39 -38
  376. package/lib-es/staking/validators/index.js.map +1 -1
  377. package/lib-es/staking/validators/monad.d.ts +5 -5
  378. package/lib-es/staking/validators/monad.d.ts.map +1 -1
  379. package/lib-es/staking/validators/monad.js +43 -36
  380. package/lib-es/staking/validators/monad.js.map +1 -1
  381. package/lib-es/staking/validators/monadResolver.d.ts +1 -1
  382. package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
  383. package/lib-es/staking/validators/monadResolver.js +6 -5
  384. package/lib-es/staking/validators/monadResolver.js.map +1 -1
  385. package/lib-es/staking/validators/sei.js +2 -2
  386. package/lib-es/staking/validators/sei.js.map +1 -1
  387. package/lib-es/staking/validators/somnia.d.ts +4 -4
  388. package/lib-es/staking/validators/somnia.d.ts.map +1 -1
  389. package/lib-es/staking/validators/somnia.js +24 -23
  390. package/lib-es/staking/validators/somnia.js.map +1 -1
  391. package/lib-es/staking/validators/types.d.ts +1 -1
  392. package/lib-es/staking/validators/types.d.ts.map +1 -1
  393. package/lib-es/staking/validators/zero_gravity.d.ts +1 -1
  394. package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
  395. package/lib-es/staking/validators/zero_gravity.js +9 -8
  396. package/lib-es/staking/validators/zero_gravity.js.map +1 -1
  397. package/lib-es/types/staking.d.ts +5 -6
  398. package/lib-es/types/staking.d.ts.map +1 -1
  399. package/package.json +2 -2
  400. package/src/abis/index.test.ts +36 -0
  401. package/src/abis/index.ts +30 -0
  402. package/src/adapters/blockOperations.ts +1 -1
  403. package/src/adapters/etherscan.test.ts +34 -38
  404. package/src/adapters/etherscan.ts +3 -2
  405. package/src/adapters/ledger.test.ts +49 -22
  406. package/src/adapters/ledger.ts +3 -2
  407. package/src/api/getBlock.integ.test.ts +2 -1
  408. package/src/api/index.monad_testnet.integ.test.ts +2 -2
  409. package/src/api/index.ts +4 -3
  410. package/src/chains.test.ts +12 -0
  411. package/src/chains.ts +97 -0
  412. package/src/config.ts +5 -1
  413. package/src/fixtures/staking.fixtures.ts +13 -0
  414. package/src/internalTxSources.ts +20 -3
  415. package/src/logic/broadcast.ts +2 -2
  416. package/src/logic/common.ts +23 -14
  417. package/src/logic/craftTransaction.ts +6 -5
  418. package/src/logic/estimateFees.ts +10 -25
  419. package/src/logic/getBalance.ts +7 -13
  420. package/src/logic/getBlock.ts +22 -19
  421. package/src/logic/getBlockInfo.ts +2 -2
  422. package/src/logic/getNextSequence.ts +1 -4
  423. package/src/logic/getStakes.ts +11 -12
  424. package/src/logic/internalTransactionsFetcher.ts +7 -9
  425. package/src/logic/lastBlock.ts +2 -2
  426. package/src/logic/listOperations.ts +0 -1
  427. package/src/logic/predicates.ts +124 -0
  428. package/src/logic/tests/broadcast.test.ts +4 -4
  429. package/src/logic/tests/broadcastSource.test.ts +0 -3
  430. package/src/logic/tests/common.test.ts +17 -33
  431. package/src/logic/tests/craftTransaction.test.ts +13 -6
  432. package/src/logic/tests/estimateFees.test.ts +16 -7
  433. package/src/logic/tests/getBalance.test.ts +17 -33
  434. package/src/logic/tests/getBlock.test.ts +69 -75
  435. package/src/logic/tests/getBlockInfo.test.ts +1 -1
  436. package/src/logic/tests/getNextSequence.test.ts +1 -1
  437. package/src/logic/tests/getStakes.test.ts +28 -16
  438. package/src/logic/tests/internalTransactionsFetcher.test.ts +5 -5
  439. package/src/logic/tests/lastBlock.test.ts +3 -6
  440. package/src/logic/tests/listOperations.test.ts +3 -4
  441. package/src/logic/tests/validateIntent.test.ts +16 -3
  442. package/src/logic/validateIntent.ts +8 -10
  443. package/src/logic.test.ts +12 -4
  444. package/src/logic.ts +13 -13
  445. package/src/network/explorer/etherscan.test.ts +9 -58
  446. package/src/network/explorer/etherscan.ts +8 -24
  447. package/src/network/explorer/index.test.ts +1 -1
  448. package/src/network/explorer/ledger.test.ts +44 -146
  449. package/src/network/explorer/ledger.ts +2 -5
  450. package/src/network/explorer/types.ts +12 -5
  451. package/src/network/gasTracker/ledger.ts +1 -4
  452. package/src/network/node/explorerProxy.test.ts +17 -22
  453. package/src/network/node/explorerProxy.ts +23 -20
  454. package/src/network/node/gethCallTracerToTraceBlockItems.test.ts +1 -1
  455. package/src/network/node/gethCallTracerToTraceBlockItems.ts +6 -9
  456. package/src/network/node/index.memoization.test.ts +29 -22
  457. package/src/network/node/index.test.ts +1 -3
  458. package/src/network/node/index.ts +11 -8
  459. package/src/network/node/ledger.test.ts +63 -69
  460. package/src/network/node/ledger.ts +39 -38
  461. package/src/network/node/rpc.common.ts +134 -158
  462. package/src/network/node/rpc.test.ts +201 -110
  463. package/src/network/node/types.ts +17 -64
  464. package/src/network/node/withNodeSources.test.ts +7 -9
  465. package/src/network/node/withNodeSources.ts +23 -26
  466. package/src/nodeSources.ts +11 -3
  467. package/src/staking/abis.test.ts +24 -28
  468. package/src/staking/abis.ts +12 -10
  469. package/src/staking/contracts.test.ts +20 -8
  470. package/src/staking/contracts.ts +13 -14
  471. package/src/staking/detectOperationType.test.ts +16 -13
  472. package/src/staking/detectOperationType.ts +24 -22
  473. package/src/staking/encoder.test.ts +38 -27
  474. package/src/staking/encoder.ts +9 -8
  475. package/src/staking/fetchers.ts +28 -39
  476. package/src/staking/logic.test.ts +34 -32
  477. package/src/staking/logic.ts +14 -14
  478. package/src/staking/operations/index.test.ts +48 -39
  479. package/src/staking/operations/index.ts +43 -21
  480. package/src/staking/prepareIntents.test.ts +14 -34
  481. package/src/staking/prepareIntents.ts +12 -14
  482. package/src/staking/redelegations.test.ts +73 -131
  483. package/src/staking/redelegations.ts +13 -31
  484. package/src/staking/rewards.test.ts +19 -21
  485. package/src/staking/rewards.ts +1 -2
  486. package/src/staking/rewardsFromReceipt.test.ts +9 -8
  487. package/src/staking/rewardsFromReceipt.ts +3 -2
  488. package/src/staking/transactionData.test.ts +35 -25
  489. package/src/staking/transactionData.ts +7 -6
  490. package/src/staking/unbondings.test.ts +26 -20
  491. package/src/staking/unbondings.ts +1 -2
  492. package/src/staking/utils.ts +19 -26
  493. package/src/staking/validators/index.ts +45 -51
  494. package/src/staking/validators/monad.test.ts +52 -54
  495. package/src/staking/validators/monad.ts +42 -40
  496. package/src/staking/validators/monadResolver.ts +4 -5
  497. package/src/staking/validators/sei.ts +2 -2
  498. package/src/staking/validators/somnia.test.ts +22 -19
  499. package/src/staking/validators/somnia.ts +23 -29
  500. package/src/staking/validators/types.ts +0 -1
  501. package/src/staking/validators/zero_gravity.test.ts +34 -49
  502. package/src/staking/validators/zero_gravity.ts +7 -12
  503. package/src/staking/validators.integ.test.ts +3 -5
  504. package/src/staking/validators.test.ts +56 -53
  505. package/src/types/staking.ts +3 -6
@@ -3,6 +3,7 @@
3
3
 
4
4
  import type { DeepPartialCtor } from '@ledgerhq/coin-module-framework/test/utils'
5
5
  import { ethers } from 'ethers'
6
+ import { CHAIN_ID } from '../config'
6
7
  import { createMockEvmConfigInfo, mkExternalNode, testLogger } from '../fixtures/context.fixtures'
7
8
  import { fetchRewards } from './rewards'
8
9
  import { USEI_TO_EVM_SCALE } from './utils'
@@ -28,7 +29,7 @@ const EVM_ADDRESS = '0x1234567890abcdef1234567890abcdef12345678'
28
29
  const COSMOS_ADDRESS = 'sei1defaultcosmosaddressfortest'
29
30
 
30
31
  const mockNode = mkExternalNode({ uri: 'https://sei-evm.coin.ledger.com' })
31
- const mockConfig = createMockEvmConfigInfo({ chainId: 1, node: mockNode })
32
+ const mockConfig = createMockEvmConfigInfo({ chainId: CHAIN_ID.SEI_EVM, node: mockNode })
32
33
 
33
34
  type RewardCoin = { denom: string; amount: string }
34
35
  const restResponse = (rewards: Array<{ validator_address: string; reward: RewardCoin[] }>) => ({
@@ -51,30 +52,32 @@ describe('fetchRewards', () => {
51
52
  })
52
53
 
53
54
  it.each([
54
- { case: 'unknown currencyId', currencyId: 'unknown_chain', setup: () => undefined },
55
+ { case: 'chain without staking', chainId: CHAIN_ID.ETHEREUM, setup: () => undefined },
55
56
  {
56
57
  case: 'chain has no rewardsStrategy (e.g. Celo)',
57
- currencyId: 'celo',
58
+ chainId: CHAIN_ID.CELO,
58
59
  setup: () => undefined,
59
60
  },
60
61
  {
61
62
  case: 'REST call fails',
62
- currencyId: 'sei_evm',
63
+ chainId: CHAIN_ID.SEI_EVM,
63
64
  setup: () => mockNetwork.mockRejectedValue(new Error('network error')),
64
65
  },
65
66
  {
66
67
  case: 'API response has no rewards array',
67
- currencyId: 'sei_evm',
68
+ chainId: CHAIN_ID.SEI_EVM,
68
69
  setup: () => mockNetwork.mockResolvedValue({ data: {} }),
69
70
  },
70
71
  {
71
72
  case: 'address precompile call fails',
72
- currencyId: 'sei_evm',
73
+ chainId: CHAIN_ID.SEI_EVM,
73
74
  setup: () => mockGetSeiAddr.mockRejectedValueOnce(new Error('not associated')),
74
75
  },
75
- ])('returns an empty map when $case', async ({ currencyId, setup }) => {
76
+ ])('returns an empty map when $case', async ({ chainId, setup }) => {
76
77
  setup()
77
- expect(await fetchRewards(mockConfig, currencyId, EVM_ADDRESS, testLogger)).toEqual(new Map())
78
+ expect(await fetchRewards({ ...mockConfig, chainId }, EVM_ADDRESS, testLogger)).toEqual(
79
+ new Map()
80
+ )
78
81
  })
79
82
 
80
83
  it('resolves the EVM address to its canonical Cosmos bech32 via the precompile', async () => {
@@ -82,12 +85,7 @@ describe('fetchRewards', () => {
82
85
  mockGetSeiAddr.mockResolvedValueOnce(canonicalCosmosAddress)
83
86
  mockNetwork.mockResolvedValueOnce(restResponse([]))
84
87
 
85
- await fetchRewards(
86
- mockConfig,
87
- 'sei_evm',
88
- '0x66c4371aE8FFeD2ec1c2EBbbcCfb7E494181E1E3',
89
- testLogger
90
- )
88
+ await fetchRewards(mockConfig, '0x66c4371aE8FFeD2ec1c2EBbbcCfb7E494181E1E3', testLogger)
91
89
 
92
90
  expect(mockNetwork.mock.calls[0][0]).toMatchObject({
93
91
  url: expect.stringContaining(canonicalCosmosAddress),
@@ -105,7 +103,7 @@ describe('fetchRewards', () => {
105
103
  ])
106
104
  )
107
105
 
108
- const result = await fetchRewards(mockConfig, 'sei_evm', EVM_ADDRESS, testLogger)
106
+ const result = await fetchRewards(mockConfig, EVM_ADDRESS, testLogger)
109
107
 
110
108
  expect(result.size).toBe(1)
111
109
  expect(result.get('seivaloper1one')).toBe(569n * USEI_TO_EVM_SCALE)
@@ -124,7 +122,7 @@ describe('fetchRewards', () => {
124
122
  ])
125
123
  )
126
124
 
127
- const result = await fetchRewards(mockConfig, 'sei_evm', EVM_ADDRESS, testLogger)
125
+ const result = await fetchRewards(mockConfig, EVM_ADDRESS, testLogger)
128
126
 
129
127
  expect(result.get('seivaloper1one')).toBe(123n * USEI_TO_EVM_SCALE)
130
128
  })
@@ -142,7 +140,7 @@ describe('fetchRewards', () => {
142
140
  ])
143
141
  )
144
142
 
145
- const result = await fetchRewards(mockConfig, 'sei_evm', EVM_ADDRESS, testLogger)
143
+ const result = await fetchRewards(mockConfig, EVM_ADDRESS, testLogger)
146
144
 
147
145
  expect(result.get('seivaloper1one')).toBe(500n * USEI_TO_EVM_SCALE)
148
146
  })
@@ -158,7 +156,7 @@ describe('fetchRewards', () => {
158
156
  ])
159
157
  )
160
158
 
161
- const result = await fetchRewards(mockConfig, 'sei_evm', EVM_ADDRESS, testLogger)
159
+ const result = await fetchRewards(mockConfig, EVM_ADDRESS, testLogger)
162
160
 
163
161
  expect(result.has('seivaloper1dust')).toBe(false)
164
162
  expect(result.get('seivaloper1real')).toBe(42n * USEI_TO_EVM_SCALE)
@@ -173,7 +171,7 @@ describe('fetchRewards', () => {
173
171
  ])
174
172
  )
175
173
 
176
- const result = await fetchRewards(mockConfig, 'sei_evm', EVM_ADDRESS, testLogger)
174
+ const result = await fetchRewards(mockConfig, EVM_ADDRESS, testLogger)
177
175
 
178
176
  expect(result.size).toBe(3)
179
177
  expect(result.get('seivaloper1a')).toBe(10n * USEI_TO_EVM_SCALE)
@@ -191,7 +189,7 @@ describe('fetchRewards', () => {
191
189
  ])
192
190
  )
193
191
 
194
- const result = await fetchRewards(mockConfig, 'sei_evm', EVM_ADDRESS, testLogger)
192
+ const result = await fetchRewards(mockConfig, EVM_ADDRESS, testLogger)
195
193
 
196
194
  expect(result.has('seivaloper1bad')).toBe(false)
197
195
  })
@@ -209,7 +207,7 @@ describe('fetchRewards', () => {
209
207
  ])
210
208
  )
211
209
 
212
- const result = await fetchRewards(mockConfig, 'sei_evm', EVM_ADDRESS, testLogger)
210
+ const result = await fetchRewards(mockConfig, EVM_ADDRESS, testLogger)
213
211
 
214
212
  expect(result.get('seivaloper1mixed')).toBe(100n * USEI_TO_EVM_SCALE)
215
213
  })
@@ -59,12 +59,11 @@ async function fetchCosmosRestRewards(
59
59
  // back to zero without blocking the staking sync.
60
60
  export async function fetchRewards(
61
61
  evmConfig: EvmConfigInfo,
62
- currencyId: string,
63
62
  evmAddress: string,
64
63
  logger: Logger
65
64
  ): Promise<Map<string, bigint>> {
66
65
  try {
67
- const config = STAKING_CONTRACTS[currencyId]
66
+ const config = STAKING_CONTRACTS[evmConfig.chainId]
68
67
  const strategy = config?.rewardsStrategy
69
68
  if (!strategy || strategy.type === 'none') return new Map()
70
69
 
@@ -3,12 +3,13 @@
3
3
 
4
4
  import type { LogWithAddress } from '../network/node/types'
5
5
  import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
6
+ import { CHAIN_ID } from '../config'
6
7
  import { testLogger } from '../fixtures/context.fixtures'
7
- import { STAKING_CONTRACTS } from './contracts'
8
+ import { requireStakingContract } from '../fixtures/staking.fixtures'
8
9
  import { enrichRewardOperationsValue, sumRewardFromReceiptLogs } from './rewardsFromReceipt'
9
10
 
10
- const MONAD_DECODER = STAKING_CONTRACTS.monad.rewardsEventDecoder!
11
- const SEI_DECODER = STAKING_CONTRACTS.sei_evm.rewardsEventDecoder!
11
+ const MONAD_DECODER = requireStakingContract(CHAIN_ID.MONAD).rewardsEventDecoder!
12
+ const SEI_DECODER = requireStakingContract(CHAIN_ID.SEI_EVM).rewardsEventDecoder!
12
13
 
13
14
  const MONAD_STAKING = '0x0000000000000000000000000000000000001000'
14
15
  const SEI_DISTRIBUTION = '0x0000000000000000000000000000000000001007'
@@ -108,17 +109,17 @@ describe('enrichRewardOperationsValue', () => {
108
109
  .fn()
109
110
  .mockResolvedValue({ logs: [monadClaimRewardsLog(MONAD_DELEGATOR_TOPIC, '030405ea888e')] })
110
111
 
111
- await enrichRewardOperationsValue('monad', [op], getReceipt, testLogger)
112
+ await enrichRewardOperationsValue(CHAIN_ID.MONAD, [op], getReceipt, testLogger)
112
113
 
113
114
  expect(getReceipt).toHaveBeenCalledWith('0xabc')
114
115
  expect(op.value).toStrictEqual(3315814008974n)
115
116
  })
116
117
 
117
- it('is a no-op for a currency without a rewardsEventDecoder', async () => {
118
+ it('is a no-op for a chain without a rewardsEventDecoder', async () => {
118
119
  const op = rewardOp('0xabc', MONAD_DELEGATOR)
119
120
  const getReceipt = jest.fn()
120
121
 
121
- await enrichRewardOperationsValue('ethereum', [op], getReceipt, testLogger)
122
+ await enrichRewardOperationsValue(CHAIN_ID.ETHEREUM, [op], getReceipt, testLogger)
122
123
 
123
124
  expect(getReceipt).not.toHaveBeenCalled()
124
125
  expect(op.value).toStrictEqual(0n)
@@ -135,7 +136,7 @@ describe('enrichRewardOperationsValue', () => {
135
136
  }
136
137
  const getReceipt = jest.fn().mockResolvedValue(null)
137
138
 
138
- await enrichRewardOperationsValue('monad', [out, nonZero], getReceipt, testLogger)
139
+ await enrichRewardOperationsValue(CHAIN_ID.MONAD, [out, nonZero], getReceipt, testLogger)
139
140
 
140
141
  expect(getReceipt).not.toHaveBeenCalled()
141
142
  })
@@ -144,7 +145,7 @@ describe('enrichRewardOperationsValue', () => {
144
145
  const op = rewardOp('0xabc', MONAD_DELEGATOR)
145
146
  const getReceipt = jest.fn().mockRejectedValue(new Error('rpc down'))
146
147
 
147
- await enrichRewardOperationsValue('monad', [op], getReceipt, testLogger)
148
+ await enrichRewardOperationsValue(CHAIN_ID.MONAD, [op], getReceipt, testLogger)
148
149
 
149
150
  expect(op.value).toStrictEqual(0n)
150
151
  })
@@ -1,6 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import type { ChainId } from '../config'
4
5
  import type { LogWithAddress } from '../network/node/types'
5
6
  import type { RewardsEventDecoder } from '../types/staking'
6
7
  import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
@@ -72,12 +73,12 @@ export function sumRewardFromReceiptLogs(
72
73
  * untouched (amount falls back to 0) rather than blocking sync.
73
74
  */
74
75
  export async function enrichRewardOperationsValue(
75
- currencyId: string,
76
+ chainId: ChainId,
76
77
  operations: Array<Operation<MemoNotSupported>>,
77
78
  getReceipt: ReceiptFetcher,
78
79
  logger: Logger
79
80
  ): Promise<void> {
80
- const decoder = STAKING_CONTRACTS[currencyId]?.rewardsEventDecoder
81
+ const decoder = STAKING_CONTRACTS[chainId]?.rewardsEventDecoder
81
82
  if (!decoder) {
82
83
  return
83
84
  }
@@ -1,14 +1,24 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import type { ChainId } from '../config'
4
5
  import type { MemoNotSupported } from '@ledgerhq/coin-module-framework/api/index'
5
6
  import type { BufferTxData } from '@ledgerhq/coin-module-framework/api/types'
6
7
  import { createStakingTransactionIntentMockData } from '@ledgerhq/coin-module-framework/test-utils'
7
8
  import { ethers } from 'ethers'
9
+ import { CHAIN_ID } from '../config'
10
+ import { createMockEvmConfigInfo, mkExternalNode } from '../fixtures/context.fixtures'
11
+ import { requireStakingContract } from '../fixtures/staking.fixtures'
8
12
  import { getStakingABI } from './abis'
9
- import { STAKING_CONTRACTS } from './contracts'
10
13
  import { buildStakingTransactionParams } from './transactionData'
11
14
 
15
+ const mkConfig = (chainId: ChainId, name: string) =>
16
+ createMockEvmConfigInfo({ chainId, name, node: mkExternalNode() })
17
+
18
+ const monadConfig = mkConfig(CHAIN_ID.MONAD, 'monad')
19
+ const seiConfig = mkConfig(CHAIN_ID.SEI_EVM, 'sei_evm')
20
+ const zeroGravityConfig = mkConfig(CHAIN_ID.ZERO_GRAVITY, 'zero_gravity')
21
+
12
22
  const delegateIntent = (fields: Record<string, unknown>) =>
13
23
  Object.assign(
14
24
  createStakingTransactionIntentMockData<MemoNotSupported, BufferTxData>({
@@ -30,9 +40,9 @@ describe('buildStakingTransactionParams', () => {
30
40
  valAddress: '0xDisplayAddressIgnoredByEncoder',
31
41
  })
32
42
 
33
- const { to, data, value } = buildStakingTransactionParams('monad', intent)
43
+ const { to, data, value } = buildStakingTransactionParams(monadConfig, intent)
34
44
 
35
- const iface = new ethers.Interface(getStakingABI('monad') ?? [])
45
+ const iface = new ethers.Interface(getStakingABI(CHAIN_ID.MONAD) ?? [])
36
46
  expect('0x' + data.toString('hex')).toEqual(iface.encodeFunctionData('delegate', [42n]))
37
47
  expect(to).toEqual('0x0000000000000000000000000000000000001000')
38
48
  expect(value).toEqual(1000000000000000000n)
@@ -46,9 +56,9 @@ describe('buildStakingTransactionParams', () => {
46
56
  valAddress: '0xDisplayAddressIgnoredByEncoder',
47
57
  })
48
58
 
49
- const { to, data, value } = buildStakingTransactionParams('monad', intent)
59
+ const { to, data, value } = buildStakingTransactionParams(monadConfig, intent)
50
60
 
51
- const iface = new ethers.Interface(getStakingABI('monad') ?? [])
61
+ const iface = new ethers.Interface(getStakingABI(CHAIN_ID.MONAD) ?? [])
52
62
  expect('0x' + data.toString('hex')).toEqual(iface.encodeFunctionData('compound', [42n]))
53
63
  expect(to).toEqual('0x0000000000000000000000000000000000001000')
54
64
  expect(value).toEqual(0n)
@@ -56,7 +66,7 @@ describe('buildStakingTransactionParams', () => {
56
66
 
57
67
  it('throws when a Monad delegate intent has no valId', () => {
58
68
  expect(() => {
59
- buildStakingTransactionParams('monad', delegateIntent({}))
69
+ buildStakingTransactionParams(monadConfig, delegateIntent({}))
60
70
  }).toThrow('monad staking requires valId')
61
71
  })
62
72
 
@@ -68,9 +78,9 @@ describe('buildStakingTransactionParams', () => {
68
78
  valAddress: '0xDisplayAddressIgnoredByEncoder',
69
79
  })
70
80
 
71
- const { to, data, value } = buildStakingTransactionParams('monad', intent)
81
+ const { to, data, value } = buildStakingTransactionParams(monadConfig, intent)
72
82
 
73
- const iface = new ethers.Interface(getStakingABI('monad') ?? [])
83
+ const iface = new ethers.Interface(getStakingABI(CHAIN_ID.MONAD) ?? [])
74
84
  expect('0x' + data.toString('hex')).toEqual(iface.encodeFunctionData('withdraw', [42n, 7n]))
75
85
  expect(to).toEqual('0x0000000000000000000000000000000000001000')
76
86
  expect(value).toEqual(0n)
@@ -78,7 +88,7 @@ describe('buildStakingTransactionParams', () => {
78
88
 
79
89
  it('throws when a Monad withdraw intent has no withdrawId', () => {
80
90
  expect(() => {
81
- buildStakingTransactionParams('monad', delegateIntent({ mode: 'withdraw', valId: '42' }))
91
+ buildStakingTransactionParams(monadConfig, delegateIntent({ mode: 'withdraw', valId: '42' }))
82
92
  }).toThrow('monad withdraw requires withdrawId')
83
93
  })
84
94
 
@@ -86,9 +96,9 @@ describe('buildStakingTransactionParams', () => {
86
96
  const valAddress = 'seivaloper1y82m5y3wevjneamzg0pmx87dzanyxzht0kepvn'
87
97
  const intent = delegateIntent({ valAddress })
88
98
 
89
- const { to, data, value } = buildStakingTransactionParams('sei_evm', intent)
99
+ const { to, data, value } = buildStakingTransactionParams(seiConfig, intent)
90
100
 
91
- const iface = new ethers.Interface(getStakingABI('sei_evm') ?? [])
101
+ const iface = new ethers.Interface(getStakingABI(CHAIN_ID.SEI_EVM) ?? [])
92
102
  expect('0x' + data.toString('hex')).toEqual(iface.encodeFunctionData('delegate', [valAddress]))
93
103
  expect(to).toEqual('0x0000000000000000000000000000000000001005')
94
104
  expect(value).toEqual(1000000000000000000n)
@@ -98,18 +108,18 @@ describe('buildStakingTransactionParams', () => {
98
108
  const valAddress = 'seivaloper1y82m5y3wevjneamzg0pmx87dzanyxzht0kepvn'
99
109
  const intent = delegateIntent({ mode: 'claimReward', valAddress })
100
110
 
101
- const { to } = buildStakingTransactionParams('sei_evm', intent)
111
+ const { to } = buildStakingTransactionParams(seiConfig, intent)
102
112
 
103
113
  expect(to).toEqual('0x0000000000000000000000000000000000001007')
104
114
  })
105
115
 
106
116
  it.each([
107
- ['sei_evm', { valAddress: 'seivaloper1y82m5y3wevjneamzg0pmx87dzanyxzht0kepvn' }],
108
- ['monad', { valId: '42', valAddress: '0xDisplayAddressIgnoredByEncoder' }],
109
- ])("ignores txValue for '%s'", (currencyId, fields) => {
117
+ ['sei_evm', seiConfig, { valAddress: 'seivaloper1y82m5y3wevjneamzg0pmx87dzanyxzht0kepvn' }],
118
+ ['monad', monadConfig, { valId: '42', valAddress: '0xDisplayAddressIgnoredByEncoder' }],
119
+ ])("ignores txValue for '%s'", (_name, evmConfig, fields) => {
110
120
  const intent = delegateIntent({ ...fields, txValue: 999n })
111
121
 
112
- const { value } = buildStakingTransactionParams(currencyId, intent)
122
+ const { value } = buildStakingTransactionParams(evmConfig, intent)
113
123
 
114
124
  expect(value).toEqual(1000000000000000000n)
115
125
  })
@@ -122,9 +132,9 @@ describe('0G / zero_gravity delegate', () => {
122
132
  sender: '0x0000000000000000000000000000000000000002',
123
133
  })
124
134
 
125
- const { to, data, value } = buildStakingTransactionParams('zero_gravity', intent)
135
+ const { to, data, value } = buildStakingTransactionParams(zeroGravityConfig, intent)
126
136
 
127
- const iface = new ethers.Interface(getStakingABI('zero_gravity') ?? [])
137
+ const iface = new ethers.Interface(getStakingABI(CHAIN_ID.ZERO_GRAVITY) ?? [])
128
138
  expect('0x' + data.toString('hex')).toEqual(
129
139
  iface.encodeFunctionData('delegate', ['0x0000000000000000000000000000000000000002'])
130
140
  )
@@ -134,14 +144,14 @@ describe('0G / zero_gravity delegate', () => {
134
144
 
135
145
  it('throws when valAddress is missing', () => {
136
146
  expect(() => {
137
- buildStakingTransactionParams('zero_gravity', delegateIntent({ valAddress: '' }))
147
+ buildStakingTransactionParams(zeroGravityConfig, delegateIntent({ valAddress: '' }))
138
148
  }).toThrow('0G staking requires a validator address')
139
149
  })
140
150
 
141
151
  it('throws when delegator is missing', () => {
142
152
  expect(() => {
143
153
  buildStakingTransactionParams(
144
- 'zero_gravity',
154
+ zeroGravityConfig,
145
155
  delegateIntent({ valAddress: '0x0000000000000000000000000000000000000001', sender: '' })
146
156
  )
147
157
  }).toThrow('zero_gravity staking requires delegator')
@@ -162,9 +172,9 @@ describe('0G / zero_gravity undelegate', () => {
162
172
  txValue: 50_000_000_000n,
163
173
  })
164
174
 
165
- const { to, data, value } = buildStakingTransactionParams('zero_gravity', intent)
175
+ const { to, data, value } = buildStakingTransactionParams(zeroGravityConfig, intent)
166
176
 
167
- const iface = new ethers.Interface(getStakingABI('zero_gravity') ?? [])
177
+ const iface = new ethers.Interface(getStakingABI(CHAIN_ID.ZERO_GRAVITY) ?? [])
168
178
  expect('0x' + data.toString('hex')).toEqual(
169
179
  iface.encodeFunctionData('undelegate', [DELEGATOR, 1_500_000_000n])
170
180
  )
@@ -175,7 +185,7 @@ describe('0G / zero_gravity undelegate', () => {
175
185
  it('throws when shares is missing', () => {
176
186
  expect(() => {
177
187
  buildStakingTransactionParams(
178
- 'zero_gravity',
188
+ zeroGravityConfig,
179
189
  delegateIntent({ mode: 'undelegate', valAddress: VAL })
180
190
  )
181
191
  }).toThrow('zero_gravity undelegate requires shares')
@@ -183,7 +193,7 @@ describe('0G / zero_gravity undelegate', () => {
183
193
  })
184
194
 
185
195
  describe('0G / zero_gravity contractAddress resolver', () => {
186
- const config = STAKING_CONTRACTS['zero_gravity']
196
+ const config = requireStakingContract(CHAIN_ID.ZERO_GRAVITY)
187
197
 
188
198
  it('returns valAddress when provided', () => {
189
199
  expect(config.contractAddress({ mode: 'delegate', valAddress: '0xValidatorAddr' })).toEqual(
@@ -203,7 +213,7 @@ describe('0G / zero_gravity contractAddress resolver', () => {
203
213
  })
204
214
 
205
215
  describe('0G / zero_gravity value resolver', () => {
206
- const config = STAKING_CONTRACTS['zero_gravity']
216
+ const config = requireStakingContract(CHAIN_ID.ZERO_GRAVITY)
207
217
 
208
218
  it.each([
209
219
  [{ mode: 'delegate', amount: 1000n }, 1000n],
@@ -1,6 +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
5
  import type { TransactionIntent, MemoNotSupported } from '@ledgerhq/coin-module-framework/api/index'
5
6
  import { isStakingIntent } from '../logic-public'
6
7
  import { isPayable } from './abis'
@@ -13,7 +14,7 @@ import { buildTransactionParams } from './operations'
13
14
  * Builds transaction parameters for staking transactions
14
15
  */
15
16
  export function buildStakingTransactionParams(
16
- currencyId: string,
17
+ evmConfig: EvmConfigInfo,
17
18
  intent: TransactionIntent<MemoNotSupported>
18
19
  ): {
19
20
  to: string
@@ -27,16 +28,16 @@ export function buildStakingTransactionParams(
27
28
  const { amount, sender, mode, valAddress, valId, dstValAddress, withdrawId, txValue, shares } =
28
29
  intent
29
30
 
30
- const config = STAKING_CONTRACTS[currencyId]
31
+ const config = STAKING_CONTRACTS[evmConfig.chainId]
31
32
  if (!config) {
32
- throw new Error(`Unsupported staking currency: ${currencyId}`)
33
+ throw new Error(`Unsupported staking currency: ${evmConfig.name}`)
33
34
  }
34
35
 
35
36
  if (!mode || !isStakingOperation(mode)) {
36
37
  throw new Error(`Invalid staking operation: ${mode}`)
37
38
  }
38
39
 
39
- const stakingParams = buildTransactionParams(currencyId, mode, {
40
+ const stakingParams = buildTransactionParams(evmConfig, mode, {
40
41
  valAddress,
41
42
  valId,
42
43
  amount,
@@ -49,7 +50,7 @@ export function buildStakingTransactionParams(
49
50
  const to = config.contractAddress({ mode, valAddress })
50
51
  const data = Buffer.from(
51
52
  encodeStakingData({
52
- currencyId,
53
+ evmConfig,
53
54
  operation: mode,
54
55
  config,
55
56
  params: stakingParams,
@@ -62,7 +63,7 @@ export function buildStakingTransactionParams(
62
63
  throw new Error(`No function mapping found for the operation: ${mode}`)
63
64
  }
64
65
 
65
- const value = isPayable(currencyId, functionName)
66
+ const value = isPayable(evmConfig.chainId, functionName)
66
67
  ? config.value({ mode, amount, ...(typeof txValue === 'bigint' ? { txValue } : {}) })
67
68
  : 0n
68
69
 
@@ -4,8 +4,9 @@
4
4
  import type { EvmConfigInfo } from '../config'
5
5
  import type { DeepPartialCtor } from '@ledgerhq/coin-module-framework/test/utils'
6
6
  import { ethers } from 'ethers'
7
+ import { CHAIN_ID } from '../config'
7
8
  import { testLogger } from '../fixtures/context.fixtures'
8
- import { STAKING_CONTRACTS } from './contracts'
9
+ import { requireStakingContract } from '../fixtures/staking.fixtures'
9
10
  import { fetchUnbondings } from './unbondings'
10
11
  import { USEI_TO_EVM_SCALE } from './utils'
11
12
 
@@ -29,14 +30,13 @@ const mockIsExternalNodeConfig = jest.mocked(require('../network/node/types').is
29
30
  const mockNode: EvmConfigInfo['node'] = { type: 'external', uri: 'https://sei-evm.coin.ledger.com' }
30
31
  const mockConfig: EvmConfigInfo = {
31
32
  status: { type: 'active' },
32
- chainId: 1329,
33
+ chainId: CHAIN_ID.SEI_EVM,
33
34
  name: 'Sei',
34
35
  unit: { name: 'sei', code: 'SEI', magnitude: 18 },
35
36
  node: mockNode,
36
37
  explorer: { type: 'none' },
37
38
  }
38
39
 
39
- const SEI_CURRENCY = 'sei_evm'
40
40
  const EVM_ADDRESS = '0x1111111111111111111111111111111111111111'
41
41
  const VALIDATOR = 'seivaloper1qe8uuf5x69c526h4nzxwv4ltftr73v7qnkypla'
42
42
  const OTHER_VALIDATOR = 'seivaloper1y82m5y3wevjneamzg0pmx87dzanyxzht0kepvn'
@@ -79,38 +79,44 @@ describe('staking/unbondings', () => {
79
79
  mockIsExternalNodeConfig.mockImplementation((node: unknown) => node === mockNode)
80
80
  })
81
81
 
82
- it('should return [] for an unknown currencyId', async () => {
83
- expect(await fetchUnbondings(mockConfig, 'unknown_chain', EVM_ADDRESS, testLogger)).toEqual(
84
- []
85
- )
82
+ it('should return [] for a chain without staking', async () => {
83
+ expect(
84
+ await fetchUnbondings(
85
+ { ...mockConfig, chainId: CHAIN_ID.ETHEREUM },
86
+ EVM_ADDRESS,
87
+ testLogger
88
+ )
89
+ ).toEqual([])
86
90
  expect(mockNetwork).not.toHaveBeenCalled()
87
91
  })
88
92
 
89
- it('should return [] for a currency without an unbonding strategy', async () => {
90
- expect(await fetchUnbondings(mockConfig, 'celo', EVM_ADDRESS, testLogger)).toEqual([])
93
+ it('should return [] for a chain without an unbonding strategy', async () => {
94
+ expect(
95
+ await fetchUnbondings({ ...mockConfig, chainId: CHAIN_ID.CELO }, EVM_ADDRESS, testLogger)
96
+ ).toEqual([])
91
97
  expect(mockNetwork).not.toHaveBeenCalled()
92
98
  })
93
99
 
94
100
  it('should return [] when the address is not associated on-chain yet', async () => {
95
101
  mockGetSeiAddr.mockResolvedValue(null)
96
- expect(await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)).toEqual([])
102
+ expect(await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)).toEqual([])
97
103
  expect(mockNetwork).not.toHaveBeenCalled()
98
104
  })
99
105
 
100
106
  it('should return [] when the REST call fails', async () => {
101
107
  mockNetwork.mockRejectedValue(new Error('network error'))
102
- expect(await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)).toEqual([])
108
+ expect(await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)).toEqual([])
103
109
  })
104
110
 
105
111
  it('should return [] when the response has no unbonding_responses array', async () => {
106
112
  mockNetwork.mockResolvedValue({ data: {} })
107
- expect(await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)).toEqual([])
113
+ expect(await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)).toEqual([])
108
114
  })
109
115
 
110
116
  it('should query the delegator endpoint with the resolved Cosmos address', async () => {
111
117
  mockNetwork.mockResolvedValue({ data: { unbonding_responses: [] } })
112
118
 
113
- await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)
119
+ await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)
114
120
 
115
121
  expect(mockNetwork).toHaveBeenCalledWith({
116
122
  url: 'https://rest.sei-apis.com/cosmos/staking/v1beta1/delegators/sei1defaultcosmosaddressfortest/unbonding_delegations',
@@ -130,7 +136,7 @@ describe('staking/unbondings', () => {
130
136
  },
131
137
  })
132
138
 
133
- const stakes = await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)
139
+ const stakes = await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)
134
140
 
135
141
  expect(stakes).toHaveLength(1)
136
142
  expect(stakes[0]).toMatchObject({
@@ -153,7 +159,7 @@ describe('staking/unbondings', () => {
153
159
  },
154
160
  })
155
161
 
156
- const [stake] = await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)
162
+ const [stake] = await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)
157
163
 
158
164
  // Sei credits the funds back automatically: no withdraw transaction exists.
159
165
  expect(stake.actions).toEqual([])
@@ -172,7 +178,7 @@ describe('staking/unbondings', () => {
172
178
  },
173
179
  })
174
180
 
175
- const stakes = await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)
181
+ const stakes = await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)
176
182
 
177
183
  expect(stakes).toHaveLength(2)
178
184
  expect(new Set(stakes.map((s) => s.uid)).size).toBe(2)
@@ -194,7 +200,7 @@ describe('staking/unbondings', () => {
194
200
  },
195
201
  })
196
202
 
197
- const stakes = await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)
203
+ const stakes = await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)
198
204
 
199
205
  expect(stakes.map((s) => s.delegate)).toEqual([VALIDATOR, OTHER_VALIDATOR])
200
206
  })
@@ -211,7 +217,7 @@ describe('staking/unbondings', () => {
211
217
  },
212
218
  })
213
219
 
214
- const stakes = await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)
220
+ const stakes = await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)
215
221
 
216
222
  expect(stakes).toHaveLength(1)
217
223
  expect(stakes[0].amount).toBe(2000000n * USEI_TO_EVM_SCALE)
@@ -231,7 +237,7 @@ describe('staking/unbondings', () => {
231
237
  },
232
238
  })
233
239
 
234
- const stakes = await fetchUnbondings(mockConfig, SEI_CURRENCY, EVM_ADDRESS, testLogger)
240
+ const stakes = await fetchUnbondings(mockConfig, EVM_ADDRESS, testLogger)
235
241
 
236
242
  expect(stakes).toHaveLength(1)
237
243
  expect(stakes[0].amount).toBe(3000000n * USEI_TO_EVM_SCALE)
@@ -240,7 +246,7 @@ describe('staking/unbondings', () => {
240
246
 
241
247
  describe('sei_evm unbonding strategy config', () => {
242
248
  it('should be configured to read the Cosmos unbonding_delegations endpoint', () => {
243
- expect(STAKING_CONTRACTS[SEI_CURRENCY]?.unbondingStrategy).toEqual({
249
+ expect(requireStakingContract(CHAIN_ID.SEI_EVM).unbondingStrategy).toEqual({
244
250
  type: 'cosmos-rest',
245
251
  endpoint: '/cosmos/staking/v1beta1/delegators/{address}/unbonding_delegations',
246
252
  })
@@ -120,11 +120,10 @@ async function fetchCosmosRestUnbondings(
120
120
  */
121
121
  export async function fetchUnbondings(
122
122
  evmConfig: EvmConfigInfo,
123
- currencyId: string,
124
123
  evmAddress: string,
125
124
  logger: Logger
126
125
  ): Promise<Stake[]> {
127
- const config = STAKING_CONTRACTS[currencyId]
126
+ const config = STAKING_CONTRACTS[evmConfig.chainId]
128
127
  const strategy = config?.unbondingStrategy
129
128
  if (!config || !strategy || strategy.type === 'none') return []
130
129