@ledgerhq/coin-stellar 6.26.0 → 6.26.1

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 (271) hide show
  1. package/.oxlintrc.json +7 -0
  2. package/CHANGELOG.md +6 -0
  3. package/LICENSE +194 -0
  4. package/knip.json +12 -0
  5. package/lib/api/index.d.ts +5 -5
  6. package/lib/api/index.d.ts.map +1 -1
  7. package/lib/api/index.js +12 -10
  8. package/lib/api/index.js.map +1 -1
  9. package/lib/config.d.ts +1 -1
  10. package/lib/config.d.ts.map +1 -1
  11. package/lib/config.js +2 -0
  12. package/lib/config.js.map +1 -1
  13. package/lib/constants.d.ts.map +1 -1
  14. package/lib/constants.js +3 -1
  15. package/lib/constants.js.map +1 -1
  16. package/lib/logic/broadcast.d.ts.map +1 -1
  17. package/lib/logic/broadcast.js +2 -0
  18. package/lib/logic/broadcast.js.map +1 -1
  19. package/lib/logic/combine.d.ts +1 -1
  20. package/lib/logic/combine.d.ts.map +1 -1
  21. package/lib/logic/combine.js +2 -0
  22. package/lib/logic/combine.js.map +1 -1
  23. package/lib/logic/common.d.ts +1 -1
  24. package/lib/logic/common.d.ts.map +1 -1
  25. package/lib/logic/common.js +4 -2
  26. package/lib/logic/common.js.map +1 -1
  27. package/lib/logic/craftTransaction.d.ts +1 -1
  28. package/lib/logic/craftTransaction.d.ts.map +1 -1
  29. package/lib/logic/craftTransaction.js +10 -8
  30. package/lib/logic/craftTransaction.js.map +1 -1
  31. package/lib/logic/estimateFees.d.ts.map +1 -1
  32. package/lib/logic/estimateFees.js +2 -0
  33. package/lib/logic/estimateFees.js.map +1 -1
  34. package/lib/logic/getBalance.d.ts +1 -1
  35. package/lib/logic/getBalance.d.ts.map +1 -1
  36. package/lib/logic/getBalance.js +4 -2
  37. package/lib/logic/getBalance.js.map +1 -1
  38. package/lib/logic/getBlock.d.ts +1 -1
  39. package/lib/logic/getBlock.d.ts.map +1 -1
  40. package/lib/logic/getBlock.js +39 -34
  41. package/lib/logic/getBlock.js.map +1 -1
  42. package/lib/logic/getBlockInfo.d.ts +1 -1
  43. package/lib/logic/getBlockInfo.d.ts.map +1 -1
  44. package/lib/logic/getBlockInfo.js +2 -0
  45. package/lib/logic/getBlockInfo.js.map +1 -1
  46. package/lib/logic/index.d.ts +12 -12
  47. package/lib/logic/index.d.ts.map +1 -1
  48. package/lib/logic/index.js +2 -0
  49. package/lib/logic/index.js.map +1 -1
  50. package/lib/logic/lastBlock.d.ts +1 -1
  51. package/lib/logic/lastBlock.d.ts.map +1 -1
  52. package/lib/logic/lastBlock.js +2 -0
  53. package/lib/logic/lastBlock.js.map +1 -1
  54. package/lib/logic/listOperations.d.ts +1 -1
  55. package/lib/logic/listOperations.d.ts.map +1 -1
  56. package/lib/logic/listOperations.js +6 -4
  57. package/lib/logic/listOperations.js.map +1 -1
  58. package/lib/logic/sdkWrapper.d.ts +1 -1
  59. package/lib/logic/sdkWrapper.d.ts.map +1 -1
  60. package/lib/logic/sdkWrapper.js +2 -0
  61. package/lib/logic/sdkWrapper.js.map +1 -1
  62. package/lib/logic/utils.d.ts.map +1 -1
  63. package/lib/logic/utils.js +4 -2
  64. package/lib/logic/utils.js.map +1 -1
  65. package/lib/logic/validateAddress.d.ts +1 -1
  66. package/lib/logic/validateAddress.d.ts.map +1 -1
  67. package/lib/logic/validateAddress.js +2 -0
  68. package/lib/logic/validateAddress.js.map +1 -1
  69. package/lib/logic/validateIntent.d.ts +2 -2
  70. package/lib/logic/validateIntent.d.ts.map +1 -1
  71. package/lib/logic/validateIntent.js +21 -19
  72. package/lib/logic/validateIntent.js.map +1 -1
  73. package/lib/logic/validateMemo.d.ts +1 -1
  74. package/lib/logic/validateMemo.d.ts.map +1 -1
  75. package/lib/logic/validateMemo.js +7 -5
  76. package/lib/logic/validateMemo.js.map +1 -1
  77. package/lib/network/horizon.d.ts +6 -7
  78. package/lib/network/horizon.d.ts.map +1 -1
  79. package/lib/network/horizon.js +71 -68
  80. package/lib/network/horizon.js.map +1 -1
  81. package/lib/network/horizonLedgerErrors.d.ts.map +1 -1
  82. package/lib/network/horizonLedgerErrors.js +5 -3
  83. package/lib/network/horizonLedgerErrors.js.map +1 -1
  84. package/lib/network/index.d.ts +1 -1
  85. package/lib/network/index.d.ts.map +1 -1
  86. package/lib/network/index.js +2 -0
  87. package/lib/network/index.js.map +1 -1
  88. package/lib/network/serialization.d.ts +6 -4
  89. package/lib/network/serialization.d.ts.map +1 -1
  90. package/lib/network/serialization.js +95 -91
  91. package/lib/network/serialization.js.map +1 -1
  92. package/lib/polyfill.d.ts.map +1 -1
  93. package/lib/polyfill.js +6 -4
  94. package/lib/polyfill.js.map +1 -1
  95. package/lib/supportedFeatures.d.ts +1 -1
  96. package/lib/supportedFeatures.d.ts.map +1 -1
  97. package/lib/supportedFeatures.js +3 -1
  98. package/lib/supportedFeatures.js.map +1 -1
  99. package/lib/types/errors.d.ts.map +1 -1
  100. package/lib/types/errors.js +14 -12
  101. package/lib/types/errors.js.map +1 -1
  102. package/lib/types/index.d.ts +2 -2
  103. package/lib/types/index.d.ts.map +1 -1
  104. package/lib/types/index.js +2 -0
  105. package/lib/types/index.js.map +1 -1
  106. package/lib/types/model.d.ts +6 -6
  107. package/lib/types/model.d.ts.map +1 -1
  108. package/lib/types/model.js +7 -5
  109. package/lib/types/model.js.map +1 -1
  110. package/lib-es/api/index.d.ts +5 -5
  111. package/lib-es/api/index.d.ts.map +1 -1
  112. package/lib-es/api/index.js +20 -18
  113. package/lib-es/api/index.js.map +1 -1
  114. package/lib-es/config.d.ts +1 -1
  115. package/lib-es/config.d.ts.map +1 -1
  116. package/lib-es/config.js +3 -1
  117. package/lib-es/config.js.map +1 -1
  118. package/lib-es/constants.d.ts.map +1 -1
  119. package/lib-es/constants.js +3 -1
  120. package/lib-es/constants.js.map +1 -1
  121. package/lib-es/logic/broadcast.d.ts.map +1 -1
  122. package/lib-es/logic/broadcast.js +3 -1
  123. package/lib-es/logic/broadcast.js.map +1 -1
  124. package/lib-es/logic/combine.d.ts +1 -1
  125. package/lib-es/logic/combine.d.ts.map +1 -1
  126. package/lib-es/logic/combine.js +3 -1
  127. package/lib-es/logic/combine.js.map +1 -1
  128. package/lib-es/logic/common.d.ts +1 -1
  129. package/lib-es/logic/common.d.ts.map +1 -1
  130. package/lib-es/logic/common.js +5 -3
  131. package/lib-es/logic/common.js.map +1 -1
  132. package/lib-es/logic/craftTransaction.d.ts +1 -1
  133. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  134. package/lib-es/logic/craftTransaction.js +15 -13
  135. package/lib-es/logic/craftTransaction.js.map +1 -1
  136. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  137. package/lib-es/logic/estimateFees.js +3 -1
  138. package/lib-es/logic/estimateFees.js.map +1 -1
  139. package/lib-es/logic/getBalance.d.ts +1 -1
  140. package/lib-es/logic/getBalance.d.ts.map +1 -1
  141. package/lib-es/logic/getBalance.js +5 -3
  142. package/lib-es/logic/getBalance.js.map +1 -1
  143. package/lib-es/logic/getBlock.d.ts +1 -1
  144. package/lib-es/logic/getBlock.d.ts.map +1 -1
  145. package/lib-es/logic/getBlock.js +42 -37
  146. package/lib-es/logic/getBlock.js.map +1 -1
  147. package/lib-es/logic/getBlockInfo.d.ts +1 -1
  148. package/lib-es/logic/getBlockInfo.d.ts.map +1 -1
  149. package/lib-es/logic/getBlockInfo.js +3 -1
  150. package/lib-es/logic/getBlockInfo.js.map +1 -1
  151. package/lib-es/logic/index.d.ts +12 -12
  152. package/lib-es/logic/index.d.ts.map +1 -1
  153. package/lib-es/logic/index.js +14 -12
  154. package/lib-es/logic/index.js.map +1 -1
  155. package/lib-es/logic/lastBlock.d.ts +1 -1
  156. package/lib-es/logic/lastBlock.d.ts.map +1 -1
  157. package/lib-es/logic/lastBlock.js +3 -1
  158. package/lib-es/logic/lastBlock.js.map +1 -1
  159. package/lib-es/logic/listOperations.d.ts +1 -1
  160. package/lib-es/logic/listOperations.d.ts.map +1 -1
  161. package/lib-es/logic/listOperations.js +7 -5
  162. package/lib-es/logic/listOperations.js.map +1 -1
  163. package/lib-es/logic/sdkWrapper.d.ts +1 -1
  164. package/lib-es/logic/sdkWrapper.d.ts.map +1 -1
  165. package/lib-es/logic/sdkWrapper.js +4 -2
  166. package/lib-es/logic/sdkWrapper.js.map +1 -1
  167. package/lib-es/logic/utils.d.ts.map +1 -1
  168. package/lib-es/logic/utils.js +6 -4
  169. package/lib-es/logic/utils.js.map +1 -1
  170. package/lib-es/logic/validateAddress.d.ts +1 -1
  171. package/lib-es/logic/validateAddress.d.ts.map +1 -1
  172. package/lib-es/logic/validateAddress.js +3 -1
  173. package/lib-es/logic/validateAddress.js.map +1 -1
  174. package/lib-es/logic/validateIntent.d.ts +2 -2
  175. package/lib-es/logic/validateIntent.d.ts.map +1 -1
  176. package/lib-es/logic/validateIntent.js +30 -28
  177. package/lib-es/logic/validateIntent.js.map +1 -1
  178. package/lib-es/logic/validateMemo.d.ts +1 -1
  179. package/lib-es/logic/validateMemo.d.ts.map +1 -1
  180. package/lib-es/logic/validateMemo.js +8 -6
  181. package/lib-es/logic/validateMemo.js.map +1 -1
  182. package/lib-es/network/horizon.d.ts +6 -7
  183. package/lib-es/network/horizon.d.ts.map +1 -1
  184. package/lib-es/network/horizon.js +80 -77
  185. package/lib-es/network/horizon.js.map +1 -1
  186. package/lib-es/network/horizonLedgerErrors.d.ts.map +1 -1
  187. package/lib-es/network/horizonLedgerErrors.js +7 -5
  188. package/lib-es/network/horizonLedgerErrors.js.map +1 -1
  189. package/lib-es/network/index.d.ts +1 -1
  190. package/lib-es/network/index.d.ts.map +1 -1
  191. package/lib-es/network/index.js +3 -1
  192. package/lib-es/network/index.js.map +1 -1
  193. package/lib-es/network/serialization.d.ts +6 -4
  194. package/lib-es/network/serialization.d.ts.map +1 -1
  195. package/lib-es/network/serialization.js +97 -95
  196. package/lib-es/network/serialization.js.map +1 -1
  197. package/lib-es/polyfill.d.ts.map +1 -1
  198. package/lib-es/polyfill.js +7 -5
  199. package/lib-es/polyfill.js.map +1 -1
  200. package/lib-es/supportedFeatures.d.ts +1 -1
  201. package/lib-es/supportedFeatures.d.ts.map +1 -1
  202. package/lib-es/supportedFeatures.js +3 -1
  203. package/lib-es/supportedFeatures.js.map +1 -1
  204. package/lib-es/types/errors.d.ts.map +1 -1
  205. package/lib-es/types/errors.js +15 -13
  206. package/lib-es/types/errors.js.map +1 -1
  207. package/lib-es/types/index.d.ts +2 -2
  208. package/lib-es/types/index.d.ts.map +1 -1
  209. package/lib-es/types/index.js +4 -2
  210. package/lib-es/types/index.js.map +1 -1
  211. package/lib-es/types/model.d.ts +6 -6
  212. package/lib-es/types/model.d.ts.map +1 -1
  213. package/lib-es/types/model.js +7 -5
  214. package/lib-es/types/model.js.map +1 -1
  215. package/package.json +13 -16
  216. package/src/api/index.integ.test.ts +165 -162
  217. package/src/api/index.test.ts +106 -103
  218. package/src/api/index.ts +49 -46
  219. package/src/api/index_error.test.ts +48 -25
  220. package/src/config.ts +15 -12
  221. package/src/constants.ts +4 -1
  222. package/src/globals.d.ts +7 -5
  223. package/src/logic/broadcast.integ.test.ts +22 -19
  224. package/src/logic/broadcast.ts +5 -2
  225. package/src/logic/combine.test.ts +18 -15
  226. package/src/logic/combine.ts +8 -5
  227. package/src/logic/common.ts +9 -6
  228. package/src/logic/craftTransaction.test.ts +76 -75
  229. package/src/logic/craftTransaction.ts +46 -43
  230. package/src/logic/estimateFees.ts +6 -3
  231. package/src/logic/getBalance.test.ts +31 -28
  232. package/src/logic/getBalance.ts +13 -10
  233. package/src/logic/getBlock.integ.test.ts +40 -39
  234. package/src/logic/getBlock.test.ts +462 -415
  235. package/src/logic/getBlock.ts +142 -127
  236. package/src/logic/getBlockInfo.test.ts +72 -69
  237. package/src/logic/getBlockInfo.ts +15 -12
  238. package/src/logic/index.ts +15 -12
  239. package/src/logic/lastBlock.ts +6 -3
  240. package/src/logic/listOperations.ts +14 -11
  241. package/src/logic/listOperations.unit.test.ts +212 -209
  242. package/src/logic/networkWrappers.test.ts +32 -29
  243. package/src/logic/sdkWrapper.ts +19 -16
  244. package/src/logic/utils.ts +13 -10
  245. package/src/logic/validateAddress.test.ts +21 -18
  246. package/src/logic/validateAddress.ts +7 -4
  247. package/src/logic/validateIntent.test.ts +62 -59
  248. package/src/logic/validateIntent.ts +87 -84
  249. package/src/logic/validateMemo.test.ts +50 -47
  250. package/src/logic/validateMemo.ts +16 -13
  251. package/src/network/broadcastTransaction.test.ts +60 -60
  252. package/src/network/fetchLedgerOperations.unit.test.ts +155 -0
  253. package/src/network/horizon.integ.test.ts +45 -42
  254. package/src/network/horizon.test.ts +17 -14
  255. package/src/network/horizon.ts +279 -281
  256. package/src/network/horizon.unit.test.ts +238 -237
  257. package/src/network/horizonLedgerErrors.test.ts +81 -78
  258. package/src/network/horizonLedgerErrors.ts +22 -19
  259. package/src/network/index.ts +4 -1
  260. package/src/network/registerHorizonInterceptors.test.ts +163 -160
  261. package/src/network/serialization.ts +232 -227
  262. package/src/network/serialization.unit.test.ts +801 -798
  263. package/src/polyfill.ts +18 -15
  264. package/src/supportedFeatures.ts +6 -3
  265. package/src/types/errors.ts +33 -32
  266. package/src/types/index.ts +5 -2
  267. package/src/types/model.ts +55 -52
  268. package/tsconfig.json +1 -1
  269. package/.unimportedrc.json +0 -17
  270. package/LICENSE.txt +0 -21
  271. package/src/network/fetchLedgerOperations.nock.unit.test.ts +0 -156
@@ -0,0 +1,155 @@
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { CoinConfig } from '@ledgerhq/coin-module-framework/config'
5
+ import { Horizon, NotFoundError } from '@stellar/stellar-sdk'
6
+ import coinConfig, { type StellarCoinConfig } from '../config'
7
+ import { fetchAllLedgerOperations, fetchLedgerRecord } from './horizon'
8
+
9
+ const HORIZON = 'https://horizon-testnet.stellar.org'
10
+
11
+ let originalGetCoinConfig: CoinConfig<StellarCoinConfig>
12
+
13
+ /** Minimal Horizon payment op shape (embedded.records). */
14
+ const MINIMAL_HORIZON_PAYMENT_OP = {
15
+ _links: {
16
+ self: { href: '' },
17
+ transaction: { href: '' },
18
+ effects: { href: '' },
19
+ succeeds: { href: '' },
20
+ precedes: { href: '' },
21
+ },
22
+ id: '1',
23
+ paging_token: '1',
24
+ transaction_successful: true,
25
+ source_account: 'GB7FW6GRFEH63Q3BVRT65VMB26OKHQRG74QRFUMTL6D553UKDZCDM7U',
26
+ type: 'payment',
27
+ type_i: 1,
28
+ created_at: '2015-07-20T20:27:50Z',
29
+ transaction_hash: 'txh',
30
+ asset_type: 'native',
31
+ from: 'GB7FW6GRFEH63Q3BVRT65VMB26OKHQRG74QRFUMTL6D553UKDZCDM7U',
32
+ to: 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN',
33
+ amount: '1.0000000',
34
+ }
35
+
36
+ /**
37
+ * Minimal chainable stub of a Horizon call builder: every builder method returns
38
+ * the builder itself, and `call()` resolves (or rejects) with the configured value.
39
+ * Lets us drive `getServer().ledgers()...call()` / `.operations()...call()` without HTTP.
40
+ */
41
+ function callBuilder(call: () => Promise<unknown>): unknown {
42
+ const builder: unknown = new Proxy(
43
+ {},
44
+ {
45
+ get(_target, prop) {
46
+ if (prop === 'call') return call
47
+ return () => builder
48
+ },
49
+ }
50
+ )
51
+ return builder
52
+ }
53
+
54
+ function setExplorer(fetchLimit = 100): void {
55
+ coinConfig.setCoinConfig(
56
+ (): StellarCoinConfig =>
57
+ ({
58
+ status: { type: 'active' },
59
+ explorer: { url: `${HORIZON}/`, fetchLimit },
60
+ }) as StellarCoinConfig
61
+ )
62
+ }
63
+
64
+ function mockLedgers(call: () => Promise<unknown>): void {
65
+ jest.spyOn(Horizon.Server.prototype, 'ledgers').mockReturnValue(callBuilder(call) as never)
66
+ }
67
+
68
+ function mockOperations(call: () => Promise<unknown>): void {
69
+ jest.spyOn(Horizon.Server.prototype, 'operations').mockReturnValue(callBuilder(call) as never)
70
+ }
71
+
72
+ describe('fetchLedgerRecord / fetchAllLedgerOperations', () => {
73
+ beforeAll(() => {
74
+ originalGetCoinConfig = coinConfig.getCoinConfig
75
+ })
76
+
77
+ afterAll(() => {
78
+ if (originalGetCoinConfig) {
79
+ coinConfig.setCoinConfig(originalGetCoinConfig)
80
+ }
81
+ })
82
+
83
+ beforeEach(() => {
84
+ setExplorer(100)
85
+ })
86
+
87
+ afterEach(() => {
88
+ jest.restoreAllMocks()
89
+ })
90
+
91
+ it('fetchLedgerRecord maps 404 to not found error', async () => {
92
+ mockLedgers(() => Promise.reject(new NotFoundError('Not Found', {} as never)))
93
+
94
+ await expect(fetchLedgerRecord(424242)).rejects.toThrow('Stellar ledger 424242 not found')
95
+ })
96
+
97
+ it('fetchAllLedgerOperations maps 404 to not found error', async () => {
98
+ mockOperations(() => Promise.reject(new NotFoundError('Not Found', {} as never)))
99
+
100
+ await expect(fetchAllLedgerOperations(424243)).rejects.toThrow(
101
+ 'Stellar ledger 424243 not found'
102
+ )
103
+ })
104
+
105
+ it('fetchLedgerRecord returns ledger on 200', async () => {
106
+ const ledgerBody = {
107
+ _links: { self: { href: '' }, transactions: { href: '' }, operations: { href: '' } },
108
+ id: 'abc',
109
+ paging_token: 'abc',
110
+ hash: '0000000000000000000000000000000000000000000000000000000000000000',
111
+ prev_hash: '',
112
+ sequence: 3,
113
+ successful_transaction_count: 0,
114
+ failed_transaction_count: 0,
115
+ operation_count: 0,
116
+ tx_set_operation_count: 0,
117
+ closed_at: '2015-07-20T20:27:50Z',
118
+ total_coins: '100000000000.0000000',
119
+ fee_pool: '0.0000000',
120
+ base_fee_in_stroops: 100,
121
+ base_reserve_in_stroops: 100000000,
122
+ max_tx_set_size: 50,
123
+ protocol_version: 1,
124
+ header_xdr: '',
125
+ }
126
+ mockLedgers(() => Promise.resolve(ledgerBody))
127
+
128
+ const rec = await fetchLedgerRecord(3)
129
+ expect(rec.sequence).toBe(3)
130
+ expect(rec.hash).toBe(ledgerBody.hash)
131
+ })
132
+
133
+ it('fetchAllLedgerOperations returns embedded records on 200', async () => {
134
+ const page = {
135
+ records: [MINIMAL_HORIZON_PAYMENT_OP],
136
+ next: () => Promise.resolve({ records: [] }),
137
+ }
138
+ mockOperations(() => Promise.resolve(page))
139
+
140
+ const records = await fetchAllLedgerOperations(10)
141
+ expect(records).toHaveLength(1)
142
+ expect(records[0].type).toBe('payment')
143
+ })
144
+
145
+ it('fetchAllLedgerOperations paginates when page is full then stops on empty page', async () => {
146
+ setExplorer(1)
147
+
148
+ const page2 = { records: [], next: () => Promise.resolve({ records: [] }) }
149
+ const page1 = { records: [MINIMAL_HORIZON_PAYMENT_OP], next: () => Promise.resolve(page2) }
150
+ mockOperations(() => Promise.resolve(page1))
151
+
152
+ const records = await fetchAllLedgerOperations(11)
153
+ expect(records.length).toBe(1)
154
+ })
155
+ })
@@ -1,67 +1,70 @@
1
- import coinConfig, { StellarCoinConfig } from "../config";
2
- import { fetchAllOperations, registerHorizonInterceptors } from "./horizon";
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- describe("fetchAllOperations", () => {
4
+ import coinConfig, { StellarCoinConfig } from '../config'
5
+ import { fetchAllOperations, registerHorizonInterceptors } from './horizon'
6
+
7
+ describe('fetchAllOperations', () => {
5
8
  beforeAll(() => {
6
9
  coinConfig.setCoinConfig(
7
10
  (): StellarCoinConfig => ({
8
- status: { type: "active" },
11
+ status: { type: 'active' },
9
12
  explorer: {
10
- url: "https://stellar.coin.ledger.com",
13
+ url: 'https://stellar.coin.ledger.com',
11
14
  fetchLimit: 10,
12
15
  },
13
- }),
14
- );
15
- registerHorizonInterceptors();
16
- });
16
+ })
17
+ )
18
+ registerHorizonInterceptors()
19
+ })
17
20
 
18
21
  it(
19
- "fetch operations with limitations, set order to desc",
22
+ 'fetch operations with limitations, set order to desc',
20
23
  async () => {
21
- const addr = "GCOCZ3ODGW3YH6PPGMLGT3MORS5YBTVJCSL46TC2NMU2KCXGL52XLEZB";
22
- const limit = 30;
23
- const ops = await fetchAllOperations(addr, addr, "desc", "241343231793946722", limit);
24
- expect(ops.length).toEqual(limit);
24
+ const addr = 'GCOCZ3ODGW3YH6PPGMLGT3MORS5YBTVJCSL46TC2NMU2KCXGL52XLEZB'
25
+ const limit = 30
26
+ const ops = await fetchAllOperations(addr, addr, 'desc', '241343231793946722', limit)
27
+ expect(ops.length).toEqual(limit)
25
28
  expect(ops[0].id).toEqual(
26
- `${addr}-00b0081a2c5c5e62cf5f5813691d33ab71a8b46b115d645bcd9df4e9c7941778-IN`,
27
- );
29
+ `${addr}-00b0081a2c5c5e62cf5f5813691d33ab71a8b46b115d645bcd9df4e9c7941778-IN`
30
+ )
28
31
  expect(ops[29].id).toEqual(
29
- `${addr}-00b0081a2c5c5e62cf5f5813691d33ab71a8b46b115d645bcd9df4e9c7941778-IN`,
30
- );
32
+ `${addr}-00b0081a2c5c5e62cf5f5813691d33ab71a8b46b115d645bcd9df4e9c7941778-IN`
33
+ )
31
34
  },
32
- 10 * 1_000,
33
- );
35
+ 10 * 1_000
36
+ )
34
37
 
35
38
  it(
36
- "fetch operations without limitations, set order to desc",
39
+ 'fetch operations without limitations, set order to desc',
37
40
  async () => {
38
- const addr = "GCOCZ3ODGW3YH6PPGMLGT3MORS5YBTVJCSL46TC2NMU2KCXGL52XLEZB";
39
- const ops = await fetchAllOperations(addr, addr, "desc", "241330913827401737");
40
- expect(ops.length).toEqual(19);
41
+ const addr = 'GCOCZ3ODGW3YH6PPGMLGT3MORS5YBTVJCSL46TC2NMU2KCXGL52XLEZB'
42
+ const ops = await fetchAllOperations(addr, addr, 'desc', '241330913827401737')
43
+ expect(ops.length).toEqual(19)
41
44
  expect(ops[0].id).toEqual(
42
- `${addr}-7352d7e754c93b39213288a268efec78843ce8db6fa15f88308c7c852f6806c9-IN`,
43
- );
45
+ `${addr}-7352d7e754c93b39213288a268efec78843ce8db6fa15f88308c7c852f6806c9-IN`
46
+ )
44
47
  expect(ops[18].id).toEqual(
45
- `${addr}-af8982997f1765ebbd41b36ab6927825f7083dc3ced07d1d086c1a3ca9c7e3e9-IN`,
46
- );
48
+ `${addr}-af8982997f1765ebbd41b36ab6927825f7083dc3ced07d1d086c1a3ca9c7e3e9-IN`
49
+ )
47
50
  },
48
- 10 * 1_000,
49
- );
51
+ 10 * 1_000
52
+ )
50
53
 
51
54
  it(
52
- "fetch operations with limitations, set order to asc",
55
+ 'fetch operations with limitations, set order to asc',
53
56
  async () => {
54
- const addr = "GCOCZ3ODGW3YH6PPGMLGT3MORS5YBTVJCSL46TC2NMU2KCXGL52XLEZB";
55
- const limit = 20;
56
- const ops = await fetchAllOperations(addr, addr, "asc", "241343201729257475", limit);
57
- expect(ops.length).toEqual(limit);
57
+ const addr = 'GCOCZ3ODGW3YH6PPGMLGT3MORS5YBTVJCSL46TC2NMU2KCXGL52XLEZB'
58
+ const limit = 20
59
+ const ops = await fetchAllOperations(addr, addr, 'asc', '241343201729257475', limit)
60
+ expect(ops.length).toEqual(limit)
58
61
  expect(ops[0].id).toEqual(
59
- `${addr}-71b49018e0ad4f9c72132a89bb58f921158aed3023f7543bab176881ff0b5b14-IN`,
60
- );
62
+ `${addr}-71b49018e0ad4f9c72132a89bb58f921158aed3023f7543bab176881ff0b5b14-IN`
63
+ )
61
64
  expect(ops[19].id).toEqual(
62
- `${addr}-71b49018e0ad4f9c72132a89bb58f921158aed3023f7543bab176881ff0b5b14-IN`,
63
- );
65
+ `${addr}-71b49018e0ad4f9c72132a89bb58f921158aed3023f7543bab176881ff0b5b14-IN`
66
+ )
64
67
  },
65
- 10 * 1_000,
66
- );
67
- });
68
+ 10 * 1_000
69
+ )
70
+ })
@@ -1,19 +1,22 @@
1
- import coinConfig from "../config";
2
- import { useConfigHostAndProtocol } from "./horizon";
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- describe("Horizon", () => {
4
+ import coinConfig from '../config'
5
+ import { useConfigHostAndProtocol } from './horizon'
6
+
7
+ describe('Horizon', () => {
5
8
  beforeAll(() => {
6
9
  coinConfig.setCoinConfig(
7
- () => ({ explorer: { url: "https://stellar.coin.ledger.com" } }) as any,
8
- );
9
- });
10
+ () => ({ explorer: { url: 'https://stellar.coin.ledger.com' } }) as any
11
+ )
12
+ })
10
13
 
11
- describe("useConfigHostAndProtocol", () => {
14
+ describe('useConfigHostAndProtocol', () => {
12
15
  it.each([
13
- ["host", "https://injected.com/1"],
14
- ["protocol", "injected://stellar.coin.ledger.com/1"],
15
- ])("overwrites the %s of the URL with the original one", (_s, url) => {
16
- expect(useConfigHostAndProtocol(url)).toEqual("https://stellar.coin.ledger.com/1");
17
- });
18
- });
19
- });
16
+ ['host', 'https://injected.com/1'],
17
+ ['protocol', 'injected://stellar.coin.ledger.com/1'],
18
+ ])('overwrites the %s of the URL with the original one', (_s, url) => {
19
+ expect(useConfigHostAndProtocol(url)).toEqual('https://stellar.coin.ledger.com/1')
20
+ })
21
+ })
22
+ })