@gala-chain/launchpad-sdk 5.0.3 → 5.0.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/EXAMPLES.md +141 -7
- package/README.md +68 -36
- package/dist/ai-docs.json +7357 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +70 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/LaunchpadSDK.d.ts +3288 -214
- package/dist/src/LaunchpadSDK.d.ts.map +1 -1
- package/dist/src/api/LaunchpadAPI.d.ts +21 -41
- package/dist/src/api/LaunchpadAPI.d.ts.map +1 -1
- package/dist/src/api/dto/BurnTokensDto.d.ts.map +1 -1
- package/dist/src/api/dto/LockTokenDto.d.ts.map +1 -1
- package/dist/src/api/dto/TransferTokenDto.d.ts.map +1 -1
- package/dist/src/api/dto/UnlockTokenDto.d.ts.map +1 -1
- package/dist/src/auth/JwtAuth.d.ts +145 -0
- package/dist/src/auth/JwtAuth.d.ts.map +1 -0
- package/dist/src/auth/SessionAuthService.d.ts +146 -0
- package/dist/src/auth/SessionAuthService.d.ts.map +1 -0
- package/dist/src/auth/SignatureAuth.d.ts.map +1 -1
- package/dist/src/bridge/BridgeService.d.ts.map +1 -1
- package/dist/src/bridge/GalaConnectClient.d.ts.map +1 -1
- package/dist/src/bridge/constants/tokens.d.ts +4 -3
- package/dist/src/bridge/constants/tokens.d.ts.map +1 -1
- package/dist/src/bridge/index.d.ts +1 -0
- package/dist/src/bridge/index.d.ts.map +1 -1
- package/dist/src/bridge/strategies/BridgeStrategy.d.ts.map +1 -1
- package/dist/src/bridge/strategies/EthereumBridgeStrategy.d.ts +1 -38
- package/dist/src/bridge/strategies/EthereumBridgeStrategy.d.ts.map +1 -1
- package/dist/src/bridge/strategies/SolanaBridgeStrategy.d.ts +1 -21
- package/dist/src/bridge/strategies/SolanaBridgeStrategy.d.ts.map +1 -1
- package/dist/src/bridge/types/bridge.dto.d.ts +15 -2
- package/dist/src/bridge/types/bridge.dto.d.ts.map +1 -1
- package/dist/src/bridge/utils/RateLimiter.d.ts +1 -1
- package/dist/src/bridge/utils/RateLimiter.d.ts.map +1 -1
- package/dist/src/bridge/utils/address-formatter.d.ts +25 -0
- package/dist/src/bridge/utils/address-formatter.d.ts.map +1 -0
- package/dist/src/bridge/utils/addressValidation.d.ts +200 -0
- package/dist/src/bridge/utils/addressValidation.d.ts.map +1 -0
- package/dist/src/bridge/utils/balanceHelpers.d.ts +215 -0
- package/dist/src/bridge/utils/balanceHelpers.d.ts.map +1 -0
- package/dist/src/bridge/utils/bridgeErrors.d.ts +98 -0
- package/dist/src/bridge/utils/bridgeErrors.d.ts.map +1 -0
- package/dist/src/bridge/utils/bridgeOutHelpers.d.ts +68 -0
- package/dist/src/bridge/utils/bridgeOutHelpers.d.ts.map +1 -0
- package/dist/src/bridge/utils/bridgePayload.d.ts +107 -0
- package/dist/src/bridge/utils/bridgePayload.d.ts.map +1 -0
- package/dist/src/bridge/utils/bridgeStatusParser.d.ts +75 -0
- package/dist/src/bridge/utils/bridgeStatusParser.d.ts.map +1 -0
- package/dist/src/bridge/utils/eip712Helpers.d.ts +66 -0
- package/dist/src/bridge/utils/eip712Helpers.d.ts.map +1 -0
- package/dist/src/bridge/utils/index.d.ts +9 -0
- package/dist/src/bridge/utils/index.d.ts.map +1 -1
- package/dist/src/bridge/utils/retry.d.ts +16 -0
- package/dist/src/bridge/utils/retry.d.ts.map +1 -1
- package/dist/src/bridge/utils/strategyDelegation.d.ts +69 -0
- package/dist/src/bridge/utils/strategyDelegation.d.ts.map +1 -0
- package/dist/src/bridge/utils/tokenIdUtils.d.ts +7 -0
- package/dist/src/bridge/utils/tokenIdUtils.d.ts.map +1 -1
- package/dist/src/bridge/utils/tokenMath.d.ts.map +1 -1
- package/dist/src/bridge/utils/tokenMetadataResolver.d.ts +97 -0
- package/dist/src/bridge/utils/tokenMetadataResolver.d.ts.map +1 -0
- package/dist/src/constants/endpoints.d.ts +453 -0
- package/dist/src/constants/endpoints.d.ts.map +1 -1
- package/dist/src/constants/error-messages.d.ts +1 -1
- package/dist/src/constants/error-messages.d.ts.map +1 -1
- package/dist/src/constants/jwt.d.ts +41 -0
- package/dist/src/constants/jwt.d.ts.map +1 -0
- package/dist/src/constants/sdk-defaults.d.ts +37 -0
- package/dist/src/constants/sdk-defaults.d.ts.map +1 -0
- package/dist/src/constants/version.generated.d.ts +1 -1
- package/dist/src/constants/version.generated.d.ts.map +1 -1
- package/dist/src/helpers/sdk.d.ts.map +1 -1
- package/dist/src/helpers/wallet.d.ts +4 -3
- package/dist/src/helpers/wallet.d.ts.map +1 -1
- package/dist/src/index.d.ts +70 -11
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/schemas/files.d.ts +2 -2
- package/dist/src/schemas/launchpad.d.ts +40 -8
- package/dist/src/schemas/launchpad.d.ts.map +1 -1
- package/dist/src/schemas/pagination.d.ts +7 -7
- package/dist/src/schemas/primitives.d.ts.map +1 -1
- package/dist/src/schemas/trade.d.ts +6 -6
- package/dist/src/schemas/user.d.ts +4 -4
- package/dist/src/schemas/validators.d.ts +15 -7
- package/dist/src/schemas/validators.d.ts.map +1 -1
- package/dist/src/services/AbstractCacheService.d.ts +227 -0
- package/dist/src/services/AbstractCacheService.d.ts.map +1 -0
- package/dist/src/services/AbstractTokenFetchService.d.ts +150 -0
- package/dist/src/services/AbstractTokenFetchService.d.ts.map +1 -0
- package/dist/src/services/ApiKeyService.d.ts +205 -0
- package/dist/src/services/ApiKeyService.d.ts.map +1 -0
- package/dist/src/services/BanService.d.ts +195 -0
- package/dist/src/services/BanService.d.ts.map +1 -0
- package/dist/src/services/BaseService.d.ts +50 -3
- package/dist/src/services/BaseService.d.ts.map +1 -1
- package/dist/src/services/BatchedCacheService.d.ts +132 -0
- package/dist/src/services/BatchedCacheService.d.ts.map +1 -0
- package/dist/src/services/BridgeableTokenCache.d.ts +32 -98
- package/dist/src/services/BridgeableTokenCache.d.ts.map +1 -1
- package/dist/src/services/BridgeableTokenService.d.ts +18 -13
- package/dist/src/services/BridgeableTokenService.d.ts.map +1 -1
- package/dist/src/services/BundleService.d.ts.map +1 -1
- package/dist/src/services/BundlerClientFactory.d.ts +32 -0
- package/dist/src/services/BundlerClientFactory.d.ts.map +1 -0
- package/dist/src/services/ChatMessagesService.d.ts +152 -0
- package/dist/src/services/ChatMessagesService.d.ts.map +1 -0
- package/dist/src/services/CommentService.d.ts +119 -0
- package/dist/src/services/CommentService.d.ts.map +1 -0
- package/dist/src/services/CommentsService.d.ts +155 -0
- package/dist/src/services/CommentsService.d.ts.map +1 -0
- package/dist/src/services/ContentFlagService.d.ts +212 -0
- package/dist/src/services/ContentFlagService.d.ts.map +1 -0
- package/dist/src/services/ContentReactionService.d.ts +175 -0
- package/dist/src/services/ContentReactionService.d.ts.map +1 -0
- package/dist/src/services/DexBackendClient.d.ts.map +1 -1
- package/dist/src/services/DexPoolService.d.ts +3 -3
- package/dist/src/services/DexPoolService.d.ts.map +1 -1
- package/dist/src/services/DexQuoteService.d.ts.map +1 -1
- package/dist/src/services/DexService.d.ts +2 -5
- package/dist/src/services/DexService.d.ts.map +1 -1
- package/dist/src/services/GSwapAssetService.d.ts +80 -0
- package/dist/src/services/GSwapAssetService.d.ts.map +1 -0
- package/dist/src/services/GSwapLiquidityMutationService.d.ts +140 -0
- package/dist/src/services/GSwapLiquidityMutationService.d.ts.map +1 -0
- package/dist/src/services/GSwapLiquidityQueryService.d.ts +87 -0
- package/dist/src/services/GSwapLiquidityQueryService.d.ts.map +1 -0
- package/dist/src/services/GSwapPoolCalculationService.d.ts +200 -0
- package/dist/src/services/GSwapPoolCalculationService.d.ts.map +1 -0
- package/dist/src/services/GSwapPoolQueryService.d.ts +116 -0
- package/dist/src/services/GSwapPoolQueryService.d.ts.map +1 -0
- package/dist/src/services/GSwapService.d.ts +14 -0
- package/dist/src/services/GSwapService.d.ts.map +1 -1
- package/dist/src/services/GSwapSwapService.d.ts +68 -0
- package/dist/src/services/GSwapSwapService.d.ts.map +1 -0
- package/dist/src/services/GalaChainBalanceService.d.ts +155 -0
- package/dist/src/services/GalaChainBalanceService.d.ts.map +1 -0
- package/dist/src/services/GalaChainGatewayClient.d.ts +32 -1
- package/dist/src/services/GalaChainGatewayClient.d.ts.map +1 -1
- package/dist/src/services/GalaChainLockService.d.ts +144 -0
- package/dist/src/services/GalaChainLockService.d.ts.map +1 -0
- package/dist/src/services/GalaChainService.d.ts +23 -106
- package/dist/src/services/GalaChainService.d.ts.map +1 -1
- package/dist/src/services/GalaChainTokenService.d.ts +108 -0
- package/dist/src/services/GalaChainTokenService.d.ts.map +1 -0
- package/dist/src/services/GalaChainTransferService.d.ts +205 -0
- package/dist/src/services/GalaChainTransferService.d.ts.map +1 -0
- package/dist/src/services/ImageService.d.ts +24 -8
- package/dist/src/services/ImageService.d.ts.map +1 -1
- package/dist/src/services/LaunchpadService.d.ts +77 -5
- package/dist/src/services/LaunchpadService.d.ts.map +1 -1
- package/dist/src/services/ModeratorService.d.ts +269 -0
- package/dist/src/services/ModeratorService.d.ts.map +1 -0
- package/dist/src/services/MultiPoolStateManager.d.ts +4 -6
- package/dist/src/services/MultiPoolStateManager.d.ts.map +1 -1
- package/dist/src/services/NetworkKeyedCacheService.d.ts +185 -0
- package/dist/src/services/NetworkKeyedCacheService.d.ts.map +1 -0
- package/dist/src/services/OverseerService.d.ts +322 -0
- package/dist/src/services/OverseerService.d.ts.map +1 -0
- package/dist/src/services/PoolCacheManager.d.ts +2 -2
- package/dist/src/services/PoolCacheManager.d.ts.map +1 -1
- package/dist/src/services/PoolService.d.ts +61 -7
- package/dist/src/services/PoolService.d.ts.map +1 -1
- package/dist/src/services/PoolStateManager.d.ts +2 -2
- package/dist/src/services/PoolStateManager.d.ts.map +1 -1
- package/dist/src/services/PriceHistoryService.d.ts.map +1 -1
- package/dist/src/services/SignatureService.d.ts.map +1 -1
- package/dist/src/services/StreamChatService.d.ts +378 -0
- package/dist/src/services/StreamChatService.d.ts.map +1 -0
- package/dist/src/services/StreamTokenServiceBase.d.ts +371 -0
- package/dist/src/services/StreamTokenServiceBase.d.ts.map +1 -0
- package/dist/src/services/StreamWebSocketService.d.ts +268 -0
- package/dist/src/services/StreamWebSocketService.d.ts.map +1 -0
- package/dist/src/services/StreamingEventService.d.ts +431 -0
- package/dist/src/services/StreamingEventService.d.ts.map +1 -0
- package/dist/src/services/StreamingService.d.ts +547 -0
- package/dist/src/services/StreamingService.d.ts.map +1 -0
- package/dist/src/services/SwapEventQueue.d.ts +2 -2
- package/dist/src/services/SwapEventQueue.d.ts.map +1 -1
- package/dist/src/services/TokenBanService.d.ts +214 -0
- package/dist/src/services/TokenBanService.d.ts.map +1 -0
- package/dist/src/services/TokenClassKeyService.d.ts.map +1 -1
- package/dist/src/services/TokenMetadataCache.d.ts +36 -27
- package/dist/src/services/TokenMetadataCache.d.ts.map +1 -1
- package/dist/src/services/TokenMetadataService.d.ts +24 -4
- package/dist/src/services/TokenMetadataService.d.ts.map +1 -1
- package/dist/src/services/TokenResolverService.d.ts.map +1 -1
- package/dist/src/services/TradeService.d.ts +73 -0
- package/dist/src/services/TradeService.d.ts.map +1 -1
- package/dist/src/services/UserService.d.ts +56 -3
- package/dist/src/services/UserService.d.ts.map +1 -1
- package/dist/src/services/WebSocketService.d.ts +3 -3
- package/dist/src/services/WebSocketService.d.ts.map +1 -1
- package/dist/src/services/WrapService.d.ts +18 -5
- package/dist/src/services/WrapService.d.ts.map +1 -1
- package/dist/src/services/WrappableTokenCache.d.ts +8 -36
- package/dist/src/services/WrappableTokenCache.d.ts.map +1 -1
- package/dist/src/services/WrappableTokenService.d.ts +18 -12
- package/dist/src/services/WrappableTokenService.d.ts.map +1 -1
- package/dist/src/services/shared/cache-helpers.d.ts +188 -0
- package/dist/src/services/shared/cache-helpers.d.ts.map +1 -0
- package/dist/src/services/shared/http-helpers.d.ts +146 -0
- package/dist/src/services/shared/http-helpers.d.ts.map +1 -0
- package/dist/src/services/shared/pagination-helpers.d.ts +157 -0
- package/dist/src/services/shared/pagination-helpers.d.ts.map +1 -0
- package/dist/src/services/shared/service-validators.d.ts +137 -0
- package/dist/src/services/shared/service-validators.d.ts.map +1 -0
- package/dist/src/services/shared/websocket-helpers.d.ts +158 -0
- package/dist/src/services/shared/websocket-helpers.d.ts.map +1 -0
- package/dist/src/test-constants.d.ts +29 -0
- package/dist/src/test-constants.d.ts.map +1 -0
- package/dist/src/types/api-key.dto.d.ts +300 -0
- package/dist/src/types/api-key.dto.d.ts.map +1 -0
- package/dist/src/types/backend-responses.d.ts +12 -0
- package/dist/src/types/backend-responses.d.ts.map +1 -1
- package/dist/src/types/ban.dto.d.ts +413 -0
- package/dist/src/types/ban.dto.d.ts.map +1 -0
- package/dist/src/types/burn.dto.d.ts +21 -0
- package/dist/src/types/burn.dto.d.ts.map +1 -1
- package/dist/src/types/chat-messages.dto.d.ts +193 -0
- package/dist/src/types/chat-messages.dto.d.ts.map +1 -0
- package/dist/src/types/comment.dto.d.ts +180 -0
- package/dist/src/types/comment.dto.d.ts.map +1 -0
- package/dist/src/types/comments.dto.d.ts +210 -0
- package/dist/src/types/comments.dto.d.ts.map +1 -0
- package/dist/src/types/common.d.ts +369 -0
- package/dist/src/types/common.d.ts.map +1 -1
- package/dist/src/types/constraints.d.ts +374 -0
- package/dist/src/types/constraints.d.ts.map +1 -0
- package/dist/src/types/content-flag.dto.d.ts +310 -0
- package/dist/src/types/content-flag.dto.d.ts.map +1 -0
- package/dist/src/types/content-reactions.dto.d.ts +132 -0
- package/dist/src/types/content-reactions.dto.d.ts.map +1 -0
- package/dist/src/types/dex-pool.dto.d.ts +13 -37
- package/dist/src/types/dex-pool.dto.d.ts.map +1 -1
- package/dist/src/types/dto.d.ts +8 -0
- package/dist/src/types/dto.d.ts.map +1 -1
- package/dist/src/types/galachain-api.types.d.ts +30 -0
- package/dist/src/types/galachain-api.types.d.ts.map +1 -1
- package/dist/src/types/gswap-responses.types.d.ts.map +1 -1
- package/dist/src/types/launchpad.dto.d.ts +234 -131
- package/dist/src/types/launchpad.dto.d.ts.map +1 -1
- package/dist/src/types/launchpad.validation.d.ts.map +1 -1
- package/dist/src/types/lock.dto.d.ts +20 -35
- package/dist/src/types/lock.dto.d.ts.map +1 -1
- package/dist/src/types/moderator.dto.d.ts +581 -0
- package/dist/src/types/moderator.dto.d.ts.map +1 -0
- package/dist/src/types/options.dto.d.ts +25 -115
- package/dist/src/types/options.dto.d.ts.map +1 -1
- package/dist/src/types/overseer.dto.d.ts +420 -0
- package/dist/src/types/overseer.dto.d.ts.map +1 -0
- package/dist/src/types/pool.dto.d.ts +106 -0
- package/dist/src/types/pool.dto.d.ts.map +1 -0
- package/dist/src/types/result.types.d.ts +3 -2
- package/dist/src/types/result.types.d.ts.map +1 -1
- package/dist/src/types/session-auth.dto.d.ts +91 -0
- package/dist/src/types/session-auth.dto.d.ts.map +1 -0
- package/dist/src/types/stream-chat.dto.d.ts +815 -0
- package/dist/src/types/stream-chat.dto.d.ts.map +1 -0
- package/dist/src/types/streaming-events.dto.d.ts +586 -0
- package/dist/src/types/streaming-events.dto.d.ts.map +1 -0
- package/dist/src/types/streaming.dto.d.ts +1141 -0
- package/dist/src/types/streaming.dto.d.ts.map +1 -0
- package/dist/src/types/token-ban.dto.d.ts +195 -0
- package/dist/src/types/token-ban.dto.d.ts.map +1 -0
- package/dist/src/types/trade.dto.d.ts +21 -61
- package/dist/src/types/trade.dto.d.ts.map +1 -1
- package/dist/src/types/trades-query.dto.d.ts +127 -0
- package/dist/src/types/trades-query.dto.d.ts.map +1 -0
- package/dist/src/types/transfer.dto.d.ts +20 -15
- package/dist/src/types/transfer.dto.d.ts.map +1 -1
- package/dist/src/types/user.dto.d.ts +185 -73
- package/dist/src/types/user.dto.d.ts.map +1 -1
- package/dist/src/types/wrappable-token.dto.d.ts +6 -2
- package/dist/src/types/wrappable-token.dto.d.ts.map +1 -1
- package/dist/src/utils/LiquidityEventExtractor.d.ts.map +1 -1
- package/dist/src/utils/Logger.d.ts.map +1 -1
- package/dist/src/utils/MonitoringMetrics.d.ts.map +1 -1
- package/dist/src/utils/PoolKeyNormalizer.d.ts.map +1 -1
- package/dist/src/utils/ReconnectionManager.d.ts +142 -0
- package/dist/src/utils/ReconnectionManager.d.ts.map +1 -0
- package/dist/src/utils/SignatureHelper.d.ts +9 -0
- package/dist/src/utils/SignatureHelper.d.ts.map +1 -1
- package/dist/src/utils/SwapEventExtractor.d.ts.map +1 -1
- package/dist/src/utils/adapters.d.ts.map +1 -1
- package/dist/src/utils/address-formatter.d.ts +317 -0
- package/dist/src/utils/address-formatter.d.ts.map +1 -0
- package/dist/src/utils/agent-config.d.ts.map +1 -1
- package/dist/src/utils/amount-validator.d.ts +268 -0
- package/dist/src/utils/amount-validator.d.ts.map +1 -0
- package/dist/src/utils/api-patterns.d.ts +347 -0
- package/dist/src/utils/api-patterns.d.ts.map +1 -0
- package/dist/src/utils/array-helpers.d.ts +115 -0
- package/dist/src/utils/array-helpers.d.ts.map +1 -0
- package/dist/src/utils/async-patterns.d.ts +272 -0
- package/dist/src/utils/async-patterns.d.ts.map +1 -0
- package/dist/src/utils/auto-pagination.d.ts +195 -2
- package/dist/src/utils/auto-pagination.d.ts.map +1 -1
- package/dist/src/utils/bignumber-helpers.d.ts +119 -13
- package/dist/src/utils/bignumber-helpers.d.ts.map +1 -1
- package/dist/src/utils/bignumber-pool-cache.d.ts.map +1 -1
- package/dist/src/utils/bondingCurveCalculations.d.ts.map +1 -1
- package/dist/src/utils/cacheWarmingHelpers.d.ts +2 -2
- package/dist/src/utils/cacheWarmingHelpers.d.ts.map +1 -1
- package/dist/src/utils/data-transform-patterns.d.ts +393 -0
- package/dist/src/utils/data-transform-patterns.d.ts.map +1 -0
- package/dist/src/utils/date-utils.d.ts +166 -0
- package/dist/src/utils/date-utils.d.ts.map +1 -1
- package/dist/src/utils/delimiter-parser.d.ts +139 -0
- package/dist/src/utils/delimiter-parser.d.ts.map +1 -0
- package/dist/src/utils/error-factories.d.ts +346 -1
- package/dist/src/utils/error-factories.d.ts.map +1 -1
- package/dist/src/utils/error-handling-patterns.d.ts +390 -0
- package/dist/src/utils/error-handling-patterns.d.ts.map +1 -0
- package/dist/src/utils/error-patterns.d.ts +360 -0
- package/dist/src/utils/error-patterns.d.ts.map +1 -0
- package/dist/src/utils/error-utils.d.ts +250 -0
- package/dist/src/utils/error-utils.d.ts.map +1 -1
- package/dist/src/utils/error-wrapper.d.ts +208 -0
- package/dist/src/utils/error-wrapper.d.ts.map +1 -0
- package/dist/src/utils/errors.d.ts +70 -0
- package/dist/src/utils/errors.d.ts.map +1 -1
- package/dist/src/utils/http-factory.d.ts +36 -0
- package/dist/src/utils/http-factory.d.ts.map +1 -0
- package/dist/src/utils/http.d.ts.map +1 -1
- package/dist/src/utils/load-env.d.ts.map +1 -1
- package/dist/src/utils/multipart.d.ts.map +1 -1
- package/dist/src/utils/numeric-patterns.d.ts +289 -0
- package/dist/src/utils/numeric-patterns.d.ts.map +1 -0
- package/dist/src/utils/numeric-wrappers.d.ts +146 -0
- package/dist/src/utils/numeric-wrappers.d.ts.map +1 -0
- package/dist/src/utils/object-extractors.d.ts +115 -0
- package/dist/src/utils/object-extractors.d.ts.map +1 -0
- package/dist/src/utils/object-patterns.d.ts +81 -0
- package/dist/src/utils/object-patterns.d.ts.map +1 -0
- package/dist/src/utils/pagination-helpers.d.ts +230 -0
- package/dist/src/utils/pagination-helpers.d.ts.map +1 -0
- package/dist/src/utils/pool-pair-parser.d.ts +3 -1
- package/dist/src/utils/pool-pair-parser.d.ts.map +1 -1
- package/dist/src/utils/pool-state-validator.d.ts.map +1 -1
- package/dist/src/utils/position-filters.d.ts +1 -2
- package/dist/src/utils/position-filters.d.ts.map +1 -1
- package/dist/src/utils/query-params.d.ts +0 -16
- package/dist/src/utils/query-params.d.ts.map +1 -1
- package/dist/src/utils/response-handlers.d.ts +149 -20
- package/dist/src/utils/response-handlers.d.ts.map +1 -1
- package/dist/src/utils/response-helpers.d.ts +28 -0
- package/dist/src/utils/response-helpers.d.ts.map +1 -0
- package/dist/src/utils/response-normalizers.d.ts +27 -49
- package/dist/src/utils/response-normalizers.d.ts.map +1 -1
- package/dist/src/utils/safe-parsers.d.ts +487 -0
- package/dist/src/utils/safe-parsers.d.ts.map +1 -0
- package/dist/src/utils/service-validators.d.ts +268 -0
- package/dist/src/utils/service-validators.d.ts.map +1 -0
- package/dist/src/utils/slippage-utils.d.ts.map +1 -1
- package/dist/src/utils/string-patterns.d.ts +404 -0
- package/dist/src/utils/string-patterns.d.ts.map +1 -0
- package/dist/src/utils/string-transforms.d.ts +89 -0
- package/dist/src/utils/string-transforms.d.ts.map +1 -0
- package/dist/src/utils/string-utils.d.ts +108 -0
- package/dist/src/utils/string-utils.d.ts.map +1 -0
- package/dist/src/utils/swap-delta-calculator.d.ts.map +1 -1
- package/dist/src/utils/tick-crossing-handler.d.ts.map +1 -1
- package/dist/src/utils/token-format-converter.d.ts +22 -8
- package/dist/src/utils/token-format-converter.d.ts.map +1 -1
- package/dist/src/utils/token-parser.d.ts +2 -2
- package/dist/src/utils/token-parser.d.ts.map +1 -1
- package/dist/src/utils/token-stringification.d.ts +168 -0
- package/dist/src/utils/token-stringification.d.ts.map +1 -0
- package/dist/src/utils/tokenNameNormalizer.d.ts +96 -0
- package/dist/src/utils/tokenNameNormalizer.d.ts.map +1 -0
- package/dist/src/utils/tokenNormalizer.d.ts +8 -45
- package/dist/src/utils/tokenNormalizer.d.ts.map +1 -1
- package/dist/src/utils/transfer-validation.d.ts +1 -1
- package/dist/src/utils/transfer-validation.d.ts.map +1 -1
- package/dist/src/utils/type-guard-factory.d.ts +260 -0
- package/dist/src/utils/type-guard-factory.d.ts.map +1 -0
- package/dist/src/utils/unique-key-generator.d.ts +148 -0
- package/dist/src/utils/unique-key-generator.d.ts.map +1 -0
- package/dist/src/utils/validation-helpers.d.ts +906 -183
- package/dist/src/utils/validation-helpers.d.ts.map +1 -1
- package/dist/src/utils/validation-patterns.d.ts +745 -0
- package/dist/src/utils/validation-patterns.d.ts.map +1 -0
- package/dist/src/utils/validation.d.ts +2 -30
- package/dist/src/utils/validation.d.ts.map +1 -1
- package/dist/src/utils/wallet.d.ts +12 -1
- package/dist/src/utils/wallet.d.ts.map +1 -1
- package/dist/src/utils/websocket-patterns.d.ts +681 -0
- package/dist/src/utils/websocket-patterns.d.ts.map +1 -0
- package/dist/src/utils/websocket-validators.d.ts.map +1 -1
- package/package.json +86 -19
- package/dist/src/bridge/strategies/index.d.ts +0 -9
- package/dist/src/bridge/strategies/index.d.ts.map +0 -1
- package/dist/src/constants/counts.d.ts +0 -66
- package/dist/src/constants/counts.d.ts.map +0 -1
- package/dist/src/services/WebSocketManager.d.ts +0 -99
- package/dist/src/services/WebSocketManager.d.ts.map +0 -1
- package/dist/src/types/eip712-types.d.ts +0 -140
- package/dist/src/types/eip712-types.d.ts.map +0 -1
- package/dist/src/types/pool-state-manager-config.dto.d.ts +0 -103
- package/dist/src/types/pool-state-manager-config.dto.d.ts.map +0 -1
- package/dist/src/utils/number-utils.d.ts +0 -94
- package/dist/src/utils/number-utils.d.ts.map +0 -1
- package/dist/src/utils/precision-math.d.ts +0 -37
- package/dist/src/utils/precision-math.d.ts.map +0 -1
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
import { Wallet } from 'ethers';
|
|
2
2
|
import { SDKConfig, AddressFormat, TokenClassKey, TokenId } from './types/common';
|
|
3
|
+
import { StreamEventCallbacks } from './services/StreamWebSocketService';
|
|
3
4
|
import { EthereumWalletBalanceResult, SolanaWalletBalanceResult, ExternalChainBalance, EstimateBridgeFeeParams, BridgeFeeEstimate, BridgeOutParams, BridgeInParams, BridgeTransaction, BridgeStatus, BridgeToken, EthereumTransactionStatus, SolanaTransactionStatus } from './bridge/types/bridge.dto';
|
|
4
5
|
import type { BridgeableNetwork, FetchBridgeableTokensOptions, FetchBridgeableTokensResult, IsTokenBridgeableOptions, IsTokenBridgeableResult } from './bridge/types/bridgeable-token.dto';
|
|
5
6
|
import type { WrappableToken, FetchWrappableTokensOptions, FetchWrappableTokensResult, IsTokenWrappableResult, WrapTokenOptions, UnwrapTokenOptions, WrapUnwrapResult, WrapUnwrapFeeEstimate, WrapUnwrapStatusResult } from './types/wrappable-token.dto';
|
|
7
|
+
import type { StreamInfo, StartStreamResult, ResetStreamKeyResult, FetchRecordingsOptions, RecordingsResult, RecordingDownloadResult, AddSimulcastTargetOptions, SimulcastTargetsResult, AddSimulcastTargetResult, GlobalStreamingStatus, StreamSubscribedEvent, GetStreamRoleOptions, StreamRoleResponse, GetTokenAccessOptions, TokenAccessResult } from './types/streaming.dto';
|
|
8
|
+
import type { ChatStatusResponse, GlobalChatStatus, GetEngagementStatsOptions, EngagementStatsResult } from './types/stream-chat.dto';
|
|
9
|
+
import type { CreateBanOptions, CreateBanResult, RemoveBanOptions, RemoveBanResult, ListBansOptions, BanListResult, GetBanStatusOptions, BanStatusResult, GetActiveUsersOptions, ActiveUsersResult } from './types/ban.dto';
|
|
10
|
+
import type { BanTokenOptions, BanTokenResult, UnbanTokenOptions, UnbanTokenResult, ListTokenBansOptions, TokenBanListResult, GetTokenBanOptions, TokenBanStatusResult } from './types/token-ban.dto';
|
|
11
|
+
import type { CreateApiKeyOptions, UpdateApiKeyOptions, ListApiKeysOptions, CreateApiKeyResponse, ApiKeyData, ApiKeyListResponse } from './types/api-key.dto';
|
|
12
|
+
import type { CreateModeratorInviteOptions, ClaimModeratorInviteOptions, ListModeratorInvitesOptions, GetModeratedTokensOptions, UpdateInviteRoleOptions, CreateModeratorInviteResult, ClaimModeratorInviteResult, ModeratorInviteListResult, ModeratedTokensResult, UpdateInviteRoleResult, PublicInviteInfo } from './types/moderator.dto';
|
|
13
|
+
import type { LoginResponse, SessionInfo, RefreshResponse } from './types/session-auth.dto';
|
|
14
|
+
import type { CreateFlagOptions, CreateFlagResult, ListFlagsOptions, ListGlobalFlagsOptions, FlagListResult, DismissFlagOptions, DismissFlagResult, ActionFlagOptions, ActionFlagResult } from './types/content-flag.dto';
|
|
15
|
+
import type { CreateOverseerInviteOptions, ListOverseerInvitesOptions, ListOverseersOptions, OverseerInviteWithUrl, PublicOverseerInviteInfo, PaginatedOverseerInvites, PaginatedOverseers, OverseerStatusResponse, OverseerSummaryResponse, ListUsersOptions, UsersListResponse, UserSummaryResponse } from './types/overseer.dto';
|
|
16
|
+
import type { AddContentReactionOptions, RemoveContentReactionOptions, AddContentReactionResult, RemoveContentReactionResult } from './types/content-reactions.dto';
|
|
17
|
+
import type { GetCommentsOptions, CreateCommentOptions, UpdateCommentOptions, CommentsResult, CreateCommentResult, UpdateCommentResult, DeleteCommentResult } from './types/comments.dto';
|
|
18
|
+
import type { GetChatMessagesOptions, CreateChatMessageOptions, UpdateChatMessageOptions, GetChatMessagesResult, CreateChatMessageResult, UpdateChatMessageResult } from './types/chat-messages.dto';
|
|
19
|
+
import type { GetTradesOptions, TradesQueryResult } from './types/trades-query.dto';
|
|
6
20
|
import { PoolDetailsData } from './types/trade.dto';
|
|
7
|
-
import { LaunchTokenData, TokenSpotPrice, FetchPoolsOptions, PoolsResult, GalaChainTokenDetails, PoolData, TokenClassWithSupply, DexSeason, LeaderboardResult, DexAggregatedVolumeSummary } from './types/launchpad.dto';
|
|
8
|
-
import { UpdateProfileData, UploadProfileImageOptions, FetchTokenBalanceOptions, LockedBalanceResult, AvailableBalanceResult, ReferralUrlResult, FetchReferralsOptions, ReferralsResult, AllReferralsResult, FetchReferralsSummaryOptions, ReferralsSummaryResult, RegisterAccountOptions, RegisterAccountResult } from './types/user.dto';
|
|
21
|
+
import { LaunchTokenData, TokenSpotPrice, FetchPoolsOptions, PoolsResult, GalaChainTokenDetails, PoolData, TokenClassWithSupply, DexSeason, LeaderboardResult, DexAggregatedVolumeSummary, UpdateSocialLinksDto, UpdateSocialLinksResponse } from './types/launchpad.dto';
|
|
22
|
+
import { UpdateProfileData, UploadProfileImageOptions, FetchTokenBalanceOptions, LockedBalanceResult, AvailableBalanceResult, ReferralUrlResult, FetchReferralsOptions, ReferralsResult, AllReferralsResult, FetchReferralsSummaryOptions, ReferralsSummaryResult, RegisterAccountOptions, RegisterAccountResult, GetManagedTokensOptions, ManagedTokensResult } from './types/user.dto';
|
|
9
23
|
import { TransferGalaData, TransferTokenData } from './types/transfer.dto';
|
|
10
24
|
import { LockTokensData, LockTokensResult, UnlockTokensData, UnlockTokensResult } from './types/lock.dto';
|
|
11
25
|
import { BurnTokensData, BurnTokensResult } from './types/burn.dto';
|
|
12
26
|
import { TokenLaunchResult, TradeResult } from './types/result.types';
|
|
13
27
|
import { WebSocketError, WebSocketTimeoutError, TransactionFailedError } from './utils/websocket-errors';
|
|
14
28
|
export { WebSocketError, WebSocketTimeoutError, TransactionFailedError, };
|
|
15
|
-
import { FetchVolumeDataOptions, FetchTradesOptions, CalculateBuyAmountOptions, CalculateSellAmountOptions, CalculateBuyAmountLocalOptions, CalculateSellAmountLocalOptions, BuyTokenOptions, SellTokenOptions, UploadImageByTokenNameOptions, FetchTokensHeldOptions, FetchTokensCreatedOptions, GraduateTokenOptions,
|
|
29
|
+
import { FetchVolumeDataOptions, FetchTradesOptions, CalculateBuyAmountOptions, CalculateSellAmountOptions, CalculateBuyAmountLocalOptions, CalculateSellAmountLocalOptions, BuyTokenOptions, SellTokenOptions, UploadImageByTokenNameOptions, FetchTokensHeldOptions, FetchTokensCreatedOptions, GraduateTokenOptions, FetchTokenSpotPriceParams, CalculateBuyAmountForGraduationOptions } from './types/options.dto';
|
|
16
30
|
import { FetchPriceHistoryOptions, PriceHistoryResult } from './types/priceHistory.dto';
|
|
17
31
|
import { FetchDexPoolsOptions, DexPoolsResult, DexPoolData } from './types/dex-pool.dto';
|
|
18
32
|
import { GSwapPosition, PoolPriceData, GetLiquidityPositionsOptions, GetLiquidityPositionsResult, RemoveLiquidityArgs, AddLiquidityByPriceArgs, AddLiquidityByTicksArgs, CollectFeesArgs, DexToken, FetchAvailableDexTokensOptions, AvailableDexTokensResult } from './types/gswap.dto';
|
|
19
33
|
import type { FetchCompositePoolDataOptions, CompositePoolDataResult, CalculateDexPoolQuoteOptions, DexPoolQuoteResult } from './types/composite-pool.dto';
|
|
20
34
|
import type { SubscribeSwapOptions, SwapMonitorConfig, CleanupFunction, SwapEventCallback } from './types/swap-monitor.dto';
|
|
21
35
|
import type { LiquidityChangedCallback, LiquidityCleanupFunction, SubscribeLiquidityOptions } from './types/liquidity-monitor.dto';
|
|
36
|
+
import { AvailableRolesResponse } from './types/streaming.dto';
|
|
22
37
|
/**
|
|
23
38
|
* Configuration for initializing the Launchpad SDK
|
|
24
39
|
*
|
|
@@ -166,6 +181,33 @@ export interface LaunchpadSDKConfig extends SDKConfig {
|
|
|
166
181
|
* ```
|
|
167
182
|
*/
|
|
168
183
|
solanaRpcUrl?: string;
|
|
184
|
+
/**
|
|
185
|
+
* Optional Stream WebSocket URL for live streaming features.
|
|
186
|
+
*
|
|
187
|
+
* This is a SEPARATE endpoint from bundleBaseUrl, dedicated to streaming operations.
|
|
188
|
+
* Required for real-time stream status, viewer count, and chat functionality.
|
|
189
|
+
*
|
|
190
|
+
* @since 5.1.0
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* const sdk = new LaunchpadSDK({
|
|
194
|
+
* wallet,
|
|
195
|
+
* streamWebSocketUrl: 'wss://stream.gala.com'
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
streamWebSocketUrl?: string;
|
|
200
|
+
/**
|
|
201
|
+
* Optional Admin API key for stream management operations.
|
|
202
|
+
*
|
|
203
|
+
* Required for admin-only operations:
|
|
204
|
+
* - Disabling/enabling streams per token
|
|
205
|
+
* - Disabling/enabling streaming globally
|
|
206
|
+
* - Disabling/enabling chat per token or globally
|
|
207
|
+
*
|
|
208
|
+
* @since 5.1.0
|
|
209
|
+
*/
|
|
210
|
+
streamAdminApiKey?: string;
|
|
169
211
|
}
|
|
170
212
|
/**
|
|
171
213
|
* Main Launchpad SDK class providing access to all Gala Launchpad functionality
|
|
@@ -239,6 +281,8 @@ export declare class LaunchpadSDK {
|
|
|
239
281
|
private wallet;
|
|
240
282
|
private readonly galaChainAddressOverride;
|
|
241
283
|
private readonly auth;
|
|
284
|
+
private readonly jwtAuth;
|
|
285
|
+
private readonly sessionAuth;
|
|
242
286
|
private readonly http;
|
|
243
287
|
private readonly galaChainHttp;
|
|
244
288
|
private readonly galaChainPublicAxios;
|
|
@@ -268,6 +312,20 @@ export declare class LaunchpadSDK {
|
|
|
268
312
|
private _wrappableTokenService?;
|
|
269
313
|
private _wrapService?;
|
|
270
314
|
private _galaConnectClient?;
|
|
315
|
+
private _streamingService;
|
|
316
|
+
private _streamChatService;
|
|
317
|
+
private _streamWebSocketService;
|
|
318
|
+
private _streamingEventService;
|
|
319
|
+
private _banService;
|
|
320
|
+
private _tokenBanService;
|
|
321
|
+
private _apiKeyService;
|
|
322
|
+
private _moderatorService;
|
|
323
|
+
private _flagService;
|
|
324
|
+
private _overseerService;
|
|
325
|
+
private _commentService;
|
|
326
|
+
private _contentReactionService;
|
|
327
|
+
private _commentsService;
|
|
328
|
+
private _chatMessagesService;
|
|
271
329
|
private readonly launchpadAPI;
|
|
272
330
|
constructor(config: LaunchpadSDKConfig);
|
|
273
331
|
/**
|
|
@@ -336,7 +394,7 @@ export declare class LaunchpadSDK {
|
|
|
336
394
|
* const backendAddr = sdk.getAddress();
|
|
337
395
|
*
|
|
338
396
|
* // Verify they represent the same address
|
|
339
|
-
* const ethHex = ethAddr
|
|
397
|
+
* const ethHex = stripHexPrefix(ethAddr);
|
|
340
398
|
* const backendHex = backendAddr.replace('eth|', '');
|
|
341
399
|
* console.log('Same address:', ethHex.toLowerCase() === backendHex.toLowerCase());
|
|
342
400
|
* ```
|
|
@@ -595,7 +653,7 @@ export declare class LaunchpadSDK {
|
|
|
595
653
|
* @example Basic pool fetching
|
|
596
654
|
* ```typescript
|
|
597
655
|
* const result = await sdk.fetchPools({ type: 'recent', page: 1, limit: 20 });
|
|
598
|
-
* console.log(`Fetched ${result.
|
|
656
|
+
* console.log(`Fetched ${result.items.length} pools`);
|
|
599
657
|
* console.log(`Total pools: ${result.total}`);
|
|
600
658
|
* ```
|
|
601
659
|
*
|
|
@@ -660,14 +718,14 @@ export declare class LaunchpadSDK {
|
|
|
660
718
|
* @example Fetch all recent pools
|
|
661
719
|
* ```typescript
|
|
662
720
|
* const all = await sdk.fetchAllPools({ type: 'recent' });
|
|
663
|
-
* console.log(`Fetched ${all.
|
|
721
|
+
* console.log(`Fetched ${all.items.length} total pools`);
|
|
664
722
|
* console.log(`Total available: ${all.total}`);
|
|
665
723
|
* ```
|
|
666
724
|
*
|
|
667
725
|
* @example Fetch all pools matching search
|
|
668
726
|
* ```typescript
|
|
669
727
|
* const dragons = await sdk.fetchAllPools({ search: 'dragon' });
|
|
670
|
-
* console.log(`Found ${dragons.
|
|
728
|
+
* console.log(`Found ${dragons.items.length} dragon tokens`);
|
|
671
729
|
* ```
|
|
672
730
|
*
|
|
673
731
|
* @example Cache warming demonstration
|
|
@@ -677,11 +735,11 @@ export declare class LaunchpadSDK {
|
|
|
677
735
|
*
|
|
678
736
|
* // Check cache statistics
|
|
679
737
|
* const cacheInfo = sdk.getCacheInfo();
|
|
680
|
-
* console.log(`Cached ${cacheInfo.totalTokens} tokens from ${all.
|
|
738
|
+
* console.log(`Cached ${cacheInfo.totalTokens} tokens from ${all.items.length} pools`);
|
|
681
739
|
*
|
|
682
740
|
* // All subsequent calculations are instant (no network calls)
|
|
683
741
|
* const calculations = await Promise.all(
|
|
684
|
-
* all.
|
|
742
|
+
* all.items.slice(0, 10).map(pool =>
|
|
685
743
|
* sdk.calculateBuyAmountLocal({
|
|
686
744
|
* tokenName: pool.tokenName,
|
|
687
745
|
* amount: '100',
|
|
@@ -725,7 +783,7 @@ export declare class LaunchpadSDK {
|
|
|
725
783
|
* console.log(`Found ${result.total} total pools`);
|
|
726
784
|
* console.log(`Showing page ${result.page} of ${result.totalPages}`);
|
|
727
785
|
*
|
|
728
|
-
* result.
|
|
786
|
+
* result.items.forEach(pool => {
|
|
729
787
|
* console.log(`${pool.poolName}: $${pool.tvl.toFixed(2)} TVL`);
|
|
730
788
|
* });
|
|
731
789
|
* ```
|
|
@@ -737,7 +795,7 @@ export declare class LaunchpadSDK {
|
|
|
737
795
|
* limit: 20
|
|
738
796
|
* });
|
|
739
797
|
*
|
|
740
|
-
* console.log(`Found ${galaPools.
|
|
798
|
+
* console.log(`Found ${galaPools.items.length} GALA trading pairs`);
|
|
741
799
|
* ```
|
|
742
800
|
*
|
|
743
801
|
* @example Get pools sorted by TVL (default)
|
|
@@ -774,7 +832,7 @@ export declare class LaunchpadSDK {
|
|
|
774
832
|
* console.log(`Total pools: ${allPools.total}`);
|
|
775
833
|
*
|
|
776
834
|
* // Find top GALA pools
|
|
777
|
-
* const galaPools = allPools.
|
|
835
|
+
* const galaPools = allPools.items
|
|
778
836
|
* .filter(p => p.poolName.includes('GALA'))
|
|
779
837
|
* .slice(0, 10);
|
|
780
838
|
*
|
|
@@ -788,7 +846,7 @@ export declare class LaunchpadSDK {
|
|
|
788
846
|
* const allPools = await sdk.fetchAllDexPools();
|
|
789
847
|
*
|
|
790
848
|
* // Find pools by token
|
|
791
|
-
* const guscPairs = allPools.
|
|
849
|
+
* const guscPairs = allPools.items.filter(p =>
|
|
792
850
|
* p.poolName.includes('GUSDC')
|
|
793
851
|
* );
|
|
794
852
|
*
|
|
@@ -992,6 +1050,33 @@ export declare class LaunchpadSDK {
|
|
|
992
1050
|
* ```
|
|
993
1051
|
*/
|
|
994
1052
|
fetchTokenDistribution(tokenName: string): Promise<import("./types/launchpad.dto").TokenDistributionResult>;
|
|
1053
|
+
/**
|
|
1054
|
+
* Fetch a user's holder context for a specific token
|
|
1055
|
+
*
|
|
1056
|
+
* Retrieves holder tier, quantity, percentage, and creator status for a user
|
|
1057
|
+
* on a specific token. Used for user cards in comments/chat to show
|
|
1058
|
+
* token-specific holder information.
|
|
1059
|
+
*
|
|
1060
|
+
* @category Token Information
|
|
1061
|
+
* @param tokenName - Token name to check holdings for (e.g., 'anime', 'mytoken')
|
|
1062
|
+
* @param userAddress - User wallet address to lookup
|
|
1063
|
+
* @returns Promise with user holder context including tier, quantity, percentage, isCreator
|
|
1064
|
+
* @throws {ValidationError} If tokenName or userAddress is invalid or empty
|
|
1065
|
+
* @throws {NetworkError} If API request fails
|
|
1066
|
+
* @since 3.7.0
|
|
1067
|
+
*
|
|
1068
|
+
* @example Get holder context for user card
|
|
1069
|
+
* ```typescript
|
|
1070
|
+
* const context = await sdk.fetchUserHolderContext('anime', '0x1234...');
|
|
1071
|
+
* if (context.holderTier) {
|
|
1072
|
+
* console.log(`User is a ${context.holderTier.tierName} holding ${context.percentage}%`);
|
|
1073
|
+
* }
|
|
1074
|
+
* if (context.isCreator) {
|
|
1075
|
+
* console.log('User created this token');
|
|
1076
|
+
* }
|
|
1077
|
+
* ```
|
|
1078
|
+
*/
|
|
1079
|
+
fetchUserHolderContext(tokenName: string, userAddress: string): Promise<import("./types/launchpad.dto").UserHolderContext>;
|
|
995
1080
|
/**
|
|
996
1081
|
* Fetch token achievement badges and metadata
|
|
997
1082
|
*
|
|
@@ -1065,37 +1150,6 @@ export declare class LaunchpadSDK {
|
|
|
1065
1150
|
* @throws Error if DEX Backend API client not configured
|
|
1066
1151
|
*/
|
|
1067
1152
|
fetchGalaPrice(): Promise<TokenSpotPrice>;
|
|
1068
|
-
/**
|
|
1069
|
-
* Calculate spot price for a launchpad token in USD
|
|
1070
|
-
*
|
|
1071
|
-
* @deprecated Use {@link fetchTokenPrice} with `{ tokenName }` parameter instead.
|
|
1072
|
-
* This method will be removed in SDK v4.0.0.
|
|
1073
|
-
*
|
|
1074
|
-
* Intelligently determines the best price source based on token graduation status:
|
|
1075
|
-
* - **Active Pools** (bonding curve ongoing): Uses bonding curve calculation
|
|
1076
|
-
* - **Graduated Tokens** (DEX trading): Uses DEX spot price endpoint for real market price
|
|
1077
|
-
*
|
|
1078
|
-
* Performance optimization: Provide currentSupply to avoid fetching pool details twice.
|
|
1079
|
-
*
|
|
1080
|
-
* @param tokenNameOrOptions Token name string OR FetchLaunchpadTokenSpotPriceOptions object
|
|
1081
|
-
* @returns Promise<TokenSpotPrice> Spot price with symbol and USD price
|
|
1082
|
-
*
|
|
1083
|
-
* @deprecated Use {@link fetchTokenPrice} instead - provides smart routing for both launchpad and DEX tokens
|
|
1084
|
-
*
|
|
1085
|
-
* @example Use the new smart router instead
|
|
1086
|
-
* ```typescript
|
|
1087
|
-
* // ❌ OLD (deprecated)
|
|
1088
|
-
* const price = await sdk.fetchLaunchpadTokenSpotPrice('galadog');
|
|
1089
|
-
*
|
|
1090
|
-
* // ✅ NEW (recommended)
|
|
1091
|
-
* const price = await sdk.fetchTokenPrice({ tokenName: 'galadog' });
|
|
1092
|
-
* ```
|
|
1093
|
-
*
|
|
1094
|
-
* @throws Error if token not found
|
|
1095
|
-
* @throws Error if price calculation fails
|
|
1096
|
-
* @throws Error if GALA price unavailable
|
|
1097
|
-
*/
|
|
1098
|
-
fetchLaunchpadTokenSpotPrice(tokenNameOrOptions: string | FetchLaunchpadTokenSpotPriceOptions): Promise<TokenSpotPrice>;
|
|
1099
1153
|
/**
|
|
1100
1154
|
* Fetch comprehensive token details from DEX API platform
|
|
1101
1155
|
*
|
|
@@ -1666,6 +1720,171 @@ export declare class LaunchpadSDK {
|
|
|
1666
1720
|
* @internal This is a private helper method for wrap/unwrap operations
|
|
1667
1721
|
*/
|
|
1668
1722
|
private getWrapService;
|
|
1723
|
+
/**
|
|
1724
|
+
* Get or create the StreamingService instance.
|
|
1725
|
+
*
|
|
1726
|
+
* Lazily initializes the StreamingService on first use.
|
|
1727
|
+
* The service handles REST API calls for stream management,
|
|
1728
|
+
* recordings, and simulcast targets.
|
|
1729
|
+
*
|
|
1730
|
+
* @returns Configured StreamingService instance
|
|
1731
|
+
*
|
|
1732
|
+
* @internal This is a private helper method for streaming operations
|
|
1733
|
+
* @since 5.1.0
|
|
1734
|
+
*/
|
|
1735
|
+
private getStreamingService;
|
|
1736
|
+
/**
|
|
1737
|
+
* Get or create the StreamChatService instance.
|
|
1738
|
+
*
|
|
1739
|
+
* Lazily initializes the StreamChatService on first use.
|
|
1740
|
+
* The service handles REST API calls for chat operations
|
|
1741
|
+
* including messages, status, and admin controls.
|
|
1742
|
+
*
|
|
1743
|
+
* @returns Configured StreamChatService instance
|
|
1744
|
+
*
|
|
1745
|
+
* @internal This is a private helper method for chat operations
|
|
1746
|
+
* @since 5.1.0
|
|
1747
|
+
*/
|
|
1748
|
+
private getStreamChatService;
|
|
1749
|
+
/**
|
|
1750
|
+
* Get or create the BanService instance.
|
|
1751
|
+
*
|
|
1752
|
+
* Lazily initializes the BanService on first use.
|
|
1753
|
+
* The service handles REST API calls for ban operations
|
|
1754
|
+
* including creating/removing bans, listing bans, and active users.
|
|
1755
|
+
*
|
|
1756
|
+
* @returns Configured BanService instance
|
|
1757
|
+
*
|
|
1758
|
+
* @internal This is a private helper method for ban operations
|
|
1759
|
+
* @since 5.5.0
|
|
1760
|
+
*/
|
|
1761
|
+
private getBanService;
|
|
1762
|
+
/**
|
|
1763
|
+
* Get or create the TokenBanService instance.
|
|
1764
|
+
*
|
|
1765
|
+
* Lazily initializes the TokenBanService on first use.
|
|
1766
|
+
* The service handles REST API calls for platform-wide token ban operations
|
|
1767
|
+
* (overseer-only).
|
|
1768
|
+
*
|
|
1769
|
+
* @returns Configured TokenBanService instance
|
|
1770
|
+
*
|
|
1771
|
+
* @internal This is a private helper method for token ban operations
|
|
1772
|
+
* @since 6.x.0
|
|
1773
|
+
*/
|
|
1774
|
+
private getTokenBanService;
|
|
1775
|
+
/**
|
|
1776
|
+
* Get or create the ApiKeyService instance.
|
|
1777
|
+
*
|
|
1778
|
+
* Lazily initializes the ApiKeyService on first use.
|
|
1779
|
+
* The service handles REST API calls for API key CRUD operations.
|
|
1780
|
+
*
|
|
1781
|
+
* @returns Configured ApiKeyService instance
|
|
1782
|
+
*
|
|
1783
|
+
* @internal This is a private helper method for API key operations
|
|
1784
|
+
* @since 5.6.0
|
|
1785
|
+
*/
|
|
1786
|
+
private getApiKeyService;
|
|
1787
|
+
/**
|
|
1788
|
+
* Get or create the ModeratorService instance.
|
|
1789
|
+
*
|
|
1790
|
+
* Lazily initializes the ModeratorService on first use.
|
|
1791
|
+
* The service handles REST API calls for moderator invite operations
|
|
1792
|
+
* including creating/claiming invites, listing invites, and managing access.
|
|
1793
|
+
*
|
|
1794
|
+
* @returns Configured ModeratorService instance
|
|
1795
|
+
*
|
|
1796
|
+
* @internal This is a private helper method for moderator invite operations
|
|
1797
|
+
* @since 5.7.0
|
|
1798
|
+
*/
|
|
1799
|
+
private getModeratorService;
|
|
1800
|
+
/**
|
|
1801
|
+
* Get or create the ContentFlagService instance.
|
|
1802
|
+
*
|
|
1803
|
+
* Lazily initializes the ContentFlagService on first use.
|
|
1804
|
+
* The service handles REST API calls for content flag operations
|
|
1805
|
+
* including creating flags, listing flags, and taking action on flags.
|
|
1806
|
+
*
|
|
1807
|
+
* @returns Configured ContentFlagService instance
|
|
1808
|
+
*
|
|
1809
|
+
* @internal This is a private helper method for flag operations
|
|
1810
|
+
* @since 5.8.0
|
|
1811
|
+
*/
|
|
1812
|
+
private getFlagService;
|
|
1813
|
+
/**
|
|
1814
|
+
* Get or create the OverseerService instance.
|
|
1815
|
+
*
|
|
1816
|
+
* Lazily initializes the OverseerService on first use.
|
|
1817
|
+
* The service handles REST API calls for overseer operations
|
|
1818
|
+
* including creating/claiming invites and managing overseers.
|
|
1819
|
+
*
|
|
1820
|
+
* @returns Configured OverseerService instance
|
|
1821
|
+
*
|
|
1822
|
+
* @internal This is a private helper method for overseer operations
|
|
1823
|
+
* @since 5.9.0
|
|
1824
|
+
*/
|
|
1825
|
+
private getOverseerService;
|
|
1826
|
+
/**
|
|
1827
|
+
* Get or create the CommentService instance.
|
|
1828
|
+
*
|
|
1829
|
+
* Lazily initializes the CommentService on first use.
|
|
1830
|
+
* Comments support both public (fetch) and authenticated (post, delete) operations.
|
|
1831
|
+
*
|
|
1832
|
+
* @internal
|
|
1833
|
+
*/
|
|
1834
|
+
private getCommentService;
|
|
1835
|
+
/**
|
|
1836
|
+
* Get or create the ContentReactionService instance.
|
|
1837
|
+
*
|
|
1838
|
+
* Lazily initializes the ContentReactionService on first use.
|
|
1839
|
+
* Content reactions are persistent reactions (heart, fire, laugh, wow, thumbs_up)
|
|
1840
|
+
* on chat messages and comments.
|
|
1841
|
+
*
|
|
1842
|
+
* @internal
|
|
1843
|
+
*/
|
|
1844
|
+
private getContentReactionService;
|
|
1845
|
+
/**
|
|
1846
|
+
* Get or create the CommentsService instance.
|
|
1847
|
+
*
|
|
1848
|
+
* Lazily initializes the CommentsService on first use.
|
|
1849
|
+
* Uses v1 comments endpoints for full CRUD operations.
|
|
1850
|
+
*
|
|
1851
|
+
* @returns Configured CommentsService instance
|
|
1852
|
+
* @internal
|
|
1853
|
+
* @since 6.2.0
|
|
1854
|
+
*/
|
|
1855
|
+
private getCommentsService;
|
|
1856
|
+
/**
|
|
1857
|
+
* Get or create the ChatMessagesService instance.
|
|
1858
|
+
*
|
|
1859
|
+
* Lazily initializes the ChatMessagesService on first use.
|
|
1860
|
+
* Uses v1 chat-messages endpoints for full CRUD operations.
|
|
1861
|
+
*
|
|
1862
|
+
* @returns Configured ChatMessagesService instance
|
|
1863
|
+
* @internal
|
|
1864
|
+
* @since 6.2.0
|
|
1865
|
+
*/
|
|
1866
|
+
private getChatMessagesService;
|
|
1867
|
+
/**
|
|
1868
|
+
* Get or create the StreamWebSocketService instance.
|
|
1869
|
+
*
|
|
1870
|
+
* Lazily initializes the StreamWebSocketService on first use.
|
|
1871
|
+
* The service handles real-time WebSocket connections for
|
|
1872
|
+
* stream status, viewer counts, and chat messages.
|
|
1873
|
+
*
|
|
1874
|
+
* @returns Configured StreamWebSocketService instance
|
|
1875
|
+
* @throws Error if streamWebSocketUrl is not configured
|
|
1876
|
+
*
|
|
1877
|
+
* @internal This is a private helper method for real-time streaming operations
|
|
1878
|
+
* @since 5.1.0
|
|
1879
|
+
*/
|
|
1880
|
+
private getStreamWebSocketService;
|
|
1881
|
+
/**
|
|
1882
|
+
* Get the streaming event service
|
|
1883
|
+
*
|
|
1884
|
+
* @internal
|
|
1885
|
+
* @since 5.12.0
|
|
1886
|
+
*/
|
|
1887
|
+
private getStreamingEventService;
|
|
1669
1888
|
/**
|
|
1670
1889
|
* Fetch a single ERC-20 token balance on Ethereum.
|
|
1671
1890
|
*
|
|
@@ -2368,192 +2587,2983 @@ export declare class LaunchpadSDK {
|
|
|
2368
2587
|
*/
|
|
2369
2588
|
getWrapStatus(transactionId: string): Promise<WrapUnwrapStatusResult>;
|
|
2370
2589
|
/**
|
|
2371
|
-
*
|
|
2590
|
+
* Login with wallet signature to get JWT token.
|
|
2372
2591
|
*
|
|
2373
|
-
*
|
|
2374
|
-
*
|
|
2592
|
+
* This authenticates the user with the backend by:
|
|
2593
|
+
* 1. Generating a message with timestamp: "Sign in to Launchpad t:{timestamp}"
|
|
2594
|
+
* 2. Signing the message with the configured wallet
|
|
2595
|
+
* 3. Sending the signature to the backend for verification
|
|
2596
|
+
* 4. Storing the returned JWT token for authenticated requests
|
|
2375
2597
|
*
|
|
2376
|
-
*
|
|
2377
|
-
*
|
|
2598
|
+
* Required before calling JWT-protected endpoints:
|
|
2599
|
+
* - `startStream()`, `stopStream()`, `resetStreamKey()`, `getRecordingDownload()`, `deleteRecording()`
|
|
2600
|
+
* - `addSimulcastTarget()`, `removeSimulcastTarget()`
|
|
2601
|
+
* - `sendChatMessage()` (REST API)
|
|
2602
|
+
*
|
|
2603
|
+
* @returns Login response with accessToken and expiration
|
|
2378
2604
|
* @throws Error if wallet is not configured
|
|
2379
|
-
* @throws Error if
|
|
2605
|
+
* @throws Error if signature fails
|
|
2380
2606
|
*
|
|
2381
|
-
* @since
|
|
2382
|
-
* @category
|
|
2607
|
+
* @since 5.2.0
|
|
2608
|
+
* @category Authentication
|
|
2383
2609
|
*
|
|
2384
|
-
* @example
|
|
2610
|
+
* @example Basic login
|
|
2385
2611
|
* ```typescript
|
|
2386
|
-
* const
|
|
2387
|
-
*
|
|
2388
|
-
*
|
|
2389
|
-
*
|
|
2390
|
-
*
|
|
2391
|
-
*
|
|
2612
|
+
* const { accessToken, expiresIn, address } = await sdk.login();
|
|
2613
|
+
* console.log(`Logged in as ${address}`);
|
|
2614
|
+
* console.log(`Token expires in ${expiresIn}s`);
|
|
2615
|
+
* ```
|
|
2616
|
+
*
|
|
2617
|
+
* @example Login before streaming
|
|
2618
|
+
* ```typescript
|
|
2619
|
+
* // Authenticate first
|
|
2620
|
+
* await sdk.login();
|
|
2621
|
+
*
|
|
2622
|
+
* // Now streaming methods work
|
|
2623
|
+
* const stream = await sdk.startStream('mytoken');
|
|
2392
2624
|
* ```
|
|
2393
2625
|
*/
|
|
2394
|
-
|
|
2626
|
+
login(): Promise<LoginResponse>;
|
|
2395
2627
|
/**
|
|
2396
|
-
*
|
|
2628
|
+
* Refresh the current JWT token.
|
|
2397
2629
|
*
|
|
2398
|
-
*
|
|
2399
|
-
* The
|
|
2400
|
-
*
|
|
2630
|
+
* Use this to get a new token before the current one expires.
|
|
2631
|
+
* The token is automatically refreshed during requests if
|
|
2632
|
+
* it will expire within 5 minutes.
|
|
2401
2633
|
*
|
|
2402
|
-
* @
|
|
2403
|
-
* @
|
|
2404
|
-
* @throws Error if wallet is not configured
|
|
2405
|
-
* @throws Error if token is not bridgeable to the destination chain
|
|
2406
|
-
* @throws Error if recipient address is invalid
|
|
2634
|
+
* @returns Refresh response with new accessToken
|
|
2635
|
+
* @throws Error if not authenticated (call login() first)
|
|
2407
2636
|
*
|
|
2408
|
-
* @since
|
|
2409
|
-
* @category
|
|
2637
|
+
* @since 5.2.0
|
|
2638
|
+
* @category Authentication
|
|
2410
2639
|
*
|
|
2411
|
-
* @example
|
|
2640
|
+
* @example Manual token refresh
|
|
2412
2641
|
* ```typescript
|
|
2413
|
-
*
|
|
2414
|
-
*
|
|
2415
|
-
*
|
|
2416
|
-
*
|
|
2417
|
-
* recipientAddress: '0x1234...abcd',
|
|
2418
|
-
* });
|
|
2419
|
-
* console.log(`Transaction: ${result.transactionHash}`);
|
|
2642
|
+
* if (sdk.shouldRefreshToken()) {
|
|
2643
|
+
* const { accessToken, expiresIn } = await sdk.refreshToken();
|
|
2644
|
+
* console.log(`Token refreshed, expires in ${expiresIn}s`);
|
|
2645
|
+
* }
|
|
2420
2646
|
* ```
|
|
2421
2647
|
*/
|
|
2422
|
-
|
|
2648
|
+
refreshToken(): Promise<RefreshResponse>;
|
|
2423
2649
|
/**
|
|
2424
|
-
*
|
|
2425
|
-
*
|
|
2426
|
-
* Initiates a cross-chain transfer from Ethereum or Solana to GalaChain.
|
|
2427
|
-
* The transfer will burn wrapped tokens on the source chain and unlock
|
|
2428
|
-
* tokens on GalaChain.
|
|
2650
|
+
* Logout and clear the JWT token.
|
|
2429
2651
|
*
|
|
2430
|
-
*
|
|
2431
|
-
*
|
|
2432
|
-
* @throws Error if wallet is not configured
|
|
2433
|
-
* @throws Error if token is not bridgeable from the source chain
|
|
2652
|
+
* This clears the client-side token. Future calls to JWT-protected
|
|
2653
|
+
* endpoints will fail until login() is called again.
|
|
2434
2654
|
*
|
|
2435
|
-
* @since
|
|
2436
|
-
* @category
|
|
2655
|
+
* @since 5.2.0
|
|
2656
|
+
* @category Authentication
|
|
2437
2657
|
*
|
|
2438
|
-
* @example
|
|
2658
|
+
* @example Clean logout
|
|
2439
2659
|
* ```typescript
|
|
2440
|
-
*
|
|
2441
|
-
*
|
|
2442
|
-
*
|
|
2443
|
-
* sourceChain: 'Ethereum',
|
|
2444
|
-
* });
|
|
2445
|
-
* console.log(`Transaction: ${result.transactionHash}`);
|
|
2660
|
+
* // ... do work ...
|
|
2661
|
+
* sdk.logout();
|
|
2662
|
+
* console.log('Logged out');
|
|
2446
2663
|
* ```
|
|
2447
2664
|
*/
|
|
2448
|
-
|
|
2665
|
+
logout(): void;
|
|
2449
2666
|
/**
|
|
2450
|
-
*
|
|
2667
|
+
* Check if user is authenticated with valid JWT.
|
|
2451
2668
|
*
|
|
2452
|
-
*
|
|
2669
|
+
* Returns true if:
|
|
2670
|
+
* - A JWT token exists
|
|
2671
|
+
* - The token has not expired
|
|
2453
2672
|
*
|
|
2454
|
-
* @
|
|
2455
|
-
* @param chainHint - Optional chain hint for faster lookup
|
|
2456
|
-
* @returns Promise resolving to bridge status
|
|
2673
|
+
* @returns true if authenticated with non-expired token
|
|
2457
2674
|
*
|
|
2458
|
-
* @since
|
|
2459
|
-
* @category
|
|
2675
|
+
* @since 5.2.0
|
|
2676
|
+
* @category Authentication
|
|
2460
2677
|
*
|
|
2461
|
-
* @example Check
|
|
2678
|
+
* @example Check authentication status
|
|
2462
2679
|
* ```typescript
|
|
2463
|
-
*
|
|
2464
|
-
*
|
|
2465
|
-
*
|
|
2466
|
-
*
|
|
2467
|
-
* console.log(`Status: ${status.status}`);
|
|
2680
|
+
* if (!sdk.isAuthenticated()) {
|
|
2681
|
+
* await sdk.login();
|
|
2682
|
+
* }
|
|
2683
|
+
* // Now proceed with authenticated operations
|
|
2468
2684
|
* ```
|
|
2469
2685
|
*/
|
|
2470
|
-
|
|
2686
|
+
isAuthenticated(): boolean;
|
|
2471
2687
|
/**
|
|
2472
|
-
*
|
|
2688
|
+
* Check if token should be refreshed.
|
|
2473
2689
|
*
|
|
2474
|
-
* Returns
|
|
2475
|
-
*
|
|
2690
|
+
* Returns true if token exists and will expire within the threshold.
|
|
2691
|
+
* Default threshold is 5 minutes.
|
|
2476
2692
|
*
|
|
2477
|
-
* @
|
|
2693
|
+
* @param thresholdMs - Custom threshold in milliseconds (default: 5 minutes)
|
|
2694
|
+
* @returns true if refresh is recommended
|
|
2478
2695
|
*
|
|
2479
|
-
* @since
|
|
2480
|
-
* @category
|
|
2696
|
+
* @since 5.2.0
|
|
2697
|
+
* @category Authentication
|
|
2481
2698
|
*
|
|
2482
|
-
* @example
|
|
2699
|
+
* @example Check before long operation
|
|
2483
2700
|
* ```typescript
|
|
2484
|
-
*
|
|
2485
|
-
*
|
|
2486
|
-
*
|
|
2487
|
-
* }
|
|
2701
|
+
* // Ensure token won't expire during operation
|
|
2702
|
+
* if (sdk.shouldRefreshToken(10 * 60 * 1000)) { // 10 minutes
|
|
2703
|
+
* await sdk.refreshToken();
|
|
2704
|
+
* }
|
|
2705
|
+
* await performLongOperation();
|
|
2488
2706
|
* ```
|
|
2489
2707
|
*/
|
|
2490
|
-
|
|
2491
|
-
tokens: BridgeToken[];
|
|
2492
|
-
totalCount: number;
|
|
2493
|
-
supportedChains: string[];
|
|
2494
|
-
}>;
|
|
2708
|
+
shouldRefreshToken(thresholdMs?: number): boolean;
|
|
2495
2709
|
/**
|
|
2496
|
-
*
|
|
2710
|
+
* Get current session information from the backend.
|
|
2497
2711
|
*
|
|
2498
|
-
*
|
|
2499
|
-
*
|
|
2712
|
+
* Returns session details including:
|
|
2713
|
+
* - Authenticated address
|
|
2714
|
+
* - Token issued time
|
|
2715
|
+
* - Token expiration time
|
|
2500
2716
|
*
|
|
2501
|
-
* @
|
|
2502
|
-
* @
|
|
2717
|
+
* @returns Session info with address and timestamps
|
|
2718
|
+
* @throws Error if not authenticated
|
|
2503
2719
|
*
|
|
2504
|
-
* @
|
|
2720
|
+
* @since 5.2.0
|
|
2721
|
+
* @category Authentication
|
|
2722
|
+
*
|
|
2723
|
+
* @example View session details
|
|
2505
2724
|
* ```typescript
|
|
2506
|
-
*
|
|
2507
|
-
*
|
|
2508
|
-
*
|
|
2509
|
-
*
|
|
2510
|
-
|
|
2725
|
+
* const session = await sdk.getSession();
|
|
2726
|
+
* console.log(`Logged in as: ${session.address}`);
|
|
2727
|
+
* console.log(`Session expires: ${session.expiresAt}`);
|
|
2728
|
+
* ```
|
|
2729
|
+
*/
|
|
2730
|
+
getSession(): Promise<SessionInfo>;
|
|
2731
|
+
/**
|
|
2732
|
+
* Get the current JWT access token.
|
|
2511
2733
|
*
|
|
2512
|
-
*
|
|
2513
|
-
*
|
|
2514
|
-
* const unicornBalance = await sdk.fetchTokenBalance({
|
|
2515
|
-
* address: sdk.getAddress(),
|
|
2516
|
-
* tokenClassKey: tokenClass
|
|
2517
|
-
* });
|
|
2734
|
+
* Returns the raw token string for use in custom requests
|
|
2735
|
+
* or debugging. Returns null if not authenticated.
|
|
2518
2736
|
*
|
|
2519
|
-
*
|
|
2520
|
-
* const unicornBalance2 = await sdk.fetchTokenBalance({
|
|
2521
|
-
* address: sdk.getAddress(),
|
|
2522
|
-
* tokenId: {
|
|
2523
|
-
* collection: "Token",
|
|
2524
|
-
* category: "Unit",
|
|
2525
|
-
* type: "UNI",
|
|
2526
|
-
* additionalKey: "eth:9401b171307bE656f00F9e18DF756643FD3a91dE",
|
|
2527
|
-
* instance: "0"
|
|
2528
|
-
* }
|
|
2529
|
-
* });
|
|
2737
|
+
* @returns Access token string, or null if not authenticated
|
|
2530
2738
|
*
|
|
2531
|
-
*
|
|
2532
|
-
*
|
|
2533
|
-
*
|
|
2534
|
-
*
|
|
2535
|
-
*
|
|
2739
|
+
* @since 5.2.0
|
|
2740
|
+
* @category Authentication
|
|
2741
|
+
*
|
|
2742
|
+
* @example Use token in custom request
|
|
2743
|
+
* ```typescript
|
|
2744
|
+
* const token = sdk.getAccessToken();
|
|
2745
|
+
* if (token) {
|
|
2746
|
+
* const headers = { 'Authorization': `Bearer ${token}` };
|
|
2747
|
+
* // Use headers in custom fetch call
|
|
2748
|
+
* }
|
|
2536
2749
|
* ```
|
|
2537
2750
|
*/
|
|
2538
|
-
|
|
2539
|
-
quantity: unknown;
|
|
2540
|
-
collection: {};
|
|
2541
|
-
category: string;
|
|
2542
|
-
tokenId: string;
|
|
2543
|
-
symbol: string;
|
|
2544
|
-
name: string;
|
|
2545
|
-
} | null>;
|
|
2751
|
+
getAccessToken(): string | null;
|
|
2546
2752
|
/**
|
|
2547
|
-
*
|
|
2753
|
+
* Ensure we have a valid token, refreshing if necessary.
|
|
2548
2754
|
*
|
|
2549
|
-
*
|
|
2550
|
-
*
|
|
2755
|
+
* Call this before making authenticated requests to ensure
|
|
2756
|
+
* the token won't expire mid-request. Will:
|
|
2757
|
+
* - Throw if not authenticated at all
|
|
2758
|
+
* - Re-login if token is expired
|
|
2759
|
+
* - Refresh if token expires within threshold
|
|
2760
|
+
* - Return current token if still valid
|
|
2551
2761
|
*
|
|
2552
|
-
* @param
|
|
2553
|
-
* @returns
|
|
2554
|
-
* @throws Error if
|
|
2762
|
+
* @param thresholdMs - Refresh threshold in milliseconds (default: 5 minutes)
|
|
2763
|
+
* @returns Current access token
|
|
2764
|
+
* @throws Error if not authenticated and can't refresh
|
|
2555
2765
|
*
|
|
2556
|
-
* @
|
|
2766
|
+
* @since 5.2.0
|
|
2767
|
+
* @category Authentication
|
|
2768
|
+
*
|
|
2769
|
+
* @example Before critical operation
|
|
2770
|
+
* ```typescript
|
|
2771
|
+
* const token = await sdk.ensureValidToken();
|
|
2772
|
+
* // Token is guaranteed valid for at least 5 more minutes
|
|
2773
|
+
* await criticalStreamingOperation();
|
|
2774
|
+
* ```
|
|
2775
|
+
*/
|
|
2776
|
+
ensureValidToken(thresholdMs?: number): Promise<string>;
|
|
2777
|
+
/**
|
|
2778
|
+
* Start a live stream for a token.
|
|
2779
|
+
*
|
|
2780
|
+
* Creates a new stream session and returns streaming credentials.
|
|
2781
|
+
* The stream key can be used with OBS or other RTMP-compatible software.
|
|
2782
|
+
*
|
|
2783
|
+
* @param tokenName - Token name (lowercase)
|
|
2784
|
+
* @returns Promise resolving to stream credentials
|
|
2785
|
+
* @throws Error if wallet is not configured
|
|
2786
|
+
* @throws Error if streaming is disabled for this token
|
|
2787
|
+
*
|
|
2788
|
+
* @since 5.1.0
|
|
2789
|
+
* @category Streaming
|
|
2790
|
+
*
|
|
2791
|
+
* @example Start streaming for a token
|
|
2792
|
+
* ```typescript
|
|
2793
|
+
* const stream = await sdk.startStream('mytoken');
|
|
2794
|
+
* console.log(`RTMP URL: ${stream.rtmpUrl}`);
|
|
2795
|
+
* console.log(`Stream Key: ${stream.streamKey}`);
|
|
2796
|
+
* console.log(`Playback URL: ${stream.playbackUrl}`);
|
|
2797
|
+
* ```
|
|
2798
|
+
*/
|
|
2799
|
+
startStream(tokenName: string): Promise<StartStreamResult>;
|
|
2800
|
+
/**
|
|
2801
|
+
* Stop an active stream for a token.
|
|
2802
|
+
*
|
|
2803
|
+
* Immediately ends the current broadcast and sets the stream to IDLE.
|
|
2804
|
+
* Requires JWT authentication (stream creator only).
|
|
2805
|
+
* The stream can be restarted by calling startStream() again.
|
|
2806
|
+
*
|
|
2807
|
+
* Unlike disableStream() which is an admin operation that prevents streaming,
|
|
2808
|
+
* stopStream() is for stream owners to end their current broadcast.
|
|
2809
|
+
*
|
|
2810
|
+
* @param tokenName - Token name (lowercase)
|
|
2811
|
+
* @throws ValidationError if token name is invalid
|
|
2812
|
+
* @throws Error if user is not authorized (not stream owner)
|
|
2813
|
+
* @throws Error if stream is not currently active
|
|
2814
|
+
*
|
|
2815
|
+
* @since 5.3.0
|
|
2816
|
+
* @category Streaming
|
|
2817
|
+
*
|
|
2818
|
+
* @see https://www.mux.com/docs/api-reference/video/live-streams/signal-live-stream-complete
|
|
2819
|
+
*
|
|
2820
|
+
* @example Stop an active stream
|
|
2821
|
+
* ```typescript
|
|
2822
|
+
* await sdk.stopStream('mytoken');
|
|
2823
|
+
* console.log('Stream stopped successfully');
|
|
2824
|
+
* ```
|
|
2825
|
+
*/
|
|
2826
|
+
stopStream(tokenName: string): Promise<void>;
|
|
2827
|
+
/**
|
|
2828
|
+
* Get stream information for a token.
|
|
2829
|
+
*
|
|
2830
|
+
* Returns current stream status, playback information, and metadata.
|
|
2831
|
+
* Does not require authentication for public stream information.
|
|
2832
|
+
*
|
|
2833
|
+
* @param tokenName - Token name (lowercase)
|
|
2834
|
+
* @returns Promise resolving to stream information
|
|
2835
|
+
*
|
|
2836
|
+
* @since 5.1.0
|
|
2837
|
+
* @category Streaming
|
|
2838
|
+
*
|
|
2839
|
+
* @example Check stream status
|
|
2840
|
+
* ```typescript
|
|
2841
|
+
* const info = await sdk.getStreamInfo('mytoken');
|
|
2842
|
+
* if (info.isLive) {
|
|
2843
|
+
* console.log(`Stream is live! Viewers: ${info.viewerCount}`);
|
|
2844
|
+
* console.log(`Watch at: https://player.example.com/${info.playbackId}`);
|
|
2845
|
+
* }
|
|
2846
|
+
* ```
|
|
2847
|
+
*/
|
|
2848
|
+
getStreamInfo(tokenName: string): Promise<StreamInfo>;
|
|
2849
|
+
/**
|
|
2850
|
+
* Disable streaming for a specific token (Admin only).
|
|
2851
|
+
*
|
|
2852
|
+
* Prevents new streams from being started for this token.
|
|
2853
|
+
* Existing active streams will continue until they end.
|
|
2854
|
+
*
|
|
2855
|
+
* @param tokenName - Token name (lowercase)
|
|
2856
|
+
* @returns Promise resolving when disabled
|
|
2857
|
+
* @throws Error if admin API key is not configured
|
|
2858
|
+
*
|
|
2859
|
+
* @since 5.1.0
|
|
2860
|
+
* @category Streaming
|
|
2861
|
+
* @admin Requires streamAdminApiKey configuration
|
|
2862
|
+
*/
|
|
2863
|
+
disableStream(tokenName: string): Promise<{
|
|
2864
|
+
enabled: boolean;
|
|
2865
|
+
tokenName: string;
|
|
2866
|
+
}>;
|
|
2867
|
+
/**
|
|
2868
|
+
* Enable streaming for a specific token (Admin only).
|
|
2869
|
+
*
|
|
2870
|
+
* Re-enables streaming capability for a previously disabled token.
|
|
2871
|
+
*
|
|
2872
|
+
* @param tokenName - Token name (lowercase)
|
|
2873
|
+
* @returns Promise resolving when enabled
|
|
2874
|
+
* @throws Error if admin API key is not configured
|
|
2875
|
+
*
|
|
2876
|
+
* @since 5.1.0
|
|
2877
|
+
* @category Streaming
|
|
2878
|
+
* @admin Requires streamAdminApiKey configuration
|
|
2879
|
+
*/
|
|
2880
|
+
enableStream(tokenName: string): Promise<{
|
|
2881
|
+
enabled: boolean;
|
|
2882
|
+
tokenName: string;
|
|
2883
|
+
}>;
|
|
2884
|
+
/**
|
|
2885
|
+
* Reset the stream key for a token.
|
|
2886
|
+
*
|
|
2887
|
+
* Generates a new stream key, invalidating the previous one.
|
|
2888
|
+
* Use this if the stream key has been compromised.
|
|
2889
|
+
*
|
|
2890
|
+
* @param tokenName - Token name (lowercase)
|
|
2891
|
+
* @returns Promise resolving to new stream credentials
|
|
2892
|
+
* @throws Error if wallet is not configured
|
|
2893
|
+
*
|
|
2894
|
+
* @since 5.1.0
|
|
2895
|
+
* @category Streaming
|
|
2896
|
+
*
|
|
2897
|
+
* @example Reset compromised stream key
|
|
2898
|
+
* ```typescript
|
|
2899
|
+
* const newCreds = await sdk.resetStreamKey('mytoken');
|
|
2900
|
+
* console.log(`New Stream Key: ${newCreds.streamKey}`);
|
|
2901
|
+
* console.log(`Reset at: ${newCreds.resetAt}`);
|
|
2902
|
+
* ```
|
|
2903
|
+
*/
|
|
2904
|
+
resetStreamKey(tokenName: string): Promise<ResetStreamKeyResult>;
|
|
2905
|
+
/**
|
|
2906
|
+
* Get recordings for a stream.
|
|
2907
|
+
*
|
|
2908
|
+
* Returns list of available recordings from past streams.
|
|
2909
|
+
*
|
|
2910
|
+
* @param tokenName - Token name (lowercase)
|
|
2911
|
+
* @param options - Pagination options
|
|
2912
|
+
* @returns Promise resolving to recordings list
|
|
2913
|
+
*
|
|
2914
|
+
* @since 5.1.0
|
|
2915
|
+
* @category Streaming
|
|
2916
|
+
*
|
|
2917
|
+
* @example List recordings
|
|
2918
|
+
* ```typescript
|
|
2919
|
+
* const { recordings, total } = await sdk.getStreamRecordings({ tokenName: 'mytoken' });
|
|
2920
|
+
* recordings.forEach(rec => {
|
|
2921
|
+
* console.log(`${rec.createdAt}: ${rec.duration}s - ${rec.status}`);
|
|
2922
|
+
* });
|
|
2923
|
+
* ```
|
|
2924
|
+
*/
|
|
2925
|
+
getStreamRecordings(options: FetchRecordingsOptions): Promise<RecordingsResult>;
|
|
2926
|
+
/**
|
|
2927
|
+
* Get download URL for a recording.
|
|
2928
|
+
*
|
|
2929
|
+
* Returns a signed URL for downloading a specific recording.
|
|
2930
|
+
* URLs are typically valid for a limited time.
|
|
2931
|
+
*
|
|
2932
|
+
* @param tokenName - Token name (lowercase)
|
|
2933
|
+
* @param assetId - Recording asset ID
|
|
2934
|
+
* @returns Promise resolving to download URL
|
|
2935
|
+
* @throws Error if wallet is not configured
|
|
2936
|
+
*
|
|
2937
|
+
* @since 5.1.0
|
|
2938
|
+
* @category Streaming
|
|
2939
|
+
*
|
|
2940
|
+
* @example Download a recording
|
|
2941
|
+
* ```typescript
|
|
2942
|
+
* const result = await sdk.getRecordingDownload('mytoken', 'asset-123');
|
|
2943
|
+
* console.log(`Download: ${result.downloadUrl}`);
|
|
2944
|
+
* console.log(`Expires: ${result.expiresAt}`);
|
|
2945
|
+
* ```
|
|
2946
|
+
*/
|
|
2947
|
+
getRecordingDownload(tokenName: string, assetId: string): Promise<RecordingDownloadResult>;
|
|
2948
|
+
/**
|
|
2949
|
+
* Delete a recording.
|
|
2950
|
+
*
|
|
2951
|
+
* Permanently removes a recording. This action cannot be undone.
|
|
2952
|
+
*
|
|
2953
|
+
* @param tokenName - Token name (lowercase)
|
|
2954
|
+
* @param assetId - Recording asset ID
|
|
2955
|
+
* @returns Promise resolving when deleted
|
|
2956
|
+
* @throws Error if wallet is not configured
|
|
2957
|
+
*
|
|
2958
|
+
* @since 5.1.0
|
|
2959
|
+
* @category Streaming
|
|
2960
|
+
*/
|
|
2961
|
+
deleteRecording(tokenName: string, assetId: string): Promise<void>;
|
|
2962
|
+
/**
|
|
2963
|
+
* Get simulcast targets for a stream.
|
|
2964
|
+
*
|
|
2965
|
+
* Returns list of configured simulcast destinations (YouTube, Twitch, etc.).
|
|
2966
|
+
*
|
|
2967
|
+
* @param tokenName - Token name (lowercase)
|
|
2968
|
+
* @returns Promise resolving to simulcast targets
|
|
2969
|
+
*
|
|
2970
|
+
* @since 5.1.0
|
|
2971
|
+
* @category Streaming
|
|
2972
|
+
*
|
|
2973
|
+
* @example Check simulcast configuration
|
|
2974
|
+
* ```typescript
|
|
2975
|
+
* const { targets } = await sdk.getSimulcastTargets('mytoken');
|
|
2976
|
+
* targets.forEach(t => {
|
|
2977
|
+
* console.log(`${t.platform}: ${t.status}`);
|
|
2978
|
+
* });
|
|
2979
|
+
* ```
|
|
2980
|
+
*/
|
|
2981
|
+
getSimulcastTargets(tokenName: string): Promise<SimulcastTargetsResult>;
|
|
2982
|
+
/**
|
|
2983
|
+
* Add a simulcast target to a stream.
|
|
2984
|
+
*
|
|
2985
|
+
* Configure the stream to rebroadcast to an external platform.
|
|
2986
|
+
*
|
|
2987
|
+
* @param tokenName - Token name (lowercase)
|
|
2988
|
+
* @param options - Simulcast target configuration
|
|
2989
|
+
* @returns Promise resolving to the new target
|
|
2990
|
+
* @throws Error if wallet is not configured
|
|
2991
|
+
*
|
|
2992
|
+
* @since 5.1.0
|
|
2993
|
+
* @category Streaming
|
|
2994
|
+
*
|
|
2995
|
+
* @example Add YouTube simulcast
|
|
2996
|
+
* ```typescript
|
|
2997
|
+
* const target = await sdk.addSimulcastTarget({
|
|
2998
|
+
* tokenName: 'mytoken',
|
|
2999
|
+
* platform: 'YOUTUBE',
|
|
3000
|
+
* streamKey: 'xxxx-xxxx-xxxx-xxxx',
|
|
3001
|
+
* rtmpUrl: 'rtmp://a.rtmp.youtube.com/live2',
|
|
3002
|
+
* });
|
|
3003
|
+
* console.log(`Added target: ${target.id}`);
|
|
3004
|
+
* ```
|
|
3005
|
+
*/
|
|
3006
|
+
addSimulcastTarget(options: AddSimulcastTargetOptions): Promise<AddSimulcastTargetResult>;
|
|
3007
|
+
/**
|
|
3008
|
+
* Remove a simulcast target from a stream.
|
|
3009
|
+
*
|
|
3010
|
+
* Stops rebroadcasting to the specified platform.
|
|
3011
|
+
*
|
|
3012
|
+
* @param tokenName - Token name (lowercase)
|
|
3013
|
+
* @param targetId - Simulcast target ID
|
|
3014
|
+
* @returns Promise resolving when removed
|
|
3015
|
+
* @throws Error if wallet is not configured
|
|
3016
|
+
*
|
|
3017
|
+
* @since 5.1.0
|
|
3018
|
+
* @category Streaming
|
|
3019
|
+
*/
|
|
3020
|
+
removeSimulcastTarget(tokenName: string, targetId: string): Promise<void>;
|
|
3021
|
+
/**
|
|
3022
|
+
* Get global streaming status.
|
|
3023
|
+
*
|
|
3024
|
+
* Returns platform-wide streaming status including maintenance windows.
|
|
3025
|
+
*
|
|
3026
|
+
* @returns Promise resolving to global streaming status
|
|
3027
|
+
*
|
|
3028
|
+
* @since 5.1.0
|
|
3029
|
+
* @category Streaming
|
|
3030
|
+
*
|
|
3031
|
+
* @example Check if streaming is available
|
|
3032
|
+
* ```typescript
|
|
3033
|
+
* const status = await sdk.getGlobalStreamingStatus();
|
|
3034
|
+
* if (!status.enabled) {
|
|
3035
|
+
* console.log(`Streaming disabled: ${status.reason ?? 'maintenance'}`);
|
|
3036
|
+
* }
|
|
3037
|
+
* ```
|
|
3038
|
+
*/
|
|
3039
|
+
getGlobalStreamingStatus(): Promise<GlobalStreamingStatus>;
|
|
3040
|
+
/**
|
|
3041
|
+
* Set the next live stream countdown time (v6.x.0+)
|
|
3042
|
+
*
|
|
3043
|
+
* Convenience method that sets a scheduled time for the next live stream.
|
|
3044
|
+
* The frontend can display a countdown timer based on this time.
|
|
3045
|
+
*
|
|
3046
|
+
* @param tokenName Token name (lowercase)
|
|
3047
|
+
* @param nextLiveStreamAt Scheduled stream time (ISO 8601 string, Date, or null to clear)
|
|
3048
|
+
* @returns Updated stream settings
|
|
3049
|
+
* @throws {ValidationError} If token name or date is invalid
|
|
3050
|
+
*
|
|
3051
|
+
* @since 6.x.0
|
|
3052
|
+
* @category Streaming
|
|
3053
|
+
*
|
|
3054
|
+
* @example Set countdown
|
|
3055
|
+
* ```typescript
|
|
3056
|
+
* await sdk.setNextLiveStreamCountdown('mytoken', '2025-01-15T18:00:00Z');
|
|
3057
|
+
* // or
|
|
3058
|
+
* await sdk.setNextLiveStreamCountdown('mytoken', new Date('2025-01-15T18:00:00Z'));
|
|
3059
|
+
* // Clear countdown
|
|
3060
|
+
* await sdk.setNextLiveStreamCountdown('mytoken', null);
|
|
3061
|
+
* ```
|
|
3062
|
+
*/
|
|
3063
|
+
setNextLiveStreamCountdown(tokenName: string, nextLiveStreamAt: string | Date | null): Promise<import('./types/streaming.dto').StreamSettings>;
|
|
3064
|
+
/**
|
|
3065
|
+
* Enable or disable streaming globally (Admin only).
|
|
3066
|
+
*
|
|
3067
|
+
* Controls platform-wide streaming capability.
|
|
3068
|
+
*
|
|
3069
|
+
* @param enabled - Whether streaming should be enabled
|
|
3070
|
+
* @returns Promise resolving when updated
|
|
3071
|
+
* @throws Error if admin API key is not configured
|
|
3072
|
+
*
|
|
3073
|
+
* @since 5.1.0
|
|
3074
|
+
* @category Streaming
|
|
3075
|
+
* @admin Requires streamAdminApiKey configuration
|
|
3076
|
+
*/
|
|
3077
|
+
setGlobalStreamingEnabled(enabled: boolean): Promise<GlobalStreamingStatus>;
|
|
3078
|
+
/**
|
|
3079
|
+
* Get the authenticated user's role for a token's stream.
|
|
3080
|
+
*
|
|
3081
|
+
* Returns the user's effective role based on:
|
|
3082
|
+
* - Token ownership (OWNER role)
|
|
3083
|
+
* - Claimed moderator invite (MANAGER, TECHNICAL_PRODUCER, or MODERATOR)
|
|
3084
|
+
* - No access (null role)
|
|
3085
|
+
*
|
|
3086
|
+
* This enables the frontend Studio page to detect permissions and show
|
|
3087
|
+
* the appropriate UI based on the user's role.
|
|
3088
|
+
*
|
|
3089
|
+
* **Authentication:** Optional JWT - returns null role if not authenticated.
|
|
3090
|
+
*
|
|
3091
|
+
* @param options - GetStreamRoleOptions with tokenName
|
|
3092
|
+
* @returns Promise resolving to StreamRoleResponse with role, isOwner flag, source, and inviteScope
|
|
3093
|
+
*
|
|
3094
|
+
* @since 5.7.0
|
|
3095
|
+
* @category Streaming
|
|
3096
|
+
*
|
|
3097
|
+
* @example Check stream access
|
|
3098
|
+
* ```typescript
|
|
3099
|
+
* const roleInfo = await sdk.getStreamRole({ tokenName: 'mytoken' });
|
|
3100
|
+
*
|
|
3101
|
+
* if (roleInfo.role === null) {
|
|
3102
|
+
* console.log('No access to this stream');
|
|
3103
|
+
* } else if (roleInfo.isOwner) {
|
|
3104
|
+
* console.log('You are the token owner');
|
|
3105
|
+
* } else {
|
|
3106
|
+
* console.log(`You have ${roleInfo.role} access via ${roleInfo.source}`);
|
|
3107
|
+
* }
|
|
3108
|
+
*
|
|
3109
|
+
* // Use role for permission checks
|
|
3110
|
+
* const canStream = ['OWNER', 'MANAGER', 'TECHNICAL_PRODUCER'].includes(roleInfo.role ?? '');
|
|
3111
|
+
* const canModerate = ['OWNER', 'MANAGER', 'MODERATOR'].includes(roleInfo.role ?? '');
|
|
3112
|
+
* ```
|
|
3113
|
+
*/
|
|
3114
|
+
getStreamRole(options: GetStreamRoleOptions): Promise<StreamRoleResponse>;
|
|
3115
|
+
/**
|
|
3116
|
+
* Get all available roles and permissions for token delegation.
|
|
3117
|
+
*
|
|
3118
|
+
* Returns reference data about the role system, including:
|
|
3119
|
+
* - All available roles (OWNER, MANAGER, TECHNICAL_PRODUCER, MODERATOR)
|
|
3120
|
+
* - Role descriptions and hierarchy levels
|
|
3121
|
+
* - Permissions assigned to each role
|
|
3122
|
+
* - Complete list of all available permissions
|
|
3123
|
+
*
|
|
3124
|
+
* This is static reference data - it doesn't change per user or token.
|
|
3125
|
+
*
|
|
3126
|
+
* @returns Promise resolving to available roles and permissions
|
|
3127
|
+
*
|
|
3128
|
+
* @since 5.10.0
|
|
3129
|
+
* @category Streaming
|
|
3130
|
+
*
|
|
3131
|
+
* @example Get available roles
|
|
3132
|
+
* ```typescript
|
|
3133
|
+
* const { roles, permissions } = await sdk.getAvailableRoles();
|
|
3134
|
+
*
|
|
3135
|
+
* // List all roles
|
|
3136
|
+
* roles.forEach(role => {
|
|
3137
|
+
* console.log(`${role.name} (level ${role.level}): ${role.description}`);
|
|
3138
|
+
* console.log(' Permissions:', role.permissions.join(', '));
|
|
3139
|
+
* });
|
|
3140
|
+
*
|
|
3141
|
+
* // Build a role selector dropdown
|
|
3142
|
+
* const roleOptions = roles.map(role => ({
|
|
3143
|
+
* value: role.name,
|
|
3144
|
+
* label: role.description,
|
|
3145
|
+
* level: role.level,
|
|
3146
|
+
* }));
|
|
3147
|
+
* ```
|
|
3148
|
+
*/
|
|
3149
|
+
getAvailableRoles(): Promise<AvailableRolesResponse>;
|
|
3150
|
+
/**
|
|
3151
|
+
* Check if the authenticated user has Studio access for a token.
|
|
3152
|
+
*
|
|
3153
|
+
* Returns comprehensive access information combining:
|
|
3154
|
+
* - Token ownership check (OWNER role)
|
|
3155
|
+
* - Claimed moderator invite (MANAGER, TECHNICAL_PRODUCER, MODERATOR)
|
|
3156
|
+
* - Platform overseer status (global access)
|
|
3157
|
+
*
|
|
3158
|
+
* This is used by the frontend to determine whether to show the
|
|
3159
|
+
* "Click to Studio" link on the buy-sell page.
|
|
3160
|
+
*
|
|
3161
|
+
* @param options Options with tokenName
|
|
3162
|
+
* @returns Promise resolving to access info with role, permissions, and flags
|
|
3163
|
+
*
|
|
3164
|
+
* @since 5.11.0
|
|
3165
|
+
* @category Streaming
|
|
3166
|
+
*
|
|
3167
|
+
* @example Check Studio access
|
|
3168
|
+
* ```typescript
|
|
3169
|
+
* const access = await sdk.getTokenAccess({ tokenName: 'mytoken' });
|
|
3170
|
+
*
|
|
3171
|
+
* if (!access.hasAccess) {
|
|
3172
|
+
* console.log('No Studio access for this token');
|
|
3173
|
+
* } else {
|
|
3174
|
+
* console.log(`Access via: ${access.accessSource}`);
|
|
3175
|
+
* console.log(`Role: ${access.role}`);
|
|
3176
|
+
* console.log('Permissions:', access.permissions);
|
|
3177
|
+
*
|
|
3178
|
+
* if (access.permissions.canStream) {
|
|
3179
|
+
* console.log('User can start/stop streams');
|
|
3180
|
+
* }
|
|
3181
|
+
* if (access.permissions.canModerate) {
|
|
3182
|
+
* console.log('User can moderate chat');
|
|
3183
|
+
* }
|
|
3184
|
+
* }
|
|
3185
|
+
* ```
|
|
3186
|
+
*/
|
|
3187
|
+
getTokenAccess(options: GetTokenAccessOptions): Promise<TokenAccessResult>;
|
|
3188
|
+
/**
|
|
3189
|
+
* Get chat messages for a stream.
|
|
3190
|
+
*
|
|
3191
|
+
* Returns paginated list of chat messages for a stream.
|
|
3192
|
+
*
|
|
3193
|
+
* @param tokenName - Token name (lowercase)
|
|
3194
|
+
* @param options - Pagination options
|
|
3195
|
+
* @returns Promise resolving to chat messages
|
|
3196
|
+
*
|
|
3197
|
+
* @since 5.1.0
|
|
3198
|
+
* @category Chat
|
|
3199
|
+
*
|
|
3200
|
+
* Get chat status for a stream.
|
|
3201
|
+
*
|
|
3202
|
+
* Returns whether chat is enabled for the stream and the reason if disabled.
|
|
3203
|
+
*
|
|
3204
|
+
* @param tokenName - Token name (lowercase)
|
|
3205
|
+
* @returns Promise resolving to chat status
|
|
3206
|
+
*
|
|
3207
|
+
* @since 5.1.0
|
|
3208
|
+
* @category Chat
|
|
3209
|
+
*
|
|
3210
|
+
* @example Check chat availability
|
|
3211
|
+
* ```typescript
|
|
3212
|
+
* const status = await sdk.getChatStatus('mytoken');
|
|
3213
|
+
* if (!status.enabled) {
|
|
3214
|
+
* console.log(`Chat disabled: ${status.reason}`);
|
|
3215
|
+
* }
|
|
3216
|
+
* ```
|
|
3217
|
+
*/
|
|
3218
|
+
getChatStatus(tokenName: string): Promise<ChatStatusResponse>;
|
|
3219
|
+
/**
|
|
3220
|
+
* Get engagement statistics for a token.
|
|
3221
|
+
*
|
|
3222
|
+
* Returns aggregated engagement metrics including:
|
|
3223
|
+
* - Chat: message count, unique chatters, session start time
|
|
3224
|
+
* - Comments: total count, unique commenters
|
|
3225
|
+
*
|
|
3226
|
+
* Chat stats are scoped to the current/last stream session.
|
|
3227
|
+
* Comment stats are all-time for the token.
|
|
3228
|
+
*
|
|
3229
|
+
* @param options - Token name to fetch stats for
|
|
3230
|
+
* @returns Promise resolving with engagement statistics
|
|
3231
|
+
*
|
|
3232
|
+
* @since 5.10.0
|
|
3233
|
+
* @category Chat
|
|
3234
|
+
*
|
|
3235
|
+
* @example Get engagement stats
|
|
3236
|
+
* ```typescript
|
|
3237
|
+
* const stats = await sdk.getEngagementStats({ tokenName: 'mytoken' });
|
|
3238
|
+
* console.log('Chat messages:', stats.chat.messageCount);
|
|
3239
|
+
* console.log('Unique chatters:', stats.chat.uniqueChatters);
|
|
3240
|
+
* console.log('Total comments:', stats.comments.count);
|
|
3241
|
+
* console.log('Unique commenters:', stats.comments.uniqueCommenters);
|
|
3242
|
+
* ```
|
|
3243
|
+
*/
|
|
3244
|
+
getEngagementStats(options: GetEngagementStatsOptions): Promise<EngagementStatsResult>;
|
|
3245
|
+
/**
|
|
3246
|
+
* Disable chat for a specific token.
|
|
3247
|
+
*
|
|
3248
|
+
* Supports dual authentication:
|
|
3249
|
+
* - **Admin (API key)**: Sets ADMIN_DISABLED - owner locked out
|
|
3250
|
+
* - **Owner (JWT)**: Sets DISABLED - owner can re-enable
|
|
3251
|
+
*
|
|
3252
|
+
* @param tokenName - Token name (lowercase)
|
|
3253
|
+
* @returns Promise resolving with enabled status and detailed status
|
|
3254
|
+
* @throws Error if neither admin API key nor JWT is configured
|
|
3255
|
+
*
|
|
3256
|
+
* @since 5.1.0
|
|
3257
|
+
* @since 5.4.0 - Added dual-auth support (Admin API key OR JWT owner)
|
|
3258
|
+
* @category Chat
|
|
3259
|
+
*/
|
|
3260
|
+
disableChat(tokenName: string): Promise<{
|
|
3261
|
+
enabled: boolean;
|
|
3262
|
+
tokenName: string;
|
|
3263
|
+
status?: string;
|
|
3264
|
+
}>;
|
|
3265
|
+
/**
|
|
3266
|
+
* Enable chat for a specific token.
|
|
3267
|
+
*
|
|
3268
|
+
* Supports dual authentication:
|
|
3269
|
+
* - **Admin (API key)**: Sets ENABLED - clears lock, owner regains control
|
|
3270
|
+
* - **Owner (JWT)**: Sets ENABLED - fails with 403 if ADMIN_DISABLED
|
|
3271
|
+
*
|
|
3272
|
+
* @param tokenName - Token name (lowercase)
|
|
3273
|
+
* @returns Promise resolving with enabled status and detailed status
|
|
3274
|
+
* @throws Error if neither admin API key nor JWT is configured
|
|
3275
|
+
* @throws Error (403) if owner tries to enable when ADMIN_DISABLED
|
|
3276
|
+
*
|
|
3277
|
+
* @since 5.1.0
|
|
3278
|
+
* @since 5.4.0 - Added dual-auth support (Admin API key OR JWT owner)
|
|
3279
|
+
* @category Chat
|
|
3280
|
+
*/
|
|
3281
|
+
enableChat(tokenName: string): Promise<{
|
|
3282
|
+
enabled: boolean;
|
|
3283
|
+
tokenName: string;
|
|
3284
|
+
status?: string;
|
|
3285
|
+
}>;
|
|
3286
|
+
/**
|
|
3287
|
+
* Get global chat status.
|
|
3288
|
+
*
|
|
3289
|
+
* Returns platform-wide chat status.
|
|
3290
|
+
*
|
|
3291
|
+
* @returns Promise resolving to global chat status
|
|
3292
|
+
*
|
|
3293
|
+
* @since 5.1.0
|
|
3294
|
+
* @category Chat
|
|
3295
|
+
*/
|
|
3296
|
+
getGlobalChatStatus(): Promise<GlobalChatStatus>;
|
|
3297
|
+
/**
|
|
3298
|
+
* Enable or disable chat globally (Admin only).
|
|
3299
|
+
*
|
|
3300
|
+
* Controls platform-wide chat capability.
|
|
3301
|
+
*
|
|
3302
|
+
* @param enabled - Whether chat should be enabled
|
|
3303
|
+
* @returns Promise resolving when updated
|
|
3304
|
+
* @throws Error if admin API key is not configured
|
|
3305
|
+
*
|
|
3306
|
+
* @since 5.1.0
|
|
3307
|
+
* @category Chat
|
|
3308
|
+
* @admin Requires streamAdminApiKey configuration
|
|
3309
|
+
*/
|
|
3310
|
+
setGlobalChatEnabled(enabled: boolean): Promise<GlobalChatStatus>;
|
|
3311
|
+
/**
|
|
3312
|
+
* Get the currently pinned chat message for a token (v6.x.0+)
|
|
3313
|
+
*
|
|
3314
|
+
* Retrieves the pinned message for a token's chat if one exists.
|
|
3315
|
+
*
|
|
3316
|
+
* @param tokenName Token name (lowercase)
|
|
3317
|
+
* @returns Pinned message details or null if no message is pinned
|
|
3318
|
+
* @throws {ValidationError} If token name is invalid
|
|
3319
|
+
*
|
|
3320
|
+
* @since 6.x.0
|
|
3321
|
+
* @category Chat
|
|
3322
|
+
*
|
|
3323
|
+
* @example Get pinned message
|
|
3324
|
+
* ```typescript
|
|
3325
|
+
* const pinned = await sdk.getPinnedChatMessage('mytoken');
|
|
3326
|
+
* if (pinned) {
|
|
3327
|
+
* console.log('Pinned message:', pinned.content);
|
|
3328
|
+
* console.log('Pinned by:', pinned.pinnedBy);
|
|
3329
|
+
* }
|
|
3330
|
+
* ```
|
|
3331
|
+
*/
|
|
3332
|
+
getPinnedChatMessage(tokenName: string): Promise<import('./types/stream-chat.dto').GetPinnedMessageResult>;
|
|
3333
|
+
/**
|
|
3334
|
+
* Pin a chat message for a token (v6.x.0+)
|
|
3335
|
+
*
|
|
3336
|
+
* Pins a message to the top of the chat for this token.
|
|
3337
|
+
* Requires admin or manager access.
|
|
3338
|
+
*
|
|
3339
|
+
* @param tokenName Token name (lowercase)
|
|
3340
|
+
* @param messageId ID of the message to pin
|
|
3341
|
+
* @returns Pinned message result with confirmation
|
|
3342
|
+
* @throws {ValidationError} If token name or message ID is invalid
|
|
3343
|
+
* @throws {Error} If user is not authorized to pin messages
|
|
3344
|
+
*
|
|
3345
|
+
* @since 6.x.0
|
|
3346
|
+
* @category Chat
|
|
3347
|
+
*
|
|
3348
|
+
* @example Pin a message
|
|
3349
|
+
* ```typescript
|
|
3350
|
+
* const result = await sdk.pinChatMessage('mytoken', 'msg123');
|
|
3351
|
+
* console.log('Message pinned:', result.pinnedMessage.id);
|
|
3352
|
+
* ```
|
|
3353
|
+
*/
|
|
3354
|
+
pinChatMessage(tokenName: string, messageId: string): Promise<import('./types/stream-chat.dto').PinMessageResult>;
|
|
3355
|
+
/**
|
|
3356
|
+
* Unpin the currently pinned chat message for a token (v6.x.0+)
|
|
3357
|
+
*
|
|
3358
|
+
* Removes the pinned message from a token's chat.
|
|
3359
|
+
* Requires admin or manager access.
|
|
3360
|
+
*
|
|
3361
|
+
* @param tokenName Token name (lowercase)
|
|
3362
|
+
* @throws {ValidationError} If token name is invalid
|
|
3363
|
+
* @throws {Error} If user is not authorized to unpin messages
|
|
3364
|
+
*
|
|
3365
|
+
* @since 6.x.0
|
|
3366
|
+
* @category Chat
|
|
3367
|
+
*
|
|
3368
|
+
* @example Unpin a message
|
|
3369
|
+
* ```typescript
|
|
3370
|
+
* await sdk.unpinChatMessage('mytoken');
|
|
3371
|
+
* console.log('Message unpinned');
|
|
3372
|
+
* ```
|
|
3373
|
+
*/
|
|
3374
|
+
unpinChatMessage(tokenName: string): Promise<import('./types/stream-chat.dto').UnpinMessageResult>;
|
|
3375
|
+
/**
|
|
3376
|
+
* Create a ban for a user on a token.
|
|
3377
|
+
*
|
|
3378
|
+
* Bans a user from participating in chat, comments, and reactions for the
|
|
3379
|
+
* specified token. Can be temporary (with duration) or permanent.
|
|
3380
|
+
*
|
|
3381
|
+
* Supports dual authentication:
|
|
3382
|
+
* - **Admin (API key)**: Can ban any user on any token
|
|
3383
|
+
* - **Owner (JWT)**: Can ban users on their own token
|
|
3384
|
+
*
|
|
3385
|
+
* @param options - Ban creation options
|
|
3386
|
+
* @returns Promise resolving to the created ban
|
|
3387
|
+
* @throws Error if neither admin API key nor JWT is configured
|
|
3388
|
+
*
|
|
3389
|
+
* @since 5.5.0
|
|
3390
|
+
* @category Moderation
|
|
3391
|
+
*
|
|
3392
|
+
* @example Ban a user permanently
|
|
3393
|
+
* ```typescript
|
|
3394
|
+
* const result = await sdk.createBan({
|
|
3395
|
+
* tokenName: 'mytoken',
|
|
3396
|
+
* userAddress: 'eth|abc123...',
|
|
3397
|
+
* reason: 'Spam',
|
|
3398
|
+
* });
|
|
3399
|
+
* console.log(`Banned: ${result.ban.userAddress}`);
|
|
3400
|
+
* ```
|
|
3401
|
+
*
|
|
3402
|
+
* @example Ban a user for 24 hours
|
|
3403
|
+
* ```typescript
|
|
3404
|
+
* const result = await sdk.createBan({
|
|
3405
|
+
* tokenName: 'mytoken',
|
|
3406
|
+
* userAddress: 'eth|abc123...',
|
|
3407
|
+
* reason: 'Warning for inappropriate content',
|
|
3408
|
+
* durationSeconds: 86400, // 24 hours
|
|
3409
|
+
* });
|
|
3410
|
+
* console.log(`Expires: ${result.ban.expiresAt}`);
|
|
3411
|
+
* ```
|
|
3412
|
+
*/
|
|
3413
|
+
createBan(options: CreateBanOptions): Promise<CreateBanResult>;
|
|
3414
|
+
/**
|
|
3415
|
+
* Remove a ban for a user on a token.
|
|
3416
|
+
*
|
|
3417
|
+
* Unbans a user, allowing them to participate in chat, comments, and reactions again.
|
|
3418
|
+
*
|
|
3419
|
+
* Supports dual authentication:
|
|
3420
|
+
* - **Admin (API key)**: Can unban any user on any token
|
|
3421
|
+
* - **Owner (JWT)**: Can unban users on their own token
|
|
3422
|
+
*
|
|
3423
|
+
* @param options - Ban removal options
|
|
3424
|
+
* @returns Promise resolving to removal confirmation
|
|
3425
|
+
* @throws Error if neither admin API key nor JWT is configured
|
|
3426
|
+
* @throws Error (404) if ban not found
|
|
3427
|
+
*
|
|
3428
|
+
* @since 5.5.0
|
|
3429
|
+
* @category Moderation
|
|
3430
|
+
*
|
|
3431
|
+
* @example Unban a user
|
|
3432
|
+
* ```typescript
|
|
3433
|
+
* const result = await sdk.removeBan({
|
|
3434
|
+
* tokenName: 'mytoken',
|
|
3435
|
+
* userAddress: 'eth|abc123...',
|
|
3436
|
+
* });
|
|
3437
|
+
* console.log(`Unbanned: ${result.removed}`);
|
|
3438
|
+
* ```
|
|
3439
|
+
*/
|
|
3440
|
+
removeBan(options: RemoveBanOptions): Promise<RemoveBanResult>;
|
|
3441
|
+
/**
|
|
3442
|
+
* List all bans for a token.
|
|
3443
|
+
*
|
|
3444
|
+
* Returns a paginated list of banned users with their profile information,
|
|
3445
|
+
* ban reasons, and expiration times.
|
|
3446
|
+
*
|
|
3447
|
+
* Supports dual authentication:
|
|
3448
|
+
* - **Admin (API key)**: Can list bans for any token
|
|
3449
|
+
* - **Owner (JWT)**: Can list bans for their own token
|
|
3450
|
+
*
|
|
3451
|
+
* @param options - List options including pagination and filters
|
|
3452
|
+
* @returns Promise resolving to paginated ban list
|
|
3453
|
+
* @throws Error if neither admin API key nor JWT is configured
|
|
3454
|
+
*
|
|
3455
|
+
* @since 5.5.0
|
|
3456
|
+
* @category Moderation
|
|
3457
|
+
*
|
|
3458
|
+
* @example List all bans
|
|
3459
|
+
* ```typescript
|
|
3460
|
+
* const result = await sdk.listBans({ tokenName: 'mytoken' });
|
|
3461
|
+
* console.log(`Total bans: ${result.meta.total}`);
|
|
3462
|
+
* result.bans.forEach(ban => {
|
|
3463
|
+
* console.log(`${ban.userAddress}: ${ban.reason}`);
|
|
3464
|
+
* });
|
|
3465
|
+
* ```
|
|
3466
|
+
*
|
|
3467
|
+
* @example Search bans by user
|
|
3468
|
+
* ```typescript
|
|
3469
|
+
* const result = await sdk.listBans({
|
|
3470
|
+
* tokenName: 'mytoken',
|
|
3471
|
+
* search: 'alice', // Search by address or name
|
|
3472
|
+
* page: 1,
|
|
3473
|
+
* limit: 20,
|
|
3474
|
+
* });
|
|
3475
|
+
* ```
|
|
3476
|
+
*/
|
|
3477
|
+
listBans(options: ListBansOptions): Promise<BanListResult>;
|
|
3478
|
+
/**
|
|
3479
|
+
* Get ban status for a specific user on a token.
|
|
3480
|
+
*
|
|
3481
|
+
* Checks if a user is currently banned and returns ban details if so.
|
|
3482
|
+
*
|
|
3483
|
+
* Supports dual authentication:
|
|
3484
|
+
* - **Admin (API key)**: Can check any user on any token
|
|
3485
|
+
* - **Owner (JWT)**: Can check users on their own token
|
|
3486
|
+
*
|
|
3487
|
+
* @param options - Status check options
|
|
3488
|
+
* @returns Promise resolving to ban status
|
|
3489
|
+
* @throws Error if neither admin API key nor JWT is configured
|
|
3490
|
+
*
|
|
3491
|
+
* @since 5.5.0
|
|
3492
|
+
* @category Moderation
|
|
3493
|
+
*
|
|
3494
|
+
* @example Check if user is banned
|
|
3495
|
+
* ```typescript
|
|
3496
|
+
* const status = await sdk.getBanStatus({
|
|
3497
|
+
* tokenName: 'mytoken',
|
|
3498
|
+
* userAddress: 'eth|abc123...',
|
|
3499
|
+
* });
|
|
3500
|
+
* if (status.banned) {
|
|
3501
|
+
* console.log(`Banned for: ${status.ban?.reason}`);
|
|
3502
|
+
* console.log(`Expires: ${status.ban?.expiresAt ?? 'permanent'}`);
|
|
3503
|
+
* }
|
|
3504
|
+
* ```
|
|
3505
|
+
*/
|
|
3506
|
+
getBanStatus(options: GetBanStatusOptions): Promise<BanStatusResult>;
|
|
3507
|
+
/**
|
|
3508
|
+
* Get active users for a token.
|
|
3509
|
+
*
|
|
3510
|
+
* Returns a list of users currently viewing or participating in a stream.
|
|
3511
|
+
* Can filter by viewer type (all viewers or only chat participants).
|
|
3512
|
+
*
|
|
3513
|
+
* Returns up to 1000 users. If more are connected, the `truncated` flag
|
|
3514
|
+
* will be true.
|
|
3515
|
+
*
|
|
3516
|
+
* Supports dual authentication:
|
|
3517
|
+
* - **Admin (API key)**: Can get users for any token
|
|
3518
|
+
* - **Owner (JWT)**: Can get users for their own token
|
|
3519
|
+
*
|
|
3520
|
+
* @param options - Active users options
|
|
3521
|
+
* @returns Promise resolving to active users list
|
|
3522
|
+
* @throws Error if neither admin API key nor JWT is configured
|
|
3523
|
+
*
|
|
3524
|
+
* @since 5.5.0
|
|
3525
|
+
* @category Moderation
|
|
3526
|
+
*
|
|
3527
|
+
* @example Get all viewers
|
|
3528
|
+
* ```typescript
|
|
3529
|
+
* const result = await sdk.getActiveUsers({
|
|
3530
|
+
* tokenName: 'mytoken',
|
|
3531
|
+
* type: 'viewers',
|
|
3532
|
+
* });
|
|
3533
|
+
* console.log(`${result.total} viewers online`);
|
|
3534
|
+
* if (result.truncated) {
|
|
3535
|
+
* console.log('More than 1000 users, list truncated');
|
|
3536
|
+
* }
|
|
3537
|
+
* ```
|
|
3538
|
+
*
|
|
3539
|
+
* @example Search for a specific user
|
|
3540
|
+
* ```typescript
|
|
3541
|
+
* const result = await sdk.getActiveUsers({
|
|
3542
|
+
* tokenName: 'mytoken',
|
|
3543
|
+
* type: 'chat_participants',
|
|
3544
|
+
* search: 'alice', // Filter by address or name
|
|
3545
|
+
* });
|
|
3546
|
+
* ```
|
|
3547
|
+
*/
|
|
3548
|
+
getActiveUsers(options: GetActiveUsersOptions): Promise<ActiveUsersResult>;
|
|
3549
|
+
/**
|
|
3550
|
+
* Create a new API key.
|
|
3551
|
+
*
|
|
3552
|
+
* **CRITICAL**: The `rawKey` in the response is ONLY shown once!
|
|
3553
|
+
* Store it securely immediately - it cannot be retrieved again.
|
|
3554
|
+
*
|
|
3555
|
+
* API keys enable delegation of specific permissions to third-party services
|
|
3556
|
+
* or automated systems without sharing full account access.
|
|
3557
|
+
*
|
|
3558
|
+
* Requires JWT authentication - call `sdk.login()` first.
|
|
3559
|
+
*
|
|
3560
|
+
* @param options - API key creation options
|
|
3561
|
+
* @returns Created API key with raw key (shown only once)
|
|
3562
|
+
* @throws ValidationError if options are invalid
|
|
3563
|
+
* @throws ConfigurationError if JWT auth is not configured
|
|
3564
|
+
*
|
|
3565
|
+
* @example
|
|
3566
|
+
* ```typescript
|
|
3567
|
+
* // Create a moderator key for chat management
|
|
3568
|
+
* const result = await sdk.createApiKey({
|
|
3569
|
+
* role: 'MODERATOR',
|
|
3570
|
+
* description: 'Twitch chat bot integration',
|
|
3571
|
+
* tokenNames: ['mytoken', 'othertoken']
|
|
3572
|
+
* });
|
|
3573
|
+
*
|
|
3574
|
+
* // CRITICAL: Save this immediately!
|
|
3575
|
+
* console.log('API Key:', result.rawKey);
|
|
3576
|
+
* // Format: glp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
3577
|
+
*
|
|
3578
|
+
* // Create an owner key for full access to all tokens
|
|
3579
|
+
* const ownerKey = await sdk.createApiKey({
|
|
3580
|
+
* role: 'OWNER',
|
|
3581
|
+
* description: 'Production automation',
|
|
3582
|
+
* delegateAllTokens: true,
|
|
3583
|
+
* expiresAt: '2025-12-31T23:59:59Z'
|
|
3584
|
+
* });
|
|
3585
|
+
* ```
|
|
3586
|
+
*
|
|
3587
|
+
* @since 5.6.0
|
|
3588
|
+
*/
|
|
3589
|
+
createApiKey(options: CreateApiKeyOptions): Promise<CreateApiKeyResponse>;
|
|
3590
|
+
/**
|
|
3591
|
+
* List all API keys for the authenticated user.
|
|
3592
|
+
*
|
|
3593
|
+
* Returns paginated list of API keys. Raw keys are never included -
|
|
3594
|
+
* they are only shown once at creation time.
|
|
3595
|
+
*
|
|
3596
|
+
* Requires JWT authentication - call `sdk.login()` first.
|
|
3597
|
+
*
|
|
3598
|
+
* @param options - Optional pagination options
|
|
3599
|
+
* @returns Paginated list of API keys
|
|
3600
|
+
* @throws ConfigurationError if JWT auth is not configured
|
|
3601
|
+
*
|
|
3602
|
+
* @example
|
|
3603
|
+
* ```typescript
|
|
3604
|
+
* // List all API keys
|
|
3605
|
+
* const result = await sdk.listApiKeys();
|
|
3606
|
+
* console.log(`Total keys: ${result.meta.total}`);
|
|
3607
|
+
*
|
|
3608
|
+
* for (const key of result.apiKeys) {
|
|
3609
|
+
* console.log(`${key.keyPrefix} - ${key.role} - ${key.description}`);
|
|
3610
|
+
* console.log(` Last used: ${key.lastUsedAt || 'Never'}`);
|
|
3611
|
+
* console.log(` Expires: ${key.expiresAt || 'Never'}`);
|
|
3612
|
+
* }
|
|
3613
|
+
*
|
|
3614
|
+
* // Paginate through keys
|
|
3615
|
+
* const page2 = await sdk.listApiKeys({ page: 2, limit: 10 });
|
|
3616
|
+
* ```
|
|
3617
|
+
*
|
|
3618
|
+
* @since 5.6.0
|
|
3619
|
+
*/
|
|
3620
|
+
listApiKeys(options?: ListApiKeysOptions): Promise<ApiKeyListResponse>;
|
|
3621
|
+
/**
|
|
3622
|
+
* Get a single API key by ID.
|
|
3623
|
+
*
|
|
3624
|
+
* Returns the API key metadata. Raw key is never included.
|
|
3625
|
+
*
|
|
3626
|
+
* Requires JWT authentication - call `sdk.login()` first.
|
|
3627
|
+
*
|
|
3628
|
+
* @param id - API key ID
|
|
3629
|
+
* @returns API key data
|
|
3630
|
+
* @throws ValidationError if ID is invalid
|
|
3631
|
+
* @throws ConfigurationError if JWT auth is not configured
|
|
3632
|
+
* @throws Error if API key not found (404)
|
|
3633
|
+
*
|
|
3634
|
+
* @example
|
|
3635
|
+
* ```typescript
|
|
3636
|
+
* const key = await sdk.getApiKey(123);
|
|
3637
|
+
* console.log(`Key ${key.keyPrefix}: ${key.role}`);
|
|
3638
|
+
* console.log(`Description: ${key.description}`);
|
|
3639
|
+
* console.log(`Delegate all tokens: ${key.delegateAllTokens}`);
|
|
3640
|
+
* console.log(`Token names: ${key.tokenNames.join(', ')}`);
|
|
3641
|
+
* ```
|
|
3642
|
+
*
|
|
3643
|
+
* @since 5.6.0
|
|
3644
|
+
*/
|
|
3645
|
+
getApiKey(id: number): Promise<ApiKeyData>;
|
|
3646
|
+
/**
|
|
3647
|
+
* Update an API key's metadata and permissions.
|
|
3648
|
+
*
|
|
3649
|
+
* Cannot change the key itself, only metadata and permissions.
|
|
3650
|
+
* At least one field must be provided.
|
|
3651
|
+
*
|
|
3652
|
+
* Requires JWT authentication - call `sdk.login()` first.
|
|
3653
|
+
*
|
|
3654
|
+
* @param id - API key ID
|
|
3655
|
+
* @param options - Fields to update
|
|
3656
|
+
* @returns Updated API key data
|
|
3657
|
+
* @throws ValidationError if ID or options are invalid
|
|
3658
|
+
* @throws ConfigurationError if JWT auth is not configured
|
|
3659
|
+
* @throws Error if API key not found (404)
|
|
3660
|
+
*
|
|
3661
|
+
* @example
|
|
3662
|
+
* ```typescript
|
|
3663
|
+
* // Update description
|
|
3664
|
+
* await sdk.updateApiKey(123, {
|
|
3665
|
+
* description: 'Updated description'
|
|
3666
|
+
* });
|
|
3667
|
+
*
|
|
3668
|
+
* // Upgrade role and extend expiration
|
|
3669
|
+
* await sdk.updateApiKey(123, {
|
|
3670
|
+
* role: 'MANAGER',
|
|
3671
|
+
* expiresAt: '2026-12-31T23:59:59Z'
|
|
3672
|
+
* });
|
|
3673
|
+
*
|
|
3674
|
+
* // Switch from specific tokens to all tokens
|
|
3675
|
+
* await sdk.updateApiKey(123, {
|
|
3676
|
+
* delegateAllTokens: true
|
|
3677
|
+
* });
|
|
3678
|
+
* ```
|
|
3679
|
+
*
|
|
3680
|
+
* @since 5.6.0
|
|
3681
|
+
*/
|
|
3682
|
+
updateApiKey(id: number, options: UpdateApiKeyOptions): Promise<ApiKeyData>;
|
|
3683
|
+
/**
|
|
3684
|
+
* Revoke an API key.
|
|
3685
|
+
*
|
|
3686
|
+
* This performs a soft delete - the key becomes immediately unusable
|
|
3687
|
+
* but is retained for audit purposes.
|
|
3688
|
+
*
|
|
3689
|
+
* Requires JWT authentication - call `sdk.login()` first.
|
|
3690
|
+
*
|
|
3691
|
+
* @param id - API key ID to revoke
|
|
3692
|
+
* @throws ValidationError if ID is invalid
|
|
3693
|
+
* @throws ConfigurationError if JWT auth is not configured
|
|
3694
|
+
* @throws Error if API key not found (404)
|
|
3695
|
+
*
|
|
3696
|
+
* @example
|
|
3697
|
+
* ```typescript
|
|
3698
|
+
* // Revoke a compromised key
|
|
3699
|
+
* await sdk.revokeApiKey(123);
|
|
3700
|
+
* console.log('API key revoked');
|
|
3701
|
+
*
|
|
3702
|
+
* // Key is now unusable
|
|
3703
|
+
* // Attempts to use it will fail with 401 Unauthorized
|
|
3704
|
+
* ```
|
|
3705
|
+
*
|
|
3706
|
+
* @since 5.6.0
|
|
3707
|
+
*/
|
|
3708
|
+
revokeApiKey(id: number): Promise<void>;
|
|
3709
|
+
/**
|
|
3710
|
+
* Get all valid API key roles.
|
|
3711
|
+
*
|
|
3712
|
+
* Returns the list of available roles for API keys.
|
|
3713
|
+
* Useful for UI dropdowns or validation.
|
|
3714
|
+
*
|
|
3715
|
+
* @returns Array of valid role strings
|
|
3716
|
+
*
|
|
3717
|
+
* @example
|
|
3718
|
+
* ```typescript
|
|
3719
|
+
* const roles = sdk.getApiKeyRoles();
|
|
3720
|
+
* console.log('Available roles:', roles);
|
|
3721
|
+
* // ['MODERATOR', 'TECHNICAL_PRODUCER', 'MANAGER', 'OWNER']
|
|
3722
|
+
* ```
|
|
3723
|
+
*
|
|
3724
|
+
* @since 5.6.0
|
|
3725
|
+
*/
|
|
3726
|
+
getApiKeyRoles(): string[];
|
|
3727
|
+
/**
|
|
3728
|
+
* Create a moderator invite for a token.
|
|
3729
|
+
*
|
|
3730
|
+
* Creates a magic link invite that can be shared with someone to grant them
|
|
3731
|
+
* moderator access to the specified token. The recipient claims the invite
|
|
3732
|
+
* after logging in, and their wallet becomes linked as a moderator.
|
|
3733
|
+
*
|
|
3734
|
+
* Requires JWT authentication - must be the token owner.
|
|
3735
|
+
*
|
|
3736
|
+
* @param options - Create invite options including tokenName, role, and optional description/expiration
|
|
3737
|
+
* @returns The created invite including the magic link URL
|
|
3738
|
+
*
|
|
3739
|
+
* @example
|
|
3740
|
+
* ```typescript
|
|
3741
|
+
* const result = await sdk.createModeratorInvite({
|
|
3742
|
+
* tokenName: 'mytoken',
|
|
3743
|
+
* role: 'MODERATOR',
|
|
3744
|
+
* description: 'John - Friday evening shows'
|
|
3745
|
+
* });
|
|
3746
|
+
* console.log('Share this link:', result.invite.inviteUrl);
|
|
3747
|
+
* ```
|
|
3748
|
+
*
|
|
3749
|
+
* @since 5.7.0
|
|
3750
|
+
*/
|
|
3751
|
+
createModeratorInvite(options: CreateModeratorInviteOptions): Promise<CreateModeratorInviteResult>;
|
|
3752
|
+
/**
|
|
3753
|
+
* Claim a moderator invite.
|
|
3754
|
+
*
|
|
3755
|
+
* Claims an invite using the code from a magic link URL. The authenticated
|
|
3756
|
+
* user's wallet becomes the moderator for the token with the specified role.
|
|
3757
|
+
*
|
|
3758
|
+
* Requires JWT authentication.
|
|
3759
|
+
*
|
|
3760
|
+
* @param options - Claim options including the invite code
|
|
3761
|
+
* @returns The token that was added to the user's moderated tokens
|
|
3762
|
+
*
|
|
3763
|
+
* @example
|
|
3764
|
+
* ```typescript
|
|
3765
|
+
* const result = await sdk.claimModeratorInvite({
|
|
3766
|
+
* inviteCode: 'abc123def456...'
|
|
3767
|
+
* });
|
|
3768
|
+
* console.log('Now moderating:', result.token.tokenName);
|
|
3769
|
+
* console.log('Role:', result.token.role);
|
|
3770
|
+
* ```
|
|
3771
|
+
*
|
|
3772
|
+
* @since 5.7.0
|
|
3773
|
+
*/
|
|
3774
|
+
claimModeratorInvite(options: ClaimModeratorInviteOptions): Promise<ClaimModeratorInviteResult>;
|
|
3775
|
+
/**
|
|
3776
|
+
* Get all tokens the current user moderates.
|
|
3777
|
+
*
|
|
3778
|
+
* Returns a paginated list of tokens where the authenticated user has claimed
|
|
3779
|
+
* a moderator invite and has active access. Used for the /studio dashboard.
|
|
3780
|
+
*
|
|
3781
|
+
* Requires JWT authentication.
|
|
3782
|
+
*
|
|
3783
|
+
* @param options - Optional pagination options
|
|
3784
|
+
* @returns Paginated list of moderated tokens
|
|
3785
|
+
*
|
|
3786
|
+
* @example
|
|
3787
|
+
* ```typescript
|
|
3788
|
+
* const result = await sdk.getModeratedTokens({ page: 1, limit: 20 });
|
|
3789
|
+
* console.log('Moderating', result.meta.totalItems, 'tokens');
|
|
3790
|
+
* for (const token of result.tokens) {
|
|
3791
|
+
* console.log(`- ${token.tokenName} (${token.role})`);
|
|
3792
|
+
* }
|
|
3793
|
+
* ```
|
|
3794
|
+
*
|
|
3795
|
+
* @since 5.7.0
|
|
3796
|
+
*/
|
|
3797
|
+
getModeratedTokens(options?: GetModeratedTokensOptions): Promise<ModeratedTokensResult>;
|
|
3798
|
+
/**
|
|
3799
|
+
* List moderator invites.
|
|
3800
|
+
*
|
|
3801
|
+
* Returns a paginated list of moderator invites. Behavior depends on tokenName:
|
|
3802
|
+
* - With tokenName: Returns invites for that specific token (verifies ownership)
|
|
3803
|
+
* - Without tokenName: Returns ALL invites created by the authenticated user across all tokens
|
|
3804
|
+
*
|
|
3805
|
+
* Requires JWT authentication.
|
|
3806
|
+
*
|
|
3807
|
+
* @param options - List options including optional tokenName, status filter, and pagination
|
|
3808
|
+
* @returns Paginated list of invites
|
|
3809
|
+
*
|
|
3810
|
+
* @example
|
|
3811
|
+
* ```typescript
|
|
3812
|
+
* // Get all invites across all tokens
|
|
3813
|
+
* const allInvites = await sdk.listModeratorInvites({});
|
|
3814
|
+
*
|
|
3815
|
+
* // Get invites for a specific token
|
|
3816
|
+
* const result = await sdk.listModeratorInvites({ tokenName: 'mytoken' });
|
|
3817
|
+
* console.log('Total invites:', result.meta.totalItems);
|
|
3818
|
+
*
|
|
3819
|
+
* // Filter by status
|
|
3820
|
+
* const pending = await sdk.listModeratorInvites({
|
|
3821
|
+
* tokenName: 'mytoken',
|
|
3822
|
+
* status: 'PENDING'
|
|
3823
|
+
* });
|
|
3824
|
+
* ```
|
|
3825
|
+
*
|
|
3826
|
+
* @since 5.7.0
|
|
3827
|
+
*/
|
|
3828
|
+
listModeratorInvites(options: ListModeratorInvitesOptions): Promise<ModeratorInviteListResult>;
|
|
3829
|
+
/**
|
|
3830
|
+
* Revoke a moderator invite.
|
|
3831
|
+
*
|
|
3832
|
+
* Revokes an invite by ID, preventing it from being claimed. If already claimed,
|
|
3833
|
+
* the moderator loses access to the token.
|
|
3834
|
+
*
|
|
3835
|
+
* Requires JWT authentication - must be the token owner.
|
|
3836
|
+
*
|
|
3837
|
+
* @param inviteId - The ID of the invite to revoke
|
|
3838
|
+
*
|
|
3839
|
+
* @example
|
|
3840
|
+
* ```typescript
|
|
3841
|
+
* await sdk.revokeModeratorInvite(123);
|
|
3842
|
+
* console.log('Invite revoked');
|
|
3843
|
+
* ```
|
|
3844
|
+
*
|
|
3845
|
+
* @since 5.7.0
|
|
3846
|
+
*/
|
|
3847
|
+
revokeModeratorInvite(inviteId: number): Promise<void>;
|
|
3848
|
+
/**
|
|
3849
|
+
* Update the role of a moderator invite.
|
|
3850
|
+
*
|
|
3851
|
+
* Changes the role granted by the invite. For claimed invites, the moderator's
|
|
3852
|
+
* effective permissions change immediately (enforced at runtime).
|
|
3853
|
+
*
|
|
3854
|
+
* Requires JWT authentication - must be the token owner.
|
|
3855
|
+
*
|
|
3856
|
+
* @param options - Update options including inviteId and new role
|
|
3857
|
+
* @returns The updated invite
|
|
3858
|
+
*
|
|
3859
|
+
* @example
|
|
3860
|
+
* ```typescript
|
|
3861
|
+
* const result = await sdk.updateModeratorInviteRole({
|
|
3862
|
+
* inviteId: 123,
|
|
3863
|
+
* role: 'MANAGER'
|
|
3864
|
+
* });
|
|
3865
|
+
* console.log('Updated role:', result.invite.role);
|
|
3866
|
+
* ```
|
|
3867
|
+
*
|
|
3868
|
+
* @since 5.7.0
|
|
3869
|
+
*/
|
|
3870
|
+
updateModeratorInviteRole(options: UpdateInviteRoleOptions): Promise<UpdateInviteRoleResult>;
|
|
3871
|
+
/**
|
|
3872
|
+
* Get invite details by code (public endpoint).
|
|
3873
|
+
*
|
|
3874
|
+
* Returns public information about an invite for the claim page. This is used
|
|
3875
|
+
* by the frontend to display invite details before the user logs in to claim.
|
|
3876
|
+
*
|
|
3877
|
+
* No authentication required.
|
|
3878
|
+
*
|
|
3879
|
+
* @param inviteCode - The invite code from the magic link URL
|
|
3880
|
+
* @returns Public invite information
|
|
3881
|
+
*
|
|
3882
|
+
* @example
|
|
3883
|
+
* ```typescript
|
|
3884
|
+
* const info = await sdk.getModeratorInviteByCode('abc123def456...');
|
|
3885
|
+
* console.log(`Invited to moderate ${info.tokenName} as ${info.role}`);
|
|
3886
|
+
* console.log(`Invited by: ${info.invitedBy.fullName || info.invitedBy.address}`);
|
|
3887
|
+
* ```
|
|
3888
|
+
*
|
|
3889
|
+
* @since 5.7.0
|
|
3890
|
+
*/
|
|
3891
|
+
getModeratorInviteByCode(inviteCode: string): Promise<PublicInviteInfo>;
|
|
3892
|
+
/**
|
|
3893
|
+
* Create a content flag/report.
|
|
3894
|
+
*
|
|
3895
|
+
* Two-tier system:
|
|
3896
|
+
* - Chat/Comment: reason and details are optional (one-click flag)
|
|
3897
|
+
* - Stream: reason is required (modal flow)
|
|
3898
|
+
*
|
|
3899
|
+
* @param options - Flag creation options
|
|
3900
|
+
* @returns Created flag data
|
|
3901
|
+
* @throws Error if not authenticated or validation fails
|
|
3902
|
+
*
|
|
3903
|
+
* @since 5.8.0
|
|
3904
|
+
* @category Flags
|
|
3905
|
+
*
|
|
3906
|
+
* @example One-click flag on chat message
|
|
3907
|
+
* ```typescript
|
|
3908
|
+
* const result = await sdk.createFlag({
|
|
3909
|
+
* tokenName: 'mytoken',
|
|
3910
|
+
* contentType: ContentType.CHAT_MESSAGE,
|
|
3911
|
+
* contentId: 'msg-123',
|
|
3912
|
+
* reportedUserAddress: 'eth|abc...',
|
|
3913
|
+
* });
|
|
3914
|
+
* ```
|
|
3915
|
+
*
|
|
3916
|
+
* @example Stream report with required reason
|
|
3917
|
+
* ```typescript
|
|
3918
|
+
* const result = await sdk.createFlag({
|
|
3919
|
+
* tokenName: 'mytoken',
|
|
3920
|
+
* contentType: ContentType.STREAM,
|
|
3921
|
+
* contentId: 'stream-456',
|
|
3922
|
+
* reportedUserAddress: 'eth|abc...',
|
|
3923
|
+
* reason: FlagReason.INAPPROPRIATE_CONTENT,
|
|
3924
|
+
* details: 'Explicit content',
|
|
3925
|
+
* });
|
|
3926
|
+
* ```
|
|
3927
|
+
*/
|
|
3928
|
+
createFlag(options: CreateFlagOptions): Promise<CreateFlagResult>;
|
|
3929
|
+
/**
|
|
3930
|
+
* List flags for a token with pagination and filtering.
|
|
3931
|
+
*
|
|
3932
|
+
* Authorization varies by content type:
|
|
3933
|
+
* - CHAT_MESSAGE/COMMENT: Owner or Moderator (JWT) can view
|
|
3934
|
+
* - STREAM: Admin API key only
|
|
3935
|
+
*
|
|
3936
|
+
* @param options - List options with filters
|
|
3937
|
+
* @returns Paginated list of flags
|
|
3938
|
+
* @throws Error if not authorized
|
|
3939
|
+
*
|
|
3940
|
+
* @since 5.8.0
|
|
3941
|
+
* @category Flags
|
|
3942
|
+
*
|
|
3943
|
+
* @example List pending flags
|
|
3944
|
+
* ```typescript
|
|
3945
|
+
* const result = await sdk.listFlags({
|
|
3946
|
+
* tokenName: 'mytoken',
|
|
3947
|
+
* status: FlagStatus.PENDING,
|
|
3948
|
+
* });
|
|
3949
|
+
* console.log(`Found ${result.flags.length} pending flags`);
|
|
3950
|
+
* ```
|
|
3951
|
+
*
|
|
3952
|
+
* @example List flags with pagination
|
|
3953
|
+
* ```typescript
|
|
3954
|
+
* const result = await sdk.listFlags({
|
|
3955
|
+
* tokenName: 'mytoken',
|
|
3956
|
+
* contentType: ContentType.CHAT_MESSAGE,
|
|
3957
|
+
* page: 1,
|
|
3958
|
+
* limit: 50,
|
|
3959
|
+
* });
|
|
3960
|
+
* ```
|
|
3961
|
+
*/
|
|
3962
|
+
listFlags(options: ListFlagsOptions): Promise<FlagListResult>;
|
|
3963
|
+
/**
|
|
3964
|
+
* List flags globally across all tokens (Overseer only).
|
|
3965
|
+
*
|
|
3966
|
+
* Returns paginated flags matching filter criteria across the platform.
|
|
3967
|
+
* Requires OVERSEER role for access.
|
|
3968
|
+
*
|
|
3969
|
+
* @param options - Filter and pagination options
|
|
3970
|
+
* @returns Paginated list of flags
|
|
3971
|
+
* @throws Error if not authorized as overseer
|
|
3972
|
+
*
|
|
3973
|
+
* @since 6.2.0
|
|
3974
|
+
* @category Flags
|
|
3975
|
+
*/
|
|
3976
|
+
listGlobalFlags(options?: ListGlobalFlagsOptions): Promise<FlagListResult>;
|
|
3977
|
+
/**
|
|
3978
|
+
* Dismiss a flag (no action taken).
|
|
3979
|
+
*
|
|
3980
|
+
* Marks the flag as reviewed but takes no action on the content.
|
|
3981
|
+
*
|
|
3982
|
+
* @param options - Dismiss options
|
|
3983
|
+
* @returns Updated flag data
|
|
3984
|
+
* @throws Error if not authorized or flag not found
|
|
3985
|
+
*
|
|
3986
|
+
* @since 5.8.0
|
|
3987
|
+
* @category Flags
|
|
3988
|
+
*
|
|
3989
|
+
* @example Dismiss a flag
|
|
3990
|
+
* ```typescript
|
|
3991
|
+
* const result = await sdk.dismissFlag({ flagId: 123 });
|
|
3992
|
+
* console.log(result.flag.status); // 'DISMISSED'
|
|
3993
|
+
* ```
|
|
3994
|
+
*/
|
|
3995
|
+
dismissFlag(options: DismissFlagOptions): Promise<DismissFlagResult>;
|
|
3996
|
+
/**
|
|
3997
|
+
* Take action on a flag.
|
|
3998
|
+
*
|
|
3999
|
+
* Actions available:
|
|
4000
|
+
* - DELETE_CONTENT: Remove the flagged content
|
|
4001
|
+
* - BAN_USER: Ban the reported user from the token
|
|
4002
|
+
* - DELETE_AND_BAN: Both delete content and ban user
|
|
4003
|
+
*
|
|
4004
|
+
* @param options - Action options
|
|
4005
|
+
* @returns Updated flag data with action taken
|
|
4006
|
+
* @throws Error if not authorized, flag not found, or action invalid
|
|
4007
|
+
*
|
|
4008
|
+
* @since 5.8.0
|
|
4009
|
+
* @category Flags
|
|
4010
|
+
*
|
|
4011
|
+
* @example Delete the flagged content
|
|
4012
|
+
* ```typescript
|
|
4013
|
+
* const result = await sdk.actionFlag({
|
|
4014
|
+
* flagId: 123,
|
|
4015
|
+
* action: FlagAction.DELETE_CONTENT,
|
|
4016
|
+
* });
|
|
4017
|
+
* ```
|
|
4018
|
+
*
|
|
4019
|
+
* @example Delete content and ban user
|
|
4020
|
+
* ```typescript
|
|
4021
|
+
* const result = await sdk.actionFlag({
|
|
4022
|
+
* flagId: 123,
|
|
4023
|
+
* action: FlagAction.DELETE_AND_BAN,
|
|
4024
|
+
* });
|
|
4025
|
+
* ```
|
|
4026
|
+
*/
|
|
4027
|
+
actionFlag(options: ActionFlagOptions): Promise<ActionFlagResult>;
|
|
4028
|
+
/**
|
|
4029
|
+
* Create an overseer invite.
|
|
4030
|
+
*
|
|
4031
|
+
* Overseers have global platform access with MANAGER-level permissions
|
|
4032
|
+
* across ALL tokens (current and future). This is different from moderators
|
|
4033
|
+
* who have token-scoped access.
|
|
4034
|
+
*
|
|
4035
|
+
* Requires Admin API key OR JWT as existing Overseer.
|
|
4036
|
+
*
|
|
4037
|
+
* @param options - Optional description and expiration settings
|
|
4038
|
+
* @returns Created invite data including the invite URL
|
|
4039
|
+
* @throws ConfigurationError if neither auth method is available
|
|
4040
|
+
* @throws ValidationError if parameters are invalid
|
|
4041
|
+
*
|
|
4042
|
+
* @since 5.9.0
|
|
4043
|
+
* @category Overseer
|
|
4044
|
+
*
|
|
4045
|
+
* @example Create an invite with description
|
|
4046
|
+
* ```typescript
|
|
4047
|
+
* const result = await sdk.createOverseerInvite({
|
|
4048
|
+
* description: 'John - Platform Support Team',
|
|
4049
|
+
* });
|
|
4050
|
+
* console.log('Share this link:', result.invite.inviteUrl);
|
|
4051
|
+
* ```
|
|
4052
|
+
*
|
|
4053
|
+
* @example Create invite with expiration
|
|
4054
|
+
* ```typescript
|
|
4055
|
+
* const result = await sdk.createOverseerInvite({
|
|
4056
|
+
* description: 'Temporary access',
|
|
4057
|
+
* expiresAt: '2025-12-31T23:59:59Z',
|
|
4058
|
+
* });
|
|
4059
|
+
* ```
|
|
4060
|
+
*/
|
|
4061
|
+
createOverseerInvite(options?: CreateOverseerInviteOptions): Promise<{
|
|
4062
|
+
invite: OverseerInviteWithUrl;
|
|
4063
|
+
}>;
|
|
4064
|
+
/**
|
|
4065
|
+
* List all overseer invites.
|
|
4066
|
+
*
|
|
4067
|
+
* Requires Admin API key OR JWT as existing Overseer.
|
|
4068
|
+
*
|
|
4069
|
+
* @param options - Optional filter and pagination options
|
|
4070
|
+
* @returns Paginated list of invites
|
|
4071
|
+
* @throws ConfigurationError if neither auth method is available
|
|
4072
|
+
*
|
|
4073
|
+
* @since 5.9.0
|
|
4074
|
+
* @category Overseer
|
|
4075
|
+
*
|
|
4076
|
+
* @example List all invites
|
|
4077
|
+
* ```typescript
|
|
4078
|
+
* const result = await sdk.listOverseerInvites();
|
|
4079
|
+
* console.log(`Total invites: ${result.meta.totalItems}`);
|
|
4080
|
+
* ```
|
|
4081
|
+
*
|
|
4082
|
+
* @example Filter by status with pagination
|
|
4083
|
+
* ```typescript
|
|
4084
|
+
* const result = await sdk.listOverseerInvites({
|
|
4085
|
+
* status: 'PENDING',
|
|
4086
|
+
* page: 1,
|
|
4087
|
+
* limit: 10,
|
|
4088
|
+
* });
|
|
4089
|
+
* ```
|
|
4090
|
+
*/
|
|
4091
|
+
listOverseerInvites(options?: ListOverseerInvitesOptions): Promise<PaginatedOverseerInvites>;
|
|
4092
|
+
/**
|
|
4093
|
+
* Get overseer invite details by code.
|
|
4094
|
+
*
|
|
4095
|
+
* This is a public endpoint used by the frontend claim page to display
|
|
4096
|
+
* invite information before the user logs in to claim.
|
|
4097
|
+
*
|
|
4098
|
+
* @param inviteCode - The invite code from the magic link URL
|
|
4099
|
+
* @returns Public invite information (description, status, inviter info)
|
|
4100
|
+
* @throws ValidationError if invite code format is invalid
|
|
4101
|
+
* @throws Error if invite not found (404)
|
|
4102
|
+
*
|
|
4103
|
+
* @since 5.9.0
|
|
4104
|
+
* @category Overseer
|
|
4105
|
+
*
|
|
4106
|
+
* @example Get invite info before claiming
|
|
4107
|
+
* ```typescript
|
|
4108
|
+
* const info = await sdk.getOverseerInviteByCode('abc123def456...');
|
|
4109
|
+
* console.log(`Invited by: ${info.invitedBy.fullName || info.invitedBy.address}`);
|
|
4110
|
+
* console.log(`Status: ${info.status}`);
|
|
4111
|
+
* ```
|
|
4112
|
+
*/
|
|
4113
|
+
getOverseerInviteByCode(inviteCode: string): Promise<PublicOverseerInviteInfo>;
|
|
4114
|
+
/**
|
|
4115
|
+
* Claim an overseer invite.
|
|
4116
|
+
*
|
|
4117
|
+
* The authenticated user's wallet becomes an overseer with global access
|
|
4118
|
+
* to ALL tokens on the platform.
|
|
4119
|
+
*
|
|
4120
|
+
* Requires JWT authentication.
|
|
4121
|
+
*
|
|
4122
|
+
* @param inviteCode - The invite code from the magic link URL
|
|
4123
|
+
* @returns The claimed invite data
|
|
4124
|
+
* @throws ValidationError if invite code is invalid or invite already claimed/revoked/expired
|
|
4125
|
+
* @throws ConfigurationError if JWT is not configured
|
|
4126
|
+
*
|
|
4127
|
+
* @since 5.9.0
|
|
4128
|
+
* @category Overseer
|
|
4129
|
+
*
|
|
4130
|
+
* @example Claim an invite
|
|
4131
|
+
* ```typescript
|
|
4132
|
+
* const result = await sdk.claimOverseerInvite('abc123def456...');
|
|
4133
|
+
* console.log('Now an overseer! Status:', result.invite.status);
|
|
4134
|
+
* ```
|
|
4135
|
+
*/
|
|
4136
|
+
claimOverseerInvite(inviteCode: string): Promise<{
|
|
4137
|
+
invite: OverseerInviteWithUrl;
|
|
4138
|
+
}>;
|
|
4139
|
+
/**
|
|
4140
|
+
* Revoke an overseer invite.
|
|
4141
|
+
*
|
|
4142
|
+
* This revokes the invite, preventing it from being claimed.
|
|
4143
|
+
* If the invite was already claimed, the overseer loses access.
|
|
4144
|
+
*
|
|
4145
|
+
* Requires Admin API key OR JWT as existing Overseer.
|
|
4146
|
+
*
|
|
4147
|
+
* @param inviteId - The ID of the invite to revoke
|
|
4148
|
+
* @throws ValidationError if invite ID is invalid
|
|
4149
|
+
* @throws ConfigurationError if neither auth method is available
|
|
4150
|
+
* @throws Error if invite not found (404)
|
|
4151
|
+
*
|
|
4152
|
+
* @since 5.9.0
|
|
4153
|
+
* @category Overseer
|
|
4154
|
+
*
|
|
4155
|
+
* @example Revoke an invite
|
|
4156
|
+
* ```typescript
|
|
4157
|
+
* await sdk.revokeOverseerInvite(123);
|
|
4158
|
+
* console.log('Invite revoked');
|
|
4159
|
+
* ```
|
|
4160
|
+
*/
|
|
4161
|
+
revokeOverseerInvite(inviteId: number): Promise<void>;
|
|
4162
|
+
/**
|
|
4163
|
+
* List all overseers.
|
|
4164
|
+
*
|
|
4165
|
+
* Requires Admin API key OR JWT as existing Overseer.
|
|
4166
|
+
*
|
|
4167
|
+
* @param options - Optional filter and pagination options
|
|
4168
|
+
* @returns Paginated list of overseers
|
|
4169
|
+
* @throws ConfigurationError if neither auth method is available
|
|
4170
|
+
*
|
|
4171
|
+
* @since 5.9.0
|
|
4172
|
+
* @category Overseer
|
|
4173
|
+
*
|
|
4174
|
+
* @example List all overseers
|
|
4175
|
+
* ```typescript
|
|
4176
|
+
* const result = await sdk.listOverseers();
|
|
4177
|
+
* console.log(`Total overseers: ${result.meta.totalItems}`);
|
|
4178
|
+
* ```
|
|
4179
|
+
*
|
|
4180
|
+
* @example Filter by status
|
|
4181
|
+
* ```typescript
|
|
4182
|
+
* const active = await sdk.listOverseers({
|
|
4183
|
+
* status: 'ACTIVE',
|
|
4184
|
+
* });
|
|
4185
|
+
* ```
|
|
4186
|
+
*/
|
|
4187
|
+
listOverseers(options?: ListOverseersOptions): Promise<PaginatedOverseers>;
|
|
4188
|
+
/**
|
|
4189
|
+
* Revoke an overseer's access.
|
|
4190
|
+
*
|
|
4191
|
+
* This revokes the overseer's global platform access.
|
|
4192
|
+
*
|
|
4193
|
+
* Requires Admin API key OR JWT as existing Overseer.
|
|
4194
|
+
*
|
|
4195
|
+
* @param address - The wallet address of the overseer to revoke
|
|
4196
|
+
* @throws ValidationError if address format is invalid
|
|
4197
|
+
* @throws ConfigurationError if neither auth method is available
|
|
4198
|
+
* @throws Error if overseer not found (404)
|
|
4199
|
+
*
|
|
4200
|
+
* @since 5.9.0
|
|
4201
|
+
* @category Overseer
|
|
4202
|
+
*
|
|
4203
|
+
* @example Revoke an overseer
|
|
4204
|
+
* ```typescript
|
|
4205
|
+
* await sdk.revokeOverseer('eth|1234567890abcdef...');
|
|
4206
|
+
* console.log('Overseer access revoked');
|
|
4207
|
+
* ```
|
|
4208
|
+
*/
|
|
4209
|
+
revokeOverseer(address: string): Promise<void>;
|
|
4210
|
+
/**
|
|
4211
|
+
* Check own overseer status.
|
|
4212
|
+
*
|
|
4213
|
+
* Returns whether the authenticated user is currently an active overseer
|
|
4214
|
+
* and their details if so.
|
|
4215
|
+
*
|
|
4216
|
+
* Requires JWT authentication.
|
|
4217
|
+
*
|
|
4218
|
+
* @returns Overseer status including details if active
|
|
4219
|
+
* @throws ConfigurationError if JWT is not configured
|
|
4220
|
+
*
|
|
4221
|
+
* @since 5.9.0
|
|
4222
|
+
* @category Overseer
|
|
4223
|
+
*
|
|
4224
|
+
* @example Check your overseer status
|
|
4225
|
+
* ```typescript
|
|
4226
|
+
* const status = await sdk.getMyOverseerStatus();
|
|
4227
|
+
* if (status.isOverseer) {
|
|
4228
|
+
* console.log('You are an overseer!');
|
|
4229
|
+
* console.log('Access granted:', status.overseer?.createdAt);
|
|
4230
|
+
* } else {
|
|
4231
|
+
* console.log('You are not an overseer');
|
|
4232
|
+
* }
|
|
4233
|
+
* ```
|
|
4234
|
+
*/
|
|
4235
|
+
getMyOverseerStatus(): Promise<OverseerStatusResponse>;
|
|
4236
|
+
/**
|
|
4237
|
+
* Get platform summary for CCTV dashboard.
|
|
4238
|
+
*
|
|
4239
|
+
* Returns quick counts for the overseer monitoring dashboard:
|
|
4240
|
+
* - Active streams (pools with live streams)
|
|
4241
|
+
* - Total viewers across all active streams
|
|
4242
|
+
* - Pending content flags awaiting review
|
|
4243
|
+
* - Total pools on the platform
|
|
4244
|
+
*
|
|
4245
|
+
* @returns Platform summary with counts
|
|
4246
|
+
* @throws ConfigurationError if neither auth method is available
|
|
4247
|
+
*
|
|
4248
|
+
* @since 5.10.0
|
|
4249
|
+
* @category Overseer
|
|
4250
|
+
*
|
|
4251
|
+
* @example Get platform summary
|
|
4252
|
+
* ```typescript
|
|
4253
|
+
* const summary = await sdk.getOverseerSummary();
|
|
4254
|
+
* console.log(`Active streams: ${summary.activeStreams}`);
|
|
4255
|
+
* console.log(`Total viewers: ${summary.totalViewers}`);
|
|
4256
|
+
* console.log(`Pending flags: ${summary.pendingFlags}`);
|
|
4257
|
+
* console.log(`Total pools: ${summary.totalPools}`);
|
|
4258
|
+
* ```
|
|
4259
|
+
*/
|
|
4260
|
+
getOverseerSummary(): Promise<OverseerSummaryResponse>;
|
|
4261
|
+
/**
|
|
4262
|
+
* List users with activity metrics (Admin/Overseer only - v6.x.0+)
|
|
4263
|
+
*
|
|
4264
|
+
* Lists all platform users with their activity metrics including
|
|
4265
|
+
* comments posted, messages sent, trades, and trading volume.
|
|
4266
|
+
*
|
|
4267
|
+
* Requires either Admin API key or JWT with overseer status.
|
|
4268
|
+
*
|
|
4269
|
+
* @param options List options including search, sorting, and pagination
|
|
4270
|
+
* @returns Paginated list of users with activity metrics
|
|
4271
|
+
* @throws ConfigurationError if neither admin API key nor JWT is configured
|
|
4272
|
+
* @throws ValidationError if options are invalid
|
|
4273
|
+
*
|
|
4274
|
+
* @since 6.x.0
|
|
4275
|
+
* @category Overseer
|
|
4276
|
+
*
|
|
4277
|
+
* @example List users with pagination
|
|
4278
|
+
* ```typescript
|
|
4279
|
+
* const result = await sdk.listOverseerUsers({ page: 1, limit: 20 });
|
|
4280
|
+
* result.items.forEach(user => {
|
|
4281
|
+
* console.log(`${user.profile.fullName}: ${user.metrics.commentCount} comments`);
|
|
4282
|
+
* });
|
|
4283
|
+
* ```
|
|
4284
|
+
*
|
|
4285
|
+
* @example Search and sort
|
|
4286
|
+
* ```typescript
|
|
4287
|
+
* const result = await sdk.listOverseerUsers({
|
|
4288
|
+
* search: 'alice',
|
|
4289
|
+
* sortBy: 'activity',
|
|
4290
|
+
* sortOrder: 'desc',
|
|
4291
|
+
* limit: 10
|
|
4292
|
+
* });
|
|
4293
|
+
* ```
|
|
4294
|
+
*/
|
|
4295
|
+
listOverseerUsers(options?: ListUsersOptions): Promise<UsersListResponse>;
|
|
4296
|
+
/**
|
|
4297
|
+
* Get comprehensive user summary (Admin/Overseer only - v6.x.0+)
|
|
4298
|
+
*
|
|
4299
|
+
* Retrieves full profile, activity metrics, and ban status for a specific user.
|
|
4300
|
+
* Useful for overseer dashboard user detail pages.
|
|
4301
|
+
*
|
|
4302
|
+
* Requires either Admin API key or JWT with overseer status.
|
|
4303
|
+
*
|
|
4304
|
+
* @param address User wallet address
|
|
4305
|
+
* @returns User profile with detailed activity metrics and ban status
|
|
4306
|
+
* @throws ConfigurationError if neither admin API key nor JWT is configured
|
|
4307
|
+
* @throws ValidationError if address format is invalid
|
|
4308
|
+
*
|
|
4309
|
+
* @since 6.x.0
|
|
4310
|
+
* @category Overseer
|
|
4311
|
+
*
|
|
4312
|
+
* @example Get user summary
|
|
4313
|
+
* ```typescript
|
|
4314
|
+
* const summary = await sdk.getOverseerUserSummary('eth|abc123...');
|
|
4315
|
+
* console.log(`User: ${summary.profile.fullName}`);
|
|
4316
|
+
* console.log(`Comments: ${summary.metrics.commentCount}`);
|
|
4317
|
+
* console.log(`Banned: ${summary.isBanned}`);
|
|
4318
|
+
* if (summary.isBanned) {
|
|
4319
|
+
* console.log(`Reason: ${summary.banInfo?.reason}`);
|
|
4320
|
+
* }
|
|
4321
|
+
* ```
|
|
4322
|
+
*/
|
|
4323
|
+
getOverseerUserSummary(address: string): Promise<UserSummaryResponse>;
|
|
4324
|
+
/**
|
|
4325
|
+
* Ban a token from the platform (overseer only).
|
|
4326
|
+
*
|
|
4327
|
+
* When a token is banned:
|
|
4328
|
+
* - Hidden from ALL pool listings (including creator's profile)
|
|
4329
|
+
* - Comments blocked on banned tokens
|
|
4330
|
+
* - Live streaming blocked on banned tokens
|
|
4331
|
+
* - Chat messages blocked on banned tokens
|
|
4332
|
+
* - Trading NOT blocked (GalaChain handles trading independently)
|
|
4333
|
+
*
|
|
4334
|
+
* Requires either Admin API key or JWT with overseer status.
|
|
4335
|
+
*
|
|
4336
|
+
* @param options - Ban options including tokenName and optional reason
|
|
4337
|
+
* @returns Created ban data with token name
|
|
4338
|
+
* @throws ValidationError if parameters are invalid
|
|
4339
|
+
* @throws ConfigurationError if neither admin API key nor JWT is configured
|
|
4340
|
+
* @throws Error if token is already banned (409 Conflict)
|
|
4341
|
+
*
|
|
4342
|
+
* @since 6.x.0
|
|
4343
|
+
* @category TokenBan
|
|
4344
|
+
*
|
|
4345
|
+
* @example Ban a token with reason
|
|
4346
|
+
* ```typescript
|
|
4347
|
+
* const result = await sdk.banToken({
|
|
4348
|
+
* tokenName: 'scamtoken',
|
|
4349
|
+
* reason: 'Fraudulent project - reported by multiple users'
|
|
4350
|
+
* });
|
|
4351
|
+
* console.log('Banned token:', result.tokenName);
|
|
4352
|
+
* console.log('Ban ID:', result.ban.id);
|
|
4353
|
+
* console.log('Banned by:', result.ban.bannedBy);
|
|
4354
|
+
* ```
|
|
4355
|
+
*
|
|
4356
|
+
* @example Ban without reason
|
|
4357
|
+
* ```typescript
|
|
4358
|
+
* await sdk.banToken({ tokenName: 'problematictoken' });
|
|
4359
|
+
* ```
|
|
4360
|
+
*/
|
|
4361
|
+
banToken(options: BanTokenOptions): Promise<BanTokenResult>;
|
|
4362
|
+
/**
|
|
4363
|
+
* Remove a ban from a token (overseer only).
|
|
4364
|
+
*
|
|
4365
|
+
* When a token is unbanned:
|
|
4366
|
+
* - Restored to all pool listings
|
|
4367
|
+
* - Visible on creator's profile again
|
|
4368
|
+
* - Comments re-enabled
|
|
4369
|
+
* - Live streaming re-enabled
|
|
4370
|
+
* - Chat re-enabled
|
|
4371
|
+
*
|
|
4372
|
+
* Requires either Admin API key or JWT with overseer status.
|
|
4373
|
+
*
|
|
4374
|
+
* @param options - Unban options including tokenName
|
|
4375
|
+
* @returns Removal confirmation with token name
|
|
4376
|
+
* @throws ValidationError if token name is invalid
|
|
4377
|
+
* @throws ConfigurationError if neither admin API key nor JWT is configured
|
|
4378
|
+
* @throws Error if token is not banned (404 Not Found)
|
|
4379
|
+
*
|
|
4380
|
+
* @since 6.x.0
|
|
4381
|
+
* @category TokenBan
|
|
4382
|
+
*
|
|
4383
|
+
* @example
|
|
4384
|
+
* ```typescript
|
|
4385
|
+
* const result = await sdk.unbanToken({ tokenName: 'scamtoken' });
|
|
4386
|
+
* console.log('Removed ban:', result.removed); // true
|
|
4387
|
+
* console.log('Token:', result.tokenName);
|
|
4388
|
+
* ```
|
|
4389
|
+
*/
|
|
4390
|
+
unbanToken(options: UnbanTokenOptions): Promise<UnbanTokenResult>;
|
|
4391
|
+
/**
|
|
4392
|
+
* List all banned tokens (overseer only).
|
|
4393
|
+
*
|
|
4394
|
+
* Returns paginated list of banned tokens with full details.
|
|
4395
|
+
*
|
|
4396
|
+
* Requires either Admin API key or JWT with overseer status.
|
|
4397
|
+
*
|
|
4398
|
+
* @param options - Optional pagination and search parameters
|
|
4399
|
+
* @returns Paginated list of banned tokens
|
|
4400
|
+
* @throws ValidationError if pagination parameters are invalid
|
|
4401
|
+
* @throws ConfigurationError if neither admin API key nor JWT is configured
|
|
4402
|
+
*
|
|
4403
|
+
* @since 6.x.0
|
|
4404
|
+
* @category TokenBan
|
|
4405
|
+
*
|
|
4406
|
+
* @example List all banned tokens
|
|
4407
|
+
* ```typescript
|
|
4408
|
+
* const result = await sdk.listTokenBans();
|
|
4409
|
+
* console.log(`Total banned: ${result.meta.total}`);
|
|
4410
|
+
* for (const ban of result.items) {
|
|
4411
|
+
* console.log(`${ban.tokenName}: ${ban.reason || 'No reason'}`);
|
|
4412
|
+
* }
|
|
4413
|
+
* ```
|
|
4414
|
+
*
|
|
4415
|
+
* @example Search for specific tokens
|
|
4416
|
+
* ```typescript
|
|
4417
|
+
* const result = await sdk.listTokenBans({
|
|
4418
|
+
* search: 'scam',
|
|
4419
|
+
* page: 1,
|
|
4420
|
+
* limit: 10
|
|
4421
|
+
* });
|
|
4422
|
+
* ```
|
|
4423
|
+
*
|
|
4424
|
+
* @example Paginate through all bans
|
|
4425
|
+
* ```typescript
|
|
4426
|
+
* let page = 1;
|
|
4427
|
+
* let hasMore = true;
|
|
4428
|
+
* while (hasMore) {
|
|
4429
|
+
* const result = await sdk.listTokenBans({ page, limit: 20 });
|
|
4430
|
+
* console.log('Bans:', result.items.map(b => b.tokenName));
|
|
4431
|
+
* hasMore = page < result.meta.totalPages;
|
|
4432
|
+
* page++;
|
|
4433
|
+
* }
|
|
4434
|
+
* ```
|
|
4435
|
+
*/
|
|
4436
|
+
listTokenBans(options?: ListTokenBansOptions): Promise<TokenBanListResult>;
|
|
4437
|
+
/**
|
|
4438
|
+
* Get ban details for a specific token (overseer only).
|
|
4439
|
+
*
|
|
4440
|
+
* Returns ban data if banned, or indicates not banned.
|
|
4441
|
+
* Use this to get full ban details including reason and who banned it.
|
|
4442
|
+
*
|
|
4443
|
+
* Requires either Admin API key or JWT with overseer status.
|
|
4444
|
+
*
|
|
4445
|
+
* @param options - Options including tokenName
|
|
4446
|
+
* @returns Ban status with full details if banned
|
|
4447
|
+
* @throws ValidationError if token name is invalid
|
|
4448
|
+
* @throws ConfigurationError if neither admin API key nor JWT is configured
|
|
4449
|
+
*
|
|
4450
|
+
* @since 6.x.0
|
|
4451
|
+
* @category TokenBan
|
|
4452
|
+
*
|
|
4453
|
+
* @example
|
|
4454
|
+
* ```typescript
|
|
4455
|
+
* const status = await sdk.getTokenBan({ tokenName: 'sometoken' });
|
|
4456
|
+
* if (status.banned) {
|
|
4457
|
+
* console.log('Token is banned');
|
|
4458
|
+
* console.log('Reason:', status.ban?.reason);
|
|
4459
|
+
* console.log('Banned by:', status.ban?.bannedBy);
|
|
4460
|
+
* console.log('Banned at:', status.ban?.createdAt);
|
|
4461
|
+
* } else {
|
|
4462
|
+
* console.log('Token is not banned');
|
|
4463
|
+
* }
|
|
4464
|
+
* ```
|
|
4465
|
+
*/
|
|
4466
|
+
getTokenBan(options: GetTokenBanOptions): Promise<TokenBanStatusResult>;
|
|
4467
|
+
/**
|
|
4468
|
+
* Check if a token is banned (overseer only).
|
|
4469
|
+
*
|
|
4470
|
+
* Convenience alias for getTokenBan() - provided for semantic clarity.
|
|
4471
|
+
* Use when you just need to check if a token is banned.
|
|
4472
|
+
*
|
|
4473
|
+
* Requires either Admin API key or JWT with overseer status.
|
|
4474
|
+
*
|
|
4475
|
+
* @param options - Options including tokenName
|
|
4476
|
+
* @returns Ban status with full details if banned
|
|
4477
|
+
* @throws ValidationError if token name is invalid
|
|
4478
|
+
* @throws ConfigurationError if neither admin API key nor JWT is configured
|
|
4479
|
+
*
|
|
4480
|
+
* @since 6.x.0
|
|
4481
|
+
* @category TokenBan
|
|
4482
|
+
*
|
|
4483
|
+
* @example
|
|
4484
|
+
* ```typescript
|
|
4485
|
+
* const status = await sdk.isTokenBanned({ tokenName: 'sometoken' });
|
|
4486
|
+
* if (status.banned) {
|
|
4487
|
+
* console.log('Token is banned:', status.ban?.reason);
|
|
4488
|
+
* }
|
|
4489
|
+
* ```
|
|
4490
|
+
*/
|
|
4491
|
+
isTokenBanned(options: GetTokenBanOptions): Promise<TokenBanStatusResult>;
|
|
4492
|
+
/**
|
|
4493
|
+
* Add a reaction to a pool message (chat or comment).
|
|
4494
|
+
*
|
|
4495
|
+
* Requires JWT or API key authentication.
|
|
4496
|
+
* Adding the same reaction type again is a no-op (idempotent).
|
|
4497
|
+
* Users can have multiple different reaction types on the same message.
|
|
4498
|
+
*
|
|
4499
|
+
* @param options - Options including tokenName, messageId, and reactionType
|
|
4500
|
+
* @returns Updated reaction data and whether reaction was newly created
|
|
4501
|
+
* @throws ValidationError if parameters are invalid
|
|
4502
|
+
* @throws ConfigurationError if authentication is not configured
|
|
4503
|
+
*
|
|
4504
|
+
* @since 5.12.0
|
|
4505
|
+
* @category ContentReactions
|
|
4506
|
+
*
|
|
4507
|
+
* @example Add a heart reaction
|
|
4508
|
+
* ```typescript
|
|
4509
|
+
* const result = await sdk.addContentReaction({
|
|
4510
|
+
* tokenName: 'mytoken',
|
|
4511
|
+
* messageId: 'msg-1703443200000-a1b2c3d4e5f6789012345678901234ab',
|
|
4512
|
+
* reactionType: 'heart'
|
|
4513
|
+
* });
|
|
4514
|
+
* console.log('Created:', result.created);
|
|
4515
|
+
* console.log('Total reactions:', result.data.totalCount);
|
|
4516
|
+
* ```
|
|
4517
|
+
*/
|
|
4518
|
+
addContentReaction(options: AddContentReactionOptions): Promise<AddContentReactionResult>;
|
|
4519
|
+
/**
|
|
4520
|
+
* Remove a reaction from a pool message.
|
|
4521
|
+
*
|
|
4522
|
+
* Requires JWT or API key authentication.
|
|
4523
|
+
* Only the user who created the reaction can remove it.
|
|
4524
|
+
*
|
|
4525
|
+
* @param options - Options including tokenName, messageId, and reactionType
|
|
4526
|
+
* @returns Success indicator
|
|
4527
|
+
* @throws ValidationError if parameters are invalid
|
|
4528
|
+
* @throws ConfigurationError if authentication is not configured
|
|
4529
|
+
*
|
|
4530
|
+
* @since 5.12.0
|
|
4531
|
+
* @category ContentReactions
|
|
4532
|
+
*
|
|
4533
|
+
* @example Remove a heart reaction
|
|
4534
|
+
* ```typescript
|
|
4535
|
+
* await sdk.removeContentReaction({
|
|
4536
|
+
* tokenName: 'mytoken',
|
|
4537
|
+
* messageId: 'msg-1703443200000-a1b2c3d4e5f6789012345678901234ab',
|
|
4538
|
+
* reactionType: 'heart'
|
|
4539
|
+
* });
|
|
4540
|
+
* ```
|
|
4541
|
+
*/
|
|
4542
|
+
removeContentReaction(options: RemoveContentReactionOptions): Promise<RemoveContentReactionResult>;
|
|
4543
|
+
/**
|
|
4544
|
+
* Add a reaction to a chat message.
|
|
4545
|
+
*
|
|
4546
|
+
* Convenience wrapper for addContentReaction specifically for chat messages.
|
|
4547
|
+
*
|
|
4548
|
+
* @param options - Options including tokenName, messageId, and reactionType
|
|
4549
|
+
* @returns Updated reaction data
|
|
4550
|
+
*
|
|
4551
|
+
* @since 5.12.0
|
|
4552
|
+
* @category ContentReactions
|
|
4553
|
+
*
|
|
4554
|
+
* @example Add a fire reaction to a chat message
|
|
4555
|
+
* ```typescript
|
|
4556
|
+
* await sdk.addReactionToChatMessage({
|
|
4557
|
+
* tokenName: 'mytoken',
|
|
4558
|
+
* messageId: 'msg-1703443200000-a1b2c3d4e5f6789012345678901234ab',
|
|
4559
|
+
* reactionType: 'fire'
|
|
4560
|
+
* });
|
|
4561
|
+
* ```
|
|
4562
|
+
*/
|
|
4563
|
+
addReactionToChatMessage(options: AddContentReactionOptions): Promise<AddContentReactionResult>;
|
|
4564
|
+
/**
|
|
4565
|
+
* Remove a reaction from a chat message.
|
|
4566
|
+
*
|
|
4567
|
+
* Convenience wrapper for removeContentReaction specifically for chat messages.
|
|
4568
|
+
*
|
|
4569
|
+
* @param options - Options including tokenName, messageId, and reactionType
|
|
4570
|
+
* @returns Success indicator
|
|
4571
|
+
*
|
|
4572
|
+
* @since 5.12.0
|
|
4573
|
+
* @category ContentReactions
|
|
4574
|
+
*
|
|
4575
|
+
* @example Remove a fire reaction from a chat message
|
|
4576
|
+
* ```typescript
|
|
4577
|
+
* await sdk.removeReactionFromChatMessage({
|
|
4578
|
+
* tokenName: 'mytoken',
|
|
4579
|
+
* messageId: 'msg-1703443200000-a1b2c3d4e5f6789012345678901234ab',
|
|
4580
|
+
* reactionType: 'fire'
|
|
4581
|
+
* });
|
|
4582
|
+
* ```
|
|
4583
|
+
*/
|
|
4584
|
+
removeReactionFromChatMessage(options: RemoveContentReactionOptions): Promise<RemoveContentReactionResult>;
|
|
4585
|
+
/**
|
|
4586
|
+
* Add a reaction to a comment.
|
|
4587
|
+
*
|
|
4588
|
+
* Convenience wrapper for addContentReaction specifically for comments.
|
|
4589
|
+
*
|
|
4590
|
+
* @param options - Options including tokenName, messageId, and reactionType
|
|
4591
|
+
* @returns Updated reaction data
|
|
4592
|
+
*
|
|
4593
|
+
* @since 5.12.0
|
|
4594
|
+
* @category ContentReactions
|
|
4595
|
+
*
|
|
4596
|
+
* @example Add a thumbs_up reaction to a comment
|
|
4597
|
+
* ```typescript
|
|
4598
|
+
* await sdk.addReactionToComment({
|
|
4599
|
+
* tokenName: 'mytoken',
|
|
4600
|
+
* messageId: 'msg-1703443200000-a1b2c3d4e5f6789012345678901234ab',
|
|
4601
|
+
* reactionType: 'thumbs_up'
|
|
4602
|
+
* });
|
|
4603
|
+
* ```
|
|
4604
|
+
*/
|
|
4605
|
+
addReactionToComment(options: AddContentReactionOptions): Promise<AddContentReactionResult>;
|
|
4606
|
+
/**
|
|
4607
|
+
* Remove a reaction from a comment.
|
|
4608
|
+
*
|
|
4609
|
+
* Convenience wrapper for removeContentReaction specifically for comments.
|
|
4610
|
+
*
|
|
4611
|
+
* @param options - Options including tokenName, messageId, and reactionType
|
|
4612
|
+
* @returns Success indicator
|
|
4613
|
+
*
|
|
4614
|
+
* @since 5.12.0
|
|
4615
|
+
* @category ContentReactions
|
|
4616
|
+
*
|
|
4617
|
+
* @example Remove a thumbs_up reaction from a comment
|
|
4618
|
+
* ```typescript
|
|
4619
|
+
* await sdk.removeReactionFromComment({
|
|
4620
|
+
* tokenName: 'mytoken',
|
|
4621
|
+
* messageId: 'msg-1703443200000-a1b2c3d4e5f6789012345678901234ab',
|
|
4622
|
+
* reactionType: 'thumbs_up'
|
|
4623
|
+
* });
|
|
4624
|
+
* ```
|
|
4625
|
+
*/
|
|
4626
|
+
removeReactionFromComment(options: RemoveContentReactionOptions): Promise<RemoveContentReactionResult>;
|
|
4627
|
+
/**
|
|
4628
|
+
* Get comments with optional filtering.
|
|
4629
|
+
*
|
|
4630
|
+
* Public endpoint - no authentication required.
|
|
4631
|
+
* At least one of tokenName or userAddress must be provided.
|
|
4632
|
+
*
|
|
4633
|
+
* @param options Query options including tokenName/userAddress and pagination
|
|
4634
|
+
* @returns Paginated list of comments
|
|
4635
|
+
* @throws ValidationError if no filter is provided or options are invalid
|
|
4636
|
+
*
|
|
4637
|
+
* @since 6.2.0
|
|
4638
|
+
* @category Comments
|
|
4639
|
+
*
|
|
4640
|
+
* @example Get comments for a token
|
|
4641
|
+
* ```typescript
|
|
4642
|
+
* const { messages, meta } = await sdk.getComments({ tokenName: 'mytoken' });
|
|
4643
|
+
* console.log(`Page ${meta.currentPage} of ${meta.totalPages}`);
|
|
4644
|
+
* messages.forEach(comment => {
|
|
4645
|
+
* console.log(`${comment.userProfile?.fullName}: ${comment.content}`);
|
|
4646
|
+
* });
|
|
4647
|
+
* ```
|
|
4648
|
+
*
|
|
4649
|
+
* @example Get comments by a user
|
|
4650
|
+
* ```typescript
|
|
4651
|
+
* const result = await sdk.getComments({
|
|
4652
|
+
* userAddress: 'eth|0x123...',
|
|
4653
|
+
* page: 2,
|
|
4654
|
+
* limit: 20
|
|
4655
|
+
* });
|
|
4656
|
+
* ```
|
|
4657
|
+
*/
|
|
4658
|
+
getComments(options: GetCommentsOptions): Promise<CommentsResult>;
|
|
4659
|
+
/**
|
|
4660
|
+
* Create a new comment on a token pool.
|
|
4661
|
+
*
|
|
4662
|
+
* Requires JWT authentication.
|
|
4663
|
+
*
|
|
4664
|
+
* @param options Create options including tokenName and content
|
|
4665
|
+
* @returns The created comment
|
|
4666
|
+
* @throws ValidationError if token name or content is invalid
|
|
4667
|
+
* @throws ConfigurationError if JWT is not configured
|
|
4668
|
+
*
|
|
4669
|
+
* @since 6.2.0
|
|
4670
|
+
* @category Comments
|
|
4671
|
+
*
|
|
4672
|
+
* @example Create a comment
|
|
4673
|
+
* ```typescript
|
|
4674
|
+
* const result = await sdk.createComment({
|
|
4675
|
+
* tokenName: 'mytoken',
|
|
4676
|
+
* content: 'This is a great project!'
|
|
4677
|
+
* });
|
|
4678
|
+
* console.log('Created comment ID:', result.comment.id);
|
|
4679
|
+
* ```
|
|
4680
|
+
*/
|
|
4681
|
+
createComment(options: CreateCommentOptions): Promise<CreateCommentResult>;
|
|
4682
|
+
/**
|
|
4683
|
+
* Update a comment.
|
|
4684
|
+
*
|
|
4685
|
+
* Requires JWT authentication. Only the comment author can update.
|
|
4686
|
+
*
|
|
4687
|
+
* @param id Message ID of the comment to update
|
|
4688
|
+
* @param options Update options including new content
|
|
4689
|
+
* @returns The updated comment
|
|
4690
|
+
* @throws ValidationError if ID or content is invalid
|
|
4691
|
+
* @throws ConfigurationError if JWT is not configured
|
|
4692
|
+
*
|
|
4693
|
+
* @since 6.2.0
|
|
4694
|
+
* @category Comments
|
|
4695
|
+
*
|
|
4696
|
+
* @example Update a comment
|
|
4697
|
+
* ```typescript
|
|
4698
|
+
* const result = await sdk.updateComment('msg-1234567890123-abc...', {
|
|
4699
|
+
* content: 'Updated comment content'
|
|
4700
|
+
* });
|
|
4701
|
+
* console.log('Updated at:', result.comment.updatedAt);
|
|
4702
|
+
* ```
|
|
4703
|
+
*/
|
|
4704
|
+
updateComment(id: string, options: UpdateCommentOptions): Promise<UpdateCommentResult>;
|
|
4705
|
+
/**
|
|
4706
|
+
* Delete a comment.
|
|
4707
|
+
*
|
|
4708
|
+
* Requires authentication (JWT or API key).
|
|
4709
|
+
* Authorization: comment author, pool creator, moderator with MANAGE_COMMENTS permission, or overseer.
|
|
4710
|
+
*
|
|
4711
|
+
* @param id Message ID of the comment to delete
|
|
4712
|
+
* @returns Success indicator
|
|
4713
|
+
* @throws ValidationError if ID is invalid
|
|
4714
|
+
* @throws ConfigurationError if neither JWT nor API key is configured
|
|
4715
|
+
*
|
|
4716
|
+
* @since 6.2.0
|
|
4717
|
+
* @category Comments
|
|
4718
|
+
*
|
|
4719
|
+
* @example Delete a comment
|
|
4720
|
+
* ```typescript
|
|
4721
|
+
* await sdk.deleteComment('msg-1234567890123-abc...');
|
|
4722
|
+
* console.log('Comment deleted');
|
|
4723
|
+
* ```
|
|
4724
|
+
*/
|
|
4725
|
+
deleteComment(id: string): Promise<DeleteCommentResult>;
|
|
4726
|
+
/**
|
|
4727
|
+
* Get chat messages with optional filtering.
|
|
4728
|
+
*
|
|
4729
|
+
* Public endpoint - no authentication required.
|
|
4730
|
+
* At least one of tokenName or userAddress must be provided.
|
|
4731
|
+
*
|
|
4732
|
+
* @param options Query options including tokenName/userAddress and pagination
|
|
4733
|
+
* @returns Paginated list of chat messages
|
|
4734
|
+
* @throws ValidationError if no filter is provided or options are invalid
|
|
4735
|
+
*
|
|
4736
|
+
* @since 6.2.0
|
|
4737
|
+
* @category Chat
|
|
4738
|
+
*
|
|
4739
|
+
* @example Get chat messages for a token
|
|
4740
|
+
* ```typescript
|
|
4741
|
+
* const { messages, meta } = await sdk.getChatMessages({ tokenName: 'anime' });
|
|
4742
|
+
* console.log(`Found ${meta.totalItems} messages`);
|
|
4743
|
+
* messages.forEach(msg => {
|
|
4744
|
+
* console.log(`${msg.userProfile?.fullName}: ${msg.content}`);
|
|
4745
|
+
* });
|
|
4746
|
+
* ```
|
|
4747
|
+
*
|
|
4748
|
+
* @example Get chat messages by a user
|
|
4749
|
+
* ```typescript
|
|
4750
|
+
* const result = await sdk.getChatMessages({
|
|
4751
|
+
* userAddress: 'eth|0x123...',
|
|
4752
|
+
* page: 1,
|
|
4753
|
+
* limit: 50
|
|
4754
|
+
* });
|
|
4755
|
+
* ```
|
|
4756
|
+
*/
|
|
4757
|
+
getChatMessages(options: GetChatMessagesOptions): Promise<GetChatMessagesResult>;
|
|
4758
|
+
/**
|
|
4759
|
+
* Send a chat message.
|
|
4760
|
+
*
|
|
4761
|
+
* Requires JWT authentication.
|
|
4762
|
+
*
|
|
4763
|
+
* @param options Send options including tokenName and content
|
|
4764
|
+
* @returns The created chat message
|
|
4765
|
+
* @throws ValidationError if token name or content is invalid
|
|
4766
|
+
* @throws ConfigurationError if JWT is not configured
|
|
4767
|
+
*
|
|
4768
|
+
* @since 6.2.0
|
|
4769
|
+
* @category Chat
|
|
4770
|
+
*
|
|
4771
|
+
* @example Send a chat message
|
|
4772
|
+
* ```typescript
|
|
4773
|
+
* const result = await sdk.sendChatMessage({
|
|
4774
|
+
* tokenName: 'anime',
|
|
4775
|
+
* content: 'Hello everyone!'
|
|
4776
|
+
* });
|
|
4777
|
+
* console.log('Message sent:', result.message.id);
|
|
4778
|
+
* ```
|
|
4779
|
+
*/
|
|
4780
|
+
sendChatMessage(options: CreateChatMessageOptions): Promise<CreateChatMessageResult>;
|
|
4781
|
+
/**
|
|
4782
|
+
* Update a chat message.
|
|
4783
|
+
*
|
|
4784
|
+
* Requires JWT authentication. Only the message author can update.
|
|
4785
|
+
*
|
|
4786
|
+
* @param id Message ID to update (format: chat-{timestamp}-{uuid})
|
|
4787
|
+
* @param options Update options including new content
|
|
4788
|
+
* @returns The updated chat message
|
|
4789
|
+
* @throws ValidationError if ID or content is invalid
|
|
4790
|
+
* @throws ConfigurationError if JWT is not configured
|
|
4791
|
+
*
|
|
4792
|
+
* @since 6.2.0
|
|
4793
|
+
* @category Chat
|
|
4794
|
+
*
|
|
4795
|
+
* @example Update a chat message
|
|
4796
|
+
* ```typescript
|
|
4797
|
+
* const result = await sdk.updateChatMessage(
|
|
4798
|
+
* 'chat-1734445623456-550e8400-e29b-41d4-a716-446655440000',
|
|
4799
|
+
* { content: 'Updated message' }
|
|
4800
|
+
* );
|
|
4801
|
+
* console.log('Updated:', result.message.updatedAt);
|
|
4802
|
+
* ```
|
|
4803
|
+
*/
|
|
4804
|
+
updateChatMessage(id: string, options: UpdateChatMessageOptions): Promise<UpdateChatMessageResult>;
|
|
4805
|
+
/**
|
|
4806
|
+
* Delete a chat message.
|
|
4807
|
+
*
|
|
4808
|
+
* Supports both JWT and API key authentication.
|
|
4809
|
+
* Authorization: message author, pool owner, or MANAGE_CHAT permission.
|
|
4810
|
+
*
|
|
4811
|
+
* @param id Message ID to delete (format: chat-{timestamp}-{uuid})
|
|
4812
|
+
* @throws ValidationError if ID format is invalid
|
|
4813
|
+
* @throws ConfigurationError if neither JWT nor API key is configured
|
|
4814
|
+
*
|
|
4815
|
+
* @since 6.2.0
|
|
4816
|
+
* @category Chat
|
|
4817
|
+
*
|
|
4818
|
+
* @example Delete a chat message
|
|
4819
|
+
* ```typescript
|
|
4820
|
+
* await sdk.deleteChatMessage('chat-1734445623456-550e8400-e29b-41d4-a716-446655440000');
|
|
4821
|
+
* console.log('Message deleted');
|
|
4822
|
+
* ```
|
|
4823
|
+
*/
|
|
4824
|
+
deleteChatMessage(id: string): Promise<void>;
|
|
4825
|
+
/**
|
|
4826
|
+
* Get trades with flexible filtering.
|
|
4827
|
+
*
|
|
4828
|
+
* Public endpoint - no authentication required.
|
|
4829
|
+
* Filter by tokenName, userAddress, or both.
|
|
4830
|
+
* At least one filter is required.
|
|
4831
|
+
*
|
|
4832
|
+
* This is the unified trades endpoint that provides flexible querying
|
|
4833
|
+
* for trade history across tokens and users.
|
|
4834
|
+
*
|
|
4835
|
+
* @param options Query options with tokenName and/or userAddress
|
|
4836
|
+
* @returns Paginated list of trades with metadata
|
|
4837
|
+
* @throws ValidationError if neither tokenName nor userAddress provided
|
|
4838
|
+
* @throws ValidationError if options contain invalid values
|
|
4839
|
+
*
|
|
4840
|
+
* @since 6.2.0
|
|
4841
|
+
* @category Trades
|
|
4842
|
+
*
|
|
4843
|
+
* @example Get all trades for a token
|
|
4844
|
+
* ```typescript
|
|
4845
|
+
* const { trades, meta } = await sdk.getTrades({ tokenName: 'anime' });
|
|
4846
|
+
* console.log(`Found ${meta.totalItems} trades`);
|
|
4847
|
+
* trades.forEach(trade => {
|
|
4848
|
+
* console.log(`${trade.txnType}: ${trade.inputAmount} -> ${trade.outputAmount}`);
|
|
4849
|
+
* });
|
|
4850
|
+
* ```
|
|
4851
|
+
*
|
|
4852
|
+
* @example Get all trades by a user
|
|
4853
|
+
* ```typescript
|
|
4854
|
+
* const { trades, meta } = await sdk.getTrades({
|
|
4855
|
+
* userAddress: 'eth|1234567890abcdef...'
|
|
4856
|
+
* });
|
|
4857
|
+
* console.log(`User has ${meta.totalItems} trades across all tokens`);
|
|
4858
|
+
* ```
|
|
4859
|
+
*
|
|
4860
|
+
* @example Get a user's trades on a specific token with pagination
|
|
4861
|
+
* ```typescript
|
|
4862
|
+
* const { trades, meta } = await sdk.getTrades({
|
|
4863
|
+
* tokenName: 'anime',
|
|
4864
|
+
* userAddress: 'eth|1234567890abcdef...',
|
|
4865
|
+
* page: 2,
|
|
4866
|
+
* limit: 20
|
|
4867
|
+
* });
|
|
4868
|
+
* console.log(`Page ${meta.currentPage} of ${meta.totalPages}`);
|
|
4869
|
+
* ```
|
|
4870
|
+
*/
|
|
4871
|
+
getTrades(options: GetTradesOptions): Promise<TradesQueryResult>;
|
|
4872
|
+
/**
|
|
4873
|
+
* Connect to the stream WebSocket server.
|
|
4874
|
+
*
|
|
4875
|
+
* Establishes a WebSocket connection for real-time stream events.
|
|
4876
|
+
* Must be called before subscribing to streams or sending chat messages.
|
|
4877
|
+
*
|
|
4878
|
+
* @param callbacks - Event callback handlers
|
|
4879
|
+
* @returns Promise resolving when connected
|
|
4880
|
+
* @throws Error if streamWebSocketUrl is not configured
|
|
4881
|
+
*
|
|
4882
|
+
* @since 5.1.0
|
|
4883
|
+
* @category WebSocket
|
|
4884
|
+
*
|
|
4885
|
+
* @example Connect with event handlers
|
|
4886
|
+
* ```typescript
|
|
4887
|
+
* await sdk.connectStreamWebSocket({
|
|
4888
|
+
* onStreamStatus: (event) => {
|
|
4889
|
+
* console.log(`Stream ${event.tokenName}: ${event.status}`);
|
|
4890
|
+
* },
|
|
4891
|
+
* onViewerCount: (event) => {
|
|
4892
|
+
* console.log(`Viewers: ${event.viewerCount}`);
|
|
4893
|
+
* },
|
|
4894
|
+
* onChatMessage: (event) => {
|
|
4895
|
+
* console.log(`Chat: ${event.message.content}`);
|
|
4896
|
+
* },
|
|
4897
|
+
* });
|
|
4898
|
+
* ```
|
|
4899
|
+
*/
|
|
4900
|
+
connectStreamWebSocket(callbacks?: StreamEventCallbacks): Promise<void>;
|
|
4901
|
+
/**
|
|
4902
|
+
* Authenticate the stream WebSocket connection.
|
|
4903
|
+
*
|
|
4904
|
+
* Required before sending chat messages via WebSocket.
|
|
4905
|
+
* Uses the configured wallet for authentication.
|
|
4906
|
+
*
|
|
4907
|
+
* @returns Promise resolving when authenticated
|
|
4908
|
+
* @throws Error if not connected
|
|
4909
|
+
* @throws Error if wallet is not configured
|
|
4910
|
+
*
|
|
4911
|
+
* @since 5.1.0
|
|
4912
|
+
* @category WebSocket
|
|
4913
|
+
*
|
|
4914
|
+
* @example Authenticate for chat
|
|
4915
|
+
* ```typescript
|
|
4916
|
+
* await sdk.connectStreamWebSocket();
|
|
4917
|
+
* await sdk.authenticateStreamWebSocket();
|
|
4918
|
+
* // Now can send chat messages via WebSocket
|
|
4919
|
+
* ```
|
|
4920
|
+
*/
|
|
4921
|
+
authenticateStreamWebSocket(): Promise<void>;
|
|
4922
|
+
/**
|
|
4923
|
+
* Subscribe to real-time events for a stream.
|
|
4924
|
+
*
|
|
4925
|
+
* Joins the stream room to receive status updates, viewer counts, and chat messages.
|
|
4926
|
+
*
|
|
4927
|
+
* @param tokenName - Token name (lowercase)
|
|
4928
|
+
* @returns Promise resolving when subscribed
|
|
4929
|
+
* @throws Error if not connected
|
|
4930
|
+
*
|
|
4931
|
+
* @since 5.1.0
|
|
4932
|
+
* @category WebSocket
|
|
4933
|
+
*
|
|
4934
|
+
* @example Subscribe to a stream
|
|
4935
|
+
* ```typescript
|
|
4936
|
+
* await sdk.connectStreamWebSocket({
|
|
4937
|
+
* onStreamStatus: (e) => console.log(`Status: ${e.status}`),
|
|
4938
|
+
* onViewerCount: (e) => console.log(`Viewers: ${e.viewerCount}`),
|
|
4939
|
+
* });
|
|
4940
|
+
* await sdk.subscribeToStream('mytoken');
|
|
4941
|
+
* // Events will now fire for 'mytoken'
|
|
4942
|
+
* ```
|
|
4943
|
+
*/
|
|
4944
|
+
subscribeToStream(tokenName: string): Promise<StreamSubscribedEvent>;
|
|
4945
|
+
/**
|
|
4946
|
+
* Unsubscribe from a stream's events.
|
|
4947
|
+
*
|
|
4948
|
+
* Leaves the stream room and stops receiving events.
|
|
4949
|
+
*
|
|
4950
|
+
* @param tokenName - Token name (lowercase)
|
|
4951
|
+
* @returns Promise resolving when unsubscribed
|
|
4952
|
+
* @throws Error if not connected
|
|
4953
|
+
*
|
|
4954
|
+
* @since 5.1.0
|
|
4955
|
+
* @category WebSocket
|
|
4956
|
+
*/
|
|
4957
|
+
unsubscribeFromStream(tokenName: string): Promise<void>;
|
|
4958
|
+
/**
|
|
4959
|
+
* Send a chat message via WebSocket.
|
|
4960
|
+
*
|
|
4961
|
+
* Sends a chat message through the WebSocket connection for lower latency
|
|
4962
|
+
* than the REST API. Requires prior authentication.
|
|
4963
|
+
*
|
|
4964
|
+
* @param tokenName - Token name (lowercase)
|
|
4965
|
+
* @param content - Message content
|
|
4966
|
+
* @returns Promise resolving when sent
|
|
4967
|
+
* @throws Error if not connected or authenticated
|
|
4968
|
+
*
|
|
4969
|
+
* @since 5.1.0
|
|
4970
|
+
* @category WebSocket
|
|
4971
|
+
*
|
|
4972
|
+
* @example Send chat via WebSocket
|
|
4973
|
+
* ```typescript
|
|
4974
|
+
* await sdk.connectStreamWebSocket();
|
|
4975
|
+
* await sdk.authenticateStreamWebSocket();
|
|
4976
|
+
* await sdk.subscribeToStream('mytoken');
|
|
4977
|
+
* await sdk.sendStreamChatViaWebSocket('mytoken', 'Hello!');
|
|
4978
|
+
* ```
|
|
4979
|
+
*/
|
|
4980
|
+
sendStreamChatViaWebSocket(tokenName: string, content: string): Promise<void>;
|
|
4981
|
+
/**
|
|
4982
|
+
* Send an ephemeral emoji reaction to a live stream.
|
|
4983
|
+
*
|
|
4984
|
+
* Reactions are broadcast to all viewers via WebSocket but NOT persisted to database.
|
|
4985
|
+
* Rate limiting is enforced server-side (burst of 10, then 0.5/sec refill).
|
|
4986
|
+
*
|
|
4987
|
+
* @param tokenName - Token name (lowercase)
|
|
4988
|
+
* @param emoji - Emoji to send (single emoji or short sequence, max 15 chars)
|
|
4989
|
+
* @param streamTime - Current stream timecode in seconds (for viewer sync, defaults to 0)
|
|
4990
|
+
* @returns Promise resolving when sent
|
|
4991
|
+
* @throws Error if not connected or authenticated
|
|
4992
|
+
*
|
|
4993
|
+
* @since 5.2.0
|
|
4994
|
+
* @category WebSocket
|
|
4995
|
+
*
|
|
4996
|
+
* @example Send a reaction during a live stream
|
|
4997
|
+
* ```typescript
|
|
4998
|
+
* await sdk.connectStreamWebSocket({
|
|
4999
|
+
* onReaction: (e) => console.log(`${e.emoji} from ${e.userAddress}`),
|
|
5000
|
+
* });
|
|
5001
|
+
* await sdk.authenticateStreamWebSocket();
|
|
5002
|
+
* await sdk.subscribeToStream('mytoken');
|
|
5003
|
+
*
|
|
5004
|
+
* // Send a heart reaction at current stream position
|
|
5005
|
+
* const currentTime = player.getCurrentTime(); // from MuxPlayer
|
|
5006
|
+
* await sdk.sendStreamReaction('mytoken', '❤️', currentTime);
|
|
5007
|
+
* ```
|
|
5008
|
+
*/
|
|
5009
|
+
sendStreamReaction(tokenName: string, emoji: string, streamTime?: number): Promise<void>;
|
|
5010
|
+
/**
|
|
5011
|
+
* Send a typing indicator start event to a stream chat.
|
|
5012
|
+
*
|
|
5013
|
+
* Indicates that the authenticated user has started typing.
|
|
5014
|
+
* The indicator auto-clears after 5 seconds of inactivity on the server.
|
|
5015
|
+
* Use sendTypingStop() to explicitly stop the indicator.
|
|
5016
|
+
*
|
|
5017
|
+
* Requires:
|
|
5018
|
+
* 1. WebSocket connected via connectStreamWebSocket()
|
|
5019
|
+
* 2. Authenticated via authenticateStreamWebSocket()
|
|
5020
|
+
* 3. Subscribed to the stream via subscribeToStream()
|
|
5021
|
+
*
|
|
5022
|
+
* @param tokenName - Token name for the stream chat room
|
|
5023
|
+
* @throws ValidationError if WebSocket not connected or not authenticated
|
|
5024
|
+
*
|
|
5025
|
+
* @since 5.11.0
|
|
5026
|
+
* @category WebSocket
|
|
5027
|
+
*
|
|
5028
|
+
* @example Send typing indicator
|
|
5029
|
+
* ```typescript
|
|
5030
|
+
* await sdk.connectStreamWebSocket({
|
|
5031
|
+
* onTypingIndicator: (e) => console.log(`${e.typingUsers.length} users typing`),
|
|
5032
|
+
* });
|
|
5033
|
+
* await sdk.authenticateStreamWebSocket();
|
|
5034
|
+
* await sdk.subscribeToStream('mytoken');
|
|
5035
|
+
*
|
|
5036
|
+
* // User starts typing
|
|
5037
|
+
* sdk.sendTypingStart('mytoken');
|
|
5038
|
+
* ```
|
|
5039
|
+
*/
|
|
5040
|
+
sendTypingStart(tokenName: string): void;
|
|
5041
|
+
/**
|
|
5042
|
+
* Send a typing indicator stop event to a stream chat.
|
|
5043
|
+
*
|
|
5044
|
+
* Indicates that the authenticated user has stopped typing.
|
|
5045
|
+
* Call this when the user sends a message, clears the input, or blurs the input.
|
|
5046
|
+
*
|
|
5047
|
+
* Requires:
|
|
5048
|
+
* 1. WebSocket connected via connectStreamWebSocket()
|
|
5049
|
+
* 2. Authenticated via authenticateStreamWebSocket()
|
|
5050
|
+
* 3. Subscribed to the stream via subscribeToStream()
|
|
5051
|
+
*
|
|
5052
|
+
* @param tokenName - Token name for the stream chat room
|
|
5053
|
+
* @throws ValidationError if WebSocket not connected or not authenticated
|
|
5054
|
+
*
|
|
5055
|
+
* @since 5.11.0
|
|
5056
|
+
* @category WebSocket
|
|
5057
|
+
*
|
|
5058
|
+
* @example Stop typing indicator after sending message
|
|
5059
|
+
* ```typescript
|
|
5060
|
+
* await sdk.sendStreamChatViaWebSocket('mytoken', message);
|
|
5061
|
+
* sdk.sendTypingStop('mytoken');
|
|
5062
|
+
* ```
|
|
5063
|
+
*/
|
|
5064
|
+
sendTypingStop(tokenName: string): void;
|
|
5065
|
+
/**
|
|
5066
|
+
* Disconnect from the stream WebSocket server.
|
|
5067
|
+
*
|
|
5068
|
+
* Closes the WebSocket connection and cleans up resources.
|
|
5069
|
+
*
|
|
5070
|
+
* @since 5.1.0
|
|
5071
|
+
* @category WebSocket
|
|
5072
|
+
*/
|
|
5073
|
+
disconnectStreamWebSocket(): void;
|
|
5074
|
+
/**
|
|
5075
|
+
* Check if stream WebSocket is connected.
|
|
5076
|
+
*
|
|
5077
|
+
* @returns true if WebSocket is connected
|
|
5078
|
+
*
|
|
5079
|
+
* @since 5.1.0
|
|
5080
|
+
* @category WebSocket
|
|
5081
|
+
*/
|
|
5082
|
+
isStreamWebSocketConnected(): boolean;
|
|
5083
|
+
/**
|
|
5084
|
+
* Subscribe to stream status changes (online/offline)
|
|
5085
|
+
*
|
|
5086
|
+
* @param callback - Handler for stream status events
|
|
5087
|
+
* @returns Unsubscribe function
|
|
5088
|
+
*
|
|
5089
|
+
* @since 5.12.0
|
|
5090
|
+
* @category WebSocket
|
|
5091
|
+
*
|
|
5092
|
+
* @example
|
|
5093
|
+
* ```typescript
|
|
5094
|
+
* const unsubscribe = sdk.onStreamStatusChanged((event) => {
|
|
5095
|
+
* console.log(`${event.tokenName}: ${event.status}`);
|
|
5096
|
+
* });
|
|
5097
|
+
* ```
|
|
5098
|
+
*/
|
|
5099
|
+
onStreamStatusChanged(callback: (event: import('./types/streaming-events.dto').StreamStatusChangedEvent) => void | Promise<void>): () => void;
|
|
5100
|
+
/**
|
|
5101
|
+
* Subscribe to user ban events
|
|
5102
|
+
*
|
|
5103
|
+
* @param callback - Handler for user banned events
|
|
5104
|
+
* @returns Unsubscribe function
|
|
5105
|
+
*
|
|
5106
|
+
* @since 5.12.0
|
|
5107
|
+
* @category WebSocket
|
|
5108
|
+
*/
|
|
5109
|
+
onUserBanned(callback: (event: import('./types/streaming-events.dto').UserBannedEvent) => void | Promise<void>): () => void;
|
|
5110
|
+
/**
|
|
5111
|
+
* Subscribe to user unban events
|
|
5112
|
+
*
|
|
5113
|
+
* @param callback - Handler for user unbanned events
|
|
5114
|
+
* @returns Unsubscribe function
|
|
5115
|
+
*
|
|
5116
|
+
* @since 5.12.0
|
|
5117
|
+
* @category WebSocket
|
|
5118
|
+
*/
|
|
5119
|
+
onUserUnbanned(callback: (event: import('./types/streaming-events.dto').UserUnbannedEvent) => void | Promise<void>): () => void;
|
|
5120
|
+
/**
|
|
5121
|
+
* Subscribe to ban enforcement events (kick, mute, ban)
|
|
5122
|
+
*
|
|
5123
|
+
* @param callback - Handler for ban enforcement events
|
|
5124
|
+
* @returns Unsubscribe function
|
|
5125
|
+
*
|
|
5126
|
+
* @since 5.12.0
|
|
5127
|
+
* @category WebSocket
|
|
5128
|
+
*/
|
|
5129
|
+
onBanEnforcement(callback: (event: import('./types/streaming-events.dto').BanEnforcementEvent) => void | Promise<void>): () => void;
|
|
5130
|
+
/**
|
|
5131
|
+
* Subscribe to content flagged events (overseer)
|
|
5132
|
+
*
|
|
5133
|
+
* @param callback - Handler for content flagged events
|
|
5134
|
+
* @returns Unsubscribe function
|
|
5135
|
+
*
|
|
5136
|
+
* @since 5.12.0
|
|
5137
|
+
* @category WebSocket
|
|
5138
|
+
*/
|
|
5139
|
+
onContentFlagged(callback: (event: import('./types/streaming-events.dto').ContentFlaggedEvent) => void | Promise<void>): () => void;
|
|
5140
|
+
/**
|
|
5141
|
+
* Subscribe to flag resolved events
|
|
5142
|
+
*
|
|
5143
|
+
* @param callback - Handler for flag resolved events
|
|
5144
|
+
* @returns Unsubscribe function
|
|
5145
|
+
*
|
|
5146
|
+
* @since 5.12.0
|
|
5147
|
+
* @category WebSocket
|
|
5148
|
+
*/
|
|
5149
|
+
onFlagResolved(callback: (event: import('./types/streaming-events.dto').FlagResolvedEvent) => void | Promise<void>): () => void;
|
|
5150
|
+
/**
|
|
5151
|
+
* Subscribe to new stream chat messages
|
|
5152
|
+
*
|
|
5153
|
+
* @param callback - Handler for chat message events
|
|
5154
|
+
* @returns Unsubscribe function
|
|
5155
|
+
*
|
|
5156
|
+
* @since 5.12.0
|
|
5157
|
+
* @category WebSocket
|
|
5158
|
+
*/
|
|
5159
|
+
onStreamChatMessage(callback: (event: import('./types/streaming-events.dto').StreamChatMessageEvent) => void | Promise<void>): () => void;
|
|
5160
|
+
/**
|
|
5161
|
+
* Subscribe to stream chat message updates
|
|
5162
|
+
*
|
|
5163
|
+
* @param callback - Handler for message updated events
|
|
5164
|
+
* @returns Unsubscribe function
|
|
5165
|
+
*
|
|
5166
|
+
* @since 5.12.0
|
|
5167
|
+
* @category WebSocket
|
|
5168
|
+
*/
|
|
5169
|
+
onStreamChatUpdated(callback: (event: import('./types/streaming-events.dto').StreamChatUpdatedEvent) => void | Promise<void>): () => void;
|
|
5170
|
+
/**
|
|
5171
|
+
* Subscribe to stream chat message deletions
|
|
5172
|
+
*
|
|
5173
|
+
* @param callback - Handler for message deleted events
|
|
5174
|
+
* @returns Unsubscribe function
|
|
5175
|
+
*
|
|
5176
|
+
* @since 5.12.0
|
|
5177
|
+
* @category WebSocket
|
|
5178
|
+
*/
|
|
5179
|
+
onStreamChatDeleted(callback: (event: import('./types/streaming-events.dto').StreamChatDeletedEvent) => void | Promise<void>): () => void;
|
|
5180
|
+
/**
|
|
5181
|
+
* Subscribe to stream chat message pins
|
|
5182
|
+
*
|
|
5183
|
+
* @param callback - Handler for message pinned events
|
|
5184
|
+
* @returns Unsubscribe function
|
|
5185
|
+
*
|
|
5186
|
+
* @since 5.12.0
|
|
5187
|
+
* @category WebSocket
|
|
5188
|
+
*/
|
|
5189
|
+
onStreamChatPinned(callback: (event: import('./types/streaming-events.dto').StreamChatPinnedEvent) => void | Promise<void>): () => void;
|
|
5190
|
+
/**
|
|
5191
|
+
* Subscribe to stream chat message unpins
|
|
5192
|
+
*
|
|
5193
|
+
* @param callback - Handler for message unpinned events
|
|
5194
|
+
* @returns Unsubscribe function
|
|
5195
|
+
*
|
|
5196
|
+
* @since 5.12.0
|
|
5197
|
+
* @category WebSocket
|
|
5198
|
+
*/
|
|
5199
|
+
onStreamChatUnpinned(callback: (event: import('./types/streaming-events.dto').StreamChatUnpinnedEvent) => void | Promise<void>): () => void;
|
|
5200
|
+
/**
|
|
5201
|
+
* Subscribe to chat status changes (enable/disable)
|
|
5202
|
+
*
|
|
5203
|
+
* @param callback - Handler for chat status events
|
|
5204
|
+
* @returns Unsubscribe function
|
|
5205
|
+
*
|
|
5206
|
+
* @since 5.12.0
|
|
5207
|
+
* @category WebSocket
|
|
5208
|
+
*/
|
|
5209
|
+
onChatStatusChanged(callback: (event: import('./types/streaming-events.dto').ChatStatusChangedEvent) => void | Promise<void>): () => void;
|
|
5210
|
+
/**
|
|
5211
|
+
* Subscribe to viewer count changes
|
|
5212
|
+
*
|
|
5213
|
+
* @param callback - Handler for viewer count events
|
|
5214
|
+
* @returns Unsubscribe function
|
|
5215
|
+
*
|
|
5216
|
+
* @since 5.12.0
|
|
5217
|
+
* @category WebSocket
|
|
5218
|
+
*/
|
|
5219
|
+
onViewerCountChanged(callback: (event: import('./types/streaming-events.dto').ViewerCountChangedEvent) => void | Promise<void>): () => void;
|
|
5220
|
+
/**
|
|
5221
|
+
* Subscribe to recording status changes
|
|
5222
|
+
*
|
|
5223
|
+
* @param callback - Handler for recording status events
|
|
5224
|
+
* @returns Unsubscribe function
|
|
5225
|
+
*
|
|
5226
|
+
* @since 5.12.0
|
|
5227
|
+
* @category WebSocket
|
|
5228
|
+
*/
|
|
5229
|
+
onRecordingStatusChanged(callback: (event: import('./types/streaming-events.dto').RecordingStatusChangedEvent) => void | Promise<void>): () => void;
|
|
5230
|
+
/**
|
|
5231
|
+
* Subscribe to simulcast target status changes
|
|
5232
|
+
*
|
|
5233
|
+
* @param callback - Handler for simulcast status events
|
|
5234
|
+
* @returns Unsubscribe function
|
|
5235
|
+
*
|
|
5236
|
+
* @since 5.12.0
|
|
5237
|
+
* @category WebSocket
|
|
5238
|
+
*/
|
|
5239
|
+
onSimulcastStatusChanged(callback: (event: import('./types/streaming-events.dto').SimulcastStatusChangedEvent) => void | Promise<void>): () => void;
|
|
5240
|
+
/**
|
|
5241
|
+
* Subscribe to download ready events
|
|
5242
|
+
*
|
|
5243
|
+
* @param callback - Handler for download ready events
|
|
5244
|
+
* @returns Unsubscribe function
|
|
5245
|
+
*
|
|
5246
|
+
* @since 5.12.0
|
|
5247
|
+
* @category WebSocket
|
|
5248
|
+
*/
|
|
5249
|
+
onDownloadReady(callback: (event: import('./types/streaming-events.dto').DownloadReadyEvent) => void | Promise<void>): () => void;
|
|
5250
|
+
/**
|
|
5251
|
+
* Subscribe to user typing indicators
|
|
5252
|
+
*
|
|
5253
|
+
* @param callback - Handler for user typing events
|
|
5254
|
+
* @returns Unsubscribe function
|
|
5255
|
+
*
|
|
5256
|
+
* @since 5.12.0
|
|
5257
|
+
* @category WebSocket
|
|
5258
|
+
*/
|
|
5259
|
+
onUserTyping(callback: (event: import('./types/streaming-events.dto').UserTypingEvent) => void | Promise<void>): () => void;
|
|
5260
|
+
/**
|
|
5261
|
+
* Subscribe to stream reactions (emoji)
|
|
5262
|
+
*
|
|
5263
|
+
* @param callback - Handler for stream reaction events
|
|
5264
|
+
* @returns Unsubscribe function
|
|
5265
|
+
*
|
|
5266
|
+
* @since 5.12.0
|
|
5267
|
+
* @category WebSocket
|
|
5268
|
+
*/
|
|
5269
|
+
onStreamReaction(callback: (event: import('./types/streaming-events.dto').StreamReactionEvent) => void | Promise<void>): () => void;
|
|
5270
|
+
/**
|
|
5271
|
+
* Subscribe to content reaction additions
|
|
5272
|
+
*
|
|
5273
|
+
* @param callback - Handler for content reaction added events
|
|
5274
|
+
* @returns Unsubscribe function
|
|
5275
|
+
*
|
|
5276
|
+
* @since 5.12.0
|
|
5277
|
+
* @category WebSocket
|
|
5278
|
+
*/
|
|
5279
|
+
onContentReactionAdded(callback: (event: import('./types/streaming-events.dto').ContentReactionAddedEvent) => void | Promise<void>): () => void;
|
|
5280
|
+
/**
|
|
5281
|
+
* Subscribe to content reaction removals
|
|
5282
|
+
*
|
|
5283
|
+
* @param callback - Handler for content reaction removed events
|
|
5284
|
+
* @returns Unsubscribe function
|
|
5285
|
+
*
|
|
5286
|
+
* @since 5.12.0
|
|
5287
|
+
* @category WebSocket
|
|
5288
|
+
*/
|
|
5289
|
+
onContentReactionRemoved(callback: (event: import('./types/streaming-events.dto').ContentReactionRemovedEvent) => void | Promise<void>): () => void;
|
|
5290
|
+
/**
|
|
5291
|
+
* Subscribe to stream countdown updates
|
|
5292
|
+
*
|
|
5293
|
+
* @param callback - Handler for countdown updated events
|
|
5294
|
+
* @returns Unsubscribe function
|
|
5295
|
+
*
|
|
5296
|
+
* @since 5.12.0
|
|
5297
|
+
* @category WebSocket
|
|
5298
|
+
*/
|
|
5299
|
+
onStreamCountdownUpdated(callback: (event: import('./types/streaming-events.dto').StreamCountdownUpdatedEvent) => void | Promise<void>): () => void;
|
|
5300
|
+
/**
|
|
5301
|
+
* Subscribe to stream language updates
|
|
5302
|
+
*
|
|
5303
|
+
* @param callback - Handler for language updated events
|
|
5304
|
+
* @returns Unsubscribe function
|
|
5305
|
+
*
|
|
5306
|
+
* @since 5.12.0
|
|
5307
|
+
* @category WebSocket
|
|
5308
|
+
*/
|
|
5309
|
+
onStreamLanguageUpdated(callback: (event: import('./types/streaming-events.dto').StreamLanguageUpdatedEvent) => void | Promise<void>): () => void;
|
|
5310
|
+
/**
|
|
5311
|
+
* Subscribe to stream control status changes
|
|
5312
|
+
*
|
|
5313
|
+
* @param callback - Handler for control status changed events
|
|
5314
|
+
* @returns Unsubscribe function
|
|
5315
|
+
*
|
|
5316
|
+
* @since 5.12.0
|
|
5317
|
+
* @category WebSocket
|
|
5318
|
+
*/
|
|
5319
|
+
onStreamControlStatusChanged(callback: (event: import('./types/streaming-events.dto').StreamControlStatusChangedEvent) => void | Promise<void>): () => void;
|
|
5320
|
+
/**
|
|
5321
|
+
* Subscribe to WebSocket connection events
|
|
5322
|
+
*
|
|
5323
|
+
* @param callback - Handler for connection events
|
|
5324
|
+
* @returns Unsubscribe function
|
|
5325
|
+
*
|
|
5326
|
+
* @since 5.12.0
|
|
5327
|
+
* @category WebSocket
|
|
5328
|
+
*/
|
|
5329
|
+
onConnection(callback: (event: import('./types/streaming-events.dto').ConnectionEvent) => void | Promise<void>): () => void;
|
|
5330
|
+
/**
|
|
5331
|
+
* Subscribe to WebSocket authentication events
|
|
5332
|
+
*
|
|
5333
|
+
* @param callback - Handler for authenticated events
|
|
5334
|
+
* @returns Unsubscribe function
|
|
5335
|
+
*
|
|
5336
|
+
* @since 5.12.0
|
|
5337
|
+
* @category WebSocket
|
|
5338
|
+
*/
|
|
5339
|
+
onAuthenticated(callback: (event: import('./types/streaming-events.dto').AuthenticatedEvent) => void | Promise<void>): () => void;
|
|
5340
|
+
/**
|
|
5341
|
+
* Subscribe to token stream room subscription events
|
|
5342
|
+
*
|
|
5343
|
+
* @param callback - Handler for token subscribed events
|
|
5344
|
+
* @returns Unsubscribe function
|
|
5345
|
+
*
|
|
5346
|
+
* @since 5.12.0
|
|
5347
|
+
* @category WebSocket
|
|
5348
|
+
*/
|
|
5349
|
+
onTokenSubscribed(callback: (event: import('./types/streaming-events.dto').TokenSubscribedEvent) => void | Promise<void>): () => void;
|
|
5350
|
+
/**
|
|
5351
|
+
* Subscribe to token stream room unsubscription events
|
|
5352
|
+
*
|
|
5353
|
+
* @param callback - Handler for token unsubscribed events
|
|
5354
|
+
* @returns Unsubscribe function
|
|
5355
|
+
*
|
|
5356
|
+
* @since 5.12.0
|
|
5357
|
+
* @category WebSocket
|
|
5358
|
+
*/
|
|
5359
|
+
onTokenUnsubscribed(callback: (event: import('./types/streaming-events.dto').TokenUnsubscribedEvent) => void | Promise<void>): () => void;
|
|
5360
|
+
/**
|
|
5361
|
+
* Subscribe to comment room subscription events
|
|
5362
|
+
*
|
|
5363
|
+
* @param callback - Handler for room subscribed events
|
|
5364
|
+
* @returns Unsubscribe function
|
|
5365
|
+
*
|
|
5366
|
+
* @since 5.12.0
|
|
5367
|
+
* @category WebSocket
|
|
5368
|
+
*/
|
|
5369
|
+
onRoomSubscribed(callback: (event: import('./types/streaming-events.dto').RoomSubscribedEvent) => void | Promise<void>): () => void;
|
|
5370
|
+
/**
|
|
5371
|
+
* Subscribe to comment room unsubscription events
|
|
5372
|
+
*
|
|
5373
|
+
* @param callback - Handler for room left events
|
|
5374
|
+
* @returns Unsubscribe function
|
|
5375
|
+
*
|
|
5376
|
+
* @since 5.12.0
|
|
5377
|
+
* @category WebSocket
|
|
5378
|
+
*/
|
|
5379
|
+
onRoomLeft(callback: (event: import('./types/streaming-events.dto').RoomLeftEvent) => void | Promise<void>): () => void;
|
|
5380
|
+
/**
|
|
5381
|
+
* Estimate bridge fees for a cross-chain transfer.
|
|
5382
|
+
*
|
|
5383
|
+
* Calculates the expected fees for bridging tokens from GalaChain to an
|
|
5384
|
+
* external chain (Ethereum or Solana).
|
|
5385
|
+
*
|
|
5386
|
+
* @param params - Fee estimation parameters
|
|
5387
|
+
* @returns Promise resolving to fee estimate with breakdown
|
|
5388
|
+
* @throws Error if wallet is not configured
|
|
5389
|
+
* @throws Error if token is not bridgeable to the destination chain
|
|
5390
|
+
*
|
|
5391
|
+
* @since 4.0.16
|
|
5392
|
+
* @category Bridge
|
|
5393
|
+
*
|
|
5394
|
+
* @example Estimate fee for bridging GALA to Ethereum
|
|
5395
|
+
* ```typescript
|
|
5396
|
+
* const fee = await sdk.estimateBridgeFee({
|
|
5397
|
+
* tokenId: 'GALA|Unit|none|none',
|
|
5398
|
+
* destinationChain: 'Ethereum',
|
|
5399
|
+
* amount: '100',
|
|
5400
|
+
* });
|
|
5401
|
+
* console.log(`Fee: ${fee.totalFee} GALA`);
|
|
5402
|
+
* ```
|
|
5403
|
+
*/
|
|
5404
|
+
estimateBridgeFee(params: EstimateBridgeFeeParams): Promise<BridgeFeeEstimate>;
|
|
5405
|
+
/**
|
|
5406
|
+
* Bridge tokens from GalaChain to an external chain.
|
|
5407
|
+
*
|
|
5408
|
+
* Initiates a cross-chain transfer from GalaChain to Ethereum or Solana.
|
|
5409
|
+
* The transfer will lock tokens on GalaChain and mint wrapped tokens on
|
|
5410
|
+
* the destination chain.
|
|
5411
|
+
*
|
|
5412
|
+
* @param params - Bridge out parameters
|
|
5413
|
+
* @returns Promise resolving to transaction details
|
|
5414
|
+
* @throws Error if wallet is not configured
|
|
5415
|
+
* @throws Error if token is not bridgeable to the destination chain
|
|
5416
|
+
* @throws Error if recipient address is invalid
|
|
5417
|
+
*
|
|
5418
|
+
* @since 4.0.16
|
|
5419
|
+
* @category Bridge
|
|
5420
|
+
*
|
|
5421
|
+
* @example Bridge GALA to Ethereum
|
|
5422
|
+
* ```typescript
|
|
5423
|
+
* const result = await sdk.bridgeOut({
|
|
5424
|
+
* tokenId: 'GALA|Unit|none|none',
|
|
5425
|
+
* amount: '100',
|
|
5426
|
+
* destinationChain: 'Ethereum',
|
|
5427
|
+
* recipientAddress: '0x1234...abcd',
|
|
5428
|
+
* });
|
|
5429
|
+
* console.log(`Transaction: ${result.transactionHash}`);
|
|
5430
|
+
* ```
|
|
5431
|
+
*/
|
|
5432
|
+
bridgeOut(params: BridgeOutParams): Promise<BridgeTransaction>;
|
|
5433
|
+
/**
|
|
5434
|
+
* Bridge tokens from an external chain to GalaChain.
|
|
5435
|
+
*
|
|
5436
|
+
* Initiates a cross-chain transfer from Ethereum or Solana to GalaChain.
|
|
5437
|
+
* The transfer will burn wrapped tokens on the source chain and unlock
|
|
5438
|
+
* tokens on GalaChain.
|
|
5439
|
+
*
|
|
5440
|
+
* @param params - Bridge in parameters
|
|
5441
|
+
* @returns Promise resolving to transaction details
|
|
5442
|
+
* @throws Error if wallet is not configured
|
|
5443
|
+
* @throws Error if token is not bridgeable from the source chain
|
|
5444
|
+
*
|
|
5445
|
+
* @since 4.0.16
|
|
5446
|
+
* @category Bridge
|
|
5447
|
+
*
|
|
5448
|
+
* @example Bridge GALA from Ethereum to GalaChain
|
|
5449
|
+
* ```typescript
|
|
5450
|
+
* const result = await sdk.bridgeIn({
|
|
5451
|
+
* tokenId: 'GALA|Unit|none|none',
|
|
5452
|
+
* amount: '100',
|
|
5453
|
+
* sourceChain: 'Ethereum',
|
|
5454
|
+
* });
|
|
5455
|
+
* console.log(`Transaction: ${result.transactionHash}`);
|
|
5456
|
+
* ```
|
|
5457
|
+
*/
|
|
5458
|
+
bridgeIn(params: BridgeInParams): Promise<BridgeTransaction>;
|
|
5459
|
+
/**
|
|
5460
|
+
* Get the status of a bridge transaction.
|
|
5461
|
+
*
|
|
5462
|
+
* Checks the current status of a cross-chain bridge transaction.
|
|
5463
|
+
*
|
|
5464
|
+
* @param transactionHash - Transaction hash to check
|
|
5465
|
+
* @param chainHint - Optional chain hint for faster lookup
|
|
5466
|
+
* @returns Promise resolving to bridge status
|
|
5467
|
+
*
|
|
5468
|
+
* @since 4.0.16
|
|
5469
|
+
* @category Bridge
|
|
5470
|
+
*
|
|
5471
|
+
* @example Check bridge status
|
|
5472
|
+
* ```typescript
|
|
5473
|
+
* const status = await sdk.getBridgeStatus(
|
|
5474
|
+
* '0x1234...abcd',
|
|
5475
|
+
* 'Ethereum'
|
|
5476
|
+
* );
|
|
5477
|
+
* console.log(`Status: ${status.status}`);
|
|
5478
|
+
* ```
|
|
5479
|
+
*/
|
|
5480
|
+
getBridgeStatus(transactionHash: string, chainHint?: 'Ethereum' | 'Solana'): Promise<BridgeStatus>;
|
|
5481
|
+
/**
|
|
5482
|
+
* Get list of tokens supported for bridging.
|
|
5483
|
+
*
|
|
5484
|
+
* Returns the static list of tokens that can be bridged between
|
|
5485
|
+
* GalaChain and external chains.
|
|
5486
|
+
*
|
|
5487
|
+
* @returns Promise resolving to supported bridge tokens
|
|
5488
|
+
*
|
|
5489
|
+
* @since 4.0.16
|
|
5490
|
+
* @category Bridge
|
|
5491
|
+
*
|
|
5492
|
+
* @example Get supported tokens
|
|
5493
|
+
* ```typescript
|
|
5494
|
+
* const tokens = await sdk.getSupportedBridgeTokens();
|
|
5495
|
+
* tokens.tokens.forEach(t => {
|
|
5496
|
+
* console.log(`${t.symbol}: ${t.supportedChains.join(', ')}`);
|
|
5497
|
+
* });
|
|
5498
|
+
* ```
|
|
5499
|
+
*/
|
|
5500
|
+
getSupportedBridgeTokens(): Promise<{
|
|
5501
|
+
tokens: BridgeToken[];
|
|
5502
|
+
totalCount: number;
|
|
5503
|
+
supportedChains: string[];
|
|
5504
|
+
}>;
|
|
5505
|
+
/**
|
|
5506
|
+
* Fetch token balance from GalaChain (published tokens) or DEX API (launchpad tokens)
|
|
5507
|
+
*
|
|
5508
|
+
* This method queries either the GalaChain gateway directly for published tokens
|
|
5509
|
+
* or the DEX API for launchpad tokens, providing reliable results.
|
|
5510
|
+
*
|
|
5511
|
+
* @param options Token balance options with flexible token identification
|
|
5512
|
+
* @returns Promise<TokenBalanceResult | null>
|
|
5513
|
+
*
|
|
5514
|
+
* @example
|
|
5515
|
+
* ```typescript
|
|
5516
|
+
* // Using string format
|
|
5517
|
+
* const galaBalance = await sdk.fetchTokenBalance({
|
|
5518
|
+
* address: sdk.getAddress(),
|
|
5519
|
+
* tokenId: "GALA|Unit|none|none"
|
|
5520
|
+
* });
|
|
5521
|
+
*
|
|
5522
|
+
* // Using TokenClassKey object
|
|
5523
|
+
* const tokenClass = await sdk.resolveTokenClassKey('unicorn');
|
|
5524
|
+
* const unicornBalance = await sdk.fetchTokenBalance({
|
|
5525
|
+
* address: sdk.getAddress(),
|
|
5526
|
+
* tokenClassKey: tokenClass
|
|
5527
|
+
* });
|
|
5528
|
+
*
|
|
5529
|
+
* // Using TokenInstanceKey object
|
|
5530
|
+
* const unicornBalance2 = await sdk.fetchTokenBalance({
|
|
5531
|
+
* address: sdk.getAddress(),
|
|
5532
|
+
* tokenId: {
|
|
5533
|
+
* collection: "Token",
|
|
5534
|
+
* category: "Unit",
|
|
5535
|
+
* type: "UNI",
|
|
5536
|
+
* additionalKey: "eth:9401b171307bE656f00F9e18DF756643FD3a91dE",
|
|
5537
|
+
* instance: "0"
|
|
5538
|
+
* }
|
|
5539
|
+
* });
|
|
5540
|
+
*
|
|
5541
|
+
* // Using token name for convenience
|
|
5542
|
+
* const unicornBalance3 = await sdk.fetchTokenBalance({
|
|
5543
|
+
* address: sdk.getAddress(),
|
|
5544
|
+
* tokenName: "unicorn"
|
|
5545
|
+
* });
|
|
5546
|
+
* ```
|
|
5547
|
+
*/
|
|
5548
|
+
fetchTokenBalance(options: FetchTokenBalanceOptions): Promise<import("./types/user.dto").TokenBalanceResult | {
|
|
5549
|
+
quantity: unknown;
|
|
5550
|
+
collection: string;
|
|
5551
|
+
category: string;
|
|
5552
|
+
tokenId: string;
|
|
5553
|
+
symbol: string;
|
|
5554
|
+
name: string;
|
|
5555
|
+
} | null>;
|
|
5556
|
+
/**
|
|
5557
|
+
* Fetch only locked balance for a token
|
|
5558
|
+
*
|
|
5559
|
+
* Returns focused information about locked tokens including lock details.
|
|
5560
|
+
* Requires tokenId (not tokenName) as lock details are only available from GalaChain.
|
|
5561
|
+
*
|
|
5562
|
+
* @param options Balance query options (must include tokenId, not tokenName)
|
|
5563
|
+
* @returns Promise<LockedBalanceResult | null> Locked balance details or null if no balance
|
|
5564
|
+
* @throws Error if tokenName is provided (lock details require tokenId)
|
|
5565
|
+
*
|
|
5566
|
+
* @example
|
|
2557
5567
|
* ```typescript
|
|
2558
5568
|
* const locked = await sdk.fetchLockedBalance({
|
|
2559
5569
|
* address: sdk.getAddress(),
|
|
@@ -3261,6 +6271,56 @@ export declare class LaunchpadSDK {
|
|
|
3261
6271
|
* ```
|
|
3262
6272
|
*/
|
|
3263
6273
|
uploadTokenImage(options: UploadImageByTokenNameOptions): Promise<string>;
|
|
6274
|
+
/**
|
|
6275
|
+
* Updates token social media links (v6.x.0+)
|
|
6276
|
+
*
|
|
6277
|
+
* Requires JWT authentication (pool owner only).
|
|
6278
|
+
* Updates the social media URLs for a token pool.
|
|
6279
|
+
*
|
|
6280
|
+
* @category Token Management
|
|
6281
|
+
* @param options Update options containing tokenName and social URLs
|
|
6282
|
+
* @returns Updated token metadata with social links
|
|
6283
|
+
* @throws {ValidationError} If token name is invalid
|
|
6284
|
+
* @throws {ConfigurationError} If JWT auth is not configured
|
|
6285
|
+
* @throws {Error} If user is not authorized to update this token
|
|
6286
|
+
* @since 6.x.0
|
|
6287
|
+
*
|
|
6288
|
+
* @example Update token socials
|
|
6289
|
+
* ```typescript
|
|
6290
|
+
* const result = await sdk.updateTokenSocials({
|
|
6291
|
+
* tokenName: 'mytoken',
|
|
6292
|
+
* websiteUrl: 'https://example.com',
|
|
6293
|
+
* twitterUrl: 'https://twitter.com/example',
|
|
6294
|
+
* telegramUrl: 'https://t.me/example',
|
|
6295
|
+
* });
|
|
6296
|
+
* console.log('Updated socials:', result);
|
|
6297
|
+
* ```
|
|
6298
|
+
*/
|
|
6299
|
+
updateTokenSocials(options: UpdateSocialLinksDto): Promise<UpdateSocialLinksResponse>;
|
|
6300
|
+
/**
|
|
6301
|
+
* Checks if a pool exists (v6.x.0+)
|
|
6302
|
+
*
|
|
6303
|
+
* Convenience method that checks pool existence by token name or symbol.
|
|
6304
|
+
* At least one parameter is required.
|
|
6305
|
+
*
|
|
6306
|
+
* @category Token Validation
|
|
6307
|
+
* @param tokenName Optional token name to check
|
|
6308
|
+
* @param symbol Optional token symbol to check
|
|
6309
|
+
* @returns Promise<boolean> True if pool exists, false otherwise
|
|
6310
|
+
* @throws {ValidationError} If neither parameter is provided
|
|
6311
|
+
* @since 6.x.0
|
|
6312
|
+
*
|
|
6313
|
+
* @example Check pool existence
|
|
6314
|
+
* ```typescript
|
|
6315
|
+
* const exists = await sdk.checkPoolExists('mytoken');
|
|
6316
|
+
* console.log('Pool exists:', exists);
|
|
6317
|
+
*
|
|
6318
|
+
* // Or check by symbol
|
|
6319
|
+
* const existsBySymbol = await sdk.checkPoolExists(undefined, 'MT');
|
|
6320
|
+
* console.log('Pool with symbol MT exists:', existsBySymbol);
|
|
6321
|
+
* ```
|
|
6322
|
+
*/
|
|
6323
|
+
checkPoolExists(tokenName?: string, symbol?: string): Promise<boolean>;
|
|
3264
6324
|
/**
|
|
3265
6325
|
* Check if a token name is available for use
|
|
3266
6326
|
*
|
|
@@ -3711,6 +6771,48 @@ export declare class LaunchpadSDK {
|
|
|
3711
6771
|
* - Passing both parameters together is discouraged (tokenName takes precedence)
|
|
3712
6772
|
*/
|
|
3713
6773
|
fetchTokensCreated(options?: FetchTokensCreatedOptions): Promise<import("./types/user.dto").UserTokenListResult>;
|
|
6774
|
+
/**
|
|
6775
|
+
* Get all tokens the authenticated user can manage.
|
|
6776
|
+
*
|
|
6777
|
+
* Returns a comprehensive view of the user's management capabilities:
|
|
6778
|
+
* - **ownedTokens**: Tokens the user created (full OWNER access)
|
|
6779
|
+
* - **moderatedTokens**: Tokens with moderator access via claimed invites
|
|
6780
|
+
* - **isOverseer**: Whether user has platform-wide overseer access
|
|
6781
|
+
* - **overseerSince**: When user became overseer (if applicable)
|
|
6782
|
+
*
|
|
6783
|
+
* This is used by the /moderators dashboard page to show all tokens
|
|
6784
|
+
* a user can access in Studio.
|
|
6785
|
+
*
|
|
6786
|
+
* **Requires JWT authentication** - call sdk.login() before using this method.
|
|
6787
|
+
*
|
|
6788
|
+
* @param options Optional pagination options (page, limit)
|
|
6789
|
+
* @returns Promise resolving to managed tokens result
|
|
6790
|
+
* @throws ConfigurationError if JWT auth is not configured
|
|
6791
|
+
* @throws ValidationError if pagination parameters are invalid
|
|
6792
|
+
*
|
|
6793
|
+
* @since 5.11.0
|
|
6794
|
+
* @category User
|
|
6795
|
+
*
|
|
6796
|
+
* @example Get all managed tokens
|
|
6797
|
+
* ```typescript
|
|
6798
|
+
* const managed = await sdk.getManagedTokens();
|
|
6799
|
+
*
|
|
6800
|
+
* console.log(`Owned tokens: ${managed.ownedTokensCount}`);
|
|
6801
|
+
* console.log(`Moderated tokens: ${managed.moderatedTokensCount}`);
|
|
6802
|
+
* console.log(`Is overseer: ${managed.isOverseer}`);
|
|
6803
|
+
*
|
|
6804
|
+
* // List owned tokens with Studio links
|
|
6805
|
+
* managed.ownedTokens.forEach(token => {
|
|
6806
|
+
* console.log(`${token.tokenName} - ${token.isLive ? 'LIVE' : 'offline'}`);
|
|
6807
|
+
* });
|
|
6808
|
+
*
|
|
6809
|
+
* // List moderated tokens with role info
|
|
6810
|
+
* managed.moderatedTokens.forEach(token => {
|
|
6811
|
+
* console.log(`${token.tokenName} - ${token.role} (${token.inviteScope})`);
|
|
6812
|
+
* });
|
|
6813
|
+
* ```
|
|
6814
|
+
*/
|
|
6815
|
+
getManagedTokens(options?: GetManagedTokensOptions): Promise<ManagedTokensResult>;
|
|
3714
6816
|
/**
|
|
3715
6817
|
* Fetch historical price data for DEX tokens via DEX Backend API
|
|
3716
6818
|
*
|
|
@@ -4130,22 +7232,6 @@ export declare class LaunchpadSDK {
|
|
|
4130
7232
|
* - Returns quote with estimated output, fee tier, and price impact
|
|
4131
7233
|
* - Automatically selects optimal liquidity pool for best pricing
|
|
4132
7234
|
*
|
|
4133
|
-
* Phase 2 Migration Plan:
|
|
4134
|
-
* This method will be migrated to eliminate GSwap SDK dependency by:
|
|
4135
|
-
* 1. Implementing quote calculation directly in BundlerService
|
|
4136
|
-
* 2. Fetching pool state directly from GalaChain (Slot0, liquidity, ticks)
|
|
4137
|
-
* 3. Implementing Uniswap V3 quote algorithm locally
|
|
4138
|
-
* 4. Adding intelligent route finding for multi-hop swaps
|
|
4139
|
-
* 5. Adding quote result caching for performance
|
|
4140
|
-
* 6. Maintaining backward-compatible API while removing SDK dependency
|
|
4141
|
-
*
|
|
4142
|
-
* Benefits of Phase 2 Migration:
|
|
4143
|
-
* - Eliminates external GSwap SDK dependency
|
|
4144
|
-
* - Enables offline quote calculations
|
|
4145
|
-
* - Adds quote caching for repeated queries
|
|
4146
|
-
* - Better control over quote accuracy and staleness
|
|
4147
|
-
* - Foundation for more advanced routing strategies
|
|
4148
|
-
*
|
|
4149
7235
|
* @category DEX Trading
|
|
4150
7236
|
* @param fromToken Source token in pipe-delimited format (e.g., "GALA|Unit|none|none")
|
|
4151
7237
|
* @param toToken Destination token in pipe-delimited format (e.g., "GUSDC|Unit|none|none")
|
|
@@ -4176,22 +7262,6 @@ export declare class LaunchpadSDK {
|
|
|
4176
7262
|
* - Returns quote with required input, fee tier, and price impact
|
|
4177
7263
|
* - Ensures amount constraints are satisfied with slippage buffer
|
|
4178
7264
|
*
|
|
4179
|
-
* Phase 2 Migration Plan:
|
|
4180
|
-
* This method will be migrated to eliminate GSwap SDK dependency by:
|
|
4181
|
-
* 1. Implementing quote calculation directly in BundlerService
|
|
4182
|
-
* 2. Fetching pool state directly from GalaChain (Slot0, liquidity, ticks)
|
|
4183
|
-
* 3. Implementing reverse Uniswap V3 quote algorithm locally
|
|
4184
|
-
* 4. Adding intelligent route finding for multi-hop swaps
|
|
4185
|
-
* 5. Adding quote result caching for performance
|
|
4186
|
-
* 6. Maintaining backward-compatible API while removing SDK dependency
|
|
4187
|
-
*
|
|
4188
|
-
* Benefits of Phase 2 Migration:
|
|
4189
|
-
* - Eliminates external GSwap SDK dependency
|
|
4190
|
-
* - Enables offline quote calculations
|
|
4191
|
-
* - Adds quote caching for repeated queries
|
|
4192
|
-
* - Better control over quote accuracy and staleness
|
|
4193
|
-
* - Foundation for more advanced routing strategies
|
|
4194
|
-
*
|
|
4195
7265
|
* @category DEX Trading
|
|
4196
7266
|
* @param fromToken Source token in pipe-delimited format (e.g., "GALA|Unit|none|none")
|
|
4197
7267
|
* @param toToken Destination token in pipe-delimited format (e.g., "GUSDC|Unit|none|none")
|
|
@@ -4638,7 +7708,7 @@ export declare class LaunchpadSDK {
|
|
|
4638
7708
|
tickLower: number;
|
|
4639
7709
|
tickUpper: number;
|
|
4640
7710
|
owner: string;
|
|
4641
|
-
}): Promise<import("
|
|
7711
|
+
}): Promise<import(".").GSwapEstimateRemoveLiquidityResult>;
|
|
4642
7712
|
/**
|
|
4643
7713
|
* Add liquidity using price range
|
|
4644
7714
|
*
|
|
@@ -4675,7 +7745,7 @@ export declare class LaunchpadSDK {
|
|
|
4675
7745
|
* console.log(`Position created: ${result.positionId}`);
|
|
4676
7746
|
* ```
|
|
4677
7747
|
*/
|
|
4678
|
-
addSwapLiquidityByPrice(args: AddLiquidityByPriceArgs): Promise<import("
|
|
7748
|
+
addSwapLiquidityByPrice(args: AddLiquidityByPriceArgs): Promise<import(".").GSwapAddLiquidityResult & {
|
|
4679
7749
|
timestamp?: Date;
|
|
4680
7750
|
wait?: (timeoutMs?: number) => Promise<void>;
|
|
4681
7751
|
}>;
|
|
@@ -4712,7 +7782,7 @@ export declare class LaunchpadSDK {
|
|
|
4712
7782
|
* console.log(`Position created: ${result.positionId}`);
|
|
4713
7783
|
* ```
|
|
4714
7784
|
*/
|
|
4715
|
-
addSwapLiquidityByTicks(args: AddLiquidityByTicksArgs): Promise<import("
|
|
7785
|
+
addSwapLiquidityByTicks(args: AddLiquidityByTicksArgs): Promise<import(".").GSwapAddLiquidityResult & {
|
|
4716
7786
|
timestamp?: Date;
|
|
4717
7787
|
wait?: (timeoutMs?: number) => Promise<void>;
|
|
4718
7788
|
}>;
|
|
@@ -4767,7 +7837,7 @@ export declare class LaunchpadSDK {
|
|
|
4767
7837
|
* });
|
|
4768
7838
|
* ```
|
|
4769
7839
|
*/
|
|
4770
|
-
removeSwapLiquidity(args: RemoveLiquidityArgs): Promise<import("
|
|
7840
|
+
removeSwapLiquidity(args: RemoveLiquidityArgs): Promise<import(".").GSwapAddLiquidityResult>;
|
|
4771
7841
|
/**
|
|
4772
7842
|
* Collect accumulated position fees
|
|
4773
7843
|
*
|
|
@@ -4791,7 +7861,7 @@ export declare class LaunchpadSDK {
|
|
|
4791
7861
|
* console.log(`Collected: ${result.amount0} token0, ${result.amount1} token1`);
|
|
4792
7862
|
* ```
|
|
4793
7863
|
*/
|
|
4794
|
-
collectSwapPositionFees(args: CollectFeesArgs): Promise<import("
|
|
7864
|
+
collectSwapPositionFees(args: CollectFeesArgs): Promise<import(".").GSwapAddLiquidityResult>;
|
|
4795
7865
|
/**
|
|
4796
7866
|
* Connect to WebSocket for real-time events
|
|
4797
7867
|
*
|
|
@@ -5191,6 +8261,10 @@ export declare class LaunchpadSDK {
|
|
|
5191
8261
|
websiteUrl: string;
|
|
5192
8262
|
telegramUrl: string;
|
|
5193
8263
|
twitterUrl: string;
|
|
8264
|
+
instagramUrl: string;
|
|
8265
|
+
facebookUrl: string;
|
|
8266
|
+
redditUrl: string;
|
|
8267
|
+
tiktokUrl: string;
|
|
5194
8268
|
isFinalized: boolean;
|
|
5195
8269
|
}) => void, options?: {
|
|
5196
8270
|
creatorFilter?: string;
|