@gala-chain/launchpad-sdk 8.0.2 → 9.0.0-rc.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 (269) hide show
  1. package/CHANGELOG.md +362 -0
  2. package/EXAMPLES.md +95 -681
  3. package/MIGRATING-TO-9.0.md +301 -0
  4. package/README.md +46 -17
  5. package/dist/LaunchpadSDK.d.ts +150 -419
  6. package/dist/LaunchpadSDK.d.ts.map +1 -1
  7. package/dist/api/LaunchpadAPI.d.ts +37 -43
  8. package/dist/api/LaunchpadAPI.d.ts.map +1 -1
  9. package/dist/auth/SessionAuthService.d.ts.map +1 -1
  10. package/dist/auth/SignatureAuth.d.ts +2 -2
  11. package/dist/auth/SignatureAuth.d.ts.map +1 -1
  12. package/dist/auth/types.d.ts +1 -1
  13. package/dist/auth/types.d.ts.map +1 -1
  14. package/dist/config/environments.d.ts +7 -2
  15. package/dist/config/environments.d.ts.map +1 -1
  16. package/dist/constants/decimals.d.ts +0 -23
  17. package/dist/constants/decimals.d.ts.map +1 -1
  18. package/dist/constants/endpoints.d.ts +0 -7
  19. package/dist/constants/endpoints.d.ts.map +1 -1
  20. package/dist/constants/version.generated.d.ts +1 -1
  21. package/dist/constants/version.generated.d.ts.map +1 -1
  22. package/dist/helpers/sdk.d.ts.map +1 -1
  23. package/dist/index.browser.d.ts +11 -23
  24. package/dist/index.browser.d.ts.map +1 -1
  25. package/dist/index.browser.esm.js +1 -1
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.esm.js +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/index.node.d.ts +4 -5
  30. package/dist/index.node.d.ts.map +1 -1
  31. package/dist/launchpad/bundle-submission.d.ts +1 -9
  32. package/dist/launchpad/bundle-submission.d.ts.map +1 -1
  33. package/dist/launchpad/sell-fee-ceiling.d.ts +66 -0
  34. package/dist/launchpad/sell-fee-ceiling.d.ts.map +1 -0
  35. package/dist/launchpad/transport.d.ts +2 -1
  36. package/dist/launchpad/transport.d.ts.map +1 -1
  37. package/dist/launchpad/writes.d.ts +30 -2
  38. package/dist/launchpad/writes.d.ts.map +1 -1
  39. package/dist/native.cjs +1 -1
  40. package/dist/native.d.ts +3 -4
  41. package/dist/native.d.ts.map +1 -1
  42. package/dist/native.esm.js +1 -1
  43. package/dist/schemas/launchpad.d.ts +4 -4
  44. package/dist/schemas/launchpad.d.ts.map +1 -1
  45. package/dist/schemas/user.d.ts +0 -15
  46. package/dist/schemas/user.d.ts.map +1 -1
  47. package/dist/services/AbstractCacheService.d.ts +2 -2
  48. package/dist/services/BundleService.d.ts +9 -1
  49. package/dist/services/BundleService.d.ts.map +1 -1
  50. package/dist/services/GalaChainBalanceService.d.ts +17 -89
  51. package/dist/services/GalaChainBalanceService.d.ts.map +1 -1
  52. package/dist/services/GalaChainLockService.d.ts +19 -20
  53. package/dist/services/GalaChainLockService.d.ts.map +1 -1
  54. package/dist/services/GalaChainService.d.ts +28 -64
  55. package/dist/services/GalaChainService.d.ts.map +1 -1
  56. package/dist/services/GalaChainTokenService.d.ts +25 -53
  57. package/dist/services/GalaChainTokenService.d.ts.map +1 -1
  58. package/dist/services/GalaChainTransferService.d.ts +42 -41
  59. package/dist/services/GalaChainTransferService.d.ts.map +1 -1
  60. package/dist/services/LaunchpadPriceService.d.ts +66 -0
  61. package/dist/services/LaunchpadPriceService.d.ts.map +1 -0
  62. package/dist/services/NftCollectionService.d.ts +22 -6
  63. package/dist/services/NftCollectionService.d.ts.map +1 -1
  64. package/dist/services/TokenResolverService.d.ts +5 -5
  65. package/dist/services/TokenResolverService.d.ts.map +1 -1
  66. package/dist/services/TradingQuotesService.d.ts +3 -5
  67. package/dist/services/TradingQuotesService.d.ts.map +1 -1
  68. package/dist/services/gateway-transport.d.ts +32 -0
  69. package/dist/services/gateway-transport.d.ts.map +1 -0
  70. package/dist/services/gateway-writes.d.ts +83 -0
  71. package/dist/services/gateway-writes.d.ts.map +1 -0
  72. package/dist/signing/index.d.ts +2 -3
  73. package/dist/signing/index.d.ts.map +1 -1
  74. package/dist/signing/signers.d.ts +23 -11
  75. package/dist/signing/signers.d.ts.map +1 -1
  76. package/dist/signing/types.d.ts +7 -10
  77. package/dist/signing/types.d.ts.map +1 -1
  78. package/dist/types/burn.dto.d.ts +4 -2
  79. package/dist/types/burn.dto.d.ts.map +1 -1
  80. package/dist/types/common.d.ts +2 -23
  81. package/dist/types/common.d.ts.map +1 -1
  82. package/dist/types/dto.d.ts +0 -5
  83. package/dist/types/dto.d.ts.map +1 -1
  84. package/dist/types/launchpad.dto.d.ts +0 -269
  85. package/dist/types/launchpad.dto.d.ts.map +1 -1
  86. package/dist/types/lock.dto.d.ts +12 -7
  87. package/dist/types/lock.dto.d.ts.map +1 -1
  88. package/dist/types/options.dto.d.ts +8 -34
  89. package/dist/types/options.dto.d.ts.map +1 -1
  90. package/dist/types/session-auth.dto.d.ts +2 -4
  91. package/dist/types/session-auth.dto.d.ts.map +1 -1
  92. package/dist/types/user.dto.d.ts +7 -62
  93. package/dist/types/user.dto.d.ts.map +1 -1
  94. package/dist/utils/address-formatter.d.ts +10 -2
  95. package/dist/utils/address-formatter.d.ts.map +1 -1
  96. package/dist/utils/agent-config.d.ts +9 -4
  97. package/dist/utils/agent-config.d.ts.map +1 -1
  98. package/dist/utils/auto-pagination.d.ts +6 -239
  99. package/dist/utils/auto-pagination.d.ts.map +1 -1
  100. package/dist/utils/bignumber-helpers.d.ts +3 -2
  101. package/dist/utils/bignumber-helpers.d.ts.map +1 -1
  102. package/dist/utils/delimiter-parser.d.ts +0 -13
  103. package/dist/utils/delimiter-parser.d.ts.map +1 -1
  104. package/dist/utils/error-patterns.d.ts +0 -47
  105. package/dist/utils/error-patterns.d.ts.map +1 -1
  106. package/dist/utils/error-wrapper.d.ts +5 -5
  107. package/dist/utils/errors.d.ts +0 -308
  108. package/dist/utils/errors.d.ts.map +1 -1
  109. package/dist/utils/http.d.ts +15 -3
  110. package/dist/utils/http.d.ts.map +1 -1
  111. package/dist/utils/token-format-converter.d.ts +1 -1
  112. package/dist/utils/token-parser.d.ts +6 -127
  113. package/dist/utils/token-parser.d.ts.map +1 -1
  114. package/dist/utils/token-stringification.d.ts +7 -7
  115. package/dist/utils/token-stringification.d.ts.map +1 -1
  116. package/dist/utils/tokenNameNormalizer.d.ts +2 -2
  117. package/dist/utils/tokenNormalizer.d.ts +5 -29
  118. package/dist/utils/tokenNormalizer.d.ts.map +1 -1
  119. package/dist/utils/trade-quote.d.ts +32 -0
  120. package/dist/utils/trade-quote.d.ts.map +1 -0
  121. package/dist/utils/unique-key-generator.d.ts +7 -134
  122. package/dist/utils/unique-key-generator.d.ts.map +1 -1
  123. package/dist/utils/validation-helpers.d.ts +3 -5
  124. package/dist/utils/validation-helpers.d.ts.map +1 -1
  125. package/package.json +47 -87
  126. package/dist/api/dto/BurnTokensDto.d.ts +0 -77
  127. package/dist/api/dto/BurnTokensDto.d.ts.map +0 -1
  128. package/dist/api/dto/LockTokenDto.d.ts +0 -85
  129. package/dist/api/dto/LockTokenDto.d.ts.map +0 -1
  130. package/dist/api/dto/TransferTokenDto.d.ts +0 -64
  131. package/dist/api/dto/TransferTokenDto.d.ts.map +0 -1
  132. package/dist/api/dto/UnlockTokenDto.d.ts +0 -74
  133. package/dist/api/dto/UnlockTokenDto.d.ts.map +0 -1
  134. package/dist/bridge/BridgeService.d.ts +0 -484
  135. package/dist/bridge/BridgeService.d.ts.map +0 -1
  136. package/dist/bridge/GalaConnectClient.d.ts +0 -170
  137. package/dist/bridge/GalaConnectClient.d.ts.map +0 -1
  138. package/dist/bridge/constants/index.d.ts +0 -7
  139. package/dist/bridge/constants/index.d.ts.map +0 -1
  140. package/dist/bridge/constants/tokens.d.ts +0 -212
  141. package/dist/bridge/constants/tokens.d.ts.map +0 -1
  142. package/dist/bridge/index.d.ts +0 -24
  143. package/dist/bridge/index.d.ts.map +0 -1
  144. package/dist/bridge/public-types.d.ts +0 -2
  145. package/dist/bridge/public-types.d.ts.map +0 -1
  146. package/dist/bridge/strategies/BridgeStrategy.d.ts +0 -204
  147. package/dist/bridge/strategies/BridgeStrategy.d.ts.map +0 -1
  148. package/dist/bridge/strategies/EthereumBridgeStrategy.d.ts +0 -178
  149. package/dist/bridge/strategies/EthereumBridgeStrategy.d.ts.map +0 -1
  150. package/dist/bridge/strategies/SolanaBridgeStrategy.d.ts +0 -236
  151. package/dist/bridge/strategies/SolanaBridgeStrategy.d.ts.map +0 -1
  152. package/dist/bridge/types/bridge.dto.d.ts +0 -772
  153. package/dist/bridge/types/bridge.dto.d.ts.map +0 -1
  154. package/dist/bridge/types/bridgeable-token.dto.d.ts +0 -209
  155. package/dist/bridge/types/bridgeable-token.dto.d.ts.map +0 -1
  156. package/dist/bridge/types/eip712.d.ts +0 -66
  157. package/dist/bridge/types/eip712.d.ts.map +0 -1
  158. package/dist/bridge/types/index.d.ts +0 -8
  159. package/dist/bridge/types/index.d.ts.map +0 -1
  160. package/dist/bridge/utils/RateLimiter.d.ts +0 -34
  161. package/dist/bridge/utils/RateLimiter.d.ts.map +0 -1
  162. package/dist/bridge/utils/address-formatter.d.ts +0 -25
  163. package/dist/bridge/utils/address-formatter.d.ts.map +0 -1
  164. package/dist/bridge/utils/addressValidation.d.ts +0 -200
  165. package/dist/bridge/utils/addressValidation.d.ts.map +0 -1
  166. package/dist/bridge/utils/balanceHelpers.d.ts +0 -215
  167. package/dist/bridge/utils/balanceHelpers.d.ts.map +0 -1
  168. package/dist/bridge/utils/bridgeErrors.d.ts +0 -98
  169. package/dist/bridge/utils/bridgeErrors.d.ts.map +0 -1
  170. package/dist/bridge/utils/bridgeOutHelpers.d.ts +0 -68
  171. package/dist/bridge/utils/bridgeOutHelpers.d.ts.map +0 -1
  172. package/dist/bridge/utils/bridgePayload.d.ts +0 -98
  173. package/dist/bridge/utils/bridgePayload.d.ts.map +0 -1
  174. package/dist/bridge/utils/bridgeStatusParser.d.ts +0 -76
  175. package/dist/bridge/utils/bridgeStatusParser.d.ts.map +0 -1
  176. package/dist/bridge/utils/eip712Helpers.d.ts +0 -66
  177. package/dist/bridge/utils/eip712Helpers.d.ts.map +0 -1
  178. package/dist/bridge/utils/index.d.ts +0 -19
  179. package/dist/bridge/utils/index.d.ts.map +0 -1
  180. package/dist/bridge/utils/retry.d.ts +0 -112
  181. package/dist/bridge/utils/retry.d.ts.map +0 -1
  182. package/dist/bridge/utils/strategyDelegation.d.ts +0 -126
  183. package/dist/bridge/utils/strategyDelegation.d.ts.map +0 -1
  184. package/dist/bridge/utils/tokenIdUtils.d.ts +0 -86
  185. package/dist/bridge/utils/tokenIdUtils.d.ts.map +0 -1
  186. package/dist/bridge/utils/tokenMath.d.ts +0 -39
  187. package/dist/bridge/utils/tokenMath.d.ts.map +0 -1
  188. package/dist/bridge/utils/tokenMetadataResolver.d.ts +0 -97
  189. package/dist/bridge/utils/tokenMetadataResolver.d.ts.map +0 -1
  190. package/dist/helpers/wallet.d.ts +0 -151
  191. package/dist/helpers/wallet.d.ts.map +0 -1
  192. package/dist/react/WalletContext.d.ts +0 -60
  193. package/dist/react/WalletContext.d.ts.map +0 -1
  194. package/dist/react/index.d.ts +0 -65
  195. package/dist/react/index.d.ts.map +0 -1
  196. package/dist/react/types.d.ts +0 -76
  197. package/dist/react/types.d.ts.map +0 -1
  198. package/dist/react/useWallet.d.ts +0 -123
  199. package/dist/react/useWallet.d.ts.map +0 -1
  200. package/dist/react/useWalletConnection.d.ts +0 -89
  201. package/dist/react/useWalletConnection.d.ts.map +0 -1
  202. package/dist/react/useWalletDetection.d.ts +0 -81
  203. package/dist/react/useWalletDetection.d.ts.map +0 -1
  204. package/dist/react.cjs +0 -1
  205. package/dist/react.esm.js +0 -1
  206. package/dist/services/AbstractTokenFetchService.d.ts +0 -150
  207. package/dist/services/AbstractTokenFetchService.d.ts.map +0 -1
  208. package/dist/services/BatchedCacheService.d.ts +0 -133
  209. package/dist/services/BatchedCacheService.d.ts.map +0 -1
  210. package/dist/services/BridgeableTokenCache.d.ts +0 -120
  211. package/dist/services/BridgeableTokenCache.d.ts.map +0 -1
  212. package/dist/services/BridgeableTokenService.d.ts +0 -218
  213. package/dist/services/BridgeableTokenService.d.ts.map +0 -1
  214. package/dist/services/DexService.d.ts +0 -440
  215. package/dist/services/DexService.d.ts.map +0 -1
  216. package/dist/services/NetworkKeyedCacheService.d.ts +0 -185
  217. package/dist/services/NetworkKeyedCacheService.d.ts.map +0 -1
  218. package/dist/services/PriceHistoryService.d.ts +0 -209
  219. package/dist/services/PriceHistoryService.d.ts.map +0 -1
  220. package/dist/services/WrapService.d.ts +0 -171
  221. package/dist/services/WrapService.d.ts.map +0 -1
  222. package/dist/services/WrappableTokenCache.d.ts +0 -100
  223. package/dist/services/WrappableTokenCache.d.ts.map +0 -1
  224. package/dist/services/WrappableTokenService.d.ts +0 -130
  225. package/dist/services/WrappableTokenService.d.ts.map +0 -1
  226. package/dist/setup.d.ts +0 -8
  227. package/dist/setup.d.ts.map +0 -1
  228. package/dist/signing/eip712.d.ts +0 -13
  229. package/dist/signing/eip712.d.ts.map +0 -1
  230. package/dist/tokens/transfers.d.ts +0 -95
  231. package/dist/tokens/transfers.d.ts.map +0 -1
  232. package/dist/types/galachain-api.types.d.ts +0 -297
  233. package/dist/types/galachain-api.types.d.ts.map +0 -1
  234. package/dist/types/priceHistory.dto.d.ts +0 -134
  235. package/dist/types/priceHistory.dto.d.ts.map +0 -1
  236. package/dist/types/token.types.d.ts +0 -359
  237. package/dist/types/token.types.d.ts.map +0 -1
  238. package/dist/types/wrappable-token.dto.d.ts +0 -305
  239. package/dist/types/wrappable-token.dto.d.ts.map +0 -1
  240. package/dist/utils/crypto-compat.d.ts +0 -40
  241. package/dist/utils/crypto-compat.d.ts.map +0 -1
  242. package/dist/utils/load-env.d.ts +0 -31
  243. package/dist/utils/load-env.d.ts.map +0 -1
  244. package/dist/utils/token-instance-key.d.ts +0 -57
  245. package/dist/utils/token-instance-key.d.ts.map +0 -1
  246. package/dist/utils/wallet.d.ts +0 -166
  247. package/dist/utils/wallet.d.ts.map +0 -1
  248. package/dist/wallet/ExternalWalletProvider.d.ts +0 -90
  249. package/dist/wallet/ExternalWalletProvider.d.ts.map +0 -1
  250. package/dist/wallet/GalaWalletProvider.d.ts +0 -122
  251. package/dist/wallet/GalaWalletProvider.d.ts.map +0 -1
  252. package/dist/wallet/PrivateKeyProvider.d.ts +0 -90
  253. package/dist/wallet/PrivateKeyProvider.d.ts.map +0 -1
  254. package/dist/wallet/detection.d.ts +0 -107
  255. package/dist/wallet/detection.d.ts.map +0 -1
  256. package/dist/wallet/event-handlers.d.ts +0 -50
  257. package/dist/wallet/event-handlers.d.ts.map +0 -1
  258. package/dist/wallet/index.d.ts +0 -51
  259. package/dist/wallet/index.d.ts.map +0 -1
  260. package/dist/wallet/signing-operation.d.ts +0 -19
  261. package/dist/wallet/signing-operation.d.ts.map +0 -1
  262. package/dist/wallet/typed-data-helpers.d.ts +0 -68
  263. package/dist/wallet/typed-data-helpers.d.ts.map +0 -1
  264. package/dist/wallet/types.d.ts +0 -267
  265. package/dist/wallet/types.d.ts.map +0 -1
  266. package/dist/wallet/utils.d.ts +0 -117
  267. package/dist/wallet/utils.d.ts.map +0 -1
  268. package/dist/wallet.cjs +0 -1
  269. package/dist/wallet.esm.js +0 -1
@@ -1,440 +0,0 @@
1
- /**
2
- * DEX API Service
3
- *
4
- * This service handles DEX API spot price operations for tokens.
5
- * It provides methods to fetch current USD spot prices for DEX tokens
6
- * and calculate spot prices for launchpad tokens.
7
- */
8
- import type { TokenId } from '../types/common';
9
- import type { DexAggregatedVolumeSummary, DexSeason, GalaChainTokenDetails, LeaderboardResult, TokenSpotPrice } from '../types/launchpad.dto';
10
- import type { AmountCalculationResult } from '../types/launchpad.dto';
11
- import type { CalculateBuyAmountOptions, FetchTokenSpotPriceParams } from '../types/options.dto';
12
- import type { HttpClient } from '../utils/http';
13
- import { LoggerBase } from './BaseService';
14
- import type { GalaChainService } from './GalaChainService';
15
- import type { TokenMetadataCache } from './TokenMetadataCache';
16
- /**
17
- * DexService handles DEX API spot price operations
18
- *
19
- * This service provides access to token pricing information from the DEX API.
20
- * It supports both single and multiple token price queries, as well as
21
- * calculated spot prices for launchpad tokens.
22
- *
23
- * ## Caching Strategy
24
- * Optional TokenMetadataCache for symbol caching. When provided, DexService will:
25
- * - Check cache for token symbols before fetching from API
26
- * - Cache symbols after successful API fetch
27
- * - Reduces API calls by 50% on repeated token symbol queries
28
- *
29
- * @category Services
30
- * @since 1.0.0
31
- */
32
- export declare class DexService extends LoggerBase {
33
- private readonly dexBackendHttp?;
34
- private readonly cache?;
35
- private readonly galaChainService?;
36
- constructor(dexBackendHttp?: HttpClient | undefined, cache?: TokenMetadataCache | undefined, galaChainService?: GalaChainService | undefined, debugMode?: boolean);
37
- /**
38
- * Fetch USD spot price for DEX tokens with tokenId
39
- *
40
- * Smart router that accepts either tokenName or tokenId (mutually exclusive).
41
- * LaunchpadSDK handles routing logic automatically:
42
- * - tokenName: Routes to bonding curve calculation (launchpad tokens)
43
- * - tokenId: Routes to DEX Backend API (graduated/DEX tokens)
44
- *
45
- * **Price Source:**
46
- * - DEX Backend API `/market/price` endpoint (keyed by symbol)
47
- * - Real-time spot prices from active DEX trading
48
- * - USD-denominated pricing (via GALA/USD base pair)
49
- *
50
- * **Token Format Support:**
51
- * - Pipe-delimited: `Token|Unit|GDOG|eth:0x...`
52
- * - Object format: `{ collection: 'Token', category: 'Unit', type: 'GDOG', additionalKey: 'eth:0x...' }`
53
- * - Auto-converts to dollar-delimited for API: `Token$Unit$GDOG$eth:0x...`
54
- *
55
- * @param params Options with either tokenName or tokenId (mutually exclusive)
56
- * @returns Promise<TokenSpotPrice> Token symbol and USD price
57
- * @throws ValidationError if neither tokenName nor tokenId provided
58
- * @throws ValidationError if both tokenName and tokenId provided
59
- * @throws NetworkError if API request fails
60
- * @category Spot Price
61
- * @since 3.0.0
62
- *
63
- * @example DEX token pricing (tokenId)
64
- * ```typescript
65
- * const price = await dexService.fetchTokenPrice({
66
- * tokenId: 'Token|Unit|GDOG|eth:0x...'
67
- * });
68
- * console.log(`${price.symbol}: $${price.price}`);
69
- * // Output: GDOG: $0.00123
70
- * ```
71
- *
72
- * @example Object format tokenId
73
- * ```typescript
74
- * const price = await dexService.fetchTokenPrice({
75
- * tokenId: {
76
- * collection: 'Token',
77
- * category: 'Unit',
78
- * type: 'BENE',
79
- * additionalKey: 'client:123'
80
- * }
81
- * });
82
- * ```
83
- *
84
- * @internal
85
- */
86
- fetchTokenPrice(params: FetchTokenSpotPriceParams): Promise<TokenSpotPrice>;
87
- /**
88
- * Resolve a token's symbol from the token metadata cache or the GalaChain token class.
89
- * Never derives a symbol from the class key; throws if neither source has it.
90
- * @private
91
- */
92
- private resolveAuthoritativeSymbol;
93
- /**
94
- * Internal method: Fetch spot price from DEX Backend API
95
- *
96
- * Queries the DEX Backend API for real-time spot prices of tokens actively
97
- * trading on GalaSwap. Includes intelligent caching for token symbols to reduce
98
- * API calls by 50% on repeated queries.
99
- *
100
- * **Price Calculation:**
101
- * - Fetches token/GALA pair price from DEX
102
- * - Converts to USD using GALA/USD base rate
103
- * - Returns final USD-denominated price
104
- *
105
- * **Symbol Resolution:**
106
- * 1. Check TokenMetadataCache (if available) - instant
107
- * 2. Fetch from GalaChain token registry - authoritative
108
- * There is no key-parsing fallback: a class key carries no symbol, so a token whose
109
- * symbol cannot be resolved fails loudly.
110
- *
111
- * **Caching Strategy:**
112
- * - Cache hit: Symbol returned instantly (no API call)
113
- * - Cache miss: Fetch from GalaChain, cache for future queries
114
- * - 50% reduction in API calls for repeated token queries
115
- *
116
- * @internal
117
- * @param tokenId Token ID in pipe-delimited or object format
118
- * @returns Promise<TokenSpotPrice> Spot price with symbol and USD price
119
- * @throws NetworkError if token not found on DEX
120
- * @throws NetworkError if API request fails
121
- * @category Spot Price
122
- * @since 3.0.0
123
- */
124
- private _fetchDexTokenSpotPrice;
125
- /**
126
- * Calculate spot price for a launchpad token using bonding curve mathematics
127
- *
128
- * Computes USD spot price for active bonding curve tokens by:
129
- * 1. Calculating tokens received for 1 GALA (bonding curve)
130
- * 2. Fetching GALA/USD spot price (DEX)
131
- * 3. Computing token/USD price (GALA price ÷ tokens per GALA)
132
- *
133
- * **Graduation Detection:**
134
- * - If token is graduated (saleStatus = 'Finished'), routes to DEX spot price
135
- * - If token is active bonding curve, uses calculation above
136
- * - Automatic routing ensures correct price source
137
- *
138
- * **Bonding Curve Pricing:**
139
- * Uses exponential bonding curve: price = e^(k × supply)
140
- * - Current supply determines current price point on curve
141
- * - Higher supply = higher price (built-in scarcity)
142
- * - 1 GALA buys fewer tokens as supply grows
143
- *
144
- * @param tokenName Launchpad token name (e.g., 'anime', 'demonkpop')
145
- * @param calculateBuyAmount Callback to calculate buy amount via bonding curve
146
- * @param fetchPoolDetails Optional callback to check graduation status
147
- * @returns Promise<TokenSpotPrice> Token symbol and USD spot price
148
- * @throws NetworkError if calculation fails
149
- * @throws ValidationError if token name is invalid
150
- * @category Spot Price
151
- * @since 2.0.0
152
- * @internal
153
- */
154
- fetchLaunchpadTokenSpotPrice(tokenName: string, calculateBuyAmount: (options: CalculateBuyAmountOptions) => Promise<AmountCalculationResult>, fetchPoolDetails?: (tokenName: string) => Promise<unknown>): Promise<TokenSpotPrice>;
155
- /**
156
- * Fetch comprehensive token details from GalaChain
157
- *
158
- * Queries the authoritative GalaChain token registry via FetchTokenClasses endpoint
159
- * to retrieve complete token metadata including symbol, decimals, name, image,
160
- * description, and blockchain-specific information.
161
- *
162
- * This method serves as the source of truth for token metadata by using the native
163
- * GalaChain API instead of a secondary DEX index. This ensures:
164
- * - Complete metadata for all tokens (including native GALA token)
165
- * - Direct blockchain source of truth
166
- * - Support for both native tokens and wrapped DEX tokens
167
- *
168
- * @param tokenId Token identifier (flexible format: string or object)
169
- * @returns Promise<GalaChainTokenDetails> Token metadata from GalaChain
170
- *
171
- * @example String format
172
- * ```typescript
173
- * const details = await dexService.fetchTokenDetails('Token|Unit|BENE|client:xxxx');
174
- * console.log(details.symbol); // 'BENE'
175
- *
176
- * // Also works for native OG coins
177
- * const gala = await dexService.fetchTokenDetails('GALA|Unit|none|none');
178
- * console.log(gala.symbol); // 'GALA'
179
- * const gusdc = await dexService.fetchTokenDetails('GUSDC|Unit|none|none');
180
- * console.log(gusdc.symbol); // 'GUSDC'
181
- * ```
182
- *
183
- * @example Object format
184
- * ```typescript
185
- * const details = await dexService.fetchTokenDetails({
186
- * collection: 'GUSDC',
187
- * category: 'Unit',
188
- * type: 'none',
189
- * additionalKey: 'none'
190
- * });
191
- * ```
192
- *
193
- * @throws ValidationError if tokenId format is invalid
194
- * @throws NetworkError if API request fails or token not found
195
- */
196
- fetchTokenDetails(tokenId: TokenId): Promise<GalaChainTokenDetails>;
197
- /**
198
- * Fetch all available DEX leaderboard seasons
199
- *
200
- * Retrieves complete list of competitive trading seasons with their time ranges
201
- * and rule configurations. Use season IDs with `fetchDexLeaderboardBySeasonId()`
202
- * to query rankings.
203
- *
204
- * **Season Structure:**
205
- * - id: Unique season identifier (used for queries)
206
- * - name: Display name (e.g., "Season 1", "Winter 2025")
207
- * - start: Season start date (Date object)
208
- * - end: Season end date (Date object)
209
- * - rulesId: Rule set identifier (scoring multipliers, XP rates)
210
- *
211
- * **Response Handling:**
212
- * Supports multiple API response formats:
213
- * - Direct array: `[...seasons...]`
214
- * - Wrapped: `{ data: [...seasons...] }`
215
- * - Nested: `{ data: { seasons: [...] } }`
216
- *
217
- * @returns Promise<DexSeason[]> Array of all seasons with time ranges
218
- * @throws NetworkError If API request fails
219
- * @category DEX Leaderboard
220
- * @since 3.23.0
221
- *
222
- * @example List all seasons
223
- * ```typescript
224
- * const seasons = await dexService.fetchAllDexSeasons();
225
- * seasons.forEach(season => {
226
- * console.log(`${season.name}: ${season.start.toISOString()} - ${season.end.toISOString()}`);
227
- * });
228
- * // Output:
229
- * // Season 1: 2025-01-01T00:00:00Z - 2025-03-31T23:59:59Z
230
- * // Season 2: 2025-04-01T00:00:00Z - 2025-06-30T23:59:59Z
231
- * ```
232
- *
233
- * @example Find specific season by name
234
- * ```typescript
235
- * const seasons = await dexService.fetchAllDexSeasons();
236
- * const winterSeason = seasons.find(s => s.name.includes('Winter'));
237
- * if (winterSeason) {
238
- * const leaderboard = await dexService.fetchDexLeaderboardBySeasonId(winterSeason.id);
239
- * }
240
- * ```
241
- *
242
- * @internal
243
- */
244
- fetchAllDexSeasons(): Promise<DexSeason[]>;
245
- /**
246
- * Find the currently active DEX leaderboard season
247
- *
248
- * Determines which season is active by comparing current time with season start/end dates.
249
- * Returns null if no season is currently active (between seasons or before first season).
250
- *
251
- * **Active Season Detection:**
252
- * - Fetches all seasons via `fetchAllDexSeasons()`
253
- * - Finds season where: `now >= season.start && now <= season.end`
254
- * - Returns first matching season (should only be one)
255
- * - Returns null if no match found
256
- *
257
- * **Use Cases:**
258
- * - Display current leaderboard automatically
259
- * - Show "No active season" message when null
260
- * - Redirect users to current competition rankings
261
- *
262
- * @returns Promise<DexSeason | null> Current season or null if none active
263
- * @throws NetworkError If API request fails
264
- * @category DEX Leaderboard
265
- * @since 3.23.0
266
- *
267
- * @example Get current season and leaderboard
268
- * ```typescript
269
- * const currentSeason = await dexService.fetchCurrentDexSeason();
270
- * if (currentSeason) {
271
- * console.log(`Active season: ${currentSeason.name}`);
272
- * const leaderboard = await dexService.fetchDexLeaderboardBySeasonId(currentSeason.id);
273
- * console.log(`Top trader: ${leaderboard.entries[0].wallet} with ${leaderboard.entries[0].totalXp} XP`);
274
- * } else {
275
- * console.log('No active season - check back later!');
276
- * }
277
- * ```
278
- *
279
- * @internal
280
- */
281
- fetchCurrentDexSeason(): Promise<DexSeason | null>;
282
- /**
283
- * Fetch DEX leaderboard for a specific season
284
- *
285
- * Returns complete leaderboard rankings with XP metrics, achievement titles, and
286
- * reward distribution percentages. Non-paginated response includes all entries
287
- * (typically 100-200 participants).
288
- *
289
- * **Leaderboard Entry Structure:**
290
- * - wallet: Participant wallet address (eth|0x...)
291
- * - rank: Position (1 = top trader, 2 = second, etc.)
292
- * - totalXp: Cumulative XP earned this season
293
- * - distributionPercent: Share of prize pool (0-100)
294
- * - liquidityXp: XP from providing liquidity
295
- * - tradingXp: XP from trading actions
296
- * - masteryTitles: Achievement badges (e.g., "Volume Master", "LP Whale")
297
- *
298
- * **XP Calculation (Standard Rules):**
299
- * - Buy token: +10 XP per GALA spent
300
- * - Sell token: +5 XP per GALA received
301
- * - DEX swap: +1 XP per $1 USD volume
302
- * - Add liquidity: +bonus XP based on pool tier and size
303
- * - Hold liquidity: +passive XP over time
304
- *
305
- * **Mastery Titles:**
306
- * - Type: 'liquidity' (LP achievements) or 'trade' (trading achievements)
307
- * - Order: Priority for display (lower = more prestigious)
308
- * - Example titles: "Liquidity Legend", "Volume King", "Diamond Hands"
309
- *
310
- * @param seasonId Season identifier number (must be positive integer)
311
- * @returns Promise<LeaderboardResult> Complete leaderboard with rankings and metrics
312
- * @throws RequiredFieldError If seasonId is invalid
313
- * @throws NetworkError If API request fails
314
- * @category DEX Leaderboard
315
- * @since 3.23.0
316
- *
317
- * @example Fetch season 3 leaderboard
318
- * ```typescript
319
- * const leaderboard = await dexService.fetchDexLeaderboardBySeasonId(3);
320
- * console.log(`Season ${leaderboard.seasonId} - ${leaderboard.totalEntries} traders`);
321
- *
322
- * // Display top 5
323
- * leaderboard.entries.slice(0, 5).forEach(entry => {
324
- * console.log(`#${entry.rank}: ${entry.wallet} - ${entry.totalXp} XP (${entry.distributionPercent}% rewards)`);
325
- * entry.masteryTitles.forEach(title => console.log(` 🏆 ${title.name}`));
326
- * });
327
- * ```
328
- *
329
- * @example Find your rank
330
- * ```typescript
331
- * const myWallet = 'eth|0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb';
332
- * const leaderboard = await dexService.fetchDexLeaderboardBySeasonId(3);
333
- * const myEntry = leaderboard.entries.find(e => e.wallet === myWallet);
334
- *
335
- * if (myEntry) {
336
- * console.log(`Your rank: #${myEntry.rank}`);
337
- * console.log(`Your XP: ${myEntry.totalXp} (Trading: ${myEntry.tradingXp}, LP: ${myEntry.liquidityXp})`);
338
- * console.log(`Reward share: ${myEntry.distributionPercent}%`);
339
- * } else {
340
- * console.log('Not ranked this season - start trading!');
341
- * }
342
- * ```
343
- *
344
- * @internal
345
- */
346
- fetchDexLeaderboardBySeasonId(seasonId: number): Promise<LeaderboardResult>;
347
- /**
348
- * Fetch leaderboard for the currently active season
349
- *
350
- * Convenience method combining `fetchCurrentDexSeason()` and `fetchDexLeaderboardBySeasonId()`.
351
- * Automatically detects the current season and fetches its leaderboard. Returns null if no
352
- * season is active (between seasons).
353
- *
354
- * **Use Cases:**
355
- * - Display current leaderboard without knowing season ID
356
- * - Homepage "Current Rankings" widget
357
- * - "Live Competition" page
358
- *
359
- * **Workflow:**
360
- * 1. Fetch all seasons → find active season by date
361
- * 2. If active season found → fetch its leaderboard
362
- * 3. If no active season → return null
363
- *
364
- * @returns Promise<LeaderboardResult | null> Current leaderboard or null if no active season
365
- * @throws NetworkError If API request fails
366
- * @category DEX Leaderboard
367
- * @since 3.23.0
368
- *
369
- * @example Display current leaderboard
370
- * ```typescript
371
- * const currentLeaderboard = await dexService.fetchCurrentDexLeaderboard();
372
- * if (currentLeaderboard) {
373
- * console.log(`Season ${currentLeaderboard.seasonId} Rankings:`);
374
- * currentLeaderboard.entries.slice(0, 10).forEach(entry => {
375
- * console.log(`${entry.rank}. ${entry.wallet}: ${entry.totalXp} XP`);
376
- * });
377
- * } else {
378
- * console.log('No active season - next season coming soon!');
379
- * }
380
- * ```
381
- *
382
- * @internal
383
- */
384
- fetchCurrentDexLeaderboard(): Promise<LeaderboardResult | null>;
385
- /**
386
- * Fetch DEX aggregated volume summary with trend metrics
387
- *
388
- * Returns platform-wide trading volume statistics across all DEX pools with
389
- * multi-timeframe comparisons. Shows total USD volume and percentage changes
390
- * relative to previous periods.
391
- *
392
- * **Volume Metrics:**
393
- * - volume1d: 24-hour trading volume (USD)
394
- * - volume1dDelta: % change vs previous 24 hours
395
- * - volume7d: 7-day rolling volume (USD)
396
- * - volume7dDelta: % change vs previous 7 days
397
- * - volume30d: 30-day rolling volume (USD)
398
- * - volume30dDelta: % change vs previous 30 days
399
- *
400
- * **Delta Interpretation:**
401
- * - Positive delta (+10.5): Volume increased by 10.5%
402
- * - Negative delta (-5.2): Volume decreased by 5.2%
403
- * - Zero delta (0): No change from previous period
404
- *
405
- * **Use Cases:**
406
- * - Platform health dashboard
407
- * - Volume trend charts
408
- * - Market activity indicators
409
- * - "Trading volume up/down X%" alerts
410
- *
411
- * @returns Promise<DexAggregatedVolumeSummary> Volume metrics and deltas
412
- * @throws NetworkError If API request fails
413
- * @category Volume Analytics
414
- * @since 4.0.0
415
- *
416
- * @example Display volume summary
417
- * ```typescript
418
- * const volumeSummary = await dexService.fetchDexAggregatedVolumeSummary();
419
- *
420
- * console.log(`24h Volume: $${volumeSummary.volume1d.toLocaleString()} (${volumeSummary.volume1dDelta > 0 ? '+' : ''}${volumeSummary.volume1dDelta.toFixed(2)}%)`);
421
- * console.log(`7d Volume: $${volumeSummary.volume7d.toLocaleString()} (${volumeSummary.volume7dDelta > 0 ? '+' : ''}${volumeSummary.volume7dDelta.toFixed(2)}%)`);
422
- * console.log(`30d Volume: $${volumeSummary.volume30d.toLocaleString()} (${volumeSummary.volume30dDelta > 0 ? '+' : ''}${volumeSummary.volume30dDelta.toFixed(2)}%)`);
423
- * ```
424
- *
425
- * @example Volume trend indicator
426
- * ```typescript
427
- * const volumeSummary = await dexService.fetchDexAggregatedVolumeSummary();
428
- *
429
- * if (volumeSummary.volume1dDelta > 10) {
430
- * console.log('🚀 High trading activity - volume up ' + volumeSummary.volume1dDelta.toFixed(1) + '%');
431
- * } else if (volumeSummary.volume1dDelta < -10) {
432
- * console.log('📉 Low trading activity - volume down ' + Math.abs(volumeSummary.volume1dDelta).toFixed(1) + '%');
433
- * } else {
434
- * console.log('📊 Stable trading activity');
435
- * }
436
- * ```
437
- */
438
- fetchDexAggregatedVolumeSummary(): Promise<DexAggregatedVolumeSummary>;
439
- }
440
- //#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A0ErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,4BAA4B,CAChC,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,uBAAuB,CAAC,EAE5F,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GACzD,OAAO,CAAC,cAAc,CAAC;IAiF1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACG,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAgDzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,kBAAkB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAmFhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACG,qBAAqB,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAkBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+DG;IACG,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA4GjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACG,0BAA0B,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAWrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;IACG,+BAA+B,IAAI,OAAO,CAAC,0BAA0B,CAAC;CAqC7E"}
@@ -1,185 +0,0 @@
1
- /**
2
- * Network-Keyed Cache Service Base Class
3
- *
4
- * Abstraction for caches that store items partitioned by network key
5
- * (e.g., 'ETHEREUM', 'SOLANA'). Extends BatchedCacheService patterns
6
- * for network-partitioned storage with dual O(1) indices.
7
- *
8
- * ## Features
9
- * - Network-partitioned storage (Map<Network, Map<Key, Item>>)
10
- * - Primary index by symbol/key + secondary index by tokenId
11
- * - Batch operations per network (set, merge)
12
- * - Timestamp tracking per network
13
- * - Common normalization via normalizeTokenKey()
14
- *
15
- * ## Subclass Responsibilities
16
- * - Implement `extractPrimaryKey()` for primary index (e.g., symbol)
17
- * - Implement `extractSecondaryKey()` for secondary index (e.g., tokenId)
18
- * - Implement `getStats()` for domain-specific statistics
19
- *
20
- * @category Services
21
- * @since 5.12.0
22
- * @template V - Value type stored in cache
23
- * @template K - Network key type (e.g., 'ETHEREUM' | 'SOLANA')
24
- * @template S - Statistics type
25
- */
26
- import { LoggerBase } from './BaseService.js';
27
- /**
28
- * Base cache statistics for network-keyed caches
29
- */
30
- export interface NetworkKeyedCacheStats<K extends string = string> {
31
- /** Networks with cached data */
32
- networks: K[];
33
- /** Total items across all networks */
34
- totalItems: number;
35
- /** Item count per network */
36
- itemsByNetwork: Record<K, number>;
37
- /** Fetch timestamps per network */
38
- fetchTimestamps: Record<K, number>;
39
- }
40
- /**
41
- * Network-keyed cache service with dual O(1) indices
42
- *
43
- * Provides reusable cache operations for network-partitioned token data.
44
- * Uses dual Map indices for efficient lookups by both symbol and tokenId.
45
- *
46
- * @template V - Value type stored in cache
47
- * @template K - Network key type (e.g., 'ETHEREUM' | 'SOLANA')
48
- * @template S - Statistics type extending NetworkKeyedCacheStats
49
- */
50
- export declare abstract class NetworkKeyedCacheService<V, K extends string = string, S extends NetworkKeyedCacheStats<K> = NetworkKeyedCacheStats<K>> extends LoggerBase {
51
- /** Primary index: network -> (primaryKey -> item) */
52
- protected readonly primaryIndex: Map<K, Map<string, V>>;
53
- /** Secondary index: network -> (secondaryKey -> item) */
54
- protected readonly secondaryIndex: Map<K, Map<string, V>>;
55
- /** Fetch timestamps per network */
56
- protected readonly fetchTimestamps: Map<K, number>;
57
- constructor(debugMode?: boolean);
58
- /**
59
- * Normalize key for consistent cache lookups
60
- *
61
- * Uses common tokenNameNormalizer for uppercase, trimmed keys.
62
- *
63
- * @param key - Raw key to normalize
64
- * @returns Normalized key string
65
- */
66
- protected normalizeKey(key: string): string;
67
- /**
68
- * Extract the primary key from an item (e.g., symbol)
69
- *
70
- * @param item - Item to extract primary key from
71
- * @returns Primary key string
72
- */
73
- protected abstract extractPrimaryKey(item: V): string;
74
- /**
75
- * Extract the secondary key from an item (e.g., stringifiedTokenClassKey)
76
- *
77
- * @param item - Item to extract secondary key from
78
- * @returns Secondary key string
79
- */
80
- protected abstract extractSecondaryKey(item: V): string;
81
- /**
82
- * Check if cache has data for a network
83
- *
84
- * @param network - Network to check
85
- * @returns True if network has cached items
86
- */
87
- has(network: K): boolean;
88
- /**
89
- * Get all items for a network
90
- *
91
- * @param network - Network to get items for
92
- * @returns Array of cached items (empty if not cached)
93
- */
94
- getAll(network: K): V[];
95
- /**
96
- * Get item by primary key (e.g., symbol)
97
- *
98
- * @param network - Network to search
99
- * @param key - Primary key (case-insensitive)
100
- * @returns Item or undefined if not found
101
- */
102
- getByPrimaryKey(network: K, key: string): V | undefined;
103
- /**
104
- * Get item by secondary key (e.g., tokenId)
105
- *
106
- * Uses the secondary index for O(1) lookup performance.
107
- *
108
- * @param network - Network to search
109
- * @param key - Secondary key (case-insensitive)
110
- * @returns Item or undefined if not found
111
- */
112
- getBySecondaryKey(network: K, key: string): V | undefined;
113
- /**
114
- * Set items for a network (replaces all existing items)
115
- *
116
- * @param network - Network to set items for
117
- * @param items - Array of items to cache
118
- */
119
- set(network: K, items: V[]): void;
120
- /**
121
- * Add items to a network cache (merges with existing)
122
- *
123
- * Used for pagination - adds new items without replacing existing.
124
- *
125
- * @param network - Network to add items to
126
- * @param items - Array of items to add
127
- */
128
- merge(network: K, items: V[]): void;
129
- /**
130
- * Get fetch timestamp for a network
131
- *
132
- * @param network - Network to get timestamp for
133
- * @returns Timestamp when network was last fetched, or undefined
134
- */
135
- getFetchTimestamp(network: K): number | undefined;
136
- /**
137
- * Get cache statistics
138
- *
139
- * Subclasses may override to add domain-specific statistics.
140
- *
141
- * @returns Cache statistics
142
- */
143
- abstract getStats(): S;
144
- /**
145
- * Build base statistics (helper for subclasses)
146
- *
147
- * @param defaultNetworks - Default networks to include in stats
148
- * @returns Base statistics object
149
- */
150
- protected buildBaseStats(defaultNetworks: K[]): NetworkKeyedCacheStats<K>;
151
- /**
152
- * Clear cache for a network or all networks
153
- *
154
- * @param network - Optional network to clear (clears all if not provided)
155
- */
156
- clear(network?: K): void;
157
- /**
158
- * Get item count for a network
159
- *
160
- * @param network - Network to count items for
161
- * @returns Number of cached items
162
- */
163
- size(network: K): number;
164
- /**
165
- * Check if item exists by primary key
166
- *
167
- * @param network - Network to check
168
- * @param key - Primary key (case-insensitive)
169
- * @returns True if item is cached
170
- */
171
- hasByPrimaryKey(network: K, key: string): boolean;
172
- /**
173
- * Get all cached networks
174
- *
175
- * @returns Array of networks with cached items
176
- */
177
- getCachedNetworks(): K[];
178
- /**
179
- * Dump entire cache contents
180
- *
181
- * @returns Full cache contents for all cached networks
182
- */
183
- dump(): Record<K, V[]>;
184
- }
185
- //# sourceMappingURL=NetworkKeyedCacheService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NetworkKeyedCacheService.d.ts","sourceRoot":"","sources":["../../src/services/NetworkKeyedCacheService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC/D,gCAAgC;IAChC,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,cAAc,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClC,mCAAmC;IACnC,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;CACp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