@ledgerhq/coin-evm 5.4.0 → 7.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 (342) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/docs/evm-family-integration-process/README.md +1 -1
  3. package/knip.json +2 -3
  4. package/lib/adapters/blockOperations.js +6 -6
  5. package/lib/adapters/blockOperations.js.map +1 -1
  6. package/lib/adapters/etherscan.js +23 -23
  7. package/lib/adapters/etherscan.js.map +1 -1
  8. package/lib/adapters/ledger.js +17 -17
  9. package/lib/adapters/ledger.js.map +1 -1
  10. package/lib/api/index.js +4 -4
  11. package/lib/api/index.js.map +1 -1
  12. package/lib/config.d.ts +21 -15
  13. package/lib/config.d.ts.map +1 -1
  14. package/lib/config.js +5 -25
  15. package/lib/config.js.map +1 -1
  16. package/lib/errors.d.ts +9 -0
  17. package/lib/errors.d.ts.map +1 -1
  18. package/lib/errors.js +15 -1
  19. package/lib/errors.js.map +1 -1
  20. package/lib/logic/broadcast.js +1 -1
  21. package/lib/logic/broadcast.js.map +1 -1
  22. package/lib/logic/common.d.ts +2 -1
  23. package/lib/logic/common.d.ts.map +1 -1
  24. package/lib/logic/common.js +4 -4
  25. package/lib/logic/common.js.map +1 -1
  26. package/lib/logic/craftTransaction.d.ts.map +1 -1
  27. package/lib/logic/craftTransaction.js +2 -2
  28. package/lib/logic/craftTransaction.js.map +1 -1
  29. package/lib/logic/estimateFees.d.ts.map +1 -1
  30. package/lib/logic/estimateFees.js +9 -9
  31. package/lib/logic/estimateFees.js.map +1 -1
  32. package/lib/logic/getBalance.d.ts.map +1 -1
  33. package/lib/logic/getBalance.js +50 -16
  34. package/lib/logic/getBalance.js.map +1 -1
  35. package/lib/logic/getBlock.d.ts.map +1 -1
  36. package/lib/logic/getBlock.js +19 -11
  37. package/lib/logic/getBlock.js.map +1 -1
  38. package/lib/logic/getBlockInfo.js +1 -1
  39. package/lib/logic/getBlockInfo.js.map +1 -1
  40. package/lib/logic/getNextSequence.d.ts.map +1 -1
  41. package/lib/logic/getNextSequence.js +1 -1
  42. package/lib/logic/getNextSequence.js.map +1 -1
  43. package/lib/logic/index.d.ts +2 -0
  44. package/lib/logic/index.d.ts.map +1 -1
  45. package/lib/logic/index.js +4 -0
  46. package/lib/logic/index.js.map +1 -1
  47. package/lib/logic/lastBlock.js +1 -1
  48. package/lib/logic/lastBlock.js.map +1 -1
  49. package/lib/logic/listOperations.d.ts.map +1 -1
  50. package/lib/logic/listOperations.js +10 -1
  51. package/lib/logic/listOperations.js.map +1 -1
  52. package/lib/logic/validateIntent.d.ts.map +1 -1
  53. package/lib/logic/validateIntent.js +12 -12
  54. package/lib/logic/validateIntent.js.map +1 -1
  55. package/lib/logic-public/index.d.ts +3 -0
  56. package/lib/logic-public/index.d.ts.map +1 -0
  57. package/lib/logic-public/index.js +19 -0
  58. package/lib/logic-public/index.js.map +1 -0
  59. package/lib/{utils.d.ts → logic-public/utils.d.ts} +0 -44
  60. package/lib/logic-public/utils.d.ts.map +1 -0
  61. package/lib/logic-public/utils.js +166 -0
  62. package/lib/logic-public/utils.js.map +1 -0
  63. package/lib/logic.d.ts +2 -1
  64. package/lib/logic.d.ts.map +1 -1
  65. package/lib/logic.js +3 -3
  66. package/lib/logic.js.map +1 -1
  67. package/lib/network/explorer/etherscan.d.ts +16 -3
  68. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  69. package/lib/network/explorer/etherscan.js +61 -6
  70. package/lib/network/explorer/etherscan.js.map +1 -1
  71. package/lib/network/explorer/ledger.d.ts +50 -4
  72. package/lib/network/explorer/ledger.d.ts.map +1 -1
  73. package/lib/network/explorer/ledger.js +286 -37
  74. package/lib/network/explorer/ledger.js.map +1 -1
  75. package/lib/network/explorer/none.d.ts +1 -0
  76. package/lib/network/explorer/none.d.ts.map +1 -1
  77. package/lib/network/explorer/none.js +4 -1
  78. package/lib/network/explorer/none.js.map +1 -1
  79. package/lib/network/explorer/types.d.ts +15 -2
  80. package/lib/network/explorer/types.d.ts.map +1 -1
  81. package/lib/network/explorer/types.js.map +1 -1
  82. package/lib/network/index.d.ts +5 -0
  83. package/lib/network/index.d.ts.map +1 -0
  84. package/lib/network/index.js +23 -0
  85. package/lib/network/index.js.map +1 -0
  86. package/lib/network/node/explorerProxy.d.ts +27 -0
  87. package/lib/network/node/explorerProxy.d.ts.map +1 -0
  88. package/lib/network/node/explorerProxy.js +262 -0
  89. package/lib/network/node/explorerProxy.js.map +1 -0
  90. package/lib/network/node/index.d.ts +2 -1
  91. package/lib/network/node/index.d.ts.map +1 -1
  92. package/lib/network/node/index.js +11 -10
  93. package/lib/network/node/index.js.map +1 -1
  94. package/lib/network/node/ledger.js +7 -7
  95. package/lib/network/node/ledger.js.map +1 -1
  96. package/lib/network/node/rpc.common.d.ts +2 -2
  97. package/lib/network/node/rpc.common.js +19 -19
  98. package/lib/network/node/rpc.common.js.map +1 -1
  99. package/lib/network/node/withNodeSources.d.ts +21 -0
  100. package/lib/network/node/withNodeSources.d.ts.map +1 -0
  101. package/lib/network/node/withNodeSources.js +78 -0
  102. package/lib/network/node/withNodeSources.js.map +1 -0
  103. package/lib/nodeSources.d.ts +15 -0
  104. package/lib/nodeSources.d.ts.map +1 -0
  105. package/lib/nodeSources.js +33 -0
  106. package/lib/nodeSources.js.map +1 -0
  107. package/lib/staking/contracts.js +1 -1
  108. package/lib/staking/contracts.js.map +1 -1
  109. package/lib/staking/fetchers.js +1 -1
  110. package/lib/staking/fetchers.js.map +1 -1
  111. package/lib/staking/operations/sei.js +1 -1
  112. package/lib/staking/operations/sei.js.map +1 -1
  113. package/lib/staking/prepareIntents.js +3 -3
  114. package/lib/staking/prepareIntents.js.map +1 -1
  115. package/lib/staking/rewards.js +1 -1
  116. package/lib/staking/rewards.js.map +1 -1
  117. package/lib/staking/transactionData.js +2 -2
  118. package/lib/staking/transactionData.js.map +1 -1
  119. package/lib/staking/utils.d.ts +45 -0
  120. package/lib/staking/utils.d.ts.map +1 -0
  121. package/lib/{utils.js → staking/utils.js} +5 -164
  122. package/lib/staking/utils.js.map +1 -0
  123. package/lib/staking/validators/sei.js +1 -1
  124. package/lib/staking/validators/sei.js.map +1 -1
  125. package/lib/types/staking.d.ts +2 -2
  126. package/lib-es/adapters/blockOperations.js +1 -1
  127. package/lib-es/adapters/blockOperations.js.map +1 -1
  128. package/lib-es/adapters/etherscan.js +1 -1
  129. package/lib-es/adapters/etherscan.js.map +1 -1
  130. package/lib-es/adapters/ledger.js +1 -1
  131. package/lib-es/adapters/ledger.js.map +1 -1
  132. package/lib-es/api/index.js +2 -2
  133. package/lib-es/api/index.js.map +1 -1
  134. package/lib-es/config.d.ts +21 -15
  135. package/lib-es/config.d.ts.map +1 -1
  136. package/lib-es/config.js +1 -21
  137. package/lib-es/config.js.map +1 -1
  138. package/lib-es/errors.d.ts +9 -0
  139. package/lib-es/errors.d.ts.map +1 -1
  140. package/lib-es/errors.js +13 -0
  141. package/lib-es/errors.js.map +1 -1
  142. package/lib-es/logic/broadcast.js +1 -1
  143. package/lib-es/logic/broadcast.js.map +1 -1
  144. package/lib-es/logic/common.d.ts +2 -1
  145. package/lib-es/logic/common.d.ts.map +1 -1
  146. package/lib-es/logic/common.js +3 -3
  147. package/lib-es/logic/common.js.map +1 -1
  148. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  149. package/lib-es/logic/craftTransaction.js +2 -2
  150. package/lib-es/logic/craftTransaction.js.map +1 -1
  151. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  152. package/lib-es/logic/estimateFees.js +6 -6
  153. package/lib-es/logic/estimateFees.js.map +1 -1
  154. package/lib-es/logic/getBalance.d.ts.map +1 -1
  155. package/lib-es/logic/getBalance.js +50 -16
  156. package/lib-es/logic/getBalance.js.map +1 -1
  157. package/lib-es/logic/getBlock.d.ts.map +1 -1
  158. package/lib-es/logic/getBlock.js +16 -8
  159. package/lib-es/logic/getBlock.js.map +1 -1
  160. package/lib-es/logic/getBlockInfo.js +1 -1
  161. package/lib-es/logic/getBlockInfo.js.map +1 -1
  162. package/lib-es/logic/getNextSequence.d.ts.map +1 -1
  163. package/lib-es/logic/getNextSequence.js +1 -1
  164. package/lib-es/logic/getNextSequence.js.map +1 -1
  165. package/lib-es/logic/index.d.ts +2 -0
  166. package/lib-es/logic/index.d.ts.map +1 -1
  167. package/lib-es/logic/index.js +4 -0
  168. package/lib-es/logic/index.js.map +1 -1
  169. package/lib-es/logic/lastBlock.js +1 -1
  170. package/lib-es/logic/lastBlock.js.map +1 -1
  171. package/lib-es/logic/listOperations.d.ts.map +1 -1
  172. package/lib-es/logic/listOperations.js +10 -1
  173. package/lib-es/logic/listOperations.js.map +1 -1
  174. package/lib-es/logic/validateIntent.d.ts.map +1 -1
  175. package/lib-es/logic/validateIntent.js +4 -4
  176. package/lib-es/logic/validateIntent.js.map +1 -1
  177. package/lib-es/logic-public/index.d.ts +3 -0
  178. package/lib-es/logic-public/index.d.ts.map +1 -0
  179. package/lib-es/logic-public/index.js +4 -0
  180. package/lib-es/logic-public/index.js.map +1 -0
  181. package/lib-es/{utils.d.ts → logic-public/utils.d.ts} +0 -44
  182. package/lib-es/logic-public/utils.d.ts.map +1 -0
  183. package/lib-es/logic-public/utils.js +150 -0
  184. package/lib-es/logic-public/utils.js.map +1 -0
  185. package/lib-es/logic.d.ts +2 -1
  186. package/lib-es/logic.d.ts.map +1 -1
  187. package/lib-es/logic.js +3 -3
  188. package/lib-es/logic.js.map +1 -1
  189. package/lib-es/network/explorer/etherscan.d.ts +16 -3
  190. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  191. package/lib-es/network/explorer/etherscan.js +60 -5
  192. package/lib-es/network/explorer/etherscan.js.map +1 -1
  193. package/lib-es/network/explorer/ledger.d.ts +50 -4
  194. package/lib-es/network/explorer/ledger.d.ts.map +1 -1
  195. package/lib-es/network/explorer/ledger.js +283 -37
  196. package/lib-es/network/explorer/ledger.js.map +1 -1
  197. package/lib-es/network/explorer/none.d.ts +1 -0
  198. package/lib-es/network/explorer/none.d.ts.map +1 -1
  199. package/lib-es/network/explorer/none.js +2 -0
  200. package/lib-es/network/explorer/none.js.map +1 -1
  201. package/lib-es/network/explorer/types.d.ts +15 -2
  202. package/lib-es/network/explorer/types.d.ts.map +1 -1
  203. package/lib-es/network/explorer/types.js.map +1 -1
  204. package/lib-es/network/index.d.ts +5 -0
  205. package/lib-es/network/index.d.ts.map +1 -0
  206. package/lib-es/network/index.js +7 -0
  207. package/lib-es/network/index.js.map +1 -0
  208. package/lib-es/network/node/explorerProxy.d.ts +27 -0
  209. package/lib-es/network/node/explorerProxy.d.ts.map +1 -0
  210. package/lib-es/network/node/explorerProxy.js +254 -0
  211. package/lib-es/network/node/explorerProxy.js.map +1 -0
  212. package/lib-es/network/node/index.d.ts +2 -1
  213. package/lib-es/network/node/index.d.ts.map +1 -1
  214. package/lib-es/network/node/index.js +11 -10
  215. package/lib-es/network/node/index.js.map +1 -1
  216. package/lib-es/network/node/ledger.js +1 -1
  217. package/lib-es/network/node/ledger.js.map +1 -1
  218. package/lib-es/network/node/rpc.common.d.ts +2 -2
  219. package/lib-es/network/node/rpc.common.js +3 -3
  220. package/lib-es/network/node/rpc.common.js.map +1 -1
  221. package/lib-es/network/node/withNodeSources.d.ts +21 -0
  222. package/lib-es/network/node/withNodeSources.d.ts.map +1 -0
  223. package/lib-es/network/node/withNodeSources.js +74 -0
  224. package/lib-es/network/node/withNodeSources.js.map +1 -0
  225. package/lib-es/nodeSources.d.ts +15 -0
  226. package/lib-es/nodeSources.d.ts.map +1 -0
  227. package/lib-es/nodeSources.js +28 -0
  228. package/lib-es/nodeSources.js.map +1 -0
  229. package/lib-es/staking/contracts.js +1 -1
  230. package/lib-es/staking/contracts.js.map +1 -1
  231. package/lib-es/staking/fetchers.js +1 -1
  232. package/lib-es/staking/fetchers.js.map +1 -1
  233. package/lib-es/staking/operations/sei.js +1 -1
  234. package/lib-es/staking/operations/sei.js.map +1 -1
  235. package/lib-es/staking/prepareIntents.js +1 -1
  236. package/lib-es/staking/prepareIntents.js.map +1 -1
  237. package/lib-es/staking/rewards.js +1 -1
  238. package/lib-es/staking/rewards.js.map +1 -1
  239. package/lib-es/staking/transactionData.js +1 -1
  240. package/lib-es/staking/transactionData.js.map +1 -1
  241. package/lib-es/staking/utils.d.ts +45 -0
  242. package/lib-es/staking/utils.d.ts.map +1 -0
  243. package/lib-es/{utils.js → staking/utils.js} +1 -147
  244. package/lib-es/staking/utils.js.map +1 -0
  245. package/lib-es/staking/validators/sei.js +1 -1
  246. package/lib-es/staking/validators/sei.js.map +1 -1
  247. package/lib-es/types/staking.d.ts +2 -2
  248. package/package.json +72 -7
  249. package/src/adapters/blockOperations.ts +1 -1
  250. package/src/adapters/etherscan.ts +1 -1
  251. package/src/adapters/ledger.ts +1 -1
  252. package/src/api/{index.arc_testnet.integ.test.ts → index.arc.integ.test.ts} +15 -12
  253. package/src/api/index.monad_testnet.integ.test.ts +95 -4
  254. package/src/api/index.ts +2 -2
  255. package/src/config.ts +22 -34
  256. package/src/errors.ts +13 -0
  257. package/src/fixtures/context.fixtures.ts +6 -1
  258. package/src/logic/broadcast.ts +1 -1
  259. package/src/logic/common.ts +4 -2
  260. package/src/logic/craftTransaction.ts +2 -1
  261. package/src/logic/estimateFees.ts +20 -6
  262. package/src/logic/getBalance.ts +72 -26
  263. package/src/logic/getBlock.ts +26 -14
  264. package/src/logic/getBlockInfo.ts +1 -1
  265. package/src/logic/getNextSequence.ts +4 -1
  266. package/src/logic/index.ts +4 -0
  267. package/src/logic/lastBlock.ts +1 -1
  268. package/src/logic/listOperations.ts +14 -1
  269. package/src/logic/tests/broadcast.integ.test.ts +53 -0
  270. package/src/logic/{broadcast.test.ts → tests/broadcast.test.ts} +7 -7
  271. package/src/logic/{broadcastSource.test.ts → tests/broadcastSource.test.ts} +6 -6
  272. package/src/logic/{combine.test.ts → tests/combine.test.ts} +1 -1
  273. package/src/logic/{common.test.ts → tests/common.test.ts} +45 -21
  274. package/src/logic/{computeGasLimit.test.ts → tests/computeGasLimit.test.ts} +2 -2
  275. package/src/logic/{craftTransaction.test.ts → tests/craftTransaction.test.ts} +7 -7
  276. package/src/logic/{craftTransactionData.test.ts → tests/craftTransactionData.test.ts} +4 -4
  277. package/src/logic/{estimateFees.test.ts → tests/estimateFees.test.ts} +12 -12
  278. package/src/logic/tests/getBalance.test.ts +602 -0
  279. package/src/logic/{getBlock.test.ts → tests/getBlock.test.ts} +182 -89
  280. package/src/logic/{getBlockInfo.test.ts → tests/getBlockInfo.test.ts} +8 -8
  281. package/src/logic/{getErc20Data.test.ts → tests/getErc20Data.test.ts} +1 -1
  282. package/src/logic/{getNextSequence.test.ts → tests/getNextSequence.test.ts} +7 -7
  283. package/src/logic/{getStakes.test.ts → tests/getStakes.test.ts} +13 -13
  284. package/src/logic/{internalTransactionsFetcher.test.ts → tests/internalTransactionsFetcher.test.ts} +8 -8
  285. package/src/logic/{lastBlock.test.ts → tests/lastBlock.test.ts} +7 -7
  286. package/src/logic/{listOperations.test.ts → tests/listOperations.test.ts} +125 -6
  287. package/src/logic/{validateAddress.test.ts → tests/validateAddress.test.ts} +1 -1
  288. package/src/logic/{validateIntent.test.ts → tests/validateIntent.test.ts} +80 -78
  289. package/src/logic/validateIntent.ts +7 -4
  290. package/src/logic-public/index.ts +18 -0
  291. package/src/{utils.test.ts → logic-public/tests/utils.test.ts} +1 -27
  292. package/src/logic-public/utils.ts +184 -0
  293. package/src/logic.test.ts +5 -59
  294. package/src/logic.ts +5 -3
  295. package/src/network/explorer/etherscan.test.ts +403 -195
  296. package/src/network/explorer/etherscan.ts +99 -10
  297. package/src/network/explorer/index.test.ts +27 -0
  298. package/src/network/explorer/ledger.test.ts +791 -62
  299. package/src/network/explorer/ledger.ts +426 -54
  300. package/src/network/explorer/none.ts +3 -0
  301. package/src/network/explorer/types.ts +29 -5
  302. package/src/network/index.ts +7 -0
  303. package/src/network/node/explorerProxy.test.ts +673 -0
  304. package/src/network/node/explorerProxy.ts +308 -0
  305. package/src/network/node/index.memoization.test.ts +22 -10
  306. package/src/network/node/index.test.ts +6 -3
  307. package/src/network/node/index.ts +11 -7
  308. package/src/network/node/ledger.ts +1 -1
  309. package/src/network/node/rpc.common.ts +3 -3
  310. package/src/network/node/rpc.test.ts +66 -105
  311. package/src/network/node/withNodeSources.test.ts +240 -0
  312. package/src/network/node/withNodeSources.ts +95 -0
  313. package/src/nodeSources.ts +38 -0
  314. package/src/staking/contracts.ts +1 -1
  315. package/src/staking/encoder.test.ts +1 -1
  316. package/src/staking/fetchers.ts +1 -1
  317. package/src/staking/operations/sei.ts +1 -1
  318. package/src/staking/prepareIntents.ts +1 -1
  319. package/src/staking/redelegations.test.ts +1 -1
  320. package/src/staking/rewards.test.ts +1 -1
  321. package/src/staking/rewards.ts +1 -1
  322. package/src/staking/transactionData.ts +1 -1
  323. package/src/staking/unbondings.test.ts +1 -1
  324. package/src/staking/utils.test.ts +25 -0
  325. package/src/{utils.ts → staking/utils.ts} +2 -182
  326. package/src/staking/validators/sei.ts +1 -1
  327. package/src/types/staking.ts +2 -2
  328. package/lib/constants.d.ts +0 -2
  329. package/lib/constants.d.ts.map +0 -1
  330. package/lib/constants.js +0 -11
  331. package/lib/constants.js.map +0 -1
  332. package/lib/utils.d.ts.map +0 -1
  333. package/lib/utils.js.map +0 -1
  334. package/lib-es/constants.d.ts +0 -2
  335. package/lib-es/constants.d.ts.map +0 -1
  336. package/lib-es/constants.js +0 -7
  337. package/lib-es/constants.js.map +0 -1
  338. package/lib-es/utils.d.ts.map +0 -1
  339. package/lib-es/utils.js.map +0 -1
  340. package/src/constants.ts +0 -9
  341. package/src/logic/broadcast.integ.test.ts +0 -46
  342. package/src/logic/getBalance.test.ts +0 -362
@@ -5,13 +5,7 @@ import type { EvmConfigInfo } from '../config'
5
5
  import type { EvmContext } from '../config'
6
6
  import type { ExplorerApi } from '../network/explorer/types'
7
7
  import type { NodeApi } from '../network/node/types'
8
- import type {
9
- Balance,
10
- AssetInfo,
11
- BalanceOptions,
12
- MemoNotSupported,
13
- Operation,
14
- } from '@ledgerhq/coin-module-framework/api/types'
8
+ import type { AssetInfo, Balance, BalanceOptions } from '@ledgerhq/coin-module-framework/api/types'
15
9
  import { getExplorerApi } from '../network/explorer'
16
10
  import { getNodeApi } from '../network/node'
17
11
  import { STAKING_CONFIG } from '../staking'
@@ -33,7 +27,7 @@ export async function getBalance(
33
27
  options?: BalanceOptions
34
28
  ): Promise<Balance[]> {
35
29
  const config = await context.config(currencyId)
36
- const nodeApi = getNodeApi(config, currencyId)
30
+ const nodeApi = getNodeApi(config, currencyId, context.logger)
37
31
  const explorerApi = getExplorerApi(config, currencyId)
38
32
 
39
33
  const [nativeBalance, tokensBalances] = await Promise.all([
@@ -69,27 +63,79 @@ async function getTokenBalances(
69
63
  ): Promise<Balance[]> {
70
64
  const balances: Balance[] = []
71
65
 
72
- const opsResult = await explorerApi
73
- .getOperations(config, currencyId, address, 0)
74
- .catch(() => null)
75
- const lastCoinOperations = opsResult?.lastCoinOperations ?? []
76
- const lastTokenOperations = opsResult?.lastTokenOperations ?? []
66
+ // Monad's `getStakes` extracts "known" validator IDs from delegate/undelegate/withdraw calls
67
+ // found in the account's coin operations (`extractKnownValIds`, `staking/validators/monad.ts`).
68
+ // For a currency that declares an extractor, the SAME `getOperations` walk also serves as
69
+ // this currency's token-discovery source (its `lastTokenOperations`) — the account's history
70
+ // is walked once, not twice, and `discoverTokenAssets` is not called on this branch. Every
71
+ // other currency relies solely on the bounded `discoverTokenAssets` walk. Either way, a failed
72
+ // walk must not be reported as a successful empty one: the framework turns an empty token
73
+ // list into `{ value: 0n }` for every already-known sub-account, which would silently display
74
+ // a held token's balance as zero — so the explorer's own error is left to propagate, never
75
+ // swallowed into an empty result.
76
+ const extractKnownValIds = STAKING_CONFIG[currencyId]?.extractKnownValIds
77
+
78
+ let discoveredAssets: AssetInfo[]
79
+ let knownValidatorIds: string[] | undefined
80
+
81
+ if (extractKnownValIds) {
82
+ const ops = await explorerApi.getOperations(
83
+ config,
84
+ currencyId,
85
+ address,
86
+ 0,
87
+ undefined,
88
+ undefined,
89
+ undefined,
90
+ undefined,
91
+ context.logger
92
+ )
93
+ knownValidatorIds = extractKnownValIds(currencyId, ops.lastCoinOperations)
94
+
95
+ discoveredAssets = []
96
+ for (const operation of ops.lastTokenOperations) {
97
+ if (!('assetReference' in operation.asset) || !operation.asset.assetReference) continue
98
+ discoveredAssets.push(operation.asset)
99
+ }
100
+ } else {
101
+ // Scanning from a height without the known set drops every asset last moved below it, which
102
+ // a consumer reads back as a zero balance on a token still held. The pair is ignored rather
103
+ // than half-applied: one extra full scan, no wrong balance.
104
+ const scanMinHeight = options?.knownAssets?.length ? options.scanAssetsMinHeight : undefined
105
+
106
+ discoveredAssets = await explorerApi.discoverTokenAssets(
107
+ config,
108
+ currencyId,
109
+ address,
110
+ scanMinHeight
111
+ )
112
+ }
77
113
 
78
- const knownValidatorIds = STAKING_CONFIG[currencyId]?.extractKnownValIds?.(
79
- currencyId,
80
- lastCoinOperations
81
- )
114
+ // `union(knownAssets, scanned)`, deduplicated on a lower-cased reference the way
115
+ // `nativeContracts` is matched below: nothing makes the two sources agree on casing, and a
116
+ // case-sensitive key would read one contract's balance twice. The scanned form wins, so the
117
+ // module keeps emitting its own normalisation.
118
+ const knownAssetsByReference = new Map<string, AssetInfo>()
119
+ for (const asset of [...(options?.knownAssets ?? []), ...discoveredAssets]) {
120
+ if (!('assetReference' in asset) || !asset.assetReference) continue
121
+ knownAssetsByReference.set(asset.assetReference.toLowerCase(), asset)
122
+ }
82
123
 
83
124
  // Contracts whose ERC20 balance mirrors the native balance — skip them here to avoid
84
125
  // counting the same value twice (the native balance is already returned upstream).
85
126
  const { nativeContracts = [] } = config
86
127
  const nativeContractsSet = new Set(nativeContracts.map((c) => c.toLowerCase()))
87
128
 
88
- // Staking and token-asset collection run in parallel; both depend only on the
89
- // operations result fetched above.
129
+ // Staking and token-asset collection run in parallel; staking depends on the coin operations
130
+ // fetched above (Monad only), token-asset collection on the discovered/known assets union.
90
131
  const [stakingResult, tokenAssetsResult] = await Promise.allSettled([
91
132
  getStakes(context, currencyId, address, { knownValidatorIds }),
92
- collectTokenAssets(lastTokenOperations, address, nativeContractsSet, options),
133
+ collectTokenAssets(
134
+ Array.from(knownAssetsByReference.values()),
135
+ address,
136
+ nativeContractsSet,
137
+ options
138
+ ),
93
139
  ])
94
140
 
95
141
  // Add staking positions to balances (with error handling)
@@ -130,12 +176,12 @@ async function getTokenBalances(
130
176
  }
131
177
 
132
178
  /**
133
- * Walk token-transfer operations and build the set of contracts whose balance we need,
179
+ * Walk the discovered/known assets and build the set of contracts whose balance we need,
134
180
  * along with their AssetInfo metadata. Contracts in `nativeContractsSet` are skipped
135
181
  * (their balance is the native balance, returned upstream).
136
182
  */
137
183
  async function collectTokenAssets(
138
- lastTokenOperations: Array<Operation<MemoNotSupported>>,
184
+ discoveredAssets: AssetInfo[],
139
185
  address: string,
140
186
  nativeContractsSet: Set<string>,
141
187
  options: BalanceOptions | undefined
@@ -143,14 +189,14 @@ async function collectTokenAssets(
143
189
  const contracts = new Set<string>()
144
190
  const assets = new Map<string, AssetInfo>()
145
191
 
146
- for (const operation of lastTokenOperations) {
147
- if (!('assetReference' in operation.asset)) continue
148
- const contract = operation.asset.assetReference
192
+ for (const asset of discoveredAssets) {
193
+ if (!('assetReference' in asset)) continue
194
+ const contract = asset.assetReference
149
195
  if (!contract) continue
150
196
  if (nativeContractsSet.has(contract.toLowerCase())) continue
151
197
 
152
198
  const assetInfo: AssetInfo = {
153
- type: operation.asset.type,
199
+ type: asset.type,
154
200
  assetReference: contract,
155
201
  assetOwner: address,
156
202
  }
@@ -3,6 +3,7 @@
3
3
 
4
4
  import type { EvmContext } from '../config'
5
5
  import type { BlockReceiptInfo, PrefetchedBlockTransaction } from '../network/node/types'
6
+ import type { InternalTxsByHash } from './internalTransactionsFetcher'
6
7
  import type {
7
8
  Block,
8
9
  BlockInfo,
@@ -15,8 +16,8 @@ import { log } from '@ledgerhq/logs'
15
16
  import { rpcTransactionToBlockOperations } from '../adapters/blockOperations'
16
17
  import { DEFAULT_INTERNAL_TX_SOURCES } from '../config'
17
18
  import { UnsupportedRpcMethodError } from '../errors'
19
+ import { buildSmartContractDetails, safeEncodeEIP55 } from '../logic-public'
18
20
  import { getNodeApi } from '../network/node'
19
- import { buildSmartContractDetails, safeEncodeEIP55 } from '../utils'
20
21
  import { createInternalTransactionsFetcher } from './internalTransactionsFetcher'
21
22
  import { dropRootTraceDuplicates } from './rootTraceDedup'
22
23
 
@@ -30,9 +31,11 @@ export async function getBlock(
30
31
  // - fetch transaction receipts in one call using eth_getBlockReceipts
31
32
  // - if the RPC does not support prefetchTxs or eth_getBlockReceipts, fall back to fetching the transaction+receipts
32
33
  // one by one
33
- // - in parallel, fetch internal transactions from explorer (etherscan/blockscout) and merge into block transactions
34
+ // - unless the block is empty, fetch internal transactions (RPC trace methods or explorer,
35
+ // per `getBlockInternalTxsSources`) in parallel with the receipts, and merge them into the
36
+ // block transactions
34
37
  const config = await context.config(currencyId)
35
- const nodeApi = getNodeApi(config, currencyId)
38
+ const nodeApi = getNodeApi(config, currencyId, context.logger)
36
39
  const internalTxSources = config.getBlockInternalTxsSources ?? DEFAULT_INTERNAL_TX_SOURCES
37
40
  const fetchInternalTxs = createInternalTransactionsFetcher(
38
41
  config,
@@ -40,10 +43,8 @@ export async function getBlock(
40
43
  currencyId,
41
44
  internalTxSources
42
45
  )
43
- const [result, internalTxs] = await Promise.all([
44
- nodeApi.getBlockByHeight(currencyId, height, true),
45
- fetchInternalTxs(height),
46
- ])
46
+
47
+ const result = await nodeApi.getBlockByHeight(currencyId, height, true)
47
48
 
48
49
  const info: BlockInfo = {
49
50
  height: result.height,
@@ -58,13 +59,24 @@ export async function getBlock(
58
59
  }
59
60
  }
60
61
 
61
- const transactions = await getTransactionsFromNode(
62
- currencyId,
63
- result.transactionHashes || result.transactions?.map((tx) => tx.hash) || [],
64
- nodeApi,
65
- result.height,
66
- result.transactions
67
- )
62
+ const transactionHashes =
63
+ result.transactionHashes || result.transactions?.map((tx) => tx.hash) || []
64
+
65
+ // Internal transactions only exist inside transactions, so a block with none has nothing to
66
+ // merge. Skipping the fetch avoids a request for a guaranteed-empty answer — on the `explorer`
67
+ // source that is one metered `txlistinternal` call per empty block.
68
+ const [transactions, internalTxs] = await Promise.all([
69
+ getTransactionsFromNode(
70
+ currencyId,
71
+ transactionHashes,
72
+ nodeApi,
73
+ result.height,
74
+ result.transactions
75
+ ),
76
+ transactionHashes.length === 0
77
+ ? Promise.resolve<InternalTxsByHash>(new Map())
78
+ : fetchInternalTxs(height),
79
+ ])
68
80
 
69
81
  const mergedTransactions = mergeInternalTransactions(transactions, internalTxs)
70
82
 
@@ -11,7 +11,7 @@ export async function getBlockInfo(
11
11
  height: number
12
12
  ): Promise<BlockInfo> {
13
13
  const config = await context.config(currencyId)
14
- const api = getNodeApi(config, currencyId)
14
+ const api = getNodeApi(config, currencyId, context.logger)
15
15
  const result = await api.getBlockByHeight(currencyId, height)
16
16
 
17
17
  const blockInfo: BlockInfo = {
@@ -10,6 +10,9 @@ export async function getNextSequence(
10
10
  address: string
11
11
  ): Promise<bigint> {
12
12
  const config = await context.config(currencyId)
13
- const txCount = await getNodeApi(config, currencyId).getTransactionCount(currencyId, address)
13
+ const txCount = await getNodeApi(config, currencyId, context.logger).getTransactionCount(
14
+ currencyId,
15
+ address
16
+ )
14
17
  return typeof txCount === 'number' ? BigInt(txCount) : txCount
15
18
  }
@@ -1,9 +1,13 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ // Re-export the standalone L2-fees helper (src/logic.ts) so it stays reachable
5
+ // from the `@ledgerhq/coin-evm/logic` entry point.
6
+ export * from '../logic'
4
7
  export * from './broadcast'
5
8
  export * from './lastBlock'
6
9
  export * from './combine'
10
+ export * from './getErc20Data'
7
11
  export * from './getBalance'
8
12
  export * from './estimateFees'
9
13
  export * from './listOperations'
@@ -7,7 +7,7 @@ import { getNodeApi } from '../network/node'
7
7
 
8
8
  export async function lastBlock(context: EvmContext, currencyId: string): Promise<BlockInfo> {
9
9
  const config = await context.config(currencyId)
10
- const api = getNodeApi(config, currencyId)
10
+ const api = getNodeApi(config, currencyId, context.logger)
11
11
  const { finalizationLevel = 'latest' } = config
12
12
  const result = await api.getBlockByHeight(currencyId, finalizationLevel)
13
13
 
@@ -8,6 +8,7 @@ import type {
8
8
  Operation,
9
9
  ListOperationsOptions,
10
10
  } from '@ledgerhq/coin-module-framework/api/types'
11
+ import { InvalidParameterError } from '@ledgerhq/coin-module-framework/errors'
11
12
  import { getExplorerApi } from '../network/explorer'
12
13
 
13
14
  // the sort parameter has a double meaning:
@@ -47,6 +48,17 @@ export async function listOperations(
47
48
  address: string,
48
49
  options: ListOperationsOptions
49
50
  ): Promise<Page<Operation<MemoNotSupported>>> {
51
+ // A page of zero operations is not a page this module can serve: it carries no record to build
52
+ // a cursor from, so it could only be answered with the caller's own cursor -- which the
53
+ // response contract forbids (a truthy `next` must advance). Raised rather than clamped, because
54
+ // a caller asking for zero operations is a caller bug, not a preference to honour. The public
55
+ // HTTP schema does allow `limit: 0`, so this is reachable from outside this repository.
56
+ if (options.limit !== undefined && options.limit <= 0) {
57
+ throw new InvalidParameterError(
58
+ `listOperations: limit must be a positive integer, got ${options.limit}`
59
+ )
60
+ }
61
+
50
62
  const config = await context.config(currencyId)
51
63
  const explorerApi = getExplorerApi(config, currencyId)
52
64
  const explorerOrder = options.limit === undefined ? 'desc' : (options.order ?? 'desc')
@@ -64,7 +76,8 @@ export async function listOperations(
64
76
  undefined,
65
77
  options.cursor,
66
78
  options.limit,
67
- explorerOrder
79
+ explorerOrder,
80
+ context.logger
68
81
  )
69
82
 
70
83
  const tokenOrNftHashes = new Set(
@@ -0,0 +1,53 @@
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { EvmContext } from '../../config'
5
+ import { Wallet } from 'ethers'
6
+ import {
7
+ createMockEvmConfigInfo,
8
+ createMockEvmContext,
9
+ mkExternalNode,
10
+ mkLedgerNode,
11
+ } from '../../fixtures/context.fixtures'
12
+ import broadcast from '../broadcast'
13
+
14
+ const contextForNetwork = (network: string): EvmContext => {
15
+ switch (network) {
16
+ case 'ethereum':
17
+ return createMockEvmContext(
18
+ createMockEvmConfigInfo({ chainId: 1, node: mkLedgerNode({ explorerId: 'eth' }) })
19
+ )
20
+ case 'sonic':
21
+ return createMockEvmContext(
22
+ createMockEvmConfigInfo({
23
+ chainId: 146,
24
+ node: mkExternalNode({ uri: 'https://sonic.coin.ledger.com' }),
25
+ })
26
+ )
27
+ default:
28
+ throw new Error('Unhandled currency')
29
+ }
30
+ }
31
+
32
+ describe('Broadcast', () => {
33
+ it.each([
34
+ ['ethereum', 1],
35
+ ['sonic', 146],
36
+ ])('throws on insufficient funds on %s', async (network, chainId) => {
37
+ const wallet = Wallet.createRandom()
38
+ const tx = {
39
+ to: wallet.address,
40
+ value: 1n,
41
+ nonce: 0,
42
+ gasLimit: 21000n,
43
+ maxFeePerGas: 10000000000000n,
44
+ maxPriorityFeePerGas: 1000000000n,
45
+ chainId,
46
+ }
47
+ const signature = await wallet.signTransaction(tx)
48
+
49
+ await expect(broadcast(contextForNetwork(network), network, { signature })).rejects.toThrow(
50
+ /insufficient funds for gas \* price \+ value|InsufficientFunds/
51
+ )
52
+ })
53
+ })
@@ -1,13 +1,13 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { mockEvmContext } from '../fixtures/context.fixtures'
5
- import { getNodeApi } from '../network/node/index'
6
- import { mockNodeApi } from '../network/node/node.fixtures'
7
- import { broadcast } from './broadcast'
4
+ import { mockEvmContext } from '../../fixtures/context.fixtures'
5
+ import { getNodeApi } from '../../network/node/index'
6
+ import { mockNodeApi } from '../../network/node/node.fixtures'
7
+ import { broadcast } from '../broadcast'
8
8
 
9
- jest.mock('../network/node/index', () => ({
10
- ...jest.requireActual('../network/node/index'),
9
+ jest.mock('../../network/node/index', () => ({
10
+ ...jest.requireActual('../../network/node/index'),
11
11
  getNodeApi: jest.fn(),
12
12
  }))
13
13
 
@@ -27,7 +27,7 @@ describe('broadcastLogic', () => {
27
27
  signature: '0xabcdef',
28
28
  broadcastConfig: { mevProtected: true },
29
29
  })
30
- expect(mockGetNodeApi).toHaveBeenCalledWith(expect.anything(), 'ethereum')
30
+ expect(mockGetNodeApi).toHaveBeenCalledWith(expect.anything(), 'ethereum', expect.any(Function))
31
31
  expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith('ethereum', '0xabcdef', {
32
32
  mevProtected: true,
33
33
  })
@@ -1,13 +1,13 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { mockEvmContext } from '../fixtures/context.fixtures'
5
- import { getNodeApi } from '../network/node/index'
6
- import { mockNodeApi } from '../network/node/node.fixtures'
7
- import { broadcast } from './broadcast'
4
+ import { mockEvmContext } from '../../fixtures/context.fixtures'
5
+ import { getNodeApi } from '../../network/node/index'
6
+ import { mockNodeApi } from '../../network/node/node.fixtures'
7
+ import { broadcast } from '../broadcast'
8
8
 
9
- jest.mock('../network/node/index', () => ({
10
- ...jest.requireActual('../network/node/index'),
9
+ jest.mock('../../network/node/index', () => ({
10
+ ...jest.requireActual('../../network/node/index'),
11
11
  getNodeApi: jest.fn(),
12
12
  }))
13
13
 
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { ethers, SigningKey, Wallet } from 'ethers'
5
- import { combine } from './combine'
5
+ import { combine } from '../combine'
6
6
 
7
7
  describe('combine', () => {
8
8
  const privateKey = '0xb40eddd40b507adb0df9d44fe668a12c7d43d75bb0a3fc46cdaba1fe46dede2d'
@@ -8,16 +8,20 @@ import {
8
8
  createStakingTransactionIntentMockData,
9
9
  } from '@ledgerhq/coin-module-framework/test-utils'
10
10
  import { BigNumber } from 'bignumber.js'
11
- import { createMockEvmConfigInfo, mkExternalNode } from '../fixtures/context.fixtures'
12
- import { getNodeApi } from '../network/node'
13
- import { mockNodeApi } from '../network/node/node.fixtures'
14
- import { buildStakingTransactionParams } from '../staking'
15
- import { USEI_TO_EVM_SCALE } from '../utils'
16
- import { getCallData, prepareUnsignedTxParams } from './common'
17
- import * as getErc20DataModule from './getErc20Data'
18
-
19
- jest.mock('./getErc20Data', () => {
20
- const actual = jest.requireActual('./getErc20Data')
11
+ import {
12
+ createMockEvmConfigInfo,
13
+ mkExternalNode,
14
+ testLogger,
15
+ } from '../../fixtures/context.fixtures'
16
+ import { getNodeApi } from '../../network/node'
17
+ import { mockNodeApi } from '../../network/node/node.fixtures'
18
+ import { buildStakingTransactionParams } from '../../staking'
19
+ import { USEI_TO_EVM_SCALE } from '../../staking/utils'
20
+ import { getCallData, prepareUnsignedTxParams } from '../common'
21
+ import * as getErc20DataModule from '../getErc20Data'
22
+
23
+ jest.mock('../getErc20Data', () => {
24
+ const actual = jest.requireActual('../getErc20Data')
21
25
  return {
22
26
  getErc20Data: jest.fn((recipient: string, amount: bigint) =>
23
27
  actual.getErc20Data(recipient, amount)
@@ -25,13 +29,13 @@ jest.mock('./getErc20Data', () => {
25
29
  }
26
30
  })
27
31
 
28
- jest.mock('../network/node', () => ({
29
- ...jest.requireActual('../network/node'),
32
+ jest.mock('../../network/node', () => ({
33
+ ...jest.requireActual('../../network/node'),
30
34
  getNodeApi: jest.fn(),
31
35
  }))
32
36
 
33
- jest.mock('../staking', () => ({
34
- ...jest.requireActual('../staking'),
37
+ jest.mock('../../staking', () => ({
38
+ ...jest.requireActual('../../staking'),
35
39
  buildStakingTransactionParams: jest.fn(),
36
40
  prepareStakingIntent: jest.fn((_config, _currencyId, intent) => Promise.resolve(intent)),
37
41
  }))
@@ -198,7 +202,8 @@ describe('common', () => {
198
202
  const result = await prepareUnsignedTxParams(
199
203
  testConfig,
200
204
  'sei_evm',
201
- makeStakingIntent(spendableBalance)
205
+ makeStakingIntent(spendableBalance),
206
+ testLogger
202
207
  )
203
208
 
204
209
  expect(nodeApiMock.getGasEstimation).toHaveBeenCalledTimes(2)
@@ -229,7 +234,12 @@ describe('common', () => {
229
234
  .mockRejectedValueOnce(GAS_ESTIMATION_ERROR)
230
235
  .mockResolvedValueOnce(new BigNumber(70_000))
231
236
 
232
- const result = await prepareUnsignedTxParams(testConfig, 'sei_evm', makeStakingIntent(0n))
237
+ const result = await prepareUnsignedTxParams(
238
+ testConfig,
239
+ 'sei_evm',
240
+ makeStakingIntent(0n),
241
+ testLogger
242
+ )
233
243
 
234
244
  expect(nodeApiMock.getGasEstimation).toHaveBeenCalledTimes(2)
235
245
  expect(nodeApiMock.getGasEstimation).toHaveBeenNthCalledWith(2, 'sei_evm', '0xSender', {
@@ -249,7 +259,12 @@ describe('common', () => {
249
259
 
250
260
  nodeApiMock.getGasEstimation.mockRejectedValue(GAS_ESTIMATION_ERROR)
251
261
 
252
- const result = await prepareUnsignedTxParams(testConfig, 'sei_evm', makeStakingIntent(0n))
262
+ const result = await prepareUnsignedTxParams(
263
+ testConfig,
264
+ 'sei_evm',
265
+ makeStakingIntent(0n),
266
+ testLogger
267
+ )
253
268
 
254
269
  expect(nodeApiMock.getGasEstimation).toHaveBeenCalledTimes(2)
255
270
  expect(result.gasLimit).toEqual(new BigNumber(0))
@@ -274,7 +289,12 @@ describe('common', () => {
274
289
  .mockRejectedValueOnce(GAS_ESTIMATION_ERROR)
275
290
  .mockResolvedValueOnce(new BigNumber(1_412_179))
276
291
 
277
- const result = await prepareUnsignedTxParams(testConfig, 'sei_evm', makeStakingIntent(0n))
292
+ const result = await prepareUnsignedTxParams(
293
+ testConfig,
294
+ 'sei_evm',
295
+ makeStakingIntent(0n),
296
+ testLogger
297
+ )
278
298
 
279
299
  expect(nodeApiMock.getGasEstimation).toHaveBeenCalledTimes(2)
280
300
  // Retry rebuilds BOTH calldata and value from the min unit (USEI_TO_EVM_SCALE), so the
@@ -310,7 +330,8 @@ describe('common', () => {
310
330
  valAddress: '0xVaultAddress',
311
331
  feesStrategy: 'medium',
312
332
  data: { type: 'buffer', value: Buffer.from([]) },
313
- })
333
+ }),
334
+ testLogger
314
335
  )
315
336
 
316
337
  // 237279 × 1.2 = 284734.8 → ceil → 284735
@@ -338,7 +359,8 @@ describe('common', () => {
338
359
  valAddress: '0xVaultAddress',
339
360
  feesStrategy: 'medium',
340
361
  data: { type: 'buffer', value: Buffer.from([]) },
341
- })
362
+ }),
363
+ testLogger
342
364
  )
343
365
 
344
366
  expect(result.gasLimit).toEqual(new BigNumber(284_735))
@@ -365,6 +387,7 @@ describe('common', () => {
365
387
  feesStrategy: 'medium',
366
388
  data: { type: 'buffer', value: Buffer.from([]) },
367
389
  }),
390
+ testLogger,
368
391
  { gasLimit: 300_000n }
369
392
  )
370
393
 
@@ -385,7 +408,8 @@ describe('common', () => {
385
408
  recipient: '0x7b2C7232f9E38F30E2868f0E5Bf311Cd83554b5A',
386
409
  sender: '0xSender',
387
410
  data: { type: 'buffer', value: Buffer.from([]) },
388
- })
411
+ }),
412
+ testLogger
389
413
  )
390
414
 
391
415
  expect(nodeApiMock.getGasEstimation).toHaveBeenCalledTimes(1)
@@ -1,12 +1,12 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { DEFAULT_GAS_LIMIT } from '../utils'
4
+ import { DEFAULT_GAS_LIMIT } from '../../logic-public'
5
5
  import {
6
6
  computeEIP7623GasLimit,
7
7
  DEFAULT_CALLDATA_FLOOR_GAS_PER_TOKEN,
8
8
  DEFAULT_CALLDATA_FLOOR_ZERO_BYTE_TOKENS,
9
- } from './computeGasLimit'
9
+ } from '../computeGasLimit'
10
10
 
11
11
  const EIP_7623 = {
12
12
  gasPerToken: DEFAULT_CALLDATA_FLOOR_GAS_PER_TOKEN,
@@ -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 { EvmConfigInfo } from '../../config'
5
5
  import type { BufferTxData, MemoNotSupported } from '@ledgerhq/coin-module-framework/api/types'
6
6
  import {
7
7
  createSendTransactionIntentMockData,
@@ -9,13 +9,13 @@ import {
9
9
  } from '@ledgerhq/coin-module-framework/test-utils'
10
10
  import BigNumber from 'bignumber.js'
11
11
  import { ethers } from 'ethers'
12
- import { createMockEvmContext, mkExternalNode, mkLedgerNode } from '../fixtures/context.fixtures'
13
- import { getNodeApi } from '../network/node'
14
- import { mockNodeApi } from '../network/node/node.fixtures'
15
- import { craftTransaction } from './craftTransaction'
12
+ import { createMockEvmContext, mkExternalNode, mkLedgerNode } from '../../fixtures/context.fixtures'
13
+ import { getNodeApi } from '../../network/node'
14
+ import { mockNodeApi } from '../../network/node/node.fixtures'
15
+ import { craftTransaction } from '../craftTransaction'
16
16
 
17
- jest.mock('../network/node', () => ({
18
- ...jest.requireActual('../network/node'),
17
+ jest.mock('../../network/node', () => ({
18
+ ...jest.requireActual('../../network/node'),
19
19
  getNodeApi: jest.fn(),
20
20
  }))
21
21
 
@@ -3,11 +3,11 @@
3
3
 
4
4
  import type { MemoNotSupported, BufferTxData } from '@ledgerhq/coin-module-framework/api/types'
5
5
  import { createSendTransactionIntentMockData } from '@ledgerhq/coin-module-framework/test-utils'
6
- import * as commonModule from './common'
7
- import { craftTransactionData } from './craftTransactionData'
6
+ import * as commonModule from '../common'
7
+ import { craftTransactionData } from '../craftTransactionData'
8
8
 
9
- jest.mock('./common', () => {
10
- const originalModule = jest.requireActual('./common')
9
+ jest.mock('../common', () => {
10
+ const originalModule = jest.requireActual('../common')
11
11
  return {
12
12
  ...originalModule,
13
13
  getCallData: jest.fn(),