@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
@@ -3,6 +3,19 @@ import type { ExplorerApi } from './types';
3
3
  export declare const DEFAULT_BATCH_SIZE = 10000;
4
4
  export declare const LEDGER_TIMEOUT = 200;
5
5
  export declare const DEFAULT_RETRIES_API = 2;
6
+ /**
7
+ * Page size for the discovery walk (see `discoverTokenAssets` below). Once discovery no longer
8
+ * accumulates pages (see `fetchPaginatedOpsWithRetries`), its peak memory is one *parsed* page,
9
+ * so this constant is a memory bound, not a throughput knob — it does not affect `getOperations`.
10
+ */
11
+ export declare const DISCOVERY_BATCH_SIZE = 100;
12
+ /**
13
+ * The explorer serves at most this many records per request regardless of a larger `batch_size`
14
+ * — measured against `https://explorers.api.live.ledger.com`: a requested 10 000 is served as
15
+ * 500. A raw page at or above this ceiling can never be trusted as proof there is nothing more,
16
+ * no matter how large `batch_size` was asked to be — see `fetchLedgerOpsPage`.
17
+ */
18
+ export declare const EXPLORER_MAX_PAGE_SIZE = 500;
6
19
  type OperationsRequestParams = {
7
20
  explorerId: string;
8
21
  address: string;
@@ -20,13 +33,46 @@ type LedgerExplorerSettings = {
20
33
  */
21
34
  export declare function fetchPaginatedOpsWithRetries(params: Required<OperationsRequestParams> & LedgerExplorerSettings, paginationToken?: string | null, previousOperations?: LedgerExplorerOperation[], retries?: number): Promise<LedgerExplorerOperation[]>;
22
35
  /**
23
- * Returns all operation types from an address
36
+ * A ledger-explorer pagination cursor: the height and hash of the last record a page delivered.
24
37
  *
25
- * Note: Ledger explorer fetches all pages recursively internally,
26
- * so pagination parameters are ignored and nextPagingToken is always empty.
27
- * Pagination may be supported in the future.
38
+ * Deliberately not the explorer's own continuation token — the framework's cursor contract
39
+ * requires a cursor that "can be used long after the last request and still provide consistent
40
+ * results" (`@ledgerhq/coin-module-framework/api/types`), which a server-side token with an
41
+ * undocumented lifetime does not guarantee by construction. Height-plus-hash needs no server
42
+ * state and doubles as the request's ceiling (descending) or floor (ascending) on the next call.
43
+ */
44
+ type LedgerCursor = {
45
+ height: number;
46
+ hash: string;
47
+ };
48
+ /** Serialises a cursor, or `NO_TOKEN` when there is no record to resume from. */
49
+ export declare function serializeLedgerCursor(record?: LedgerCursor): string;
50
+ /**
51
+ * Parses a cursor produced by `serializeLedgerCursor`. Returns `undefined` for an absent cursor
52
+ * or `NO_TOKEN` (first page); throws on anything else that does not match the `height:hash` shape
53
+ * — mirroring `deserializePagingToken`'s contract for the etherscan-like arm.
54
+ */
55
+ export declare function parseLedgerCursor(cursor: string | undefined): LedgerCursor | undefined;
56
+ /**
57
+ * Returns all operation types from an address.
58
+ *
59
+ * With no `limit`, Ledger explorer fetches all pages recursively internally, so `nextPagingToken`
60
+ * is always empty — this is the legacy, unchanged shape. With a `limit`, exactly one page is
61
+ * fetched and `nextPagingToken` carries a cursor the caller can resume from (see
62
+ * `serializeLedgerCursor`).
28
63
  */
29
64
  export declare const getOperations: ExplorerApi['getOperations'];
65
+ /**
66
+ * Discover which tokens an address holds by walking its ERC20 transfer events, one page at a
67
+ * time, without ever holding more than the current page in memory.
68
+ *
69
+ * Unlike `getOperations`, this walk loops instead of recursing over pages and drops each page
70
+ * once its events are folded into the running `Map<assetReference, AssetInfo>`, so its peak
71
+ * memory is O(distinct contracts), not O(history length). It never caps or truncates: it keeps
72
+ * walking until the explorer says there is no more, and a page that cannot be fetched after its
73
+ * own retry budget propagates rather than being skipped.
74
+ */
75
+ export declare const discoverTokenAssets: ExplorerApi['discoverTokenAssets'];
30
76
  declare const ledgerExplorerAPI: ExplorerApi;
31
77
  export default ledgerExplorerAPI;
32
78
  //# sourceMappingURL=ledger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../../src/network/explorer/ledger.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAe1C,eAAO,MAAM,kBAAkB,QAAS,CAAA;AACxC,eAAO,MAAM,cAAc,MAAM,CAAA;AACjC,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC,KAAK,uBAAuB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS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CAAA;IAChC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACnC,CAAA;AA6CD;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GAAG,sBAAsB,EAClE,eAAe,GAAE,MAAM,GAAG,IAAW,EACrC,kBAAkB,GAAE,uBAAuB,EAAO,EAClD,OAAO,SAAsB,GAC5B,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAwBpC;AA8BD;;;;;;;;GAQG;AACH,KAAK,YAAY,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpD,iFAAiF;AACjF,wBAAgB,qBAAqB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAatF;AA4LD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAyDtD,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAkElE,CAAA;AAED,QAAA,MAAM,iBAAiB,EAAE,WAGxB,CAAA;AAED,eAAe,iBAAiB,CAAA"}
@@ -5,37 +5,71 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  return (mod && mod.__esModule) ? mod : { "default": mod };
6
6
  };
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.getOperations = exports.DEFAULT_RETRIES_API = exports.LEDGER_TIMEOUT = exports.DEFAULT_BATCH_SIZE = void 0;
8
+ exports.discoverTokenAssets = exports.getOperations = exports.EXPLORER_MAX_PAGE_SIZE = exports.DISCOVERY_BATCH_SIZE = exports.DEFAULT_RETRIES_API = exports.LEDGER_TIMEOUT = exports.DEFAULT_BATCH_SIZE = void 0;
9
9
  exports.fetchPaginatedOpsWithRetries = fetchPaginatedOpsWithRetries;
10
+ exports.serializeLedgerCursor = serializeLedgerCursor;
11
+ exports.parseLedgerCursor = parseLedgerCursor;
10
12
  const promises_1 = require("@ledgerhq/coin-module-framework/promises");
11
13
  const axios_1 = __importDefault(require("axios"));
14
+ const eip55_1 = __importDefault(require("eip55"));
12
15
  const index_1 = require("../../adapters/index");
13
16
  const config_1 = require("../../config");
14
17
  const errors_1 = require("../../errors");
18
+ const logic_public_1 = require("../../logic-public");
15
19
  const types_1 = require("./types");
16
20
  exports.DEFAULT_BATCH_SIZE = 10_000;
17
21
  exports.LEDGER_TIMEOUT = 200; // 200ms between 2 calls
18
22
  exports.DEFAULT_RETRIES_API = 2;
23
+ /**
24
+ * Page size for the discovery walk (see `discoverTokenAssets` below). Once discovery no longer
25
+ * accumulates pages (see `fetchPaginatedOpsWithRetries`), its peak memory is one *parsed* page,
26
+ * so this constant is a memory bound, not a throughput knob — it does not affect `getOperations`.
27
+ */
28
+ exports.DISCOVERY_BATCH_SIZE = 100;
29
+ /**
30
+ * The explorer serves at most this many records per request regardless of a larger `batch_size`
31
+ * — measured against `https://explorers.api.live.ledger.com`: a requested 10 000 is served as
32
+ * 500. A raw page at or above this ceiling can never be trusted as proof there is nothing more,
33
+ * no matter how large `batch_size` was asked to be — see `fetchLedgerOpsPage`.
34
+ */
35
+ exports.EXPLORER_MAX_PAGE_SIZE = 500;
36
+ function mapExplorerOrder(order = 'asc') {
37
+ return order === 'desc' ? 'descending' : 'ascending';
38
+ }
39
+ /**
40
+ * Bare HTTP call for a single page: no retry, no accumulation.
41
+ *
42
+ * `paginationToken`: `undefined` omits the `token` parameter entirely (the paged fetch resumes
43
+ * through `from_height`/`to_height`, never through the explorer's own token); `null` or a string
44
+ * requests continuation through the explorer's token, as the exhaustive walks below do.
45
+ */
46
+ async function requestOpsPage(params, paginationToken) {
47
+ const { data: { data: operations, token }, } = await axios_1.default.request({
48
+ ...(params.clientVersion
49
+ ? { headers: { 'X-Ledger-Client-Version': params.clientVersion } }
50
+ : {}),
51
+ method: 'GET',
52
+ url: `${params.explorerUri ?? config_1.DEFAULT_LEDGER_EXPLORER_URI}/blockchain/v4/${params.explorerId}/address/${params.address}/txs`,
53
+ params: {
54
+ filtering: true,
55
+ from_height: params.fromBlock ?? 0,
56
+ // Needed to make sure we get transactions after the block height and not before, when no
57
+ // explicit order is requested. Order is still descending in the end for that legacy walk.
58
+ order: mapExplorerOrder(params.order),
59
+ batch_size: params.batchSize,
60
+ ...(params.toBlock !== undefined ? { to_height: params.toBlock } : {}),
61
+ ...(paginationToken !== undefined ? { token: paginationToken } : {}),
62
+ },
63
+ });
64
+ return { operations, token };
65
+ }
19
66
  /**
20
67
  * Request fetching all operations from an address
21
68
  * and supporting pagination through tokens.
22
69
  */
23
70
  async function fetchPaginatedOpsWithRetries(params, paginationToken = null, previousOperations = [], retries = exports.DEFAULT_RETRIES_API) {
24
71
  try {
25
- const { data: { data: operationsBatch, token }, } = await axios_1.default.request({
26
- ...(params.clientVersion
27
- ? { headers: { 'X-Ledger-Client-Version': params.clientVersion } }
28
- : {}),
29
- method: 'GET',
30
- url: `${params.explorerUri ?? config_1.DEFAULT_LEDGER_EXPLORER_URI}/blockchain/v4/${params.explorerId}/address/${params.address}/txs`,
31
- params: {
32
- filtering: true,
33
- from_height: params.fromBlock ?? 0,
34
- order: 'ascending', // Needed to make sure we get transactions after the block height and not before. Order is still descending in the end
35
- batch_size: params.batchSize,
36
- token: paginationToken,
37
- },
38
- });
72
+ const { operations: operationsBatch, token } = await requestOpsPage(params, paginationToken);
39
73
  previousOperations.push(...operationsBatch);
40
74
  return token
41
75
  ? fetchPaginatedOpsWithRetries(params, token, previousOperations, retries)
@@ -57,25 +91,138 @@ async function fetchPaginatedOpsWithRetries(params, paginationToken = null, prev
57
91
  }
58
92
  }
59
93
  /**
60
- * Returns all operation types from an address
94
+ * Fetch a single page, retrying up to `retries` times on failure. Shared by the discovery walk
95
+ * and the paged fetch below. Unlike `fetchPaginatedOpsWithRetries`, the retry budget is per page,
96
+ * not per walk: a page that keeps failing after its own retries propagates instead of being
97
+ * silently skipped — a hole in the middle of a walk is worse than a failure.
61
98
  *
62
- * Note: Ledger explorer fetches all pages recursively internally,
63
- * so pagination parameters are ignored and nextPagingToken is always empty.
64
- * Pagination may be supported in the future.
99
+ * A rate limit is the one error that is never retried, exactly as the exhaustive walk treats it:
100
+ * it is not transient, so spending the budget on it only walks the caller into a timeout.
65
101
  */
66
- const getOperations = async (config, currencyId, address, fromBlock) => {
67
- const { explorer } = config || /* istanbul ignore next */ {};
68
- if (!(0, types_1.isLedgerExplorerConfig)(explorer)) {
69
- throw new errors_1.LedgerExplorerUsedIncorrectly(`Ledger explorer used incorrectly with currency: ${currencyId}`);
102
+ async function requestOpsPageWithRetries(params, paginationToken, retries = exports.DEFAULT_RETRIES_API) {
103
+ try {
104
+ return await requestOpsPage(params, paginationToken);
70
105
  }
71
- const ledgerExplorerOps = await fetchPaginatedOpsWithRetries({
72
- explorerUri: config.ledgerExplorerUri,
73
- clientVersion: config.ledgerClientVersion,
74
- explorerId: explorer.explorerId,
75
- address,
76
- fromBlock,
77
- batchSize: explorer.batchSize ?? exports.DEFAULT_BATCH_SIZE,
78
- }, null, [], explorer.retries ?? exports.DEFAULT_RETRIES_API);
106
+ catch (e) {
107
+ if (axios_1.default.isAxiosError(e) && e.response?.status === 429) {
108
+ throw new errors_1.RateLimitError();
109
+ }
110
+ if (retries) {
111
+ await (0, promises_1.delay)(exports.LEDGER_TIMEOUT);
112
+ return requestOpsPageWithRetries(params, paginationToken, retries - 1);
113
+ }
114
+ throw e;
115
+ }
116
+ }
117
+ /** Serialises a cursor, or `NO_TOKEN` when there is no record to resume from. */
118
+ function serializeLedgerCursor(record) {
119
+ return record ? `${record.height}:${record.hash}` : types_1.NO_TOKEN;
120
+ }
121
+ /**
122
+ * Parses a cursor produced by `serializeLedgerCursor`. Returns `undefined` for an absent cursor
123
+ * or `NO_TOKEN` (first page); throws on anything else that does not match the `height:hash` shape
124
+ * — mirroring `deserializePagingToken`'s contract for the etherscan-like arm.
125
+ */
126
+ function parseLedgerCursor(cursor) {
127
+ if (cursor === undefined || cursor === types_1.NO_TOKEN)
128
+ return undefined;
129
+ const separatorIndex = cursor.indexOf(':');
130
+ const heightPart = cursor.slice(0, separatorIndex);
131
+ const hash = cursor.slice(separatorIndex + 1);
132
+ const height = Number.parseInt(heightPart, 10);
133
+ if (separatorIndex <= 0 || hash.length === 0 || Number.isNaN(height)) {
134
+ throw new Error(`Invalid ledger explorer cursor: ${cursor}`);
135
+ }
136
+ return { height, hash };
137
+ }
138
+ /**
139
+ * Resolves the block window for one paged request: the cursor caps a descending walk (it is a
140
+ * ceiling, combined with the caller's `toBlock` as the more restrictive of the two) and floors an
141
+ * ascending one (combined with the caller's `fromBlock` the same way). `from_height` is always a
142
+ * floor on this explorer, never a resume point — resuming a descending walk therefore goes
143
+ * through `to_height`, not `from_height`.
144
+ */
145
+ function resolveWindow(order, fromBlock, toBlock, cursor) {
146
+ if (order === 'desc') {
147
+ const ceiling = cursor === undefined
148
+ ? toBlock
149
+ : toBlock === undefined
150
+ ? cursor.height
151
+ : Math.min(cursor.height, toBlock);
152
+ return { fromBlock, toBlock: ceiling };
153
+ }
154
+ const floor = cursor === undefined ? fromBlock : Math.max(cursor.height, fromBlock);
155
+ return { fromBlock: floor, toBlock };
156
+ }
157
+ /**
158
+ * Fetch exactly one page for a caller that supplied `limit`: one explorer request in the common
159
+ * case, more only to work around boundary exhaustion (see below). Never accumulates further
160
+ * pages — a caller that stops after this page causes no further explorer request.
161
+ */
162
+ async function fetchLedgerOpsPage(params) {
163
+ const cursor = parseLedgerCursor(params.cursor);
164
+ const { fromBlock, toBlock } = resolveWindow(params.order, params.fromBlock, params.toBlock, cursor);
165
+ let batchSize = params.limit;
166
+ let records = [];
167
+ let rawPageIsFull = false;
168
+ for (;;) {
169
+ const { operations: rawRecords } = await requestOpsPageWithRetries({
170
+ explorerUri: params.explorerUri,
171
+ clientVersion: params.clientVersion,
172
+ explorerId: params.explorerId,
173
+ address: params.address,
174
+ fromBlock,
175
+ toBlock,
176
+ batchSize,
177
+ order: params.order,
178
+ }, undefined, // resumed through from_height/to_height, never through the explorer's token
179
+ params.retries);
180
+ // A raw page at or beyond the explorer's own page-size ceiling can never prove the window is
181
+ // exhausted, no matter how large `batchSize` was asked to be (measured: requests above ~500
182
+ // are served as 500) — "full" is judged against whichever of the two is smaller, so doubling
183
+ // past that ceiling cannot be mistaken for the walk having reached the end of the window.
184
+ rawPageIsFull = rawRecords.length >= Math.min(batchSize, exports.EXPLORER_MAX_PAGE_SIZE);
185
+ const cursorIndex = cursor ? rawRecords.findIndex((record) => record.hash === cursor.hash) : -1;
186
+ // No cursor: the whole page is new. A cursor supplied but not located in this page is never
187
+ // treated as "nothing to skip" — that would risk re-serving already-delivered records if a
188
+ // caller changed `limit` between two calls — it is treated the same as an exhausted boundary
189
+ // block below, so the loop can only end once every already-delivered record is accounted for.
190
+ records = !cursor ? rawRecords : cursorIndex === -1 ? [] : rawRecords.slice(cursorIndex + 1);
191
+ // Boundary exhaustion: everything the cursor should skip is still in this page, and the raw
192
+ // page was full, so the block holding the cursor's record may hold more records than the
193
+ // requested page size. Enlarge the page and re-request the same window. Bounded by that
194
+ // block's record count: the loop ends once a new record surfaces or the explorer confirms
195
+ // there is nothing left (a raw page that is not full).
196
+ if (records.length > 0 || !rawPageIsFull)
197
+ break;
198
+ if (batchSize >= exports.EXPLORER_MAX_PAGE_SIZE) {
199
+ // Even a request at the explorer's own ceiling cannot get past this block: there is no
200
+ // per-block offset in this API, so no `batch_size` ever will either. Paging through it is
201
+ // impossible, not merely slow — fail loudly rather than loop forever or silently report the
202
+ // end of the history (which would be indistinguishable from a genuinely complete one).
203
+ // This branch is only reachable with a cursor: without one, `records` always equals
204
+ // `rawRecords`, so `records.length === 0` (the other condition to reach here) requires an
205
+ // empty raw page, which is never "full" and breaks the loop before this check.
206
+ const boundaryHeight = cursor.height;
207
+ throw new errors_1.UnpageableLedgerExplorerBlock(`Ledger explorer block ${boundaryHeight} holds more records than a single page can ` +
208
+ `serve (explorer page-size ceiling: ${exports.EXPLORER_MAX_PAGE_SIZE})`, { blockHeight: boundaryHeight, explorerMaxPageSize: exports.EXPLORER_MAX_PAGE_SIZE });
209
+ }
210
+ batchSize *= 2;
211
+ }
212
+ // `rawPageIsFull` is only ever true when the loop above broke on `records.length > 0`, so
213
+ // `lastRecord` is always defined on that branch.
214
+ const lastRecord = records[records.length - 1];
215
+ const nextPagingToken = rawPageIsFull
216
+ ? serializeLedgerCursor({ height: lastRecord.block.height, hash: lastRecord.hash })
217
+ : types_1.NO_TOKEN;
218
+ return { operations: records, nextPagingToken };
219
+ }
220
+ /**
221
+ * Turns explorer records into the four operation buckets `getOperations` returns. Shared by both
222
+ * the legacy exhaustive path and the paged path: the same input records must produce the same
223
+ * operations regardless of which path fetched them.
224
+ */
225
+ function adaptLedgerRecords(config, currencyId, address, records) {
79
226
  const lastCoinOperations = [];
80
227
  const lastTokenOperations = [];
81
228
  const lastNftOperations = [];
@@ -83,7 +230,7 @@ const getOperations = async (config, currencyId, address, fromBlock) => {
83
230
  // Drop ERC20 Transfer events on contracts that mirror the native asset
84
231
  const nativeContractsSet = new Set((config.nativeContracts ?? []).map((c) => c.toLowerCase()));
85
232
  const isNativeContract = (contract) => nativeContractsSet.has(contract.toLowerCase());
86
- for (const ledgerOp of ledgerExplorerOps) {
233
+ for (const ledgerOp of records) {
87
234
  const coinOps = (0, index_1.ledgerOperationToOperations)(address, currencyId, ledgerOp);
88
235
  const erc20TransferEvents = nativeContractsSet.size === 0
89
236
  ? ledgerOp.transfer_events
@@ -102,17 +249,119 @@ const getOperations = async (config, currencyId, address, fromBlock) => {
102
249
  lastNftOperations.push(...erc1155Ops);
103
250
  lastInternalOperations.push(...internalOps);
104
251
  }
252
+ return { lastCoinOperations, lastTokenOperations, lastNftOperations, lastInternalOperations };
253
+ }
254
+ /**
255
+ * Returns all operation types from an address.
256
+ *
257
+ * With no `limit`, Ledger explorer fetches all pages recursively internally, so `nextPagingToken`
258
+ * is always empty — this is the legacy, unchanged shape. With a `limit`, exactly one page is
259
+ * fetched and `nextPagingToken` carries a cursor the caller can resume from (see
260
+ * `serializeLedgerCursor`).
261
+ */
262
+ const getOperations = async (config, currencyId, address, fromBlock, toBlock, pagingToken, limit, order) => {
263
+ const { explorer } = config || /* istanbul ignore next */ {};
264
+ if (!(0, types_1.isLedgerExplorerConfig)(explorer)) {
265
+ throw new errors_1.LedgerExplorerUsedIncorrectly(`Ledger explorer used incorrectly with currency: ${currencyId}`);
266
+ }
267
+ const settings = {
268
+ explorerUri: config.ledgerExplorerUri,
269
+ clientVersion: config.ledgerClientVersion,
270
+ explorerId: explorer.explorerId,
271
+ address,
272
+ };
273
+ let records;
274
+ let nextPagingToken;
275
+ if (limit === undefined) {
276
+ records = await fetchPaginatedOpsWithRetries({
277
+ ...settings,
278
+ fromBlock,
279
+ batchSize: explorer.batchSize ?? exports.DEFAULT_BATCH_SIZE,
280
+ }, null, [], explorer.retries ?? exports.DEFAULT_RETRIES_API);
281
+ nextPagingToken = types_1.NO_TOKEN; // Ledger explorer fetches all pages internally
282
+ }
283
+ else {
284
+ const page = await fetchLedgerOpsPage({
285
+ ...settings,
286
+ fromBlock,
287
+ toBlock,
288
+ cursor: pagingToken,
289
+ limit,
290
+ order: order ?? 'desc',
291
+ retries: explorer.retries ?? exports.DEFAULT_RETRIES_API,
292
+ });
293
+ records = page.operations;
294
+ nextPagingToken = page.nextPagingToken;
295
+ }
105
296
  return {
106
- lastCoinOperations,
107
- lastTokenOperations,
108
- lastNftOperations,
109
- lastInternalOperations,
110
- nextPagingToken: types_1.NO_TOKEN, // Ledger explorer fetches all pages internally
297
+ ...adaptLedgerRecords(config, currencyId, address, records),
298
+ nextPagingToken,
111
299
  };
112
300
  };
113
301
  exports.getOperations = getOperations;
302
+ /**
303
+ * Discover which tokens an address holds by walking its ERC20 transfer events, one page at a
304
+ * time, without ever holding more than the current page in memory.
305
+ *
306
+ * Unlike `getOperations`, this walk loops instead of recursing over pages and drops each page
307
+ * once its events are folded into the running `Map<assetReference, AssetInfo>`, so its peak
308
+ * memory is O(distinct contracts), not O(history length). It never caps or truncates: it keeps
309
+ * walking until the explorer says there is no more, and a page that cannot be fetched after its
310
+ * own retry budget propagates rather than being skipped.
311
+ */
312
+ const discoverTokenAssets = async (config, currencyId, address, fromBlock) => {
313
+ const { explorer } = config || /* istanbul ignore next */ {};
314
+ if (!(0, types_1.isLedgerExplorerConfig)(explorer)) {
315
+ throw new errors_1.LedgerExplorerUsedIncorrectly(`Ledger explorer used incorrectly with currency: ${currencyId}`);
316
+ }
317
+ // A smaller operator-configured batch size is honoured (it only shrinks the page); a larger
318
+ // one cannot defeat the memory bound the discovery walk relies on. A non-positive one is not
319
+ // honoured at all: it would make every page empty, end the walk immediately, and report an
320
+ // account as holding no token -- which the framework turns into a zero balance on every token
321
+ // it does hold.
322
+ const configuredBatchSize = explorer.batchSize;
323
+ const batchSize = configuredBatchSize !== undefined && configuredBatchSize > 0
324
+ ? Math.min(configuredBatchSize, exports.DISCOVERY_BATCH_SIZE)
325
+ : exports.DISCOVERY_BATCH_SIZE;
326
+ const params = {
327
+ explorerUri: config.ledgerExplorerUri,
328
+ clientVersion: config.ledgerClientVersion,
329
+ explorerId: explorer.explorerId,
330
+ address,
331
+ fromBlock: fromBlock ?? 0,
332
+ batchSize,
333
+ };
334
+ const checksummedAddress = eip55_1.default.encode(address);
335
+ const assets = new Map();
336
+ let token = null;
337
+ for (;;) {
338
+ const page = await requestOpsPageWithRetries(params, token, explorer.retries ?? exports.DEFAULT_RETRIES_API);
339
+ for (const record of page.operations) {
340
+ for (const event of record.transfer_events) {
341
+ // Same party filter as the ERC20 adapter: an event contributes an asset only if the
342
+ // requested address is its `from` or `to`, never a third party the address merely
343
+ // co-occurred with in the same transaction.
344
+ const isParty = (0, logic_public_1.safeEncodeEIP55)(event.from) === checksummedAddress ||
345
+ (0, logic_public_1.safeEncodeEIP55)(event.to) === checksummedAddress;
346
+ if (!isParty)
347
+ continue;
348
+ const contract = eip55_1.default.encode(event.contract);
349
+ assets.set(contract, { type: 'erc20', assetReference: contract, assetOwner: address });
350
+ }
351
+ }
352
+ // Stop on: a falsy token (normal end of history), an empty page that still carries a token
353
+ // (defends against a misbehaving explorer), or a token identical to the one just used (a
354
+ // cycling-cursor guard a plain recursion could not express).
355
+ if (!page.token || page.operations.length === 0 || page.token === token)
356
+ break;
357
+ token = page.token;
358
+ }
359
+ return Array.from(assets.values());
360
+ };
361
+ exports.discoverTokenAssets = discoverTokenAssets;
114
362
  const ledgerExplorerAPI = {
115
363
  getOperations: exports.getOperations,
364
+ discoverTokenAssets: exports.discoverTokenAssets,
116
365
  };
117
366
  exports.default = ledgerExplorerAPI;
118
367
  //# sourceMappingURL=ledger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../src/network/explorer/ledger.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;;;;AAuCtC,oEA+CC;AAjFD,uEAAgE;AAChE,kDAAyB;AACzB,gDAM6B;AAC7B,yCAA0D;AAC1D,yCAA4E;AAC5E,mCAA0D;AAE7C,QAAA,kBAAkB,GAAG,MAAM,CAAA;AAC3B,QAAA,cAAc,GAAG,GAAG,CAAA,CAAC,wBAAwB;AAC7C,QAAA,mBAAmB,GAAG,CAAC,CAAA;AAepC;;;GAGG;AACI,KAAK,UAAU,4BAA4B,CAChD,MAAkE,EAClE,kBAAiC,IAAI,EACrC,qBAAgD,EAAE,EAClD,OAAO,GAAG,2BAAmB;IAE7B,IAAI,CAAC;QACH,MAAM,EACJ,IAAI,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,GACvC,GAAG,MAAM,eAAK,CAAC,OAAO,CAGpB;YACD,GAAG,CAAC,MAAM,CAAC,aAAa;gBACtB,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,yB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AC,MAAM,EAAE,CAAC,CAAA;AACpC,CAAC,CAAA;AAlEY,QAAA,mBAAmB,uBAkE/B;AAED,MAAM,iBAAiB,GAAgB;IACrC,aAAa,EAAb,qBAAa;IACb,mBAAmB,EAAnB,2BAAmB;CACpB,CAAA;AAED,kBAAe,iBAAiB,CAAA"}
@@ -4,6 +4,7 @@ import type { ExplorerApi } from './types';
4
4
  * No explorer configured - returns empty results
5
5
  */
6
6
  export declare const getOperations: ExplorerApi['getOperations'];
7
+ export declare const discoverTokenAssets: ExplorerApi['discoverTokenAssets'];
7
8
  declare const noExplorerAPI: ExplorerApi;
8
9
  export default noExplorerAPI;
9
10
  //# sourceMappingURL=none.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../../src/network/explorer/none.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAQtD,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,WAEpB,CAAA;AAED,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../../src/network/explorer/none.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAQtD,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAAkB,CAAA;AAErF,QAAA,MAAM,aAAa,EAAE,WAGpB,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -2,7 +2,7 @@
2
2
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getOperations = void 0;
5
+ exports.discoverTokenAssets = exports.getOperations = void 0;
6
6
  const types_1 = require("./types");
7
7
  /**
8
8
  * Returns all operation types from an address
@@ -18,8 +18,11 @@ const getOperations = async () => {
18
18
  };
19
19
  };
20
20
  exports.getOperations = getOperations;
21
+ const discoverTokenAssets = async () => [];
22
+ exports.discoverTokenAssets = discoverTokenAssets;
21
23
  const noExplorerAPI = {
22
24
  getOperations: exports.getOperations,
25
+ discoverTokenAssets: exports.discoverTokenAssets,
23
26
  };
24
27
  exports.default = noExplorerAPI;
25
28
  //# sourceMappingURL=none.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"none.js","sourceRoot":"","sources":["../../../src/network/explorer/none.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;AAGtC,mCAAkC;AAElC;;;GAGG;AACI,MAAM,aAAa,GAAiC,KAAK,IAAI,EAAE;IACpE,OAAO;QACL,kBAAkB,EAAE,EAAE;QACtB,mBAAmB,EAAE,EAAE;QACvB,iBAAiB,EAAE,EAAE;QACrB,sBAAsB,EAAE,EAAE;QAC1B,eAAe,EAAE,gBAAQ;KAC1B,CAAA;AACH,CAAC,CAAA;AARY,QAAA,aAAa,iBAQzB;AAED,MAAM,aAAa,GAAgB;IACjC,aAAa,EAAb,qBAAa;CACd,CAAA;AAED,kBAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"none.js","sourceRoot":"","sources":["../../../src/network/explorer/none.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;AAGtC,mCAAkC;AAElC;;;GAGG;AACI,MAAM,aAAa,GAAiC,KAAK,IAAI,EAAE;IACpE,OAAO;QACL,kBAAkB,EAAE,EAAE;QACtB,mBAAmB,EAAE,EAAE;QACvB,iBAAiB,EAAE,EAAE;QACrB,sBAAsB,EAAE,EAAE;QAC1B,eAAe,EAAE,gBAAQ;KAC1B,CAAA;AACH,CAAC,CAAA;AARY,QAAA,aAAa,iBAQzB;AAEM,MAAM,mBAAmB,GAAuC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAA;AAAxE,QAAA,mBAAmB,uBAAqD;AAErF,MAAM,aAAa,GAAgB;IACjC,aAAa,EAAb,qBAAa;IACb,mBAAmB,EAAnB,2BAAmB;CACpB,CAAA;AAED,kBAAe,aAAa,CAAA"}
@@ -1,15 +1,28 @@
1
1
  import type { EvmConfigInfo } from '../../config';
2
- import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types';
2
+ import type { AssetInfo, MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types';
3
+ import type { Logger } from '@ledgerhq/coin-module-framework/config';
3
4
  /** Constant representing no pagination token (end of pagination or first page) */
4
5
  export declare const NO_TOKEN = "";
5
6
  export type ExplorerApi = {
6
- getOperations: (config: EvmConfigInfo, currencyId: string, address: string, fromBlock: number, toBlock?: number, pagingToken?: string, limit?: number, order?: 'asc' | 'desc') => Promise<{
7
+ getOperations: (config: EvmConfigInfo, currencyId: string, address: string, fromBlock: number, toBlock: number | undefined, pagingToken: string | undefined, limit: number | undefined, order: 'asc' | 'desc' | undefined, logger: Logger) => Promise<{
7
8
  lastCoinOperations: Array<Operation<MemoNotSupported>>;
8
9
  lastTokenOperations: Array<Operation<MemoNotSupported>>;
9
10
  lastNftOperations: Array<Operation<MemoNotSupported>>;
10
11
  lastInternalOperations: Array<Operation<MemoNotSupported>>;
11
12
  nextPagingToken: string;
12
13
  }>;
14
+ /**
15
+ * Discover the tokens an address holds, without accumulating its operation history.
16
+ *
17
+ * Returns the deduplicated set of assets the address has ever transferred, as of the current
18
+ * chain head (or resumed from `fromBlock` when the arm supports it) — never operations, never
19
+ * raw explorer records. This is the only input `getBalance` needs to know which contracts to
20
+ * read a balance for.
21
+ *
22
+ * @param fromBlock resume the walk from this height instead of from genesis; an arm that does
23
+ * not support resuming ignores it and walks the full history.
24
+ */
25
+ discoverTokenAssets: (config: EvmConfigInfo, currencyId: string, address: string, fromBlock?: number) => Promise<AssetInfo[]>;
13
26
  };
14
27
  type ExplorerConfig = EvmConfigInfo['explorer'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AC,CAAA;CAC1B,CAAA;AAED,KAAK,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,gBAAgB,cAAc,KAC7B,cAAc,IAAI,cAAc,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAErD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,GACxC,gBAAgB,cAAc,KAC7B,cAAc,IAAI,cAAc,GAAG;IACpC,IAAI,EAAE,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,CAAA;CAKvF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/network/explorer/types.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;AAKtC,kFAAkF;AACrE,QAAA,QAAQ,GAAG,EAAE,CAAA;AAuB1B;;GAEG;AACI,MAAM,sBAAsB,GAAG,CACpC,cAA8B,EACyB,EAAE;IACzD,OAAO,cAAc,EAAE,IAAI,KAAK,QAAQ,CAAA;AAC1C,CAAC,CAAA;AAJY,QAAA,sBAAsB,0BAIlC;AAED;;GAEG;AACI,MAAM,6BAA6B,GAAG,CAC3C,cAA8B,EAG9B,EAAE;IACF,OAAO,CAAC,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAC3F,cAAc,EAAE,IAAc,CAC/B,CAAA;AACH,CAAC,CAAA;AARY,QAAA,6BAA6B,iCAQzC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/network/explorer/types.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;AAUtC,kFAAkF;AACrE,QAAA,QAAQ,GAAG,EAAE,CAAA;AA0C1B;;GAEG;AACI,MAAM,sBAAsB,GAAG,CACpC,cAA8B,EACyB,EAAE;IACzD,OAAO,cAAc,EAAE,IAAI,KAAK,QAAQ,CAAA;AAC1C,CAAC,CAAA;AAJY,QAAA,sBAAsB,0BAIlC;AAED;;GAEG;AACI,MAAM,6BAA6B,GAAG,CAC3C,cAA8B,EAG9B,EAAE;IACF,OAAO,CAAC,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAC3F,cAAc,EAAE,IAAc,CAC/B,CAAA;AACH,CAAC,CAAA;AARY,QAAA,6BAA6B,iCAQzC"}
@@ -0,0 +1,5 @@
1
+ export * from './node';
2
+ export * from './node/types';
3
+ export * from './gasTracker';
4
+ export * from './gasTracker/types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/network/index.ts"],"names":[],"mappings":"AAGA,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ __exportStar(require("./node"), exports);
20
+ __exportStar(require("./node/types"), exports);
21
+ __exportStar(require("./gasTracker"), exports);
22
+ __exportStar(require("./gasTracker/types"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/network/index.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;;;;;;;;;;;;;;AAEtC,yCAAsB;AACtB,+CAA4B;AAC5B,+CAA4B;AAC5B,qDAAkC"}