@gala-chain/launchpad-sdk 4.0.0 → 4.0.1-beta.2
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.
- package/API.md +5 -5
- package/CHANGELOG.md +15 -15
- package/EXAMPLES.md +80 -2
- package/README.md +118 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +37 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{LaunchpadSDK.d.ts → src/LaunchpadSDK.d.ts} +899 -20
- package/dist/src/LaunchpadSDK.d.ts.map +1 -0
- package/dist/src/api/LaunchpadAPI.d.ts.map +1 -0
- package/dist/src/api/dto/BondingCurveDTOs.d.ts.map +1 -0
- package/dist/src/api/dto/LockTokenDto.d.ts +97 -0
- package/dist/src/api/dto/LockTokenDto.d.ts.map +1 -0
- package/dist/src/api/dto/TransferTokenDto.d.ts.map +1 -0
- package/dist/src/api/dto/UnlockTokenDto.d.ts +86 -0
- package/dist/src/api/dto/UnlockTokenDto.d.ts.map +1 -0
- package/dist/src/auth/SignatureAuth.d.ts.map +1 -0
- package/dist/src/auth/types.d.ts.map +1 -0
- package/dist/src/config/environments.d.ts.map +1 -0
- package/dist/src/constants/bondingCurve.d.ts.map +1 -0
- package/dist/src/constants/config.d.ts.map +1 -0
- package/dist/src/constants/counts.d.ts.map +1 -0
- package/dist/src/constants/decimals.d.ts.map +1 -0
- package/dist/src/constants/endpoints.d.ts.map +1 -0
- package/dist/src/constants/enums.d.ts.map +1 -0
- package/dist/src/constants/error-messages.d.ts.map +1 -0
- package/dist/src/constants/pagination.d.ts.map +1 -0
- package/dist/src/constants/query-fields.d.ts.map +1 -0
- package/dist/src/constants/version.d.ts.map +1 -0
- package/dist/{constants → src/constants}/version.generated.d.ts +1 -1
- package/dist/src/constants/version.generated.d.ts.map +1 -0
- package/dist/src/helpers/sdk.d.ts.map +1 -0
- package/dist/src/helpers/wallet.d.ts.map +1 -0
- package/dist/src/index.d.ts +51 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/polyfills/file-global.d.ts.map +1 -0
- package/dist/src/schemas/files.d.ts.map +1 -0
- package/dist/src/schemas/index.d.ts.map +1 -0
- package/dist/src/schemas/launchpad.d.ts.map +1 -0
- package/dist/src/schemas/pagination.d.ts.map +1 -0
- package/dist/src/schemas/primitives.d.ts.map +1 -0
- package/dist/src/schemas/trade.d.ts.map +1 -0
- package/dist/src/schemas/user.d.ts.map +1 -0
- package/dist/src/schemas/validators.d.ts.map +1 -0
- package/dist/src/services/BaseService.d.ts.map +1 -0
- package/dist/src/services/BundleService.d.ts.map +1 -0
- package/dist/src/services/CommentService.d.ts.map +1 -0
- package/dist/src/services/DexBackendClient.d.ts.map +1 -0
- package/dist/src/services/DexPoolService.d.ts.map +1 -0
- package/dist/src/services/DexQuoteService.d.ts.map +1 -0
- package/dist/{services → src/services}/DexService.d.ts +83 -9
- package/dist/src/services/DexService.d.ts.map +1 -0
- package/dist/src/services/FaucetService.d.ts.map +1 -0
- package/dist/{services → src/services}/GSwapService.d.ts +84 -12
- package/dist/src/services/GSwapService.d.ts.map +1 -0
- package/dist/{services → src/services}/GalaChainGatewayClient.d.ts +12 -3
- package/dist/src/services/GalaChainGatewayClient.d.ts.map +1 -0
- package/dist/{services → src/services}/GalaChainService.d.ts +73 -4
- package/dist/src/services/GalaChainService.d.ts.map +1 -0
- package/dist/src/services/ImageService.d.ts.map +1 -0
- package/dist/src/services/LaunchpadService.d.ts.map +1 -0
- package/dist/src/services/MultiPoolStateManager.d.ts +284 -0
- package/dist/src/services/MultiPoolStateManager.d.ts.map +1 -0
- package/dist/src/services/PoolCacheManager.d.ts +171 -0
- package/dist/src/services/PoolCacheManager.d.ts.map +1 -0
- package/dist/src/services/PoolService.d.ts.map +1 -0
- package/dist/src/services/PoolStateManager.d.ts.map +1 -0
- package/dist/{services → src/services}/PriceHistoryService.d.ts +5 -5
- package/dist/src/services/PriceHistoryService.d.ts.map +1 -0
- package/dist/src/services/SignatureService.d.ts.map +1 -0
- package/dist/src/services/SwapEventQueue.d.ts +123 -0
- package/dist/src/services/SwapEventQueue.d.ts.map +1 -0
- package/dist/src/services/TokenClassKeyService.d.ts.map +1 -0
- package/dist/{services → src/services}/TokenMetadataCache.d.ts +5 -5
- package/dist/src/services/TokenMetadataCache.d.ts.map +1 -0
- package/dist/{services → src/services}/TokenMetadataService.d.ts +3 -3
- package/dist/src/services/TokenMetadataService.d.ts.map +1 -0
- package/dist/src/services/TokenResolverService.d.ts.map +1 -0
- package/dist/src/services/TradeService.d.ts.map +1 -0
- package/dist/src/services/UserService.d.ts.map +1 -0
- package/dist/src/services/WebSocketManager.d.ts.map +1 -0
- package/dist/src/services/WebSocketService.d.ts.map +1 -0
- package/dist/src/services/__mocks__/logger.mock.d.ts.map +1 -0
- package/dist/{setup.d.ts.map → src/setup.d.ts.map} +1 -1
- package/dist/{types → src/types}/backend-responses.d.ts +17 -0
- package/dist/src/types/backend-responses.d.ts.map +1 -0
- package/dist/src/types/comment.dto.d.ts.map +1 -0
- package/dist/src/types/common.d.ts.map +1 -0
- package/dist/{types → src/types}/composite-pool.dto.d.ts +1 -1
- package/dist/src/types/composite-pool.dto.d.ts.map +1 -0
- package/dist/src/types/dex-pool.dto.d.ts.map +1 -0
- package/dist/src/types/dto.d.ts.map +1 -0
- package/dist/src/types/eip712-types.d.ts.map +1 -0
- package/dist/{types → src/types}/galachain-api.types.d.ts +18 -8
- package/dist/src/types/galachain-api.types.d.ts.map +1 -0
- package/dist/{types → src/types}/gswap-responses.types.d.ts +14 -14
- package/dist/src/types/gswap-responses.types.d.ts.map +1 -0
- package/dist/src/types/gswap.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/launchpad.dto.d.ts +175 -0
- package/dist/src/types/launchpad.dto.d.ts.map +1 -0
- package/dist/src/types/launchpad.validation.d.ts.map +1 -0
- package/dist/src/types/liquidity-monitor.dto.d.ts +177 -0
- package/dist/src/types/liquidity-monitor.dto.d.ts.map +1 -0
- package/dist/src/types/lock.dto.d.ts +146 -0
- package/dist/src/types/lock.dto.d.ts.map +1 -0
- package/dist/src/types/options.dto.d.ts.map +1 -0
- package/dist/src/types/pool-state-delta.dto.d.ts.map +1 -0
- package/dist/src/types/pool-state-manager-config.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/priceHistory.dto.d.ts +4 -4
- package/dist/src/types/priceHistory.dto.d.ts.map +1 -0
- package/dist/src/types/result.types.d.ts.map +1 -0
- package/dist/src/types/swap-monitor.dto.d.ts +256 -0
- package/dist/src/types/swap-monitor.dto.d.ts.map +1 -0
- package/dist/src/types/trade.dto.d.ts.map +1 -0
- package/dist/src/types/transfer.dto.d.ts.map +1 -0
- package/dist/src/types/user.dto.d.ts.map +1 -0
- package/dist/src/types/websocket-data.types.d.ts.map +1 -0
- package/dist/src/types/websocket.types.d.ts.map +1 -0
- package/dist/src/utils/LiquidityEventExtractor.d.ts +99 -0
- package/dist/src/utils/LiquidityEventExtractor.d.ts.map +1 -0
- package/dist/src/utils/Logger.d.ts.map +1 -0
- package/dist/src/utils/MonitoringMetrics.d.ts +152 -0
- package/dist/src/utils/MonitoringMetrics.d.ts.map +1 -0
- package/dist/src/utils/PoolKeyNormalizer.d.ts +135 -0
- package/dist/src/utils/PoolKeyNormalizer.d.ts.map +1 -0
- package/dist/{utils → src/utils}/SignatureHelper.d.ts +38 -0
- package/dist/src/utils/SignatureHelper.d.ts.map +1 -0
- package/dist/src/utils/SwapEventExtractor.d.ts +152 -0
- package/dist/src/utils/SwapEventExtractor.d.ts.map +1 -0
- package/dist/src/utils/adapters.d.ts.map +1 -0
- package/dist/src/utils/agent-config.d.ts.map +1 -0
- package/dist/{utils → src/utils}/auto-pagination.d.ts +1 -1
- package/dist/src/utils/auto-pagination.d.ts.map +1 -0
- package/dist/{utils → src/utils}/bignumber-helpers.d.ts +5 -1
- package/dist/src/utils/bignumber-helpers.d.ts.map +1 -0
- package/dist/src/utils/bignumber-pool-cache.d.ts.map +1 -0
- package/dist/src/utils/bondingCurveCalculations.d.ts.map +1 -0
- package/dist/src/utils/cacheWarmingHelpers.d.ts.map +1 -0
- package/dist/src/utils/composite-pool-converter.d.ts.map +1 -0
- package/dist/src/utils/date-utils.d.ts.map +1 -0
- package/dist/src/utils/error-factories.d.ts.map +1 -0
- package/dist/src/utils/error-utils.d.ts.map +1 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/http.d.ts.map +1 -0
- package/dist/src/utils/load-env.d.ts.map +1 -0
- package/dist/src/utils/multipart-helpers.d.ts.map +1 -0
- package/dist/{utils → src/utils}/multipart.d.ts +2 -2
- package/dist/src/utils/multipart.d.ts.map +1 -0
- package/dist/src/utils/number-utils.d.ts.map +1 -0
- package/dist/src/utils/pool-pair-parser.d.ts.map +1 -0
- package/dist/src/utils/pool-state-validator.d.ts.map +1 -0
- package/dist/src/utils/position-filters.d.ts.map +1 -0
- package/dist/src/utils/precision-math.d.ts.map +1 -0
- package/dist/{utils → src/utils}/query-params.d.ts +2 -2
- package/dist/src/utils/query-params.d.ts.map +1 -0
- package/dist/src/utils/response-handlers.d.ts.map +1 -0
- package/dist/src/utils/response-normalizers.d.ts.map +1 -0
- package/dist/src/utils/slippage-utils.d.ts.map +1 -0
- package/dist/src/utils/swap-delta-calculator.d.ts.map +1 -0
- package/dist/src/utils/tick-crossing-handler.d.ts.map +1 -0
- package/dist/{utils → src/utils}/token-format-converter.d.ts +8 -8
- package/dist/src/utils/token-format-converter.d.ts.map +1 -0
- package/dist/src/utils/token-parser.d.ts.map +1 -0
- package/dist/src/utils/tokenNormalizer.d.ts.map +1 -0
- package/dist/src/utils/trade-transformers.d.ts.map +1 -0
- package/dist/src/utils/transfer-validation.d.ts.map +1 -0
- package/dist/{utils → src/utils}/validation-helpers.d.ts +1 -1
- package/dist/src/utils/validation-helpers.d.ts.map +1 -0
- package/dist/src/utils/validation.d.ts.map +1 -0
- package/dist/src/utils/wallet.d.ts.map +1 -0
- package/dist/src/utils/websocket-errors.d.ts.map +1 -0
- package/dist/src/utils/websocket-validators.d.ts.map +1 -0
- package/package.json +39 -6
- package/dist/LaunchpadSDK.d.ts.map +0 -1
- package/dist/api/LaunchpadAPI.d.ts.map +0 -1
- package/dist/api/dto/BondingCurveDTOs.d.ts.map +0 -1
- package/dist/api/dto/TransferTokenDto.d.ts.map +0 -1
- package/dist/auth/SignatureAuth.d.ts.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/config/environments.d.ts.map +0 -1
- package/dist/constants/bondingCurve.d.ts.map +0 -1
- package/dist/constants/config.d.ts.map +0 -1
- package/dist/constants/counts.d.ts.map +0 -1
- package/dist/constants/decimals.d.ts.map +0 -1
- package/dist/constants/endpoints.d.ts.map +0 -1
- package/dist/constants/enums.d.ts.map +0 -1
- package/dist/constants/error-messages.d.ts.map +0 -1
- package/dist/constants/pagination.d.ts.map +0 -1
- package/dist/constants/query-fields.d.ts.map +0 -1
- package/dist/constants/version.d.ts.map +0 -1
- package/dist/constants/version.generated.d.ts.map +0 -1
- package/dist/helpers/sdk.d.ts.map +0 -1
- package/dist/helpers/wallet.d.ts.map +0 -1
- package/dist/polyfills/file-global.d.ts.map +0 -1
- package/dist/schemas/files.d.ts.map +0 -1
- package/dist/schemas/index.d.ts.map +0 -1
- package/dist/schemas/launchpad.d.ts.map +0 -1
- package/dist/schemas/pagination.d.ts.map +0 -1
- package/dist/schemas/primitives.d.ts.map +0 -1
- package/dist/schemas/trade.d.ts.map +0 -1
- package/dist/schemas/user.d.ts.map +0 -1
- package/dist/schemas/validators.d.ts.map +0 -1
- package/dist/services/BaseService.d.ts.map +0 -1
- package/dist/services/BundleService.d.ts.map +0 -1
- package/dist/services/CommentService.d.ts.map +0 -1
- package/dist/services/DexBackendClient.d.ts.map +0 -1
- package/dist/services/DexPoolService.d.ts.map +0 -1
- package/dist/services/DexQuoteService.d.ts.map +0 -1
- package/dist/services/DexService.d.ts.map +0 -1
- package/dist/services/FaucetService.d.ts.map +0 -1
- package/dist/services/GSwapService.d.ts.map +0 -1
- package/dist/services/GalaChainGatewayClient.d.ts.map +0 -1
- package/dist/services/GalaChainService.d.ts.map +0 -1
- package/dist/services/ImageService.d.ts.map +0 -1
- package/dist/services/LaunchpadService.d.ts.map +0 -1
- package/dist/services/PoolService.d.ts.map +0 -1
- package/dist/services/PoolStateManager.d.ts.map +0 -1
- package/dist/services/PriceHistoryService.d.ts.map +0 -1
- package/dist/services/SignatureService.d.ts.map +0 -1
- package/dist/services/TokenClassKeyService.d.ts.map +0 -1
- package/dist/services/TokenMetadataCache.d.ts.map +0 -1
- package/dist/services/TokenMetadataService.d.ts.map +0 -1
- package/dist/services/TokenResolverService.d.ts.map +0 -1
- package/dist/services/TradeService.d.ts.map +0 -1
- package/dist/services/UserService.d.ts.map +0 -1
- package/dist/services/WebSocketManager.d.ts.map +0 -1
- package/dist/services/WebSocketService.d.ts.map +0 -1
- package/dist/services/__mocks__/logger.mock.d.ts.map +0 -1
- package/dist/types/backend-responses.d.ts.map +0 -1
- package/dist/types/comment.dto.d.ts.map +0 -1
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/composite-pool.dto.d.ts.map +0 -1
- package/dist/types/dex-pool.dto.d.ts.map +0 -1
- package/dist/types/dto.d.ts.map +0 -1
- package/dist/types/eip712-types.d.ts.map +0 -1
- package/dist/types/galachain-api.types.d.ts.map +0 -1
- package/dist/types/gswap-responses.types.d.ts.map +0 -1
- package/dist/types/gswap.dto.d.ts.map +0 -1
- package/dist/types/launchpad.dto.d.ts.map +0 -1
- package/dist/types/launchpad.validation.d.ts.map +0 -1
- package/dist/types/options.dto.d.ts.map +0 -1
- package/dist/types/pool-state-delta.dto.d.ts.map +0 -1
- package/dist/types/pool-state-manager-config.dto.d.ts.map +0 -1
- package/dist/types/priceHistory.dto.d.ts.map +0 -1
- package/dist/types/result.types.d.ts.map +0 -1
- package/dist/types/trade.dto.d.ts.map +0 -1
- package/dist/types/transfer.dto.d.ts.map +0 -1
- package/dist/types/user.dto.d.ts.map +0 -1
- package/dist/types/websocket-data.types.d.ts.map +0 -1
- package/dist/types/websocket.types.d.ts.map +0 -1
- package/dist/utils/Logger.d.ts.map +0 -1
- package/dist/utils/SignatureHelper.d.ts.map +0 -1
- package/dist/utils/adapters.d.ts.map +0 -1
- package/dist/utils/agent-config.d.ts.map +0 -1
- package/dist/utils/auto-pagination.d.ts.map +0 -1
- package/dist/utils/bignumber-helpers.d.ts.map +0 -1
- package/dist/utils/bignumber-pool-cache.d.ts.map +0 -1
- package/dist/utils/bondingCurveCalculations.d.ts.map +0 -1
- package/dist/utils/cacheWarmingHelpers.d.ts.map +0 -1
- package/dist/utils/composite-pool-converter.d.ts.map +0 -1
- package/dist/utils/date-utils.d.ts.map +0 -1
- package/dist/utils/error-factories.d.ts.map +0 -1
- package/dist/utils/error-utils.d.ts.map +0 -1
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/http.d.ts.map +0 -1
- package/dist/utils/load-env.d.ts.map +0 -1
- package/dist/utils/multipart-helpers.d.ts.map +0 -1
- package/dist/utils/multipart.d.ts.map +0 -1
- package/dist/utils/number-utils.d.ts.map +0 -1
- package/dist/utils/pool-pair-parser.d.ts.map +0 -1
- package/dist/utils/pool-state-validator.d.ts.map +0 -1
- package/dist/utils/position-filters.d.ts.map +0 -1
- package/dist/utils/precision-math.d.ts.map +0 -1
- package/dist/utils/query-params.d.ts.map +0 -1
- package/dist/utils/response-handlers.d.ts.map +0 -1
- package/dist/utils/response-normalizers.d.ts.map +0 -1
- package/dist/utils/slippage-utils.d.ts.map +0 -1
- package/dist/utils/swap-delta-calculator.d.ts.map +0 -1
- package/dist/utils/tick-crossing-handler.d.ts.map +0 -1
- package/dist/utils/token-format-converter.d.ts.map +0 -1
- package/dist/utils/token-parser.d.ts.map +0 -1
- package/dist/utils/tokenNormalizer.d.ts.map +0 -1
- package/dist/utils/trade-transformers.d.ts.map +0 -1
- package/dist/utils/transfer-validation.d.ts.map +0 -1
- package/dist/utils/validation-helpers.d.ts.map +0 -1
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/wallet.d.ts.map +0 -1
- package/dist/utils/websocket-errors.d.ts.map +0 -1
- package/dist/utils/websocket-validators.d.ts.map +0 -1
- /package/dist/{api → src/api}/LaunchpadAPI.d.ts +0 -0
- /package/dist/{api → src/api}/dto/BondingCurveDTOs.d.ts +0 -0
- /package/dist/{api → src/api}/dto/TransferTokenDto.d.ts +0 -0
- /package/dist/{auth → src/auth}/SignatureAuth.d.ts +0 -0
- /package/dist/{auth → src/auth}/types.d.ts +0 -0
- /package/dist/{config → src/config}/environments.d.ts +0 -0
- /package/dist/{constants → src/constants}/bondingCurve.d.ts +0 -0
- /package/dist/{constants → src/constants}/config.d.ts +0 -0
- /package/dist/{constants → src/constants}/counts.d.ts +0 -0
- /package/dist/{constants → src/constants}/decimals.d.ts +0 -0
- /package/dist/{constants → src/constants}/endpoints.d.ts +0 -0
- /package/dist/{constants → src/constants}/enums.d.ts +0 -0
- /package/dist/{constants → src/constants}/error-messages.d.ts +0 -0
- /package/dist/{constants → src/constants}/pagination.d.ts +0 -0
- /package/dist/{constants → src/constants}/query-fields.d.ts +0 -0
- /package/dist/{constants → src/constants}/version.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/sdk.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/wallet.d.ts +0 -0
- /package/dist/{polyfills → src/polyfills}/file-global.d.ts +0 -0
- /package/dist/{schemas → src/schemas}/files.d.ts +0 -0
- /package/dist/{schemas → src/schemas}/index.d.ts +0 -0
- /package/dist/{schemas → src/schemas}/launchpad.d.ts +0 -0
- /package/dist/{schemas → src/schemas}/pagination.d.ts +0 -0
- /package/dist/{schemas → src/schemas}/primitives.d.ts +0 -0
- /package/dist/{schemas → src/schemas}/trade.d.ts +0 -0
- /package/dist/{schemas → src/schemas}/user.d.ts +0 -0
- /package/dist/{schemas → src/schemas}/validators.d.ts +0 -0
- /package/dist/{services → src/services}/BaseService.d.ts +0 -0
- /package/dist/{services → src/services}/BundleService.d.ts +0 -0
- /package/dist/{services → src/services}/CommentService.d.ts +0 -0
- /package/dist/{services → src/services}/DexBackendClient.d.ts +0 -0
- /package/dist/{services → src/services}/DexPoolService.d.ts +0 -0
- /package/dist/{services → src/services}/DexQuoteService.d.ts +0 -0
- /package/dist/{services → src/services}/FaucetService.d.ts +0 -0
- /package/dist/{services → src/services}/ImageService.d.ts +0 -0
- /package/dist/{services → src/services}/LaunchpadService.d.ts +0 -0
- /package/dist/{services → src/services}/PoolService.d.ts +0 -0
- /package/dist/{services → src/services}/PoolStateManager.d.ts +0 -0
- /package/dist/{services → src/services}/SignatureService.d.ts +0 -0
- /package/dist/{services → src/services}/TokenClassKeyService.d.ts +0 -0
- /package/dist/{services → src/services}/TokenResolverService.d.ts +0 -0
- /package/dist/{services → src/services}/TradeService.d.ts +0 -0
- /package/dist/{services → src/services}/UserService.d.ts +0 -0
- /package/dist/{services → src/services}/WebSocketManager.d.ts +0 -0
- /package/dist/{services → src/services}/WebSocketService.d.ts +0 -0
- /package/dist/{services → src/services}/__mocks__/logger.mock.d.ts +0 -0
- /package/dist/{setup.d.ts → src/setup.d.ts} +0 -0
- /package/dist/{types → src/types}/comment.dto.d.ts +0 -0
- /package/dist/{types → src/types}/common.d.ts +0 -0
- /package/dist/{types → src/types}/dex-pool.dto.d.ts +0 -0
- /package/dist/{types → src/types}/dto.d.ts +0 -0
- /package/dist/{types → src/types}/eip712-types.d.ts +0 -0
- /package/dist/{types → src/types}/gswap.dto.d.ts +0 -0
- /package/dist/{types → src/types}/launchpad.validation.d.ts +0 -0
- /package/dist/{types → src/types}/options.dto.d.ts +0 -0
- /package/dist/{types → src/types}/pool-state-delta.dto.d.ts +0 -0
- /package/dist/{types → src/types}/pool-state-manager-config.dto.d.ts +0 -0
- /package/dist/{types → src/types}/result.types.d.ts +0 -0
- /package/dist/{types → src/types}/trade.dto.d.ts +0 -0
- /package/dist/{types → src/types}/transfer.dto.d.ts +0 -0
- /package/dist/{types → src/types}/user.dto.d.ts +0 -0
- /package/dist/{types → src/types}/websocket-data.types.d.ts +0 -0
- /package/dist/{types → src/types}/websocket.types.d.ts +0 -0
- /package/dist/{utils → src/utils}/Logger.d.ts +0 -0
- /package/dist/{utils → src/utils}/adapters.d.ts +0 -0
- /package/dist/{utils → src/utils}/agent-config.d.ts +0 -0
- /package/dist/{utils → src/utils}/bignumber-pool-cache.d.ts +0 -0
- /package/dist/{utils → src/utils}/bondingCurveCalculations.d.ts +0 -0
- /package/dist/{utils → src/utils}/cacheWarmingHelpers.d.ts +0 -0
- /package/dist/{utils → src/utils}/composite-pool-converter.d.ts +0 -0
- /package/dist/{utils → src/utils}/date-utils.d.ts +0 -0
- /package/dist/{utils → src/utils}/error-factories.d.ts +0 -0
- /package/dist/{utils → src/utils}/error-utils.d.ts +0 -0
- /package/dist/{utils → src/utils}/errors.d.ts +0 -0
- /package/dist/{utils → src/utils}/http.d.ts +0 -0
- /package/dist/{utils → src/utils}/load-env.d.ts +0 -0
- /package/dist/{utils → src/utils}/multipart-helpers.d.ts +0 -0
- /package/dist/{utils → src/utils}/number-utils.d.ts +0 -0
- /package/dist/{utils → src/utils}/pool-pair-parser.d.ts +0 -0
- /package/dist/{utils → src/utils}/pool-state-validator.d.ts +0 -0
- /package/dist/{utils → src/utils}/position-filters.d.ts +0 -0
- /package/dist/{utils → src/utils}/precision-math.d.ts +0 -0
- /package/dist/{utils → src/utils}/response-handlers.d.ts +0 -0
- /package/dist/{utils → src/utils}/response-normalizers.d.ts +0 -0
- /package/dist/{utils → src/utils}/slippage-utils.d.ts +0 -0
- /package/dist/{utils → src/utils}/swap-delta-calculator.d.ts +0 -0
- /package/dist/{utils → src/utils}/tick-crossing-handler.d.ts +0 -0
- /package/dist/{utils → src/utils}/token-parser.d.ts +0 -0
- /package/dist/{utils → src/utils}/tokenNormalizer.d.ts +0 -0
- /package/dist/{utils → src/utils}/trade-transformers.d.ts +0 -0
- /package/dist/{utils → src/utils}/transfer-validation.d.ts +0 -0
- /package/dist/{utils → src/utils}/validation.d.ts +0 -0
- /package/dist/{utils → src/utils}/wallet.d.ts +0 -0
- /package/dist/{utils → src/utils}/websocket-errors.d.ts +0 -0
- /package/dist/{utils → src/utils}/websocket-validators.d.ts +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Wallet } from 'ethers';
|
|
2
2
|
import { SDKConfig, AddressFormat, TokenClassKey, TokenId } from './types/common';
|
|
3
3
|
import { PoolDetailsData } from './types/trade.dto';
|
|
4
|
-
import { LaunchTokenData, TokenSpotPrice, FetchPoolsOptions, PoolsResult, GalaChainTokenDetails, PoolData, TokenClassWithSupply } from './types/launchpad.dto';
|
|
4
|
+
import { LaunchTokenData, TokenSpotPrice, FetchPoolsOptions, PoolsResult, GalaChainTokenDetails, PoolData, TokenClassWithSupply, DexSeason, LeaderboardResult, DexAggregatedVolumeSummary } from './types/launchpad.dto';
|
|
5
5
|
import { UpdateProfileData, UploadProfileImageOptions, FetchTokenBalanceOptions } from './types/user.dto';
|
|
6
6
|
import { TransferGalaData, TransferTokenData } from './types/transfer.dto';
|
|
7
|
+
import { LockTokenData, UnlockTokenData } from './types/lock.dto';
|
|
7
8
|
import { TokenLaunchResult, TradeResult } from './types/result.types';
|
|
8
9
|
import { WebSocketError, WebSocketTimeoutError, TransactionFailedError } from './utils/websocket-errors';
|
|
9
10
|
export { WebSocketError, WebSocketTimeoutError, TransactionFailedError, };
|
|
@@ -12,6 +13,8 @@ import { FetchPriceHistoryOptions, PriceHistoryResult } from './types/priceHisto
|
|
|
12
13
|
import { FetchDexPoolsOptions, DexPoolsResult, DexPoolData } from './types/dex-pool.dto';
|
|
13
14
|
import { GSwapPosition, PoolPriceData, GetLiquidityPositionsOptions, GetLiquidityPositionsResult } from './types/gswap.dto';
|
|
14
15
|
import type { FetchCompositePoolDataOptions, CompositePoolDataResult, CalculateDexPoolQuoteOptions, DexPoolQuoteResult } from './types/composite-pool.dto';
|
|
16
|
+
import type { SubscribeSwapOptions, SwapMonitorConfig, CleanupFunction, SwapEventCallback } from './types/swap-monitor.dto';
|
|
17
|
+
import type { LiquidityChangedCallback, LiquidityCleanupFunction, SubscribeLiquidityOptions } from './types/liquidity-monitor.dto';
|
|
15
18
|
/**
|
|
16
19
|
* Configuration for initializing the Launchpad SDK
|
|
17
20
|
*
|
|
@@ -972,7 +975,7 @@ export declare class LaunchpadSDK {
|
|
|
972
975
|
* and trading capabilities.
|
|
973
976
|
*
|
|
974
977
|
* Supports flexible token identification using either string or object format:
|
|
975
|
-
* - String: `'
|
|
978
|
+
* - String: `'GUSDC|Unit|none|eth:0x...'` (pipe-delimited)
|
|
976
979
|
* - Object: `{ collection, category, type, additionalKey }`
|
|
977
980
|
*
|
|
978
981
|
* @param tokenId Token identifier in flexible format
|
|
@@ -980,7 +983,7 @@ export declare class LaunchpadSDK {
|
|
|
980
983
|
*
|
|
981
984
|
* @example String format
|
|
982
985
|
* ```typescript
|
|
983
|
-
* const details = await sdk.fetchTokenDetails('
|
|
986
|
+
* const details = await sdk.fetchTokenDetails('GUSDC|Unit|none|none');
|
|
984
987
|
* console.log(details.symbol); // 'GUSDC'
|
|
985
988
|
* console.log(details.decimals); // 6
|
|
986
989
|
* console.log(details.verified); // true
|
|
@@ -990,10 +993,10 @@ export declare class LaunchpadSDK {
|
|
|
990
993
|
* @example Object format
|
|
991
994
|
* ```typescript
|
|
992
995
|
* const details = await sdk.fetchTokenDetails({
|
|
993
|
-
* collection: '
|
|
996
|
+
* collection: 'GUSDC',
|
|
994
997
|
* category: 'Unit',
|
|
995
|
-
* type: '
|
|
996
|
-
* additionalKey: '
|
|
998
|
+
* type: 'none',
|
|
999
|
+
* additionalKey: 'none'
|
|
997
1000
|
* });
|
|
998
1001
|
* ```
|
|
999
1002
|
*
|
|
@@ -1001,6 +1004,156 @@ export declare class LaunchpadSDK {
|
|
|
1001
1004
|
* @throws {NetworkError} If API request fails or token not found
|
|
1002
1005
|
*/
|
|
1003
1006
|
fetchTokenDetails(tokenId: TokenId): Promise<GalaChainTokenDetails>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Fetch all available DEX leaderboard seasons
|
|
1009
|
+
*
|
|
1010
|
+
* Returns all season configurations with time ranges. Use season IDs
|
|
1011
|
+
* to fetch specific leaderboards with `fetchDexLeaderboardBySeasonId()`.
|
|
1012
|
+
*
|
|
1013
|
+
* @category DEX Leaderboard
|
|
1014
|
+
* @returns Promise<DexSeason[]> Array of all seasons
|
|
1015
|
+
* @throws {NetworkError} If API request fails
|
|
1016
|
+
* @since 3.X.0
|
|
1017
|
+
*
|
|
1018
|
+
* @example
|
|
1019
|
+
* ```typescript
|
|
1020
|
+
* const seasons = await sdk.fetchAllDexSeasons();
|
|
1021
|
+
* console.log(`Found ${seasons.length} seasons`);
|
|
1022
|
+
* seasons.forEach(s => {
|
|
1023
|
+
* console.log(`${s.name}: ${s.start} to ${s.end}`);
|
|
1024
|
+
* });
|
|
1025
|
+
* ```
|
|
1026
|
+
*/
|
|
1027
|
+
fetchAllDexSeasons(): Promise<DexSeason[]>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Find the currently active DEX leaderboard season
|
|
1030
|
+
*
|
|
1031
|
+
* Determines which season is active based on current time falling
|
|
1032
|
+
* between season start and end dates. Returns null if no season
|
|
1033
|
+
* is currently active.
|
|
1034
|
+
*
|
|
1035
|
+
* @category DEX Leaderboard
|
|
1036
|
+
* @returns Promise<DexSeason | null> Current season or null
|
|
1037
|
+
* @throws {NetworkError} If API request fails
|
|
1038
|
+
* @since 3.X.0
|
|
1039
|
+
*
|
|
1040
|
+
* @example
|
|
1041
|
+
* ```typescript
|
|
1042
|
+
* const current = await sdk.fetchCurrentDexSeason();
|
|
1043
|
+
* if (current) {
|
|
1044
|
+
* console.log(`Active: ${current.name} (ID: ${current.id})`);
|
|
1045
|
+
* } else {
|
|
1046
|
+
* console.log('No active season');
|
|
1047
|
+
* }
|
|
1048
|
+
* ```
|
|
1049
|
+
*/
|
|
1050
|
+
fetchCurrentDexSeason(): Promise<DexSeason | null>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Fetch DEX leaderboard for a specific season
|
|
1053
|
+
*
|
|
1054
|
+
* Returns complete leaderboard rankings with XP metrics and achievement titles.
|
|
1055
|
+
* Non-paginated response includes all entries (typically 100 participants).
|
|
1056
|
+
*
|
|
1057
|
+
* **XP Metrics:**
|
|
1058
|
+
* - `totalXp`: Combined liquidity + trading XP
|
|
1059
|
+
* - `liquidityXp`: Points from providing liquidity
|
|
1060
|
+
* - `tradingXp`: Points from trading volume
|
|
1061
|
+
*
|
|
1062
|
+
* **Achievement Titles:**
|
|
1063
|
+
* - Liquidity titles: Pool Explorer, Flow Enabler, Yield Artisan, etc.
|
|
1064
|
+
* - Trading titles: Novice Trader, Rookie Trader, Elite Trader, etc.
|
|
1065
|
+
* - Order indicates tier (1 = entry level, higher = more advanced)
|
|
1066
|
+
*
|
|
1067
|
+
* @category DEX Leaderboard
|
|
1068
|
+
* @param seasonId Season identifier number (must be positive integer)
|
|
1069
|
+
* @returns Promise<LeaderboardResult> Complete leaderboard with rankings and metrics
|
|
1070
|
+
* @throws {RequiredFieldError} If seasonId is invalid
|
|
1071
|
+
* @throws {NetworkError} If API request fails
|
|
1072
|
+
* @since 3.X.0
|
|
1073
|
+
*
|
|
1074
|
+
* @example
|
|
1075
|
+
* ```typescript
|
|
1076
|
+
* // Fetch specific season leaderboard
|
|
1077
|
+
* const leaderboard = await sdk.fetchDexLeaderboardBySeasonId(4);
|
|
1078
|
+
*
|
|
1079
|
+
* // Display top trader
|
|
1080
|
+
* const topTrader = leaderboard.entries[0];
|
|
1081
|
+
* console.log(`Rank 1: ${topTrader.wallet}`);
|
|
1082
|
+
* console.log(`Total XP: ${topTrader.totalXp}`);
|
|
1083
|
+
* console.log(`Distribution: ${topTrader.distributionPercent}%`);
|
|
1084
|
+
*
|
|
1085
|
+
* // Find users with specific titles
|
|
1086
|
+
* const whales = leaderboard.entries.filter(entry =>
|
|
1087
|
+
* entry.masteryTitles.some(t => t.name === 'Protocol Whale')
|
|
1088
|
+
* );
|
|
1089
|
+
* ```
|
|
1090
|
+
*/
|
|
1091
|
+
fetchDexLeaderboardBySeasonId(seasonId: number): Promise<LeaderboardResult>;
|
|
1092
|
+
/**
|
|
1093
|
+
* Fetch leaderboard for the currently active season
|
|
1094
|
+
*
|
|
1095
|
+
* Convenience method that automatically determines the current season
|
|
1096
|
+
* and fetches its leaderboard. Returns null if no season is active.
|
|
1097
|
+
*
|
|
1098
|
+
* Equivalent to:
|
|
1099
|
+
* ```typescript
|
|
1100
|
+
* const season = await sdk.fetchCurrentDexSeason();
|
|
1101
|
+
* return season ? sdk.fetchDexLeaderboardBySeasonId(season.id) : null;
|
|
1102
|
+
* ```
|
|
1103
|
+
*
|
|
1104
|
+
* @category DEX Leaderboard
|
|
1105
|
+
* @returns Promise<LeaderboardResult | null> Current leaderboard or null
|
|
1106
|
+
* @throws {NetworkError} If API request fails
|
|
1107
|
+
* @since 3.X.0
|
|
1108
|
+
*
|
|
1109
|
+
* @example
|
|
1110
|
+
* ```typescript
|
|
1111
|
+
* // Get current leaderboard in one call
|
|
1112
|
+
* const leaderboard = await sdk.fetchCurrentDexLeaderboard();
|
|
1113
|
+
*
|
|
1114
|
+
* if (leaderboard) {
|
|
1115
|
+
* console.log(`Season ${leaderboard.seasonId} leaders:`);
|
|
1116
|
+
* leaderboard.entries.slice(0, 10).forEach(entry => {
|
|
1117
|
+
* console.log(`${entry.rank}. ${entry.wallet}: ${entry.totalXp} XP`);
|
|
1118
|
+
* });
|
|
1119
|
+
* } else {
|
|
1120
|
+
* console.log('No active season');
|
|
1121
|
+
* }
|
|
1122
|
+
* ```
|
|
1123
|
+
*/
|
|
1124
|
+
fetchCurrentDexLeaderboard(): Promise<LeaderboardResult | null>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Fetch DEX aggregated volume summary with trend metrics
|
|
1127
|
+
*
|
|
1128
|
+
* Returns platform-wide trading volume statistics across all DEX pools with
|
|
1129
|
+
* 1-day, 7-day, and 30-day comparisons and percentage changes.
|
|
1130
|
+
*
|
|
1131
|
+
* **Use Cases:**
|
|
1132
|
+
* - Monitor overall DEX trading activity
|
|
1133
|
+
* - Identify volume trends and patterns
|
|
1134
|
+
* - Compare performance across time periods
|
|
1135
|
+
* - Detect market changes (increases/decreases)
|
|
1136
|
+
*
|
|
1137
|
+
* @category DEX Analytics
|
|
1138
|
+
* @returns Promise<DexAggregatedVolumeSummary> Volume metrics with deltas
|
|
1139
|
+
* @throws {NetworkError} If API request fails
|
|
1140
|
+
* @since 4.0.0
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
* ```typescript
|
|
1144
|
+
* const summary = await sdk.fetchDexAggregatedVolumeSummary();
|
|
1145
|
+
* console.log(`Today's volume: $${summary.volume1d.toFixed(2)}`);
|
|
1146
|
+
* console.log(`7-day change: ${(summary.volume7dDelta * 100).toFixed(2)}%`);
|
|
1147
|
+
*
|
|
1148
|
+
* // Analyze trend direction
|
|
1149
|
+
* if (summary.volume1dDelta > 0) {
|
|
1150
|
+
* console.log('✅ Volume increasing');
|
|
1151
|
+
* } else {
|
|
1152
|
+
* console.log('📉 Volume decreasing');
|
|
1153
|
+
* }
|
|
1154
|
+
* ```
|
|
1155
|
+
*/
|
|
1156
|
+
fetchDexAggregatedVolumeSummary(): Promise<DexAggregatedVolumeSummary>;
|
|
1004
1157
|
/**
|
|
1005
1158
|
* Fetch the current launchpad token launch fee
|
|
1006
1159
|
*
|
|
@@ -1719,10 +1872,10 @@ export declare class LaunchpadSDK {
|
|
|
1719
1872
|
* // Fetch price history for a DEX token
|
|
1720
1873
|
* const history = await sdk.fetchPriceHistory({
|
|
1721
1874
|
* tokenClassKey: {
|
|
1722
|
-
* collection: '
|
|
1875
|
+
* collection: 'GUSDC',
|
|
1723
1876
|
* category: 'Unit',
|
|
1724
|
-
* type: '
|
|
1725
|
-
* additionalKey: '
|
|
1877
|
+
* type: 'none',
|
|
1878
|
+
* additionalKey: 'none'
|
|
1726
1879
|
* },
|
|
1727
1880
|
* from: new Date('2024-01-01'),
|
|
1728
1881
|
* to: new Date('2024-01-31'),
|
|
@@ -1758,10 +1911,10 @@ export declare class LaunchpadSDK {
|
|
|
1758
1911
|
* // Fetch all price history for a DEX token (automatic pagination)
|
|
1759
1912
|
* const allHistory = await sdk.fetchAllPriceHistory({
|
|
1760
1913
|
* tokenId: {
|
|
1761
|
-
* collection: '
|
|
1914
|
+
* collection: 'GUSDC',
|
|
1762
1915
|
* category: 'Unit',
|
|
1763
|
-
* type: '
|
|
1764
|
-
* additionalKey: '
|
|
1916
|
+
* type: 'none',
|
|
1917
|
+
* additionalKey: 'none'
|
|
1765
1918
|
* },
|
|
1766
1919
|
* from: new Date('2024-01-01'),
|
|
1767
1920
|
* to: new Date('2024-12-31')
|
|
@@ -1852,6 +2005,88 @@ export declare class LaunchpadSDK {
|
|
|
1852
2005
|
* @throws {TransferError} When token name cannot be resolved
|
|
1853
2006
|
*/
|
|
1854
2007
|
resolveTokenClassKey(tokenName: string): Promise<TokenClassKey>;
|
|
2008
|
+
/**
|
|
2009
|
+
* Lock tokens on GalaChain
|
|
2010
|
+
*
|
|
2011
|
+
* Places a hold on tokens, preventing them from being transferred until unlocked.
|
|
2012
|
+
* Useful for staking, escrow, vesting, or other hold scenarios.
|
|
2013
|
+
*
|
|
2014
|
+
* The lock operation creates a hold that can only be released by the lock authority
|
|
2015
|
+
* (defaults to the caller's address if not specified).
|
|
2016
|
+
*
|
|
2017
|
+
* @param data Lock token parameters
|
|
2018
|
+
* @param data.tokenId Flexible token identifier (string, TokenClassKey, or TokenInstanceKey)
|
|
2019
|
+
* @param data.tokenName Token name for lookup (used if tokenId not provided)
|
|
2020
|
+
* @param data.amount Amount of tokens to lock in decimal format
|
|
2021
|
+
* @param data.lockAuthority Address that can manage/unlock (defaults to caller)
|
|
2022
|
+
* @param data.expires Optional expiration timestamp (epoch milliseconds)
|
|
2023
|
+
* @param data.name Optional lock name/identifier for matching during unlock
|
|
2024
|
+
* @param data.uniqueKey Optional unique key for idempotency
|
|
2025
|
+
* @param data.privateKey Optional private key override for this operation
|
|
2026
|
+
* @returns Transaction ID of the lock operation
|
|
2027
|
+
*
|
|
2028
|
+
* @example Lock tokens with default authority
|
|
2029
|
+
* ```typescript
|
|
2030
|
+
* const txId = await sdk.lockToken({
|
|
2031
|
+
* tokenName: 'anime',
|
|
2032
|
+
* amount: '1000'
|
|
2033
|
+
* });
|
|
2034
|
+
* console.log('Tokens locked, txId:', txId);
|
|
2035
|
+
* ```
|
|
2036
|
+
*
|
|
2037
|
+
* @example Lock with expiration and custom authority
|
|
2038
|
+
* ```typescript
|
|
2039
|
+
* const txId = await sdk.lockToken({
|
|
2040
|
+
* tokenName: 'anime',
|
|
2041
|
+
* amount: '500',
|
|
2042
|
+
* lockAuthority: 'eth|OtherWalletAddress',
|
|
2043
|
+
* expires: Date.now() + 7 * 24 * 60 * 60 * 1000, // 7 days
|
|
2044
|
+
* name: 'staking-lock-001'
|
|
2045
|
+
* });
|
|
2046
|
+
* ```
|
|
2047
|
+
*
|
|
2048
|
+
* @throws {TransferError} When token cannot be found or lock fails
|
|
2049
|
+
* @throws {ValidationError} When wallet is not configured
|
|
2050
|
+
*/
|
|
2051
|
+
lockToken(data: LockTokenData): Promise<string>;
|
|
2052
|
+
/**
|
|
2053
|
+
* Unlock previously locked tokens on GalaChain
|
|
2054
|
+
*
|
|
2055
|
+
* Releases a token hold, making the tokens available for transfer again.
|
|
2056
|
+
* Must be signed by the lock authority (the address that locked the tokens
|
|
2057
|
+
* or was designated as lock authority during the lock operation).
|
|
2058
|
+
*
|
|
2059
|
+
* @param data Unlock token parameters
|
|
2060
|
+
* @param data.tokenId Flexible token identifier (string, TokenClassKey, or TokenInstanceKey)
|
|
2061
|
+
* @param data.tokenName Token name for lookup (used if tokenId not provided)
|
|
2062
|
+
* @param data.amount Amount of tokens to unlock in decimal format
|
|
2063
|
+
* @param data.name Optional lock name to match (if used during lock)
|
|
2064
|
+
* @param data.uniqueKey Optional unique key for idempotency
|
|
2065
|
+
* @param data.privateKey Optional private key override for this operation
|
|
2066
|
+
* @returns Transaction ID of the unlock operation
|
|
2067
|
+
*
|
|
2068
|
+
* @example Unlock tokens
|
|
2069
|
+
* ```typescript
|
|
2070
|
+
* const txId = await sdk.unlockToken({
|
|
2071
|
+
* tokenName: 'anime',
|
|
2072
|
+
* amount: '1000'
|
|
2073
|
+
* });
|
|
2074
|
+
* console.log('Tokens unlocked, txId:', txId);
|
|
2075
|
+
* ```
|
|
2076
|
+
*
|
|
2077
|
+
* @example Unlock with lock name matching
|
|
2078
|
+
* ```typescript
|
|
2079
|
+
* const txId = await sdk.unlockToken({
|
|
2080
|
+
* tokenName: 'anime',
|
|
2081
|
+
* amount: '500',
|
|
2082
|
+
* name: 'staking-lock-001' // Match specific lock
|
|
2083
|
+
* });
|
|
2084
|
+
* ```
|
|
2085
|
+
*
|
|
2086
|
+
* @throws {TransferError} When token or lock cannot be found, or unlock fails
|
|
2087
|
+
* @throws {ValidationError} When wallet is not configured
|
|
2088
|
+
*/
|
|
2089
|
+
unlockToken(data: UnlockTokenData): Promise<string>;
|
|
1855
2090
|
/**
|
|
1856
2091
|
* Resolve vault address for a token name
|
|
1857
2092
|
*
|
|
@@ -2284,23 +2519,34 @@ export declare class LaunchpadSDK {
|
|
|
2284
2519
|
* Get liquidity position by position ID
|
|
2285
2520
|
*
|
|
2286
2521
|
* Retrieves a specific liquidity position by its unique identifier.
|
|
2522
|
+
* Optionally accepts token information for more efficient compound key lookups.
|
|
2287
2523
|
*
|
|
2288
2524
|
* @category DEX Liquidity Management
|
|
2289
2525
|
* @since 3.25.0
|
|
2290
2526
|
*
|
|
2291
2527
|
* @param ownerAddress - Wallet address
|
|
2292
2528
|
* @param positionId - Unique position identifier
|
|
2529
|
+
* @param token0 - Optional token0 for compound key lookup (improves lookup reliability)
|
|
2530
|
+
* @param token1 - Optional token1 for compound key lookup (improves lookup reliability)
|
|
2531
|
+
* @param feeTier - Optional fee tier for compound key lookup (improves lookup reliability)
|
|
2532
|
+
* @param tickLower - Optional lower tick boundary for compound key lookup
|
|
2533
|
+
* @param tickUpper - Optional upper tick boundary for compound key lookup
|
|
2293
2534
|
* @returns Liquidity position details
|
|
2294
2535
|
*
|
|
2295
|
-
* @example Get position by ID
|
|
2536
|
+
* @example Get position by ID with token information
|
|
2296
2537
|
* ```typescript
|
|
2297
2538
|
* const position = await sdk.getSwapLiquidityPositionById(
|
|
2298
2539
|
* 'eth|0x123...',
|
|
2299
|
-
* 'pos-abc123'
|
|
2540
|
+
* 'pos-abc123',
|
|
2541
|
+
* 'GALA',
|
|
2542
|
+
* 'GUSDC',
|
|
2543
|
+
* 3000,
|
|
2544
|
+
* -1080, // tickLower
|
|
2545
|
+
* 900 // tickUpper
|
|
2300
2546
|
* );
|
|
2301
2547
|
* ```
|
|
2302
2548
|
*/
|
|
2303
|
-
getSwapLiquidityPositionById(ownerAddress: string, positionId: string): Promise<import("./types/gswap.dto").LiquidityPosition>;
|
|
2549
|
+
getSwapLiquidityPositionById(ownerAddress: string, positionId: string, token0?: string | Record<string, any>, token1?: string | Record<string, any>, feeTier?: number, tickLower?: number, tickUpper?: number): Promise<import("./types/gswap.dto").LiquidityPosition>;
|
|
2304
2550
|
/**
|
|
2305
2551
|
* Fetch a single liquidity position using ONLY the compound key (most efficient)
|
|
2306
2552
|
*
|
|
@@ -2378,7 +2624,7 @@ export declare class LaunchpadSDK {
|
|
|
2378
2624
|
liquidity: string;
|
|
2379
2625
|
tickLower: number;
|
|
2380
2626
|
tickUpper: number;
|
|
2381
|
-
}): Promise<
|
|
2627
|
+
}): Promise<import("./types/gswap-responses.types").GSwapEstimateRemoveLiquidityResult>;
|
|
2382
2628
|
/**
|
|
2383
2629
|
* Add liquidity using price range
|
|
2384
2630
|
*
|
|
@@ -2408,7 +2654,10 @@ export declare class LaunchpadSDK {
|
|
|
2408
2654
|
* console.log(`Position created: ${result.positionId}`);
|
|
2409
2655
|
* ```
|
|
2410
2656
|
*/
|
|
2411
|
-
addSwapLiquidityByPrice(args: any): Promise<
|
|
2657
|
+
addSwapLiquidityByPrice(args: any): Promise<import("./types/gswap-responses.types").GSwapAddLiquidityResult & {
|
|
2658
|
+
timestamp?: Date;
|
|
2659
|
+
wait?: (timeoutMs?: number) => Promise<void>;
|
|
2660
|
+
}>;
|
|
2412
2661
|
/**
|
|
2413
2662
|
* Add liquidity using tick range
|
|
2414
2663
|
*
|
|
@@ -2434,7 +2683,10 @@ export declare class LaunchpadSDK {
|
|
|
2434
2683
|
* });
|
|
2435
2684
|
* ```
|
|
2436
2685
|
*/
|
|
2437
|
-
addSwapLiquidityByTicks(args: any): Promise<
|
|
2686
|
+
addSwapLiquidityByTicks(args: any): Promise<import("./types/gswap-responses.types").GSwapAddLiquidityResult & {
|
|
2687
|
+
timestamp?: Date;
|
|
2688
|
+
wait?: (timeoutMs?: number) => Promise<void>;
|
|
2689
|
+
}>;
|
|
2438
2690
|
/**
|
|
2439
2691
|
* Remove liquidity from a position
|
|
2440
2692
|
*
|
|
@@ -2459,7 +2711,7 @@ export declare class LaunchpadSDK {
|
|
|
2459
2711
|
* });
|
|
2460
2712
|
* ```
|
|
2461
2713
|
*/
|
|
2462
|
-
removeSwapLiquidity(args: any): Promise<
|
|
2714
|
+
removeSwapLiquidity(args: any): Promise<import("./types/gswap-responses.types").GSwapAddLiquidityResult>;
|
|
2463
2715
|
/**
|
|
2464
2716
|
* Collect accumulated position fees
|
|
2465
2717
|
*
|
|
@@ -2481,7 +2733,7 @@ export declare class LaunchpadSDK {
|
|
|
2481
2733
|
* console.log(`Collected: ${result.amount0} token0, ${result.amount1} token1`);
|
|
2482
2734
|
* ```
|
|
2483
2735
|
*/
|
|
2484
|
-
collectSwapPositionFees(args: any): Promise<
|
|
2736
|
+
collectSwapPositionFees(args: any): Promise<import("./types/gswap-responses.types").GSwapAddLiquidityResult>;
|
|
2485
2737
|
/**
|
|
2486
2738
|
* Connect to WebSocket for real-time events
|
|
2487
2739
|
*
|
|
@@ -2674,6 +2926,633 @@ export declare class LaunchpadSDK {
|
|
|
2674
2926
|
intervalMs?: number;
|
|
2675
2927
|
creatorAddress?: string;
|
|
2676
2928
|
}): () => void;
|
|
2929
|
+
private static readonly TOKEN_CREATION_SOCKET_WAIT_ATTEMPTS;
|
|
2930
|
+
private static readonly TOKEN_CREATION_SOCKET_POLL_INTERVAL_MS;
|
|
2931
|
+
private static readonly DEX_POOL_SOCKET_WAIT_ATTEMPTS;
|
|
2932
|
+
private static readonly DEX_POOL_SOCKET_POLL_INTERVAL_MS;
|
|
2933
|
+
/**
|
|
2934
|
+
* Normalize fee tier to standard format (500, 3000, or 10000)
|
|
2935
|
+
*
|
|
2936
|
+
* Handles various fee formats: percentage strings ("0.3", "1"), basis points (500, 3000, 10000)
|
|
2937
|
+
*
|
|
2938
|
+
* @param value - Fee value in any format
|
|
2939
|
+
* @returns Normalized fee tier (500, 3000, 10000) or null if invalid
|
|
2940
|
+
* @private
|
|
2941
|
+
*/
|
|
2942
|
+
private normalizeFee;
|
|
2943
|
+
/**
|
|
2944
|
+
* Extract a field from an object with multiple possible key names
|
|
2945
|
+
*
|
|
2946
|
+
* @param obj - Object to search
|
|
2947
|
+
* @param keys - Possible key names to try in order
|
|
2948
|
+
* @returns Value of first matching key or empty string
|
|
2949
|
+
* @private
|
|
2950
|
+
*/
|
|
2951
|
+
private extractField;
|
|
2952
|
+
/**
|
|
2953
|
+
* Check if a string looks like a pool pair format
|
|
2954
|
+
*
|
|
2955
|
+
* Format: "token0/token1/fee" or full format with class keys
|
|
2956
|
+
*
|
|
2957
|
+
* @param value - Value to check
|
|
2958
|
+
* @returns Normalized pool pair string or null
|
|
2959
|
+
* @private
|
|
2960
|
+
*/
|
|
2961
|
+
private looksLikePoolPair;
|
|
2962
|
+
/**
|
|
2963
|
+
* Build pool pair from object with token and fee fields
|
|
2964
|
+
*
|
|
2965
|
+
* Tries multiple field name patterns to extract token0, token1, and fee
|
|
2966
|
+
*
|
|
2967
|
+
* @param obj - Object potentially containing pool data
|
|
2968
|
+
* @returns Pool pair string or null
|
|
2969
|
+
* @private
|
|
2970
|
+
*/
|
|
2971
|
+
private buildPoolPairFromObject;
|
|
2972
|
+
/**
|
|
2973
|
+
* Parse pool pair string into token0, token1, and fee
|
|
2974
|
+
*
|
|
2975
|
+
* Format: "token0ClassKey/token1ClassKey/feeTier"
|
|
2976
|
+
* Example: "GALA|Unit|none|none/GUSDC|Unit|none|none/10000"
|
|
2977
|
+
*
|
|
2978
|
+
* @param poolPairString - Pool pair string
|
|
2979
|
+
* @returns Pool data or null if invalid
|
|
2980
|
+
* @private
|
|
2981
|
+
*/
|
|
2982
|
+
private parsePoolPairString;
|
|
2983
|
+
/**
|
|
2984
|
+
* Serialize balance token object to classKey format
|
|
2985
|
+
* Used by buildPoolPairFromBalances to convert balance objects to token symbols
|
|
2986
|
+
*
|
|
2987
|
+
* Format: "collection|category|type|additionalKey"
|
|
2988
|
+
* Example: "GALA|Unit|none|none"
|
|
2989
|
+
*
|
|
2990
|
+
* @param balance - Balance object with collection, category, type fields
|
|
2991
|
+
* @returns Serialized token string or empty string if invalid
|
|
2992
|
+
* @private
|
|
2993
|
+
*/
|
|
2994
|
+
private serializeBalanceToken;
|
|
2995
|
+
/**
|
|
2996
|
+
* Build pool pair from balance delta objects
|
|
2997
|
+
* Handles extraction from swap and liquidity events that include balance changes
|
|
2998
|
+
*
|
|
2999
|
+
* Looks for:
|
|
3000
|
+
* - userBalanceDelta, balanceDelta, or delta objects
|
|
3001
|
+
* - token0Balance/token0/baseBalance/primaryBalance fields
|
|
3002
|
+
* - token1Balance/token1/quoteBalance/secondaryBalance fields
|
|
3003
|
+
* - Fee from poolFee, feeTier, fee, feeTierBps, or liquidityFeeBps
|
|
3004
|
+
*
|
|
3005
|
+
* @param obj - Object that may contain balance delta data
|
|
3006
|
+
* @returns Pool pair string or null if extraction failed
|
|
3007
|
+
* @private
|
|
3008
|
+
*/
|
|
3009
|
+
private buildPoolPairFromBalances;
|
|
3010
|
+
/**
|
|
3011
|
+
* Extract pool data from WebSocket event payload
|
|
3012
|
+
*
|
|
3013
|
+
* Tries multiple patterns in order to find pool data:
|
|
3014
|
+
* 1. Direct poolPair string
|
|
3015
|
+
* 2. Direct poolPair field
|
|
3016
|
+
* 3. Balance delta patterns (from swap/liquidity events) - CRITICAL for event detection
|
|
3017
|
+
* 4. Object fields (token0, token1, fee)
|
|
3018
|
+
* 5. Nested pool object
|
|
3019
|
+
*
|
|
3020
|
+
* Order matches reference implementation (newPoolsWatch.js) for maximum compatibility
|
|
3021
|
+
*
|
|
3022
|
+
* @param payload - WebSocket event payload
|
|
3023
|
+
* @returns Pool data or null if not found
|
|
3024
|
+
* @private
|
|
3025
|
+
*/
|
|
3026
|
+
private extractPoolDataFromPayload;
|
|
3027
|
+
/**
|
|
3028
|
+
* Check if a pool matches the optional filters
|
|
3029
|
+
*
|
|
3030
|
+
* Implements position-independent token matching:
|
|
3031
|
+
* - tokenFilter matches if token appears in EITHER position (token0 OR token1)
|
|
3032
|
+
* - pairTokens matches if BOTH tokens are present regardless of order
|
|
3033
|
+
* - feeTierFilter matches the fee tier
|
|
3034
|
+
*
|
|
3035
|
+
* @param pool - Pool data to check
|
|
3036
|
+
* @param options - Optional filters
|
|
3037
|
+
* @returns true if pool matches all specified filters
|
|
3038
|
+
* @private
|
|
3039
|
+
*/
|
|
3040
|
+
private matchesPoolFilter;
|
|
3041
|
+
/**
|
|
3042
|
+
* Check if a token creation event matches the optional creator filter
|
|
3043
|
+
*
|
|
3044
|
+
* Extracted for testability and maintainability.
|
|
3045
|
+
*
|
|
3046
|
+
* @param token - Token data from event
|
|
3047
|
+
* @param creatorFilter - Optional creator address filter
|
|
3048
|
+
* @returns true if token matches filter (or no filter specified)
|
|
3049
|
+
* @private
|
|
3050
|
+
*/
|
|
3051
|
+
private matchesCreatorFilter;
|
|
3052
|
+
/**
|
|
3053
|
+
* Subscribe to real-time token creation broadcasts
|
|
3054
|
+
*
|
|
3055
|
+
* Listens to WebSocket broadcasts for ALL token creations globally.
|
|
3056
|
+
* Provides real-time notifications with ~1-2 second latency (vs 15-30s polling).
|
|
3057
|
+
*
|
|
3058
|
+
* **Architecture:**
|
|
3059
|
+
* The backend broadcasts transaction confirmation events to ALL connected Socket.IO clients.
|
|
3060
|
+
* This listener captures "CreateSale" events which indicate token creation.
|
|
3061
|
+
*
|
|
3062
|
+
* **Key Difference from onLaunchpadTokenCreation():**
|
|
3063
|
+
* - `subscribeToTokenCreations()` - WebSocket broadcasts (instant, <2s latency)
|
|
3064
|
+
* - `onLaunchpadTokenCreation()` - REST API polling (slow, 15-30s latency)
|
|
3065
|
+
*
|
|
3066
|
+
* **Connection Management:**
|
|
3067
|
+
* - If WebSocket is already connected, listener is registered immediately
|
|
3068
|
+
* - If not connected, automatically initiates connection with 3-second timeout
|
|
3069
|
+
* - Connection failures are logged and can be handled via error callback
|
|
3070
|
+
*
|
|
3071
|
+
* **Cleanup Function:**
|
|
3072
|
+
* - Safe to call multiple times (idempotent)
|
|
3073
|
+
* - Removes listener and cleans up tracking state
|
|
3074
|
+
* - Returns immediately if listener was never registered
|
|
3075
|
+
*
|
|
3076
|
+
* @param callback - Called when any token is created
|
|
3077
|
+
* @param options - Optional filtering and error handling
|
|
3078
|
+
* @param options.creatorFilter - Only receive tokens from specific creator address
|
|
3079
|
+
* @param options.onError - Called if WebSocket connection fails
|
|
3080
|
+
* @returns Cleanup function to stop listening - safe to call multiple times
|
|
3081
|
+
*
|
|
3082
|
+
* @category Real-time Monitoring
|
|
3083
|
+
* @since 4.1.0
|
|
3084
|
+
*
|
|
3085
|
+
* @throws Error if WebSocket service not initialized
|
|
3086
|
+
*
|
|
3087
|
+
* @example Basic usage - listen to all token creations
|
|
3088
|
+
* ```typescript
|
|
3089
|
+
* const cleanup = sdk.subscribeToTokenCreations((token) => {
|
|
3090
|
+
* console.log(`Token created: ${token.tokenName} by ${token.creatorAddress}`);
|
|
3091
|
+
* });
|
|
3092
|
+
*
|
|
3093
|
+
* // Stop listening when done
|
|
3094
|
+
* cleanup();
|
|
3095
|
+
* ```
|
|
3096
|
+
*
|
|
3097
|
+
* @example Filter to specific creator
|
|
3098
|
+
* ```typescript
|
|
3099
|
+
* const cleanup = sdk.subscribeToTokenCreations(
|
|
3100
|
+
* (token) => console.log(`My token: ${token.tokenName}`),
|
|
3101
|
+
* {
|
|
3102
|
+
* creatorFilter: sdk.getAddress(),
|
|
3103
|
+
* onError: (error) => console.error('Connection failed:', error)
|
|
3104
|
+
* }
|
|
3105
|
+
* );
|
|
3106
|
+
* ```
|
|
3107
|
+
*
|
|
3108
|
+
* @example Monitor for competitor tokens with error handling
|
|
3109
|
+
* ```typescript
|
|
3110
|
+
* const cleanup = sdk.subscribeToTokenCreations(
|
|
3111
|
+
* (token) => {
|
|
3112
|
+
* console.log(`New token: ${token.tokenName} - ${token.symbol}`);
|
|
3113
|
+
* // Could trigger automatic buy/analysis
|
|
3114
|
+
* },
|
|
3115
|
+
* {
|
|
3116
|
+
* onError: (error) => {
|
|
3117
|
+
* console.error('Real-time monitoring failed:', error);
|
|
3118
|
+
* // Fallback to polling
|
|
3119
|
+
* }
|
|
3120
|
+
* }
|
|
3121
|
+
* );
|
|
3122
|
+
* ```
|
|
3123
|
+
*/
|
|
3124
|
+
subscribeToTokenCreations(callback: (token: {
|
|
3125
|
+
tokenName: string;
|
|
3126
|
+
symbol: string;
|
|
3127
|
+
creatorAddress: string;
|
|
3128
|
+
description: string;
|
|
3129
|
+
image: string;
|
|
3130
|
+
vaultAddress: string;
|
|
3131
|
+
tokenStringKey: string;
|
|
3132
|
+
preBuyQuantity: string;
|
|
3133
|
+
websiteUrl: string;
|
|
3134
|
+
telegramUrl: string;
|
|
3135
|
+
twitterUrl: string;
|
|
3136
|
+
isFinalized: boolean;
|
|
3137
|
+
}) => void, options?: {
|
|
3138
|
+
creatorFilter?: string;
|
|
3139
|
+
onError?: (error: Error) => void;
|
|
3140
|
+
}): () => void;
|
|
3141
|
+
/**
|
|
3142
|
+
* Recursively walk WebSocket event payload to find all pools
|
|
3143
|
+
*
|
|
3144
|
+
* Exhaustively searches through entire payload tree, including nested objects.
|
|
3145
|
+
* Matches reference implementation (newPoolsWatch.js walkPayload) for complete event coverage.
|
|
3146
|
+
*
|
|
3147
|
+
* Uses WeakSet to track visited objects and prevent infinite loops on circular references.
|
|
3148
|
+
* Deduplicates pools using the provided seenPools Set.
|
|
3149
|
+
*
|
|
3150
|
+
* @param payload - Event payload to walk (can be string, object, or any value)
|
|
3151
|
+
* @param seenPools - Set of already-seen pool pair strings (for deduplication)
|
|
3152
|
+
* @param visited - WeakSet of visited objects (to prevent circular reference loops)
|
|
3153
|
+
* @returns Array of newly discovered pool data objects
|
|
3154
|
+
* @private
|
|
3155
|
+
*/
|
|
3156
|
+
private walkPayloadForPools;
|
|
3157
|
+
/**
|
|
3158
|
+
* Subscribe to real-time DEX pool creation broadcasts
|
|
3159
|
+
*
|
|
3160
|
+
* Listens to WebSocket broadcasts for DEX pool creation events globally.
|
|
3161
|
+
* Provides real-time notifications when new liquidity pools are added (~1-2 second latency).
|
|
3162
|
+
*
|
|
3163
|
+
* **Use Case:**
|
|
3164
|
+
* Monitor for graduated tokens becoming swappable on the DEX. When a token graduates from
|
|
3165
|
+
* bonding curve to DEX, a pool is created and this subscription notifies in real-time.
|
|
3166
|
+
*
|
|
3167
|
+
* **Position-Independent Token Matching:**
|
|
3168
|
+
* Token filters work regardless of position (token0 vs token1):
|
|
3169
|
+
* - `tokenFilter: 'GALA'` matches both GALA/USDC and USDC/GALA pools
|
|
3170
|
+
* - `pairTokens: ['GALA', 'USDC']` matches the specific pair in any order
|
|
3171
|
+
*
|
|
3172
|
+
* **Connection Management:**
|
|
3173
|
+
* - If WebSocket is already connected, listener is registered immediately
|
|
3174
|
+
* - If not connected, automatically initiates connection with 3-second timeout
|
|
3175
|
+
* - Connection failures are logged and can be handled via error callback
|
|
3176
|
+
*
|
|
3177
|
+
* **Cleanup Function:**
|
|
3178
|
+
* - Safe to call multiple times (idempotent)
|
|
3179
|
+
* - Removes listener and cleans up tracking state
|
|
3180
|
+
* - Returns immediately if listener was never registered
|
|
3181
|
+
*
|
|
3182
|
+
* @param callback - Called when a new DEX pool is created
|
|
3183
|
+
* @param options - Optional filtering and error handling
|
|
3184
|
+
* @param options.tokenFilter - Only receive pools containing this token (in either position)
|
|
3185
|
+
* @param options.pairTokens - Only receive pools with this specific token pair (order-independent)
|
|
3186
|
+
* @param options.feeTierFilter - Only receive pools with this fee tier (500, 3000, or 10000)
|
|
3187
|
+
* @param options.onError - Called if WebSocket connection fails
|
|
3188
|
+
* @returns Cleanup function to stop listening - safe to call multiple times
|
|
3189
|
+
*
|
|
3190
|
+
* @category Real-time Monitoring
|
|
3191
|
+
* @since 4.1.0
|
|
3192
|
+
*
|
|
3193
|
+
* @throws Error if WebSocket service not initialized
|
|
3194
|
+
*
|
|
3195
|
+
* @example Listen to all new pools
|
|
3196
|
+
* ```typescript
|
|
3197
|
+
* const cleanup = sdk.subscribeToDexPoolAdded((pool) => {
|
|
3198
|
+
* console.log(`New pool: ${pool.token0}/${pool.token1} (${pool.fee}% fee)`);
|
|
3199
|
+
* });
|
|
3200
|
+
*
|
|
3201
|
+
* // Stop listening when done
|
|
3202
|
+
* cleanup();
|
|
3203
|
+
* ```
|
|
3204
|
+
*
|
|
3205
|
+
* @example Listen for GALA pools only
|
|
3206
|
+
* ```typescript
|
|
3207
|
+
* const cleanup = sdk.subscribeToDexPoolAdded(
|
|
3208
|
+
* (pool) => {
|
|
3209
|
+
* if (pool.token0 === 'GALA' || pool.token1 === 'GALA') {
|
|
3210
|
+
* console.log(`GALA pool created: ${pool.poolPair}`);
|
|
3211
|
+
* }
|
|
3212
|
+
* },
|
|
3213
|
+
* { tokenFilter: 'GALA' }
|
|
3214
|
+
* );
|
|
3215
|
+
* ```
|
|
3216
|
+
*
|
|
3217
|
+
* @example Monitor specific pair with fee tier
|
|
3218
|
+
* ```typescript
|
|
3219
|
+
* const cleanup = sdk.subscribeToDexPoolAdded(
|
|
3220
|
+
* (pool) => {
|
|
3221
|
+
* console.log(`GALA/GUSDC 0.3% pool created!`);
|
|
3222
|
+
* },
|
|
3223
|
+
* {
|
|
3224
|
+
* pairTokens: ['GALA', 'GUSDC'],
|
|
3225
|
+
* feeTierFilter: 3000, // 0.3%
|
|
3226
|
+
* onError: (error) => console.error('Connection failed:', error)
|
|
3227
|
+
* }
|
|
3228
|
+
* );
|
|
3229
|
+
* ```
|
|
3230
|
+
*
|
|
3231
|
+
* @example Monitor graduated tokens (all pools, real-time)
|
|
3232
|
+
* ```typescript
|
|
3233
|
+
* // Watch for ANY new pools - indicates graduated tokens
|
|
3234
|
+
* const cleanup = sdk.subscribeToDexPoolAdded(
|
|
3235
|
+
* (pool) => {
|
|
3236
|
+
* console.log(`Graduated token detected: ${pool.token0}/${pool.token1}`);
|
|
3237
|
+
* // Could trigger automatic trading strategies
|
|
3238
|
+
* }
|
|
3239
|
+
* );
|
|
3240
|
+
* ```
|
|
3241
|
+
*/
|
|
3242
|
+
subscribeToDexPoolAdded(callback: (pool: {
|
|
3243
|
+
token0: string;
|
|
3244
|
+
token1: string;
|
|
3245
|
+
fee: string;
|
|
3246
|
+
poolPair: string;
|
|
3247
|
+
}) => void, options?: {
|
|
3248
|
+
tokenFilter?: string;
|
|
3249
|
+
pairTokens?: [string, string];
|
|
3250
|
+
feeTierFilter?: string | number;
|
|
3251
|
+
onError?: (error: Error) => void;
|
|
3252
|
+
}): () => void;
|
|
3253
|
+
/**
|
|
3254
|
+
* Subscribe to real-time DEX swap execution events
|
|
3255
|
+
*
|
|
3256
|
+
* Monitors all completed swaps on the DEX globally with real-time notifications (~1-2 second latency).
|
|
3257
|
+
* Provides offline price predictions and delta-based pool state updates for arbitrage bot use cases.
|
|
3258
|
+
*
|
|
3259
|
+
* **Architecture:**
|
|
3260
|
+
* The backend broadcasts transaction confirmation events for completed swaps to ALL connected clients.
|
|
3261
|
+
* This listener captures "ExecuteSwap" events and provides:
|
|
3262
|
+
* - Real-time swap transaction data (tokens, amounts, fees)
|
|
3263
|
+
* - Offline price quotes using cached pool state (~25-50ms vs network requests)
|
|
3264
|
+
* - Delta-based pool updates (~15-25ms vs full refetch ~200-400ms)
|
|
3265
|
+
* - Performance metrics (latency percentiles, cache hit rates, throughput)
|
|
3266
|
+
*
|
|
3267
|
+
* **Position-Independent Token Matching:**
|
|
3268
|
+
* Token filters work regardless of position (token0 vs token1):
|
|
3269
|
+
* - `tokenFilter: 'GALA'` matches both GALA/USDC and USDC/GALA swaps
|
|
3270
|
+
* - `pairTokens: ['GALA', 'USDC']` matches the specific pair in any order
|
|
3271
|
+
*
|
|
3272
|
+
* **Connection Management:**
|
|
3273
|
+
* - If WebSocket is already connected, listener is registered immediately
|
|
3274
|
+
* - If not connected, automatically initiates connection with 3-second timeout
|
|
3275
|
+
* - Connection failures are logged and can be handled via error callback
|
|
3276
|
+
*
|
|
3277
|
+
* **Cleanup Function:**
|
|
3278
|
+
* - Safe to call multiple times (idempotent)
|
|
3279
|
+
* - Removes listener and cleans up tracking state
|
|
3280
|
+
* - Returns immediately if listener was never registered
|
|
3281
|
+
*
|
|
3282
|
+
* @param callback - Called when a swap completes with enriched swap data
|
|
3283
|
+
* @param options - Optional filtering, configuration, and error handling
|
|
3284
|
+
* @param options.tokenFilter - Only receive swaps containing this token (in either position)
|
|
3285
|
+
* @param options.pairTokens - Only receive swaps with this specific token pair (order-independent)
|
|
3286
|
+
* @param options.feeTierFilter - Only receive swaps with this fee tier (500, 3000, or 10000)
|
|
3287
|
+
* @param options.userFilter - Only receive swaps from this wallet address
|
|
3288
|
+
* @param options.memoryProfile - Cache memory profile: 'conservative' (55MB), 'moderate' (250MB), 'aggressive' (530MB)
|
|
3289
|
+
* @param options.maxPools - Maximum pools to cache (default: 500)
|
|
3290
|
+
* @param options.enableDeltaOptimization - Use delta updates instead of full refetch (default: true)
|
|
3291
|
+
* @param options.enableOfflineQuotes - Calculate offline quotes for known pools (default: true)
|
|
3292
|
+
* @param options.debug - Enable debug logging (default: false)
|
|
3293
|
+
* @param options.onError - Called if WebSocket connection fails
|
|
3294
|
+
* @returns Cleanup function to stop listening - safe to call multiple times
|
|
3295
|
+
*
|
|
3296
|
+
* @category Real-time Monitoring
|
|
3297
|
+
* @since 4.2.0
|
|
3298
|
+
*
|
|
3299
|
+
* @throws Error if WebSocket service not initialized
|
|
3300
|
+
*
|
|
3301
|
+
* @example Listen to all swaps globally
|
|
3302
|
+
* ```typescript
|
|
3303
|
+
* const cleanup = sdk.subscribeToDexSwapExecuted((swap) => {
|
|
3304
|
+
* console.log(`Swap: ${swap.token0} → ${swap.token1}`);
|
|
3305
|
+
* console.log(`Amount: ${swap.amount0} / ${swap.amount1}`);
|
|
3306
|
+
* if (swap.estimatedPrice) {
|
|
3307
|
+
* console.log(`Price: ${swap.estimatedPrice}`);
|
|
3308
|
+
* }
|
|
3309
|
+
* });
|
|
3310
|
+
*
|
|
3311
|
+
* // Stop listening when done
|
|
3312
|
+
* cleanup();
|
|
3313
|
+
* ```
|
|
3314
|
+
*
|
|
3315
|
+
* @example Arbitrage bot - monitor GALA/GUSDC swaps with offline pricing
|
|
3316
|
+
* ```typescript
|
|
3317
|
+
* const cleanup = sdk.subscribeToDexSwapExecuted(
|
|
3318
|
+
* async (swap) => {
|
|
3319
|
+
* if (swap.estimatedPrice && swap.poolStateUpdated) {
|
|
3320
|
+
* // Price calculated instantly using cached pool state
|
|
3321
|
+
* console.log(`Arbitrage opportunity: ${swap.estimatedPrice}`);
|
|
3322
|
+
*
|
|
3323
|
+
* // Trigger trading logic
|
|
3324
|
+
* await executeArbitrageStrategy(swap);
|
|
3325
|
+
* }
|
|
3326
|
+
* },
|
|
3327
|
+
* {
|
|
3328
|
+
* pairTokens: ['GALA', 'GUSDC'],
|
|
3329
|
+
* memoryProfile: 'aggressive', // Max cache for arbitrage
|
|
3330
|
+
* enableDeltaOptimization: true, // Fast updates
|
|
3331
|
+
* enableOfflineQuotes: true, // Instant pricing
|
|
3332
|
+
* onError: (error) => console.error('Swap monitoring failed:', error)
|
|
3333
|
+
* }
|
|
3334
|
+
* );
|
|
3335
|
+
* ```
|
|
3336
|
+
*
|
|
3337
|
+
* @example Monitor specific token with fee tier
|
|
3338
|
+
* ```typescript
|
|
3339
|
+
* const cleanup = sdk.subscribeToDexSwapExecuted(
|
|
3340
|
+
* (swap) => {
|
|
3341
|
+
* console.log(`GALA 0.3% pool swap: ${swap.amount0}`);
|
|
3342
|
+
* },
|
|
3343
|
+
* {
|
|
3344
|
+
* tokenFilter: 'GALA',
|
|
3345
|
+
* feeTierFilter: 3000, // 0.3% fee tier
|
|
3346
|
+
* }
|
|
3347
|
+
* );
|
|
3348
|
+
* ```
|
|
3349
|
+
*
|
|
3350
|
+
* @example Health monitoring for swap monitoring system
|
|
3351
|
+
* ```typescript
|
|
3352
|
+
* let swapMonitor: MultiPoolStateManager | null = null;
|
|
3353
|
+
*
|
|
3354
|
+
* const cleanup = sdk.subscribeToDexSwapExecuted(
|
|
3355
|
+
* (swap) => {
|
|
3356
|
+
* console.log(`Swap processed in <50ms:`, swap.poolStateUpdated);
|
|
3357
|
+
* },
|
|
3358
|
+
* {
|
|
3359
|
+
* memoryProfile: 'moderate',
|
|
3360
|
+
* onError: (error) => console.error('Connection failed:', error)
|
|
3361
|
+
* }
|
|
3362
|
+
* );
|
|
3363
|
+
*
|
|
3364
|
+
* // Can get health metrics
|
|
3365
|
+
* // const health = swapMonitor?.getHealth();
|
|
3366
|
+
* // console.log(`Cache hit rate: ${health.metrics.cacheHitRate}%`);
|
|
3367
|
+
* ```
|
|
3368
|
+
*/
|
|
3369
|
+
subscribeToDexSwapExecuted(callback: SwapEventCallback, options?: SubscribeSwapOptions & SwapMonitorConfig): CleanupFunction;
|
|
3370
|
+
/**
|
|
3371
|
+
* Subscribe to real-time DEX liquidity addition events
|
|
3372
|
+
*
|
|
3373
|
+
* Monitors all liquidity additions on the DEX globally with real-time notifications.
|
|
3374
|
+
* All liquidity events are broadcast to all connected clients - you can monitor
|
|
3375
|
+
* market-wide liquidity activity, not just your own transactions.
|
|
3376
|
+
*
|
|
3377
|
+
* **Use Cases:**
|
|
3378
|
+
* - LP position tracking: Monitor when users add liquidity to positions
|
|
3379
|
+
* - Whale watching: Detect large liquidity additions
|
|
3380
|
+
* - Market analysis: Track overall DEX liquidity growth
|
|
3381
|
+
* - Position management: React to liquidity changes in pools you care about
|
|
3382
|
+
*
|
|
3383
|
+
* **Position-Independent Token Matching:**
|
|
3384
|
+
* Token filters work regardless of position (token0 vs token1):
|
|
3385
|
+
* - `tokenFilter: 'GALA'` matches liquidity additions to any GALA pool
|
|
3386
|
+
* - `pairTokens: ['GALA', 'GUSDC']` matches the specific pair in any order
|
|
3387
|
+
*
|
|
3388
|
+
* @param callback - Called when liquidity is added with event data
|
|
3389
|
+
* @param options - Optional filtering and error handling
|
|
3390
|
+
* @param options.positionId - Only receive events for this LP position NFT
|
|
3391
|
+
* @param options.poolHash - Only receive events for this pool
|
|
3392
|
+
* @param options.tokenFilter - Only receive events containing this token (in either position)
|
|
3393
|
+
* @param options.pairTokens - Only receive events with this specific token pair (order-independent)
|
|
3394
|
+
* @param options.feeTierFilter - Only receive events with this fee tier (500, 3000, or 10000)
|
|
3395
|
+
* @param options.userFilter - Only receive events from this wallet address
|
|
3396
|
+
* @param options.minAmount - Only receive events where at least one amount exceeds this value
|
|
3397
|
+
* @param options.onError - Called if WebSocket connection fails
|
|
3398
|
+
* @returns Cleanup function to stop listening - safe to call multiple times
|
|
3399
|
+
*
|
|
3400
|
+
* @category Real-time Monitoring
|
|
3401
|
+
* @since 4.3.0
|
|
3402
|
+
*
|
|
3403
|
+
* @throws Error if WebSocket service not initialized
|
|
3404
|
+
*
|
|
3405
|
+
* @example Listen to all liquidity additions
|
|
3406
|
+
* ```typescript
|
|
3407
|
+
* const cleanup = sdk.subscribeToDexLiquidityAdded((event) => {
|
|
3408
|
+
* console.log(`Liquidity added: ${event.amounts[0]} / ${event.amounts[1]}`);
|
|
3409
|
+
* console.log(`Position: ${event.positionId}`);
|
|
3410
|
+
* console.log(`Pool: ${event.poolHash}`);
|
|
3411
|
+
* });
|
|
3412
|
+
*
|
|
3413
|
+
* // Stop listening when done
|
|
3414
|
+
* await cleanup();
|
|
3415
|
+
* ```
|
|
3416
|
+
*
|
|
3417
|
+
* @example Track specific pool liquidity
|
|
3418
|
+
* ```typescript
|
|
3419
|
+
* const cleanup = sdk.subscribeToDexLiquidityAdded(
|
|
3420
|
+
* (event) => {
|
|
3421
|
+
* console.log(`GALA/GUSDC liquidity: +${event.amounts[0]} GALA`);
|
|
3422
|
+
* },
|
|
3423
|
+
* {
|
|
3424
|
+
* pairTokens: ['GALA', 'GUSDC'],
|
|
3425
|
+
* feeTierFilter: 3000, // 0.3% fee tier
|
|
3426
|
+
* }
|
|
3427
|
+
* );
|
|
3428
|
+
* ```
|
|
3429
|
+
*
|
|
3430
|
+
* @example Whale watching
|
|
3431
|
+
* ```typescript
|
|
3432
|
+
* const cleanup = sdk.subscribeToDexLiquidityAdded(
|
|
3433
|
+
* (event) => {
|
|
3434
|
+
* console.log(`🐋 Large liquidity add detected!`);
|
|
3435
|
+
* console.log(`Amount: ${event.amounts[0]} / ${event.amounts[1]}`);
|
|
3436
|
+
* console.log(`User: ${event.userAddress}`);
|
|
3437
|
+
* },
|
|
3438
|
+
* { minAmount: '10000' } // Only large additions
|
|
3439
|
+
* );
|
|
3440
|
+
* ```
|
|
3441
|
+
*/
|
|
3442
|
+
subscribeToDexLiquidityAdded(callback: LiquidityChangedCallback, options?: SubscribeLiquidityOptions): LiquidityCleanupFunction;
|
|
3443
|
+
/**
|
|
3444
|
+
* Subscribe to real-time DEX liquidity removal events
|
|
3445
|
+
*
|
|
3446
|
+
* Monitors all liquidity removals on the DEX globally with real-time notifications.
|
|
3447
|
+
* All liquidity events are broadcast to all connected clients - you can monitor
|
|
3448
|
+
* market-wide liquidity activity, not just your own transactions.
|
|
3449
|
+
*
|
|
3450
|
+
* **Use Cases:**
|
|
3451
|
+
* - LP exit tracking: Monitor when users remove liquidity from positions
|
|
3452
|
+
* - Whale watching: Detect large liquidity withdrawals
|
|
3453
|
+
* - Market analysis: Track overall DEX liquidity changes
|
|
3454
|
+
* - Risk management: React to liquidity decreases in pools you trade
|
|
3455
|
+
*
|
|
3456
|
+
* @param callback - Called when liquidity is removed with event data
|
|
3457
|
+
* @param options - Optional filtering and error handling
|
|
3458
|
+
* @param options.positionId - Only receive events for this LP position NFT
|
|
3459
|
+
* @param options.poolHash - Only receive events for this pool
|
|
3460
|
+
* @param options.tokenFilter - Only receive events containing this token (in either position)
|
|
3461
|
+
* @param options.pairTokens - Only receive events with this specific token pair (order-independent)
|
|
3462
|
+
* @param options.feeTierFilter - Only receive events with this fee tier (500, 3000, or 10000)
|
|
3463
|
+
* @param options.userFilter - Only receive events from this wallet address
|
|
3464
|
+
* @param options.minAmount - Only receive events where at least one amount exceeds this value
|
|
3465
|
+
* @param options.onError - Called if WebSocket connection fails
|
|
3466
|
+
* @returns Cleanup function to stop listening - safe to call multiple times
|
|
3467
|
+
*
|
|
3468
|
+
* @category Real-time Monitoring
|
|
3469
|
+
* @since 4.3.0
|
|
3470
|
+
*
|
|
3471
|
+
* @throws Error if WebSocket service not initialized
|
|
3472
|
+
*
|
|
3473
|
+
* @example Listen to all liquidity removals
|
|
3474
|
+
* ```typescript
|
|
3475
|
+
* const cleanup = sdk.subscribeToDexLiquidityRemoved((event) => {
|
|
3476
|
+
* console.log(`Liquidity removed: ${event.amounts[0]} / ${event.amounts[1]}`);
|
|
3477
|
+
* console.log(`Position: ${event.positionId}`);
|
|
3478
|
+
* });
|
|
3479
|
+
*
|
|
3480
|
+
* await cleanup();
|
|
3481
|
+
* ```
|
|
3482
|
+
*
|
|
3483
|
+
* @example Track position exits
|
|
3484
|
+
* ```typescript
|
|
3485
|
+
* const cleanup = sdk.subscribeToDexLiquidityRemoved(
|
|
3486
|
+
* (event) => {
|
|
3487
|
+
* console.log(`Position ${event.positionId} reduced liquidity`);
|
|
3488
|
+
* },
|
|
3489
|
+
* { positionId: 'my-position-id' }
|
|
3490
|
+
* );
|
|
3491
|
+
* ```
|
|
3492
|
+
*/
|
|
3493
|
+
subscribeToDexLiquidityRemoved(callback: LiquidityChangedCallback, options?: SubscribeLiquidityOptions): LiquidityCleanupFunction;
|
|
3494
|
+
/**
|
|
3495
|
+
* Subscribe to all DEX liquidity changes
|
|
3496
|
+
*
|
|
3497
|
+
* Monitors all liquidity operations on the DEX globally with real-time notifications.
|
|
3498
|
+
* The backend broadcasts position change events without distinguishing between
|
|
3499
|
+
* add and remove operations.
|
|
3500
|
+
*
|
|
3501
|
+
* **Use Cases:**
|
|
3502
|
+
* - Complete liquidity tracking: Monitor all LP activity in a pool
|
|
3503
|
+
* - Position monitoring: Track changes to specific positions
|
|
3504
|
+
* - Dashboard displays: Show real-time liquidity activity feed
|
|
3505
|
+
*
|
|
3506
|
+
* @param callback - Called when liquidity changes with event data
|
|
3507
|
+
* @param options - Optional filtering and error handling
|
|
3508
|
+
* @returns Cleanup function to stop listening - safe to call multiple times
|
|
3509
|
+
*
|
|
3510
|
+
* @category Real-time Monitoring
|
|
3511
|
+
* @since 4.3.0
|
|
3512
|
+
*
|
|
3513
|
+
* @throws Error if WebSocket service not initialized
|
|
3514
|
+
*
|
|
3515
|
+
* @example Monitor all liquidity activity
|
|
3516
|
+
* ```typescript
|
|
3517
|
+
* const cleanup = sdk.subscribeToDexLiquidityChanged((event) => {
|
|
3518
|
+
* console.log(`Liquidity changed: ${event.amounts[0]} / ${event.amounts[1]}`);
|
|
3519
|
+
* console.log(`Pool: ${event.poolHash}`);
|
|
3520
|
+
* console.log(`Position: ${event.positionId}`);
|
|
3521
|
+
* });
|
|
3522
|
+
*
|
|
3523
|
+
* await cleanup();
|
|
3524
|
+
* ```
|
|
3525
|
+
*
|
|
3526
|
+
* @example Track specific pool liquidity
|
|
3527
|
+
* ```typescript
|
|
3528
|
+
* const cleanup = sdk.subscribeToDexLiquidityChanged(
|
|
3529
|
+
* (event) => {
|
|
3530
|
+
* console.log(`Pool activity: ${event.amounts[0]} / ${event.amounts[1]}`);
|
|
3531
|
+
* console.log(`User: ${event.userAddress}`);
|
|
3532
|
+
* },
|
|
3533
|
+
* { pairTokens: ['GALA', 'GUSDC'] }
|
|
3534
|
+
* );
|
|
3535
|
+
* ```
|
|
3536
|
+
*/
|
|
3537
|
+
subscribeToDexLiquidityChanged(callback: LiquidityChangedCallback, options?: SubscribeLiquidityOptions): LiquidityCleanupFunction;
|
|
3538
|
+
/**
|
|
3539
|
+
* Internal method for subscribing to liquidity events
|
|
3540
|
+
*
|
|
3541
|
+
* @internal
|
|
3542
|
+
*/
|
|
3543
|
+
private subscribeToDexLiquidityEvents;
|
|
3544
|
+
/**
|
|
3545
|
+
* Check if a liquidity event matches the specified filters
|
|
3546
|
+
*
|
|
3547
|
+
* @internal
|
|
3548
|
+
*/
|
|
3549
|
+
private matchesLiquidityFilter;
|
|
3550
|
+
/**
|
|
3551
|
+
* Normalize fee tier to basis points
|
|
3552
|
+
*
|
|
3553
|
+
* @internal
|
|
3554
|
+
*/
|
|
3555
|
+
private normalizeFeeTier;
|
|
2677
3556
|
/**
|
|
2678
3557
|
* Cleanup SDK resources and connections
|
|
2679
3558
|
*
|