@gala-chain/launchpad-sdk 3.31.2 → 4.0.1-beta.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.
- package/API.md +525 -5
- package/CHANGELOG.md +101 -9
- package/EXAMPLES.md +923 -0
- package/README.md +539 -15
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +37 -27
- 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} +1333 -37
- 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 +46 -0
- package/dist/src/services/DexBackendClient.d.ts.map +1 -0
- package/dist/src/services/DexPoolService.d.ts +137 -0
- package/dist/src/services/DexPoolService.d.ts.map +1 -0
- package/dist/src/services/DexQuoteService.d.ts +288 -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/src/services/GSwapService.d.ts +817 -0
- package/dist/src/services/GSwapService.d.ts.map +1 -0
- package/dist/src/services/GalaChainGatewayClient.d.ts +98 -0
- package/dist/src/services/GalaChainGatewayClient.d.ts.map +1 -0
- package/dist/{services → src/services}/GalaChainService.d.ts +99 -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 +176 -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/{services → src/services}/SignatureService.d.ts +13 -35
- 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 +183 -0
- package/dist/src/services/WebSocketService.d.ts.map +1 -0
- package/dist/src/services/__mocks__/logger.mock.d.ts +17 -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/{types → src/types}/common.d.ts +2 -0
- package/dist/src/types/common.d.ts.map +1 -0
- package/dist/src/types/composite-pool.dto.d.ts +103 -0
- package/dist/src/types/composite-pool.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/dex-pool.dto.d.ts +56 -5
- package/dist/src/types/dex-pool.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/dto.d.ts +6 -6
- package/dist/src/types/dto.d.ts.map +1 -0
- package/dist/src/types/eip712-types.d.ts +140 -0
- package/dist/src/types/eip712-types.d.ts.map +1 -0
- package/dist/src/types/galachain-api.types.d.ts +216 -0
- package/dist/src/types/galachain-api.types.d.ts.map +1 -0
- package/dist/src/types/gswap-responses.types.d.ts +366 -0
- package/dist/src/types/gswap-responses.types.d.ts.map +1 -0
- package/dist/{types → src/types}/gswap.dto.d.ts +58 -3
- package/dist/src/types/gswap.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/launchpad.dto.d.ts +232 -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 +246 -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 +103 -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 +75 -1
- package/dist/src/utils/auto-pagination.d.ts.map +1 -0
- package/dist/{utils → src/utils}/bignumber-helpers.d.ts +79 -3
- package/dist/src/utils/bignumber-helpers.d.ts.map +1 -0
- package/dist/src/utils/bignumber-pool-cache.d.ts +169 -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 +121 -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/{utils → src/utils}/errors.d.ts +86 -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 +31 -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 +55 -0
- package/dist/src/utils/pool-pair-parser.d.ts.map +1 -0
- package/dist/src/utils/pool-state-validator.d.ts +207 -0
- package/dist/src/utils/pool-state-validator.d.ts.map +1 -0
- package/dist/src/utils/position-filters.d.ts +253 -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 +231 -0
- package/dist/src/utils/swap-delta-calculator.d.ts.map +1 -0
- package/dist/src/utils/tick-crossing-handler.d.ts +250 -0
- package/dist/src/utils/tick-crossing-handler.d.ts.map +1 -0
- package/dist/{utils → src/utils}/token-format-converter.d.ts +18 -11
- package/dist/src/utils/token-format-converter.d.ts.map +1 -0
- package/dist/src/utils/token-parser.d.ts +235 -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 +73 -19
- 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/DexPoolService.d.ts +0 -95
- package/dist/services/DexPoolService.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 +0 -315
- package/dist/services/GSwapService.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/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 +0 -85
- package/dist/services/WebSocketService.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/dex-pool.dto.d.ts.map +0 -1
- package/dist/types/dto.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/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/bondingCurveCalculations.d.ts.map +0 -1
- package/dist/utils/cacheWarmingHelpers.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/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/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/token-format-converter.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}/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}/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/{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}/launchpad.validation.d.ts +0 -0
- /package/dist/{types → src/types}/options.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}/bondingCurveCalculations.d.ts +0 -0
- /package/dist/{utils → src/utils}/cacheWarmingHelpers.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}/http.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}/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}/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
package/API.md
CHANGED
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Complete API documentation for the Gala Launchpad SDK (v3.23.0+).
|
|
4
4
|
|
|
5
|
+
> **⚠️ BREAKING CHANGE (v3.33.0+)**: Token format parsing now **ONLY accepts delimited formats**. Plain token strings (`'GALA'`, `'GUSDC'`) are **permanently rejected** for security. Use delimited format: `'GALA|Unit|none|none'` or `'GALA$Unit$none$none'`. See README.md for [migration guide](./README.md#token-format-migration-v330).
|
|
6
|
+
|
|
5
7
|
## Table of Contents
|
|
6
8
|
|
|
7
9
|
- [SDK Initialization](#sdk-initialization)
|
|
8
10
|
- [Bonding Curve Trading (Launchpad Tokens)](#bonding-curve-trading)
|
|
9
11
|
- [DEX Trading (Graduated Tokens)](#dex-trading-galaswap)
|
|
12
|
+
- [GalaSwap Liquidity Position Management](#galaswap-liquidity-position-management)
|
|
10
13
|
- [Pool Information](#pool-information)
|
|
11
14
|
- [Token Management](#token-management)
|
|
12
15
|
- [Portfolio & Balances](#portfolio--balances)
|
|
13
16
|
- [Price History & Analytics](#price-history--analytics)
|
|
14
17
|
- [Real-Time Features](#real-time-features)
|
|
15
18
|
- [Type Definitions](#type-definitions)
|
|
19
|
+
- [Error Handling](#error-handling)
|
|
16
20
|
|
|
17
21
|
---
|
|
18
22
|
|
|
@@ -244,8 +248,8 @@ Get a quote for swapping a known input amount on GalaSwap DEX.
|
|
|
244
248
|
|
|
245
249
|
**Parameters:**
|
|
246
250
|
```typescript
|
|
247
|
-
fromToken: string; // Source token ("GALA"
|
|
248
|
-
toToken: string; // Destination token ("
|
|
251
|
+
fromToken: string; // Source token in delimited format (e.g., "GALA|Unit|none|none" or "GALA$Unit$none$none") - v3.33.0+ REQUIRED
|
|
252
|
+
toToken: string; // Destination token in delimited format (e.g., "GUSDC|Unit|none|none" or "GUSDC$Unit$none$none") - v3.33.0+ REQUIRED
|
|
249
253
|
amount: string; // Input amount (how much fromToken to spend)
|
|
250
254
|
```
|
|
251
255
|
|
|
@@ -262,8 +266,8 @@ amount: string; // Input amount (how much fromToken to spend)
|
|
|
262
266
|
|
|
263
267
|
**Example:**
|
|
264
268
|
```typescript
|
|
265
|
-
// How many GUSDC for 100 GALA?
|
|
266
|
-
const quote = await sdk.getSwapQuoteExactInput('GALA', 'GUSDC', '100');
|
|
269
|
+
// How many GUSDC for 100 GALA? (v3.33.0+ requires delimited token format)
|
|
270
|
+
const quote = await sdk.getSwapQuoteExactInput('GALA|Unit|none|none', 'GUSDC|Unit|none|none', '100');
|
|
267
271
|
console.log(`Spend: 100 GALA`);
|
|
268
272
|
console.log(`Receive: ~${quote.estimatedOutput} GUSDC`);
|
|
269
273
|
console.log(`Price impact: ${(quote.priceImpact * 100).toFixed(2)}%`);
|
|
@@ -406,6 +410,418 @@ console.log(`Fee tiers: ${pool.feeTiers.map(t => t / 100 + '%').join(', ')}`);
|
|
|
406
410
|
|
|
407
411
|
---
|
|
408
412
|
|
|
413
|
+
## GalaSwap Liquidity Position Management
|
|
414
|
+
|
|
415
|
+
Provide liquidity to DEX pools and earn trading fees. Liquidity positions enable passive income through fee accumulation while helping maintain DEX liquidity.
|
|
416
|
+
|
|
417
|
+
### `getAllSwapUserLiquidityPositions(ownerAddress)`
|
|
418
|
+
|
|
419
|
+
Get **all** open liquidity positions for a wallet with automatic pagination (recommended).
|
|
420
|
+
|
|
421
|
+
**Parameters:**
|
|
422
|
+
```typescript
|
|
423
|
+
ownerAddress: string; // Wallet address (e.g., "0x1234..." or "eth|1234...")
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
**Returns:**
|
|
427
|
+
```typescript
|
|
428
|
+
Array<{
|
|
429
|
+
positionId: string; // Unique position identifier
|
|
430
|
+
token0: string; // First token symbol
|
|
431
|
+
token1: string; // Second token symbol
|
|
432
|
+
feeTier: number; // Fee tier in basis points
|
|
433
|
+
liquidity: string; // Liquidity amount
|
|
434
|
+
amount0: string; // Token0 amount in position
|
|
435
|
+
amount1: string; // Token1 amount in position
|
|
436
|
+
feeAmount0: string; // Accumulated fees (Token0)
|
|
437
|
+
feeAmount1: string; // Accumulated fees (Token1)
|
|
438
|
+
tickLower: number; // Lower tick boundary
|
|
439
|
+
tickUpper: number; // Upper tick boundary
|
|
440
|
+
}>
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Example:**
|
|
444
|
+
```typescript
|
|
445
|
+
// Fetch all positions with automatic pagination
|
|
446
|
+
const allPositions = await sdk.getAllSwapUserLiquidityPositions('eth|0x...');
|
|
447
|
+
|
|
448
|
+
console.log(`Total positions: ${allPositions.length}`);
|
|
449
|
+
|
|
450
|
+
// Analyze positions
|
|
451
|
+
allPositions.forEach(pos => {
|
|
452
|
+
console.log(`${pos.token0}/${pos.token1}: ${pos.liquidity} liquidity`);
|
|
453
|
+
console.log(`Fees earned: ${pos.feeAmount0} ${pos.token0}, ${pos.feeAmount1} ${pos.token1}`);
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
// Find best-performing position (highest accumulated fees)
|
|
457
|
+
const bestPosition = allPositions.reduce((best, current) => {
|
|
458
|
+
const currentFees = parseFloat(current.feeAmount0) + parseFloat(current.feeAmount1);
|
|
459
|
+
const bestFees = parseFloat(best.feeAmount0) + parseFloat(best.feeAmount1);
|
|
460
|
+
return currentFees > bestFees ? current : best;
|
|
461
|
+
});
|
|
462
|
+
console.log(`Best position: ${bestPosition.token0}/${bestPosition.token1}`);
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### `getSwapUserLiquidityPositions(ownerAddress, limit?, bookmark?)`
|
|
466
|
+
|
|
467
|
+
Get open liquidity positions with manual pagination control (paginated version).
|
|
468
|
+
|
|
469
|
+
**Parameters:**
|
|
470
|
+
```typescript
|
|
471
|
+
ownerAddress: string; // Wallet address
|
|
472
|
+
limit?: number; // Results per page (default: 10, max: 20)
|
|
473
|
+
bookmark?: string; // Pagination bookmark from previous response
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
**Returns:** Same array structure as getAllSwapUserLiquidityPositions, plus pagination metadata:
|
|
477
|
+
```typescript
|
|
478
|
+
{
|
|
479
|
+
positions: Array<...>; // Array of position objects
|
|
480
|
+
bookmark?: string; // Bookmark for next page (if more results exist)
|
|
481
|
+
hasMore: boolean; // True if more pages available
|
|
482
|
+
total: number; // Total positions
|
|
483
|
+
}
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
**Example:**
|
|
487
|
+
```typescript
|
|
488
|
+
// Paginated retrieval for streaming/processing
|
|
489
|
+
let allPositions = [];
|
|
490
|
+
let bookmark;
|
|
491
|
+
let hasMore = true;
|
|
492
|
+
|
|
493
|
+
while (hasMore) {
|
|
494
|
+
const page = await sdk.getSwapUserLiquidityPositions('eth|0x...', 10, bookmark);
|
|
495
|
+
allPositions = allPositions.concat(page.positions);
|
|
496
|
+
hasMore = !!page.bookmark;
|
|
497
|
+
bookmark = page.bookmark;
|
|
498
|
+
console.log(`Fetched page: ${page.positions.length} positions`);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
console.log(`Total fetched: ${allPositions.length}`);
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### `getSwapLiquidityPositionById(ownerAddress, positionId)`
|
|
505
|
+
|
|
506
|
+
Get a specific liquidity position by its ID.
|
|
507
|
+
|
|
508
|
+
**Parameters:**
|
|
509
|
+
```typescript
|
|
510
|
+
ownerAddress: string; // Wallet address
|
|
511
|
+
positionId: string; // Position UUID
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**Returns:** Single position object (same structure as above)
|
|
515
|
+
|
|
516
|
+
**Example:**
|
|
517
|
+
```typescript
|
|
518
|
+
const position = await sdk.getSwapLiquidityPositionById('eth|0x...', 'position-uuid');
|
|
519
|
+
|
|
520
|
+
console.log(`Position: ${position.token0}/${position.token1}`);
|
|
521
|
+
console.log(`Liquidity: ${position.liquidity}`);
|
|
522
|
+
console.log(`Accumulated fees: ${position.feeAmount0} + ${position.feeAmount1}`);
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### `getSwapLiquidityPosition(ownerAddress, token0, token1, fee, tickLower, tickUpper)`
|
|
526
|
+
|
|
527
|
+
Get a liquidity position by token pair and price range.
|
|
528
|
+
|
|
529
|
+
**Parameters:**
|
|
530
|
+
```typescript
|
|
531
|
+
ownerAddress: string; // Wallet address
|
|
532
|
+
token0: string; // First token
|
|
533
|
+
token1: string; // Second token
|
|
534
|
+
fee: number; // Fee tier (500, 3000, or 10000)
|
|
535
|
+
tickLower: number; // Lower tick boundary
|
|
536
|
+
tickUpper: number; // Upper tick boundary
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
**Returns:** Single position object
|
|
540
|
+
|
|
541
|
+
**Example:**
|
|
542
|
+
```typescript
|
|
543
|
+
const position = await sdk.getSwapLiquidityPosition(
|
|
544
|
+
'eth|0x...',
|
|
545
|
+
'GALA',
|
|
546
|
+
'GUSDC',
|
|
547
|
+
3000,
|
|
548
|
+
-1000,
|
|
549
|
+
1000
|
|
550
|
+
);
|
|
551
|
+
|
|
552
|
+
console.log(`Active: ${position.liquidity > 0}`);
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### `getSwapEstimateRemoveLiquidity(token0, token1, fee, liquidity, tickLower, tickUpper)`
|
|
556
|
+
|
|
557
|
+
Estimate tokens and fees you'll receive when removing liquidity.
|
|
558
|
+
|
|
559
|
+
**Parameters:**
|
|
560
|
+
```typescript
|
|
561
|
+
token0: string; // First token
|
|
562
|
+
token1: string; // Second token
|
|
563
|
+
fee: number; // Fee tier
|
|
564
|
+
liquidity: string; // Liquidity amount to remove
|
|
565
|
+
tickLower: number; // Lower tick
|
|
566
|
+
tickUpper: number; // Upper tick
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
**Returns:**
|
|
570
|
+
```typescript
|
|
571
|
+
{
|
|
572
|
+
amount0: string; // Token0 amount to receive
|
|
573
|
+
amount1: string; // Token1 amount to receive
|
|
574
|
+
fee0: string; // Collected fees (Token0)
|
|
575
|
+
fee1: string; // Collected fees (Token1)
|
|
576
|
+
feeAmount0: string; // Same as fee0
|
|
577
|
+
feeAmount1: string; // Same as fee1
|
|
578
|
+
token0Symbol: string; // Token0 symbol
|
|
579
|
+
token1Symbol: string; // Token1 symbol
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
**Example:**
|
|
584
|
+
```typescript
|
|
585
|
+
// Preview removal before executing
|
|
586
|
+
const estimate = await sdk.getSwapEstimateRemoveLiquidity(
|
|
587
|
+
'GALA',
|
|
588
|
+
'GUSDC',
|
|
589
|
+
3000,
|
|
590
|
+
position.liquidity,
|
|
591
|
+
position.tickLower,
|
|
592
|
+
position.tickUpper
|
|
593
|
+
);
|
|
594
|
+
|
|
595
|
+
console.log(`Will receive: ${estimate.amount0} GALA, ${estimate.amount1} GUSDC`);
|
|
596
|
+
console.log(`Collected fees: ${estimate.feeAmount0} GALA, ${estimate.feeAmount1} GUSDC`);
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### `addSwapLiquidityByPrice(token0, token1, fee, minPrice, maxPrice, amount0Desired, amount1Desired, amount0Min?, amount1Min?)`
|
|
600
|
+
|
|
601
|
+
Add liquidity by specifying a price range (user-friendly approach).
|
|
602
|
+
|
|
603
|
+
**Parameters:**
|
|
604
|
+
```typescript
|
|
605
|
+
token0: string; // First token
|
|
606
|
+
token1: string; // Second token
|
|
607
|
+
fee: number; // Fee tier (500, 3000, or 10000)
|
|
608
|
+
minPrice: string; // Minimum price (e.g., "0.95")
|
|
609
|
+
maxPrice: string; // Maximum price (e.g., "1.05")
|
|
610
|
+
amount0Desired: string; // Desired Token0 amount to provide
|
|
611
|
+
amount1Desired: string; // Desired Token1 amount to provide
|
|
612
|
+
amount0Min?: string; // Minimum Token0 (slippage protection, default: "0")
|
|
613
|
+
amount1Min?: string; // Minimum Token1 (slippage protection, default: "0")
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
**Returns:**
|
|
617
|
+
```typescript
|
|
618
|
+
{
|
|
619
|
+
transactionId: string;
|
|
620
|
+
status: 'PENDING' | 'COMPLETED' | 'FAILED';
|
|
621
|
+
positionId: string; // New position ID
|
|
622
|
+
liquidity: string; // Liquidity amount provided
|
|
623
|
+
amount0Used: string; // Actual Token0 used
|
|
624
|
+
amount1Used: string; // Actual Token1 used
|
|
625
|
+
wait(): Promise<TransactionResult>;
|
|
626
|
+
}
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
**Example:**
|
|
630
|
+
```typescript
|
|
631
|
+
// Create position with 0.95-1.05 price range
|
|
632
|
+
const result = await sdk.addSwapLiquidityByPrice({
|
|
633
|
+
token0: 'GALA',
|
|
634
|
+
token1: 'GUSDC',
|
|
635
|
+
fee: 3000, // 0.30% fee tier
|
|
636
|
+
minPrice: '0.95', // Active when price between 0.95-1.05
|
|
637
|
+
maxPrice: '1.05',
|
|
638
|
+
amount0Desired: '100', // Provide 100 GALA
|
|
639
|
+
amount1Desired: '100', // Provide 100 GUSDC
|
|
640
|
+
amount0Min: '95', // Accept at least 95 GALA
|
|
641
|
+
amount1Min: '95' // Accept at least 95 GUSDC
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
console.log(`Position created: ${result.positionId}`);
|
|
645
|
+
console.log(`Liquidity provided: ${result.liquidity}`);
|
|
646
|
+
|
|
647
|
+
// Wait for confirmation
|
|
648
|
+
await result.wait();
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
### `addSwapLiquidityByTicks(token0, token1, feeTier, tickLower, tickUpper, amount0Desired, amount1Desired, amount0Min?, amount1Min?)`
|
|
652
|
+
|
|
653
|
+
Add liquidity by specifying exact tick boundaries (advanced users).
|
|
654
|
+
|
|
655
|
+
**Parameters:**
|
|
656
|
+
```typescript
|
|
657
|
+
token0: string; // First token
|
|
658
|
+
token1: string; // Second token
|
|
659
|
+
feeTier: number; // Fee tier (500, 3000, or 10000)
|
|
660
|
+
tickLower: number; // Lower tick (must align with tickSpacing)
|
|
661
|
+
tickUpper: number; // Upper tick (must align with tickSpacing)
|
|
662
|
+
amount0Desired: string; // Desired Token0 amount
|
|
663
|
+
amount1Desired: string; // Desired Token1 amount
|
|
664
|
+
amount0Min?: string; // Minimum Token0 (default: "0")
|
|
665
|
+
amount1Min?: string; // Minimum Token1 (default: "0")
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
**Returns:** Same as addSwapLiquidityByPrice
|
|
669
|
+
|
|
670
|
+
**Example:**
|
|
671
|
+
```typescript
|
|
672
|
+
// Create position with exact tick boundaries (advanced)
|
|
673
|
+
// Note: ticks must be multiples of tickSpacing (varies by fee tier)
|
|
674
|
+
const result = await sdk.addSwapLiquidityByTicks({
|
|
675
|
+
token0: 'GALA',
|
|
676
|
+
token1: 'GUSDC',
|
|
677
|
+
feeTier: 3000,
|
|
678
|
+
tickLower: -1000, // Exact tick
|
|
679
|
+
tickUpper: 1000, // Exact tick
|
|
680
|
+
amount0Desired: '100',
|
|
681
|
+
amount1Desired: '100'
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
console.log(`Position ID: ${result.positionId}`);
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
### `removeSwapLiquidity(ownerAddress, positionId, liquidity, amount0Min, amount1Min, deadline?)`
|
|
688
|
+
|
|
689
|
+
Remove liquidity from a position and withdraw underlying tokens.
|
|
690
|
+
|
|
691
|
+
**Parameters:**
|
|
692
|
+
```typescript
|
|
693
|
+
ownerAddress: string; // Wallet address
|
|
694
|
+
positionId: string; // Position ID to remove from
|
|
695
|
+
liquidity: string; // Liquidity amount to remove (use full amount to close)
|
|
696
|
+
amount0Min: string; // Minimum Token0 to receive (slippage protection)
|
|
697
|
+
amount1Min: string; // Minimum Token1 to receive (slippage protection)
|
|
698
|
+
deadline?: number; // Deadline timestamp (unix seconds, optional)
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
**Returns:**
|
|
702
|
+
```typescript
|
|
703
|
+
{
|
|
704
|
+
transactionId: string;
|
|
705
|
+
status: 'PENDING' | 'COMPLETED' | 'FAILED';
|
|
706
|
+
amount0Withdrawn: string; // Token0 received
|
|
707
|
+
amount1Withdrawn: string; // Token1 received
|
|
708
|
+
fee0Collected: string; // Fees collected (Token0)
|
|
709
|
+
fee1Collected: string; // Fees collected (Token1)
|
|
710
|
+
wait(): Promise<TransactionResult>;
|
|
711
|
+
}
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
**Example:**
|
|
715
|
+
```typescript
|
|
716
|
+
// Preview removal before executing
|
|
717
|
+
const estimate = await sdk.getSwapEstimateRemoveLiquidity(
|
|
718
|
+
position.token0,
|
|
719
|
+
position.token1,
|
|
720
|
+
position.feeTier,
|
|
721
|
+
position.liquidity,
|
|
722
|
+
position.tickLower,
|
|
723
|
+
position.tickUpper
|
|
724
|
+
);
|
|
725
|
+
|
|
726
|
+
// Remove full liquidity and close position
|
|
727
|
+
const result = await sdk.removeSwapLiquidity({
|
|
728
|
+
ownerAddress: 'eth|0x...',
|
|
729
|
+
positionId: position.positionId,
|
|
730
|
+
liquidity: position.liquidity,
|
|
731
|
+
amount0Min: estimate.amount0, // Use estimate values
|
|
732
|
+
amount1Min: estimate.amount1,
|
|
733
|
+
deadline: Math.floor(Date.now() / 1000) + 3600 // 1 hour from now
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
console.log(`Withdrawn: ${result.amount0Withdrawn} + ${result.amount1Withdrawn}`);
|
|
737
|
+
console.log(`Fees collected: ${result.fee0Collected} + ${result.fee1Collected}`);
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
### `collectSwapPositionFees(ownerAddress, positionId, amount0Max?, amount1Max?)`
|
|
741
|
+
|
|
742
|
+
Collect accumulated trading fees without closing the position.
|
|
743
|
+
|
|
744
|
+
**Parameters:**
|
|
745
|
+
```typescript
|
|
746
|
+
ownerAddress: string; // Wallet address
|
|
747
|
+
positionId: string; // Position ID
|
|
748
|
+
amount0Max?: string; // Maximum Token0 fees (optional)
|
|
749
|
+
amount1Max?: string; // Maximum Token1 fees (optional)
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
**Returns:**
|
|
753
|
+
```typescript
|
|
754
|
+
{
|
|
755
|
+
transactionId: string;
|
|
756
|
+
status: 'PENDING' | 'COMPLETED' | 'FAILED';
|
|
757
|
+
amount0Collected: string; // Token0 fees collected
|
|
758
|
+
amount1Collected: string; // Token1 fees collected
|
|
759
|
+
wait(): Promise<TransactionResult>;
|
|
760
|
+
}
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
**Example:**
|
|
764
|
+
```typescript
|
|
765
|
+
// Collect fees periodically without removing liquidity
|
|
766
|
+
const result = await sdk.collectSwapPositionFees({
|
|
767
|
+
ownerAddress: 'eth|0x...',
|
|
768
|
+
positionId: position.positionId
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
console.log(`Collected: ${result.amount0Collected} + ${result.amount1Collected}`);
|
|
772
|
+
|
|
773
|
+
// Position remains active and continues earning fees
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
### Complete Liquidity Management Workflow
|
|
777
|
+
|
|
778
|
+
```typescript
|
|
779
|
+
// 1. View all positions
|
|
780
|
+
const positions = await sdk.getAllSwapUserLiquidityPositions('eth|0x...');
|
|
781
|
+
console.log(`You have ${positions.length} active positions`);
|
|
782
|
+
|
|
783
|
+
// 2. Create new position
|
|
784
|
+
const newPos = await sdk.addSwapLiquidityByPrice({
|
|
785
|
+
token0: 'GALA',
|
|
786
|
+
token1: 'GUSDC',
|
|
787
|
+
fee: 3000,
|
|
788
|
+
minPrice: '0.95',
|
|
789
|
+
maxPrice: '1.05',
|
|
790
|
+
amount0Desired: '1000',
|
|
791
|
+
amount1Desired: '1000'
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
await newPos.wait();
|
|
795
|
+
console.log(`Position created: ${newPos.positionId}`);
|
|
796
|
+
|
|
797
|
+
// 3. Monitor fees (periodically)
|
|
798
|
+
setTimeout(async () => {
|
|
799
|
+
const position = await sdk.getSwapLiquidityPositionById('eth|0x...', newPos.positionId);
|
|
800
|
+
console.log(`Fees earned: ${position.feeAmount0} + ${position.feeAmount1}`);
|
|
801
|
+
}, 3600000); // Every hour
|
|
802
|
+
|
|
803
|
+
// 4. Collect fees when ready
|
|
804
|
+
const fees = await sdk.collectSwapPositionFees({
|
|
805
|
+
ownerAddress: 'eth|0x...',
|
|
806
|
+
positionId: newPos.positionId
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
console.log(`Harvested: ${fees.amount0Collected} + ${fees.amount1Collected}`);
|
|
810
|
+
|
|
811
|
+
// 5. Close position when desired
|
|
812
|
+
const removed = await sdk.removeSwapLiquidity({
|
|
813
|
+
ownerAddress: 'eth|0x...',
|
|
814
|
+
positionId: newPos.positionId,
|
|
815
|
+
liquidity: newPos.liquidity,
|
|
816
|
+
amount0Min: '0',
|
|
817
|
+
amount1Min: '0'
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
console.log(`Closed position, received: ${removed.amount0Withdrawn} + ${removed.amount1Withdrawn}`);
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
---
|
|
824
|
+
|
|
409
825
|
## Pool Information
|
|
410
826
|
|
|
411
827
|
### `fetchPoolDetails(tokenName)`
|
|
@@ -548,6 +964,81 @@ symbol: string; // 1-8 uppercase characters
|
|
|
548
964
|
}
|
|
549
965
|
```
|
|
550
966
|
|
|
967
|
+
### `fetchTokenClassesWithSupply(tokenClasses)`
|
|
968
|
+
|
|
969
|
+
Fetch authoritative supply information for one or more token classes from GalaChain.
|
|
970
|
+
|
|
971
|
+
Queries the GalaChain network for definitive token supply data including total supply, maximum supply, burned amounts, and mint-related metrics. This method provides blockchain-verified token information.
|
|
972
|
+
|
|
973
|
+
**Parameters:**
|
|
974
|
+
```typescript
|
|
975
|
+
tokenClasses: TokenClassKey[]; // Array of token class identifiers
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
**Returns:**
|
|
979
|
+
```typescript
|
|
980
|
+
Promise<Array<{
|
|
981
|
+
// Token Identification
|
|
982
|
+
collection: string; // Token collection (e.g., 'Token')
|
|
983
|
+
category: string; // Token category (e.g., 'Unit')
|
|
984
|
+
type: string; // Token type (e.g., 'GALA', 'GUSDC')
|
|
985
|
+
additionalKey: string; // Additional key/network (e.g., 'eth:0x...', 'none')
|
|
986
|
+
|
|
987
|
+
// Token Metadata
|
|
988
|
+
symbol: string; // Token symbol
|
|
989
|
+
name: string; // Token display name
|
|
990
|
+
decimals: number; // Decimal precision
|
|
991
|
+
|
|
992
|
+
// Supply Information
|
|
993
|
+
totalSupply: string; // Current total supply in circulation
|
|
994
|
+
maxSupply: string; // Maximum possible supply
|
|
995
|
+
totalBurned: string; // Total amount burned
|
|
996
|
+
knownMintSupply: string; // Known mint supply
|
|
997
|
+
knownMintAllowanceSupply: string; // Known mint allowance
|
|
998
|
+
}>>
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
**Example:**
|
|
1002
|
+
```typescript
|
|
1003
|
+
// Query single token
|
|
1004
|
+
const supplies = await sdk.fetchTokenClassesWithSupply([
|
|
1005
|
+
{
|
|
1006
|
+
collection: 'GALA',
|
|
1007
|
+
category: 'Unit',
|
|
1008
|
+
type: 'none',
|
|
1009
|
+
additionalKey: 'none'
|
|
1010
|
+
}
|
|
1011
|
+
]);
|
|
1012
|
+
|
|
1013
|
+
console.log(`GALA Total Supply: ${supplies[0].totalSupply}`);
|
|
1014
|
+
console.log(`GALA Max Supply: ${supplies[0].maxSupply}`);
|
|
1015
|
+
console.log(`GALA Burned: ${supplies[0].totalBurned}`);
|
|
1016
|
+
|
|
1017
|
+
// Query multiple tokens in one call
|
|
1018
|
+
const multiSupplies = await sdk.fetchTokenClassesWithSupply([
|
|
1019
|
+
{ collection: 'GALA', category: 'Unit', type: 'none', additionalKey: 'none' },
|
|
1020
|
+
{ collection: 'GUSDC', category: 'Unit', type: 'none', additionalKey: 'none' }
|
|
1021
|
+
]);
|
|
1022
|
+
|
|
1023
|
+
// Analyze supply metrics
|
|
1024
|
+
for (const token of multiSupplies) {
|
|
1025
|
+
const circulationPercent = (parseFloat(token.totalSupply) / parseFloat(token.maxSupply)) * 100;
|
|
1026
|
+
const burnPercent = (parseFloat(token.totalBurned) / parseFloat(token.totalSupply)) * 100;
|
|
1027
|
+
|
|
1028
|
+
console.log(`${token.symbol}:`);
|
|
1029
|
+
console.log(` Circulation: ${circulationPercent.toFixed(2)}% of max`);
|
|
1030
|
+
console.log(` Burned: ${burnPercent.toFixed(2)}% of total`);
|
|
1031
|
+
}
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
**Use Cases:**
|
|
1035
|
+
- Token supply tracking and dashboards
|
|
1036
|
+
- Burn rate analysis and monitoring
|
|
1037
|
+
- Mint allowance verification
|
|
1038
|
+
- Token health metrics and reporting
|
|
1039
|
+
- Supply distribution analysis
|
|
1040
|
+
- Compliance and audit reporting
|
|
1041
|
+
|
|
551
1042
|
---
|
|
552
1043
|
|
|
553
1044
|
## Portfolio & Balances
|
|
@@ -797,7 +1288,7 @@ tokenId: string | {
|
|
|
797
1288
|
|
|
798
1289
|
**Example:**
|
|
799
1290
|
```typescript
|
|
800
|
-
const details = await sdk.fetchTokenDetails('
|
|
1291
|
+
const details = await sdk.fetchTokenDetails('GUSDC|Unit|none|eth:0x...');
|
|
801
1292
|
|
|
802
1293
|
if (details.verified && details.tradingEnabled) {
|
|
803
1294
|
console.log(`${details.symbol}: ${details.name}`);
|
|
@@ -877,6 +1368,35 @@ interface TokenClassKey {
|
|
|
877
1368
|
}
|
|
878
1369
|
```
|
|
879
1370
|
|
|
1371
|
+
### TokenClassWithSupply
|
|
1372
|
+
```typescript
|
|
1373
|
+
interface TokenClassWithSupply {
|
|
1374
|
+
// Token Identification
|
|
1375
|
+
collection: string; // Token collection (e.g., "Token")
|
|
1376
|
+
category: string; // Token category (e.g., "Unit")
|
|
1377
|
+
type: string; // Token type (e.g., "GALA", "GUSDC")
|
|
1378
|
+
additionalKey: string; // Network/chain info (e.g., "eth:0x...", "none")
|
|
1379
|
+
|
|
1380
|
+
// Token Metadata
|
|
1381
|
+
symbol: string; // Token symbol
|
|
1382
|
+
name: string; // Token display name
|
|
1383
|
+
decimals: number; // Decimal precision
|
|
1384
|
+
|
|
1385
|
+
// Supply Information
|
|
1386
|
+
totalSupply: string; // Current total supply in circulation
|
|
1387
|
+
maxSupply: string; // Maximum possible supply
|
|
1388
|
+
totalBurned: string; // Total amount burned
|
|
1389
|
+
knownMintSupply: string; // Known mint supply
|
|
1390
|
+
knownMintAllowanceSupply: string; // Known mint allowance supply
|
|
1391
|
+
|
|
1392
|
+
// Optional Fields
|
|
1393
|
+
authorities?: Array<{ // Optional token authorities
|
|
1394
|
+
address?: string; // Authority address
|
|
1395
|
+
role?: string; // Authority role/type
|
|
1396
|
+
}>;
|
|
1397
|
+
}
|
|
1398
|
+
```
|
|
1399
|
+
|
|
880
1400
|
### TransactionResult
|
|
881
1401
|
```typescript
|
|
882
1402
|
interface TransactionResult {
|