@gala-chain/launchpad-mcp-server 5.0.3 → 5.0.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -21
- package/dist/ai-docs.json +7357 -0
- package/dist/constants/mcpToolNames.d.ts +3 -1
- package/dist/constants/mcpToolNames.d.ts.map +1 -1
- package/dist/constants/mcpToolNames.js +2 -1
- package/dist/constants/mcpToolNames.js.map +1 -1
- package/dist/explain-sdk-usage-ai.json +3445 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.d.ts.map +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/generated/version.js.map +1 -1
- package/dist/prompts/account.d.ts +24 -0
- package/dist/prompts/account.d.ts.map +1 -0
- package/dist/prompts/account.js +89 -0
- package/dist/prompts/account.js.map +1 -0
- package/dist/prompts/api-keys.d.ts +36 -0
- package/dist/prompts/api-keys.d.ts.map +1 -0
- package/dist/prompts/api-keys.js +251 -0
- package/dist/prompts/api-keys.js.map +1 -0
- package/dist/prompts/auth.d.ts +29 -0
- package/dist/prompts/auth.d.ts.map +1 -0
- package/dist/prompts/auth.js +127 -0
- package/dist/prompts/auth.js.map +1 -0
- package/dist/prompts/balances.d.ts.map +1 -1
- package/dist/prompts/balances.js +17 -17
- package/dist/prompts/balances.js.map +1 -1
- package/dist/prompts/bans.d.ts +23 -0
- package/dist/prompts/bans.d.ts.map +1 -0
- package/dist/prompts/bans.js +82 -0
- package/dist/prompts/bans.js.map +1 -0
- package/dist/prompts/bridge.d.ts +2 -1
- package/dist/prompts/bridge.d.ts.map +1 -1
- package/dist/prompts/bridge.js +91 -227
- package/dist/prompts/bridge.js.map +1 -1
- package/dist/prompts/burns.d.ts +30 -0
- package/dist/prompts/burns.d.ts.map +1 -0
- package/dist/prompts/burns.js +127 -0
- package/dist/prompts/burns.js.map +1 -0
- package/dist/prompts/chat-messages.d.ts +21 -0
- package/dist/prompts/chat-messages.d.ts.map +1 -0
- package/dist/prompts/chat-messages.js +103 -0
- package/dist/prompts/chat-messages.js.map +1 -0
- package/dist/prompts/chat.d.ts +67 -0
- package/dist/prompts/chat.d.ts.map +1 -0
- package/dist/prompts/chat.js +355 -0
- package/dist/prompts/chat.js.map +1 -0
- package/dist/prompts/comments.d.ts +29 -0
- package/dist/prompts/comments.d.ts.map +1 -0
- package/dist/prompts/comments.js +133 -0
- package/dist/prompts/comments.js.map +1 -0
- package/dist/prompts/content-flags.d.ts +29 -0
- package/dist/prompts/content-flags.d.ts.map +1 -0
- package/dist/prompts/content-flags.js +248 -0
- package/dist/prompts/content-flags.js.map +1 -0
- package/dist/prompts/content-reactions.d.ts +29 -0
- package/dist/prompts/content-reactions.d.ts.map +1 -0
- package/dist/prompts/content-reactions.js +77 -0
- package/dist/prompts/content-reactions.js.map +1 -0
- package/dist/prompts/create-token.d.ts.map +1 -1
- package/dist/prompts/create-token.js +11 -18
- package/dist/prompts/create-token.js.map +1 -1
- package/dist/prompts/dex-trading.d.ts.map +1 -1
- package/dist/prompts/dex-trading.js +11 -42
- package/dist/prompts/dex-trading.js.map +1 -1
- package/dist/prompts/discover-tokens.d.ts.map +1 -1
- package/dist/prompts/discover-tokens.js +11 -26
- package/dist/prompts/discover-tokens.js.map +1 -1
- package/dist/prompts/event-subscriptions.d.ts +45 -0
- package/dist/prompts/event-subscriptions.d.ts.map +1 -0
- package/dist/prompts/event-subscriptions.js +330 -0
- package/dist/prompts/event-subscriptions.js.map +1 -0
- package/dist/prompts/explore-dex-pools.d.ts +2 -0
- package/dist/prompts/explore-dex-pools.d.ts.map +1 -1
- package/dist/prompts/explore-dex-pools.js +26 -104
- package/dist/prompts/explore-dex-pools.js.map +1 -1
- package/dist/prompts/factories/balance-prompt-factory.d.ts +102 -0
- package/dist/prompts/factories/balance-prompt-factory.d.ts.map +1 -0
- package/dist/prompts/factories/balance-prompt-factory.js +176 -0
- package/dist/prompts/factories/balance-prompt-factory.js.map +1 -0
- package/dist/prompts/factories/ban-management-factory.d.ts +90 -0
- package/dist/prompts/factories/ban-management-factory.d.ts.map +1 -0
- package/dist/prompts/factories/ban-management-factory.js +330 -0
- package/dist/prompts/factories/ban-management-factory.js.map +1 -0
- package/dist/prompts/factories/calculation-prompt-factory.d.ts +119 -0
- package/dist/prompts/factories/calculation-prompt-factory.d.ts.map +1 -0
- package/dist/prompts/factories/calculation-prompt-factory.js +183 -0
- package/dist/prompts/factories/calculation-prompt-factory.js.map +1 -0
- package/dist/prompts/factories/discovery-prompt-factory.d.ts +135 -0
- package/dist/prompts/factories/discovery-prompt-factory.d.ts.map +1 -0
- package/dist/prompts/factories/discovery-prompt-factory.js +240 -0
- package/dist/prompts/factories/discovery-prompt-factory.js.map +1 -0
- package/dist/prompts/factories/event-subscription-factory.d.ts +177 -0
- package/dist/prompts/factories/event-subscription-factory.d.ts.map +1 -0
- package/dist/prompts/factories/event-subscription-factory.js +329 -0
- package/dist/prompts/factories/event-subscription-factory.js.map +1 -0
- package/dist/prompts/factories/filtered-list-prompt-factory.d.ts +95 -0
- package/dist/prompts/factories/filtered-list-prompt-factory.d.ts.map +1 -0
- package/dist/prompts/factories/filtered-list-prompt-factory.js +147 -0
- package/dist/prompts/factories/filtered-list-prompt-factory.js.map +1 -0
- package/dist/prompts/factories/index.d.ts +33 -0
- package/dist/prompts/factories/index.d.ts.map +1 -0
- package/dist/prompts/factories/index.js +91 -0
- package/dist/prompts/factories/index.js.map +1 -0
- package/dist/prompts/factories/invite-management-factory.d.ts +88 -0
- package/dist/prompts/factories/invite-management-factory.d.ts.map +1 -0
- package/dist/prompts/factories/invite-management-factory.js +262 -0
- package/dist/prompts/factories/invite-management-factory.js.map +1 -0
- package/dist/prompts/factories/reaction-prompt-factory.d.ts +81 -0
- package/dist/prompts/factories/reaction-prompt-factory.d.ts.map +1 -0
- package/dist/prompts/factories/reaction-prompt-factory.js +188 -0
- package/dist/prompts/factories/reaction-prompt-factory.js.map +1 -0
- package/dist/prompts/factories/simple-operation-factory.d.ts +166 -0
- package/dist/prompts/factories/simple-operation-factory.d.ts.map +1 -0
- package/dist/prompts/factories/simple-operation-factory.js +218 -0
- package/dist/prompts/factories/simple-operation-factory.js.map +1 -0
- package/dist/prompts/index.d.ts +31 -6
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +136 -5
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/locks.d.ts.map +1 -1
- package/dist/prompts/locks.js +32 -56
- package/dist/prompts/locks.js.map +1 -1
- package/dist/prompts/moderators.d.ts +22 -0
- package/dist/prompts/moderators.d.ts.map +1 -0
- package/dist/prompts/moderators.js +62 -0
- package/dist/prompts/moderators.js.map +1 -0
- package/dist/prompts/monitoring.d.ts +3 -1
- package/dist/prompts/monitoring.d.ts.map +1 -1
- package/dist/prompts/monitoring.js +52 -140
- package/dist/prompts/monitoring.js.map +1 -1
- package/dist/prompts/overseers.d.ts +34 -0
- package/dist/prompts/overseers.d.ts.map +1 -0
- package/dist/prompts/overseers.js +117 -0
- package/dist/prompts/overseers.js.map +1 -0
- package/dist/prompts/pools.d.ts +22 -20
- package/dist/prompts/pools.d.ts.map +1 -1
- package/dist/prompts/pools.js +150 -251
- package/dist/prompts/pools.js.map +1 -1
- package/dist/prompts/portfolio.d.ts.map +1 -1
- package/dist/prompts/portfolio.js +1 -9
- package/dist/prompts/portfolio.js.map +1 -1
- package/dist/prompts/prompt-factories.d.ts +179 -0
- package/dist/prompts/prompt-factories.d.ts.map +1 -0
- package/dist/prompts/prompt-factories.js +230 -0
- package/dist/prompts/prompt-factories.js.map +1 -0
- package/dist/prompts/referrals.d.ts +27 -0
- package/dist/prompts/referrals.d.ts.map +1 -0
- package/dist/prompts/referrals.js +176 -0
- package/dist/prompts/referrals.js.map +1 -0
- package/dist/prompts/streaming.d.ts +84 -0
- package/dist/prompts/streaming.d.ts.map +1 -0
- package/dist/prompts/streaming.js +411 -0
- package/dist/prompts/streaming.js.map +1 -0
- package/dist/prompts/tier1-bridge-operations.d.ts +30 -0
- package/dist/prompts/tier1-bridge-operations.d.ts.map +1 -0
- package/dist/prompts/tier1-bridge-operations.js +634 -0
- package/dist/prompts/tier1-bridge-operations.js.map +1 -0
- package/dist/prompts/tier1-liquidity-management.d.ts +30 -0
- package/dist/prompts/tier1-liquidity-management.d.ts.map +1 -0
- package/dist/prompts/tier1-liquidity-management.js +560 -0
- package/dist/prompts/tier1-liquidity-management.js.map +1 -0
- package/dist/prompts/tier1-pool-discovery.d.ts +30 -0
- package/dist/prompts/tier1-pool-discovery.d.ts.map +1 -0
- package/dist/prompts/tier1-pool-discovery.js +221 -0
- package/dist/prompts/tier1-pool-discovery.js.map +1 -0
- package/dist/prompts/tier1-price-history.d.ts +30 -0
- package/dist/prompts/tier1-price-history.d.ts.map +1 -0
- package/dist/prompts/tier1-price-history.js +429 -0
- package/dist/prompts/tier1-price-history.js.map +1 -0
- package/dist/prompts/tier1-token-analysis.d.ts +30 -0
- package/dist/prompts/tier1-token-analysis.d.ts.map +1 -0
- package/dist/prompts/tier1-token-analysis.js +376 -0
- package/dist/prompts/tier1-token-analysis.js.map +1 -0
- package/dist/prompts/tier2-account-setup.d.ts +24 -0
- package/dist/prompts/tier2-account-setup.d.ts.map +1 -0
- package/dist/prompts/tier2-account-setup.js +206 -0
- package/dist/prompts/tier2-account-setup.js.map +1 -0
- package/dist/prompts/tier2-advanced-liquidity.d.ts +24 -0
- package/dist/prompts/tier2-advanced-liquidity.d.ts.map +1 -0
- package/dist/prompts/tier2-advanced-liquidity.js +298 -0
- package/dist/prompts/tier2-advanced-liquidity.js.map +1 -0
- package/dist/prompts/tier2-asset-management.d.ts +25 -0
- package/dist/prompts/tier2-asset-management.d.ts.map +1 -0
- package/dist/prompts/tier2-asset-management.js +246 -0
- package/dist/prompts/tier2-asset-management.js.map +1 -0
- package/dist/prompts/tier2-token-lifecycle.d.ts +25 -0
- package/dist/prompts/tier2-token-lifecycle.d.ts.map +1 -0
- package/dist/prompts/tier2-token-lifecycle.js +241 -0
- package/dist/prompts/tier2-token-lifecycle.js.map +1 -0
- package/dist/prompts/tier3-community-engagement.d.ts +26 -0
- package/dist/prompts/tier3-community-engagement.d.ts.map +1 -0
- package/dist/prompts/tier3-community-engagement.js +610 -0
- package/dist/prompts/tier3-community-engagement.js.map +1 -0
- package/dist/prompts/tier3-moderation-workflows.d.ts +31 -0
- package/dist/prompts/tier3-moderation-workflows.d.ts.map +1 -0
- package/dist/prompts/tier3-moderation-workflows.js +511 -0
- package/dist/prompts/tier3-moderation-workflows.js.map +1 -0
- package/dist/prompts/tier3-streaming-management.d.ts +26 -0
- package/dist/prompts/tier3-streaming-management.d.ts.map +1 -0
- package/dist/prompts/tier3-streaming-management.js +797 -0
- package/dist/prompts/tier3-streaming-management.js.map +1 -0
- package/dist/prompts/token-bans.d.ts +27 -0
- package/dist/prompts/token-bans.d.ts.map +1 -0
- package/dist/prompts/token-bans.js +77 -0
- package/dist/prompts/token-bans.js.map +1 -0
- package/dist/prompts/trades.d.ts +22 -0
- package/dist/prompts/trades.d.ts.map +1 -0
- package/dist/prompts/trades.js +107 -0
- package/dist/prompts/trades.js.map +1 -0
- package/dist/prompts/trading-calculations.d.ts +3 -1
- package/dist/prompts/trading-calculations.d.ts.map +1 -1
- package/dist/prompts/trading-calculations.js +134 -270
- package/dist/prompts/trading-calculations.js.map +1 -1
- package/dist/prompts/trading.d.ts +10 -1
- package/dist/prompts/trading.d.ts.map +1 -1
- package/dist/prompts/trading.js +128 -2
- package/dist/prompts/trading.js.map +1 -1
- package/dist/prompts/transfers.d.ts +2 -1
- package/dist/prompts/transfers.d.ts.map +1 -1
- package/dist/prompts/transfers.js +26 -30
- package/dist/prompts/transfers.js.map +1 -1
- package/dist/prompts/uploads.d.ts +19 -0
- package/dist/prompts/uploads.d.ts.map +1 -0
- package/dist/prompts/uploads.js +114 -0
- package/dist/prompts/uploads.js.map +1 -0
- package/dist/prompts/utility-tools.d.ts.map +1 -1
- package/dist/prompts/utility-tools.js +27 -18
- package/dist/prompts/utility-tools.js.map +1 -1
- package/dist/prompts/utils/index.d.ts +21 -0
- package/dist/prompts/utils/index.d.ts.map +1 -0
- package/dist/prompts/utils/index.js +38 -0
- package/dist/prompts/utils/index.js.map +1 -0
- package/dist/prompts/utils/pagination-helpers.d.ts +95 -0
- package/dist/prompts/utils/pagination-helpers.d.ts.map +1 -0
- package/dist/prompts/utils/pagination-helpers.js +121 -0
- package/dist/prompts/utils/pagination-helpers.js.map +1 -0
- package/dist/prompts/utils/workflowTemplates.d.ts.map +1 -1
- package/dist/prompts/utils/workflowTemplates.js +4 -3
- package/dist/prompts/utils/workflowTemplates.js.map +1 -1
- package/dist/prompts/wallet.d.ts +24 -0
- package/dist/prompts/wallet.d.ts.map +1 -0
- package/dist/prompts/wallet.js +139 -0
- package/dist/prompts/wallet.js.map +1 -0
- package/dist/schemas/common-schemas.d.ts +890 -0
- package/dist/schemas/common-schemas.d.ts.map +1 -1
- package/dist/schemas/common-schemas.js +853 -1
- package/dist/schemas/common-schemas.js.map +1 -1
- package/dist/server.d.ts +31 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +68 -7
- package/dist/server.js.map +1 -1
- package/dist/tools/api-keys/index.d.ts +41 -0
- package/dist/tools/api-keys/index.d.ts.map +1 -0
- package/dist/tools/api-keys/index.js +245 -0
- package/dist/tools/api-keys/index.js.map +1 -0
- package/dist/tools/auth/index.d.ts +19 -0
- package/dist/tools/auth/index.d.ts.map +1 -0
- package/dist/tools/auth/index.js +138 -0
- package/dist/tools/auth/index.js.map +1 -0
- package/dist/tools/balance/helpers/format-balance.d.ts +86 -0
- package/dist/tools/balance/helpers/format-balance.d.ts.map +1 -0
- package/dist/tools/balance/helpers/format-balance.js +87 -0
- package/dist/tools/balance/helpers/format-balance.js.map +1 -0
- package/dist/tools/balance/index.d.ts +4 -4
- package/dist/tools/balance/index.d.ts.map +1 -1
- package/dist/tools/balance/index.js +64 -176
- package/dist/tools/balance/index.js.map +1 -1
- package/dist/tools/ban/index.d.ts +37 -0
- package/dist/tools/ban/index.d.ts.map +1 -0
- package/dist/tools/ban/index.js +206 -0
- package/dist/tools/ban/index.js.map +1 -0
- package/dist/tools/bridge/helpers/bridgeable-token-tools.d.ts +87 -0
- package/dist/tools/bridge/helpers/bridgeable-token-tools.d.ts.map +1 -0
- package/dist/tools/bridge/helpers/bridgeable-token-tools.js +130 -0
- package/dist/tools/bridge/helpers/bridgeable-token-tools.js.map +1 -0
- package/dist/tools/bridge/helpers/external-chain-balance-tools.d.ts +87 -0
- package/dist/tools/bridge/helpers/external-chain-balance-tools.d.ts.map +1 -0
- package/dist/tools/bridge/helpers/external-chain-balance-tools.js +167 -0
- package/dist/tools/bridge/helpers/external-chain-balance-tools.js.map +1 -0
- package/dist/tools/bridge/index.d.ts +3 -7
- package/dist/tools/bridge/index.d.ts.map +1 -1
- package/dist/tools/bridge/index.js +89 -371
- package/dist/tools/bridge/index.js.map +1 -1
- package/dist/tools/burns/index.d.ts.map +1 -1
- package/dist/tools/burns/index.js +8 -36
- package/dist/tools/burns/index.js.map +1 -1
- package/dist/tools/chat/getPinnedChatMessage.d.ts +15 -0
- package/dist/tools/chat/getPinnedChatMessage.d.ts.map +1 -0
- package/dist/tools/chat/getPinnedChatMessage.js +37 -0
- package/dist/tools/chat/getPinnedChatMessage.js.map +1 -0
- package/dist/tools/chat/index.d.ts +73 -0
- package/dist/tools/chat/index.d.ts.map +1 -0
- package/dist/tools/chat/index.js +359 -0
- package/dist/tools/chat/index.js.map +1 -0
- package/dist/tools/chat/pinChatMessage.d.ts +16 -0
- package/dist/tools/chat/pinChatMessage.d.ts.map +1 -0
- package/dist/tools/chat/pinChatMessage.js +51 -0
- package/dist/tools/chat/pinChatMessage.js.map +1 -0
- package/dist/tools/chat/unpinChatMessage.d.ts +16 -0
- package/dist/tools/chat/unpinChatMessage.d.ts.map +1 -0
- package/dist/tools/chat/unpinChatMessage.js +39 -0
- package/dist/tools/chat/unpinChatMessage.js.map +1 -0
- package/dist/tools/chat-messages/index.d.ts +35 -0
- package/dist/tools/chat-messages/index.d.ts.map +1 -0
- package/dist/tools/chat-messages/index.js +165 -0
- package/dist/tools/chat-messages/index.js.map +1 -0
- package/dist/tools/comments/index.d.ts +44 -0
- package/dist/tools/comments/index.d.ts.map +1 -0
- package/dist/tools/comments/index.js +171 -0
- package/dist/tools/comments/index.js.map +1 -0
- package/dist/tools/content-flags/index.d.ts +38 -0
- package/dist/tools/content-flags/index.d.ts.map +1 -0
- package/dist/tools/content-flags/index.js +282 -0
- package/dist/tools/content-flags/index.js.map +1 -0
- package/dist/tools/content-reactions/index.d.ts +43 -0
- package/dist/tools/content-reactions/index.d.ts.map +1 -0
- package/dist/tools/content-reactions/index.js +135 -0
- package/dist/tools/content-reactions/index.js.map +1 -0
- package/dist/tools/creation/index.d.ts.map +1 -1
- package/dist/tools/creation/index.js +2 -5
- package/dist/tools/creation/index.js.map +1 -1
- package/dist/tools/dex/fetchAllDexPools.d.ts.map +1 -1
- package/dist/tools/dex/fetchAllDexPools.js +5 -21
- package/dist/tools/dex/fetchAllDexPools.js.map +1 -1
- package/dist/tools/dex/fetchDexPools.d.ts.map +1 -1
- package/dist/tools/dex/fetchDexPools.js +11 -28
- package/dist/tools/dex/fetchDexPools.js.map +1 -1
- package/dist/tools/dex/helpers.d.ts +479 -0
- package/dist/tools/dex/helpers.d.ts.map +1 -0
- package/dist/tools/dex/helpers.js +570 -0
- package/dist/tools/dex/helpers.js.map +1 -0
- package/dist/tools/dex/index.d.ts +50 -11
- package/dist/tools/dex/index.d.ts.map +1 -1
- package/dist/tools/dex/index.js +124 -486
- package/dist/tools/dex/index.js.map +1 -1
- package/dist/tools/dex/leaderboard.d.ts.map +1 -1
- package/dist/tools/dex/leaderboard.js +5 -70
- package/dist/tools/dex/leaderboard.js.map +1 -1
- package/dist/tools/dex/liquidity-positions.d.ts.map +1 -1
- package/dist/tools/dex/liquidity-positions.js +20 -91
- package/dist/tools/dex/liquidity-positions.js.map +1 -1
- package/dist/tools/dex/volume.d.ts.map +1 -1
- package/dist/tools/dex/volume.js +6 -21
- package/dist/tools/dex/volume.js.map +1 -1
- package/dist/tools/dex-analytics/index.d.ts +48 -0
- package/dist/tools/dex-analytics/index.d.ts.map +1 -0
- package/dist/tools/dex-analytics/index.js +111 -0
- package/dist/tools/dex-analytics/index.js.map +1 -0
- package/dist/tools/dex-liquidity/index.d.ts +22 -0
- package/dist/tools/dex-liquidity/index.d.ts.map +1 -0
- package/dist/tools/dex-liquidity/index.js +384 -0
- package/dist/tools/dex-liquidity/index.js.map +1 -0
- package/dist/tools/dex-pools/index.d.ts +60 -0
- package/dist/tools/dex-pools/index.d.ts.map +1 -0
- package/dist/tools/dex-pools/index.js +231 -0
- package/dist/tools/dex-pools/index.js.map +1 -0
- package/dist/tools/handler-factories.d.ts +1401 -0
- package/dist/tools/handler-factories.d.ts.map +1 -0
- package/dist/tools/handler-factories.js +1680 -0
- package/dist/tools/handler-factories.js.map +1 -0
- package/dist/tools/index.d.ts +1 -11
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +171 -27
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/locks/index.d.ts +2 -0
- package/dist/tools/locks/index.d.ts.map +1 -1
- package/dist/tools/locks/index.js +9 -86
- package/dist/tools/locks/index.js.map +1 -1
- package/dist/tools/moderators/index.d.ts +53 -0
- package/dist/tools/moderators/index.d.ts.map +1 -0
- package/dist/tools/moderators/index.js +258 -0
- package/dist/tools/moderators/index.js.map +1 -0
- package/dist/tools/overseers/getOverseerUserSummary.d.ts +15 -0
- package/dist/tools/overseers/getOverseerUserSummary.d.ts.map +1 -0
- package/dist/tools/overseers/getOverseerUserSummary.js +40 -0
- package/dist/tools/overseers/getOverseerUserSummary.js.map +1 -0
- package/dist/tools/overseers/index.d.ts +58 -0
- package/dist/tools/overseers/index.d.ts.map +1 -0
- package/dist/tools/overseers/index.js +325 -0
- package/dist/tools/overseers/index.js.map +1 -0
- package/dist/tools/overseers/listOverseerUsers.d.ts +15 -0
- package/dist/tools/overseers/listOverseerUsers.d.ts.map +1 -0
- package/dist/tools/overseers/listOverseerUsers.js +76 -0
- package/dist/tools/overseers/listOverseerUsers.js.map +1 -0
- package/dist/tools/pagination-handler-factory.d.ts +131 -0
- package/dist/tools/pagination-handler-factory.d.ts.map +1 -0
- package/dist/tools/pagination-handler-factory.js +159 -0
- package/dist/tools/pagination-handler-factory.js.map +1 -0
- package/dist/tools/pools/checkPoolExists.d.ts +16 -0
- package/dist/tools/pools/checkPoolExists.d.ts.map +1 -0
- package/dist/tools/pools/checkPoolExists.js +48 -0
- package/dist/tools/pools/checkPoolExists.js.map +1 -0
- package/dist/tools/pools/fetchAllPools.d.ts.map +1 -1
- package/dist/tools/pools/fetchAllPools.js +51 -11
- package/dist/tools/pools/fetchAllPools.js.map +1 -1
- package/dist/tools/pools/fetchAllPriceHistory.d.ts.map +1 -1
- package/dist/tools/pools/fetchAllPriceHistory.js +11 -51
- package/dist/tools/pools/fetchAllPriceHistory.js.map +1 -1
- package/dist/tools/pools/fetchPoolDetails.d.ts.map +1 -1
- package/dist/tools/pools/fetchPoolDetails.js +4 -11
- package/dist/tools/pools/fetchPoolDetails.js.map +1 -1
- package/dist/tools/pools/fetchPools.d.ts.map +1 -1
- package/dist/tools/pools/fetchPools.js +40 -20
- package/dist/tools/pools/fetchPools.js.map +1 -1
- package/dist/tools/pools/fetchPriceHistory.d.ts.map +1 -1
- package/dist/tools/pools/fetchPriceHistory.js +10 -51
- package/dist/tools/pools/fetchPriceHistory.js.map +1 -1
- package/dist/tools/pools/fetchTokenDetails.d.ts.map +1 -1
- package/dist/tools/pools/fetchTokenDetails.js +4 -35
- package/dist/tools/pools/fetchTokenDetails.js.map +1 -1
- package/dist/tools/pools/index.d.ts +2 -0
- package/dist/tools/pools/index.d.ts.map +1 -1
- package/dist/tools/pools/index.js +103 -35
- package/dist/tools/pools/index.js.map +1 -1
- package/dist/tools/pools/onDexPoolCreation.d.ts +1 -2
- package/dist/tools/pools/onDexPoolCreation.d.ts.map +1 -1
- package/dist/tools/pools/onDexPoolCreation.js +14 -48
- package/dist/tools/pools/onDexPoolCreation.js.map +1 -1
- package/dist/tools/pools/onLaunchpadTokenCreation.d.ts +1 -2
- package/dist/tools/pools/onLaunchpadTokenCreation.d.ts.map +1 -1
- package/dist/tools/pools/onLaunchpadTokenCreation.js +9 -42
- package/dist/tools/pools/onLaunchpadTokenCreation.js.map +1 -1
- package/dist/tools/pools/priceHistoryFactory.d.ts +44 -0
- package/dist/tools/pools/priceHistoryFactory.d.ts.map +1 -0
- package/dist/tools/pools/priceHistoryFactory.js +154 -0
- package/dist/tools/pools/priceHistoryFactory.js.map +1 -0
- package/dist/tools/pools/updateTokenSocials.d.ts +16 -0
- package/dist/tools/pools/updateTokenSocials.d.ts.map +1 -0
- package/dist/tools/pools/updateTokenSocials.js +84 -0
- package/dist/tools/pools/updateTokenSocials.js.map +1 -0
- package/dist/tools/referrals/index.d.ts +12 -0
- package/dist/tools/referrals/index.d.ts.map +1 -0
- package/dist/tools/referrals/index.js +110 -0
- package/dist/tools/referrals/index.js.map +1 -0
- package/dist/tools/streaming/index.d.ts +94 -0
- package/dist/tools/streaming/index.d.ts.map +1 -0
- package/dist/tools/streaming/index.js +549 -0
- package/dist/tools/streaming/index.js.map +1 -0
- package/dist/tools/streaming/setNextLiveStreamCountdown.d.ts +16 -0
- package/dist/tools/streaming/setNextLiveStreamCountdown.d.ts.map +1 -0
- package/dist/tools/streaming/setNextLiveStreamCountdown.js +62 -0
- package/dist/tools/streaming/setNextLiveStreamCountdown.js.map +1 -0
- package/dist/tools/token-ban/index.d.ts +39 -0
- package/dist/tools/token-ban/index.d.ts.map +1 -0
- package/dist/tools/token-ban/index.js +177 -0
- package/dist/tools/token-ban/index.js.map +1 -0
- package/dist/tools/tool-factory.d.ts +84 -0
- package/dist/tools/tool-factory.d.ts.map +1 -0
- package/dist/tools/tool-factory.js +135 -0
- package/dist/tools/tool-factory.js.map +1 -0
- package/dist/tools/trades/index.d.ts +20 -0
- package/dist/tools/trades/index.d.ts.map +1 -0
- package/dist/tools/trades/index.js +113 -0
- package/dist/tools/trades/index.js.map +1 -0
- package/dist/tools/trading/helpers/arg-extractors.d.ts +128 -0
- package/dist/tools/trading/helpers/arg-extractors.d.ts.map +1 -0
- package/dist/tools/trading/helpers/arg-extractors.js +215 -0
- package/dist/tools/trading/helpers/arg-extractors.js.map +1 -0
- package/dist/tools/trading/helpers/index.d.ts +8 -0
- package/dist/tools/trading/helpers/index.d.ts.map +1 -0
- package/dist/tools/trading/helpers/index.js +24 -0
- package/dist/tools/trading/helpers/index.js.map +1 -0
- package/dist/tools/trading/helpers/trading-schemas.d.ts +276 -0
- package/dist/tools/trading/helpers/trading-schemas.d.ts.map +1 -0
- package/dist/tools/trading/helpers/trading-schemas.js +310 -0
- package/dist/tools/trading/helpers/trading-schemas.js.map +1 -0
- package/dist/tools/trading/index.d.ts +2 -0
- package/dist/tools/trading/index.d.ts.map +1 -1
- package/dist/tools/trading/index.js +148 -371
- package/dist/tools/trading/index.js.map +1 -1
- package/dist/tools/transfers/index.d.ts +3 -0
- package/dist/tools/transfers/index.d.ts.map +1 -1
- package/dist/tools/transfers/index.js +72 -52
- package/dist/tools/transfers/index.js.map +1 -1
- package/dist/tools/utils/cleanup.d.ts.map +1 -1
- package/dist/tools/utils/cleanup.js +2 -9
- package/dist/tools/utils/cleanup.js.map +1 -1
- package/dist/tools/utils/clearCache.d.ts.map +1 -1
- package/dist/tools/utils/clearCache.js +5 -7
- package/dist/tools/utils/clearCache.js.map +1 -1
- package/dist/tools/utils/explainSdkUsage.d.ts +52 -0
- package/dist/tools/utils/explainSdkUsage.d.ts.map +1 -1
- package/dist/tools/utils/explainSdkUsage.js +1905 -93
- package/dist/tools/utils/explainSdkUsage.js.map +1 -1
- package/dist/tools/utils/getEthereumAddressFromPrivateKey.d.ts.map +1 -1
- package/dist/tools/utils/getEthereumAddressFromPrivateKey.js +2 -1
- package/dist/tools/utils/getEthereumAddressFromPrivateKey.js.map +1 -1
- package/dist/tools/utils/index.d.ts +2 -0
- package/dist/tools/utils/index.d.ts.map +1 -1
- package/dist/tools/utils/index.js +2 -12
- package/dist/tools/utils/index.js.map +1 -1
- package/dist/tools/wallet/index.d.ts +7 -0
- package/dist/tools/wallet/index.d.ts.map +1 -0
- package/dist/tools/wallet/index.js +24 -0
- package/dist/tools/wallet/index.js.map +1 -0
- package/dist/utils/date-converter.d.ts +58 -0
- package/dist/utils/date-converter.d.ts.map +1 -0
- package/dist/utils/date-converter.js +83 -0
- package/dist/utils/date-converter.js.map +1 -0
- package/dist/utils/pool-filter-builder.d.ts +78 -0
- package/dist/utils/pool-filter-builder.d.ts.map +1 -0
- package/dist/utils/pool-filter-builder.js +130 -0
- package/dist/utils/pool-filter-builder.js.map +1 -0
- package/dist/utils/safe-parsers.d.ts +87 -0
- package/dist/utils/safe-parsers.d.ts.map +1 -0
- package/dist/utils/safe-parsers.js +134 -0
- package/dist/utils/safe-parsers.js.map +1 -0
- package/dist/utils/validation.d.ts +5 -5
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +24 -21
- package/dist/utils/validation.js.map +1 -1
- package/package.json +23 -15
- package/.env.example +0 -21
- package/.eslintrc.json +0 -88
- package/CHANGELOG.md +0 -2161
- package/DOCS_AUDIT_REPORT.md +0 -189
- package/DRY_REFACTORING_GUIDE.md +0 -271
- package/MCP_COVERAGE_REPORT.md +0 -164
- package/MCP_TEST_ANALYSIS.md +0 -317
- package/jest.integration.config.js +0 -70
- package/scripts/inject-version.ts +0 -31
- package/scripts/validate-mcp-test-analysis.ts +0 -250
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
* Acts as a development reference showing how MCP tools map to SDK methods.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.explainSdkUsageTool = exports.COMPOSITE_TOPICS = exports.TOPIC_METHOD_MAPPING = void 0;
|
|
9
|
+
exports.explainSdkUsageTool = exports.SDK_EXAMPLES = exports.COMPOSITE_TOPICS = exports.TOPIC_METHOD_MAPPING = void 0;
|
|
10
10
|
const error_handler_js_1 = require("../../utils/error-handler.js");
|
|
11
11
|
const response_formatter_js_1 = require("../../utils/response-formatter.js");
|
|
12
|
+
// BigNumber utilities for precise currency handling (imported from SDK)
|
|
13
|
+
// These are shown in examples but note: developers would typically import directly from '@gala-chain/launchpad-sdk'
|
|
14
|
+
// import { compareAmounts, formatTokenAmount } from '@gala-chain/launchpad-sdk';
|
|
12
15
|
/**
|
|
13
16
|
* Topic-to-method mapping for documentation validation
|
|
14
17
|
* Defines which SDK methods are covered by each documentation topic
|
|
@@ -21,19 +24,19 @@ exports.TOPIC_METHOD_MAPPING = {
|
|
|
21
24
|
// Pool Discovery
|
|
22
25
|
'fetch-pools': [
|
|
23
26
|
'fetchPools', 'fetchAllPools', 'fetchPoolDetails', 'fetchPoolDetailsForCalculation',
|
|
24
|
-
'fetchVolumeData', 'fetchTokenPrice',
|
|
27
|
+
'fetchVolumeData', 'fetchTokenPrice',
|
|
25
28
|
'fetchTokenDistribution', 'fetchTokenBadges', 'resolveVaultAddress', 'resolveTokenClassKey'
|
|
26
29
|
],
|
|
27
30
|
'balances': ['fetchGalaBalance', 'fetchTokenBalance', 'fetchTokensHeld', 'fetchTokensCreated', 'fetchAvailableBalance'],
|
|
28
31
|
// Token Creation & Management
|
|
29
32
|
'token-creation': ['isTokenNameAvailable', 'isTokenSymbolAvailable', 'fetchLaunchTokenFee', 'uploadTokenImage', 'launchToken'],
|
|
30
33
|
'token-details': ['fetchTokenDetails'],
|
|
31
|
-
'token-distribution': ['fetchTokenDistribution'],
|
|
34
|
+
'token-distribution': ['fetchTokenDistribution', 'fetchUserHolderContext'],
|
|
32
35
|
'token-status': ['isTokenGraduated', 'onDexPoolCreation', 'onLaunchpadTokenCreation'],
|
|
33
36
|
// Portfolio Management
|
|
34
37
|
'multi-wallet': [], // Composite workflow topic
|
|
35
38
|
'transfers': ['transferGala', 'transferToken'],
|
|
36
|
-
'locks': ['lockTokens', 'unlockTokens', 'burnTokens', '
|
|
39
|
+
'locks': ['lockTokens', 'unlockTokens', 'burnTokens', 'fetchLockedBalance'],
|
|
37
40
|
// DEX Trading
|
|
38
41
|
'dex-trading': ['getSwapQuoteExactInput', 'getSwapQuoteExactOutput', 'executeSwap', 'getSwapUserAssets', 'getAllSwapUserAssets', 'getSwapPoolInfo'],
|
|
39
42
|
'error-handling': [], // Cross-cutting concern
|
|
@@ -44,22 +47,23 @@ exports.TOPIC_METHOD_MAPPING = {
|
|
|
44
47
|
'price-history': ['fetchPriceHistory', 'fetchAllPriceHistory'],
|
|
45
48
|
'spot-prices-smart-routing': ['fetchTokenPrice', 'getSwapPoolPrice'],
|
|
46
49
|
// User Profile
|
|
47
|
-
'profile-management': ['fetchProfile', 'updateProfile', 'uploadProfileImage'],
|
|
50
|
+
'profile-management': ['fetchProfile', 'updateProfile', 'uploadProfileImage', 'getManagedTokens'],
|
|
48
51
|
// Liquidity Management
|
|
49
52
|
'liquidity-positions': ['getSwapUserLiquidityPositions', 'getAllSwapUserLiquidityPositions', 'getSwapLiquidityPosition', 'getSwapLiquidityPositionById', 'addSwapLiquidityByPrice', 'addSwapLiquidityByTicks', 'getSwapEstimateRemoveLiquidity', 'removeSwapLiquidity', 'collectSwapPositionFees'],
|
|
50
53
|
// Advanced Analysis
|
|
51
54
|
'advanced-dex-analysis': ['fetchCompositePoolData', 'calculateDexPoolQuoteExactAmountLocal', 'calculateDexPoolQuoteExactAmountExternal', 'calculateDexPoolQuoteExactAmount'],
|
|
52
|
-
'trading-analytics': ['fetchTrades'],
|
|
55
|
+
'trading-analytics': ['fetchTrades', 'getTrades'],
|
|
53
56
|
'utilities-and-helpers': ['fetchGalaPrice', 'fetchTokenClassesWithSupply', 'calculateInitialBuyAmount', 'getBundlerTransactionResult', 'getSwapPoolPrice', 'fetchSwapPositionDirect', 'getAllSwapUserAssets', 'cleanup', 'clearCache', 'getCacheInfo'],
|
|
54
57
|
'utilities-system': ['getAddress', 'getConfig', 'getEthereumAddress', 'getUrlByTokenName', 'getVersion', 'getWallet', 'hasWallet', 'setWallet', 'createWallet', 'connectWebSocket', 'disconnectWebSocket', 'isWebSocketConnected'],
|
|
55
58
|
// DEX Leaderboards & Metrics
|
|
56
59
|
'fetch-all-dex-seasons': ['fetchAllDexSeasons'],
|
|
57
60
|
'fetch-current-dex-season': ['fetchCurrentDexSeason'],
|
|
58
|
-
'fetch-dex-leaderboard-by-season-id': ['fetchDexLeaderboardBySeasonId'
|
|
61
|
+
'fetch-dex-leaderboard-by-season-id': ['fetchDexLeaderboardBySeasonId'],
|
|
62
|
+
'fetch-current-dex-leaderboard': ['fetchCurrentDexLeaderboard'],
|
|
59
63
|
'fetch-dex-aggregated-volume-summary': ['fetchDexAggregatedVolumeSummary'],
|
|
60
64
|
'fetch-dex-pools': ['fetchDexPools', 'fetchAllDexPools'],
|
|
61
65
|
// Event Subscriptions
|
|
62
|
-
'event-subscriptions': ['
|
|
66
|
+
'event-subscriptions': ['subscribeToStream', 'unsubscribeFromStream', 'onStreamStatusChanged', 'onUserBanned', 'onUserUnbanned', 'onBanEnforcement', 'onContentFlagged', 'onFlagResolved', 'onStreamChatMessage', 'onStreamChatUpdated', 'onStreamChatDeleted', 'onStreamChatPinned', 'onStreamChatUnpinned', 'onChatStatusChanged', 'onViewerCountChanged', 'onRecordingStatusChanged', 'onSimulcastStatusChanged', 'onDownloadReady', 'onUserTyping', 'onStreamReaction', 'onContentReactionAdded', 'onContentReactionRemoved', 'onStreamCountdownUpdated', 'onStreamLanguageUpdated', 'onStreamControlStatusChanged', 'onConnection', 'onAuthenticated', 'onTokenSubscribed', 'onTokenUnsubscribed', 'onRoomSubscribed', 'onRoomLeft', 'onDexPoolCreation', 'onLaunchpadTokenCreation'],
|
|
63
67
|
// MCP Integration
|
|
64
68
|
'mcp-to-sdk-mapping': [], // Composite workflow topic
|
|
65
69
|
// Bridge Operations
|
|
@@ -94,6 +98,66 @@ exports.TOPIC_METHOD_MAPPING = {
|
|
|
94
98
|
'account-management': [
|
|
95
99
|
'registerAccount'
|
|
96
100
|
],
|
|
101
|
+
// Session Authentication (JWT)
|
|
102
|
+
'session-auth': [
|
|
103
|
+
'login', 'logout', 'refreshToken', 'getSession', 'isAuthenticated',
|
|
104
|
+
'shouldRefreshToken', 'getAccessToken', 'ensureValidToken'
|
|
105
|
+
],
|
|
106
|
+
// Live Streaming
|
|
107
|
+
'streaming': [
|
|
108
|
+
'startStream', 'stopStream', 'getStreamInfo', 'disableStream', 'enableStream', 'resetStreamKey',
|
|
109
|
+
'getStreamRecordings', 'getRecordingDownload', 'deleteRecording',
|
|
110
|
+
'getSimulcastTargets', 'addSimulcastTarget', 'removeSimulcastTarget',
|
|
111
|
+
'getGlobalStreamingStatus', 'setGlobalStreamingEnabled',
|
|
112
|
+
'getAvailableRoles', 'getStreamRole', 'getTokenAccess'
|
|
113
|
+
],
|
|
114
|
+
// Stream Chat
|
|
115
|
+
'stream-chat': [
|
|
116
|
+
'getChatMessages', 'sendChatMessage', 'updateChatMessage', 'deleteChatMessage', 'getChatStatus', 'disableChat', 'enableChat',
|
|
117
|
+
'getGlobalChatStatus', 'setGlobalChatEnabled',
|
|
118
|
+
'connectStreamWebSocket', 'authenticateStreamWebSocket', 'subscribeToStream',
|
|
119
|
+
'unsubscribeFromStream', 'sendStreamChatViaWebSocket', 'sendStreamReaction', 'disconnectStreamWebSocket',
|
|
120
|
+
'isStreamWebSocketConnected', 'getEngagementStats'
|
|
121
|
+
],
|
|
122
|
+
// Ban/Moderation Operations
|
|
123
|
+
'ban-management': [
|
|
124
|
+
'createBan', 'removeBan', 'listBans', 'getBanStatus', 'getActiveUsers'
|
|
125
|
+
],
|
|
126
|
+
// API Key Management
|
|
127
|
+
'api-key-management': [
|
|
128
|
+
'createApiKey', 'listApiKeys', 'getApiKey', 'updateApiKey', 'revokeApiKey', 'getApiKeyRoles'
|
|
129
|
+
],
|
|
130
|
+
// Moderator Invites (Magic Link Delegation)
|
|
131
|
+
'moderator-invites': [
|
|
132
|
+
'createModeratorInvite', 'claimModeratorInvite', 'getModeratedTokens',
|
|
133
|
+
'listModeratorInvites', 'revokeModeratorInvite', 'getModeratorInviteByCode',
|
|
134
|
+
'updateModeratorInviteRole'
|
|
135
|
+
],
|
|
136
|
+
// Overseer System (Global Platform Oversight)
|
|
137
|
+
'overseer-invites': [
|
|
138
|
+
'createOverseerInvite', 'claimOverseerInvite', 'listOverseerInvites',
|
|
139
|
+
'getOverseerInviteByCode', 'revokeOverseerInvite', 'listOverseers',
|
|
140
|
+
'revokeOverseer', 'getMyOverseerStatus', 'getOverseerSummary'
|
|
141
|
+
],
|
|
142
|
+
// Content Moderation (Flags & Comments)
|
|
143
|
+
'content-flag-management': [
|
|
144
|
+
'createFlag', 'listFlags', 'listGlobalFlags', 'dismissFlag', 'actionFlag',
|
|
145
|
+
'getComments', 'createComment', 'updateComment', 'deleteComment'
|
|
146
|
+
],
|
|
147
|
+
// Content Reactions (Chat Messages & Comments)
|
|
148
|
+
'content-reactions': [
|
|
149
|
+
'addContentReaction', 'removeContentReaction',
|
|
150
|
+
'addReactionToChatMessage', 'removeReactionFromChatMessage',
|
|
151
|
+
'addReactionToComment', 'removeReactionFromComment'
|
|
152
|
+
],
|
|
153
|
+
// Trade History Queries
|
|
154
|
+
'trade-history': [
|
|
155
|
+
'getTrades'
|
|
156
|
+
],
|
|
157
|
+
// Token Ban Management (Platform-wide, Overseer Only)
|
|
158
|
+
'token-ban-management': [
|
|
159
|
+
'banToken', 'unbanToken', 'listTokenBans', 'getTokenBan', 'isTokenBanned'
|
|
160
|
+
],
|
|
97
161
|
};
|
|
98
162
|
/**
|
|
99
163
|
* Composite topics that don't map 1:1 to SDK methods
|
|
@@ -106,14 +170,17 @@ exports.COMPOSITE_TOPICS = new Set([
|
|
|
106
170
|
'spot-prices-smart-routing', 'profile-management', 'token-distribution',
|
|
107
171
|
'liquidity-positions', 'advanced-dex-analysis',
|
|
108
172
|
'trading-analytics', 'utilities-and-helpers', 'utilities-system', 'fetch-all-dex-seasons',
|
|
109
|
-
'fetch-current-dex-season', 'fetch-dex-leaderboard-by-season-id', 'fetch-dex-aggregated-volume-summary',
|
|
173
|
+
'fetch-current-dex-season', 'fetch-current-dex-leaderboard', 'fetch-dex-leaderboard-by-season-id', 'fetch-dex-aggregated-volume-summary',
|
|
110
174
|
'fetch-dex-pools', 'event-subscriptions', 'mcp-to-sdk-mapping', 'bridge-operations', 'dex-token-discovery',
|
|
111
175
|
'wrap-unwrap-operations', 'referral-system', 'account-management',
|
|
176
|
+
'session-auth', 'streaming', 'stream-chat', 'ban-management', 'api-key-management',
|
|
177
|
+
'moderator-invites', 'overseer-invites', 'content-flag-management', 'content-reactions', 'trade-history', 'token-ban-management',
|
|
112
178
|
]);
|
|
113
179
|
/**
|
|
114
180
|
* SDK code examples organized by topic
|
|
181
|
+
* Exported for use in documentation generation and AI agents
|
|
115
182
|
*/
|
|
116
|
-
|
|
183
|
+
exports.SDK_EXAMPLES = {
|
|
117
184
|
// ============================================================================
|
|
118
185
|
// TRADING WORKFLOWS: Bonding Curve Trading
|
|
119
186
|
// ============================================================================
|
|
@@ -218,7 +285,7 @@ async function sellTokens() {
|
|
|
218
285
|
- \`graduateToken()\`
|
|
219
286
|
|
|
220
287
|
\`\`\`typescript
|
|
221
|
-
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
288
|
+
import { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';
|
|
222
289
|
|
|
223
290
|
async function graduatePool() {
|
|
224
291
|
const sdk = createLaunchpadSDK({
|
|
@@ -234,7 +301,8 @@ async function graduatePool() {
|
|
|
234
301
|
|
|
235
302
|
// Check if you have enough balance
|
|
236
303
|
const balance = await sdk.fetchGalaBalance();
|
|
237
|
-
|
|
304
|
+
// Use compareAmounts() instead of parseFloat for precision with currency amounts
|
|
305
|
+
if (compareAmounts(balance.balance, calculation.amount) < 0) {
|
|
238
306
|
throw new Error('Insufficient GALA balance');
|
|
239
307
|
}
|
|
240
308
|
|
|
@@ -271,14 +339,13 @@ async function graduatePool() {
|
|
|
271
339
|
- \`fetchPoolDetailsForCalculation()\`
|
|
272
340
|
- \`fetchVolumeData()\`
|
|
273
341
|
- \`fetchTokenPrice()\`
|
|
274
|
-
- \`fetchLaunchpadTokenSpotPrice()\`
|
|
275
342
|
- \`fetchTokenDistribution()\`
|
|
276
343
|
- \`fetchTokenBadges()\`
|
|
277
344
|
- \`resolveVaultAddress()\`
|
|
278
345
|
- \`resolveTokenClassKey()\`
|
|
279
346
|
|
|
280
347
|
\`\`\`typescript
|
|
281
|
-
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
348
|
+
import { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';
|
|
282
349
|
|
|
283
350
|
// 1. BASIC POOL FETCHING - With Pagination
|
|
284
351
|
async function basicPoolFetching() {
|
|
@@ -363,14 +430,14 @@ async function getDexTokenPrices() {
|
|
|
363
430
|
console.log(\`MUSIC: $\${prices.MUSIC}\`);
|
|
364
431
|
}
|
|
365
432
|
|
|
366
|
-
// 7. LAUNCHPAD TOKEN SPOT PRICES
|
|
433
|
+
// 7. LAUNCHPAD TOKEN SPOT PRICES (via smart router)
|
|
367
434
|
async function getLaunchpadTokenPrice(tokenName) {
|
|
368
435
|
const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
|
|
369
436
|
|
|
370
437
|
// Get USD spot price for a launchpad token (anime, woohoo, etc.)
|
|
371
|
-
const price = await sdk.
|
|
438
|
+
const price = await sdk.fetchTokenPrice({ tokenName });
|
|
372
439
|
|
|
373
|
-
console.log(\`\${tokenName} price: $\${price}\`);
|
|
440
|
+
console.log(\`\${tokenName} price: $\${price.price}\`);
|
|
374
441
|
}
|
|
375
442
|
|
|
376
443
|
// 8. RESOLVE UTILITY ADDRESSES
|
|
@@ -403,16 +470,18 @@ async function analyzeToken(tokenName) {
|
|
|
403
470
|
console.log(\`Supply: \${details.currentSupply} / \${details.maxSupply}\`);
|
|
404
471
|
|
|
405
472
|
// Analyze volume trend
|
|
406
|
-
|
|
473
|
+
// Note: For analytics/aggregation, we use safeParseFloat for performance. For trades, use BigNumber via SDK
|
|
474
|
+
const volumes = volumeData.map(v => safeParseFloat(v.volume, 0));
|
|
407
475
|
const avgVolume = volumes.reduce((a, b) => a + b, 0) / volumes.length;
|
|
408
|
-
console.log(\`Avg daily volume: $\${avgVolume
|
|
476
|
+
console.log(\`Avg daily volume: $\${toBigNumberFixed(avgVolume, 2)}\`);
|
|
409
477
|
|
|
410
478
|
// Analyze distribution
|
|
479
|
+
// Use compareAmounts for precise balance comparisons
|
|
411
480
|
const top5Ownership = distribution.holders
|
|
412
|
-
.sort((a, b) =>
|
|
481
|
+
.sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)
|
|
413
482
|
.slice(0, 5)
|
|
414
483
|
.reduce((sum, h) => sum + h.percentage, 0);
|
|
415
|
-
console.log(\`Top 5 holders: \${top5Ownership
|
|
484
|
+
console.log(\`Top 5 holders: \${toBigNumberFixed(top5Ownership, 2)}%\`);
|
|
416
485
|
|
|
417
486
|
// Check badges
|
|
418
487
|
console.log(\`Badges: \${badges.join(', ')}\`);
|
|
@@ -504,6 +573,27 @@ async function checkBalances() {
|
|
|
504
573
|
- \`gala_launchpad_fetch_tokens_held\`
|
|
505
574
|
- \`gala_launchpad_fetch_tokens_created\`
|
|
506
575
|
- \`gala_launchpad_fetch_profile\`
|
|
576
|
+
- \`gala_launchpad_fetch_available_balance\`
|
|
577
|
+
- \`gala_launchpad_fetch_locked_tokens\`
|
|
578
|
+
|
|
579
|
+
### Available vs Locked Balance
|
|
580
|
+
|
|
581
|
+
\`\`\`typescript
|
|
582
|
+
// Get available balance (excludes locked/escrowed tokens)
|
|
583
|
+
const available = await sdk.fetchAvailableBalance({
|
|
584
|
+
tokenName: 'anime',
|
|
585
|
+
address: walletAddress
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
// Get locked tokens with details
|
|
589
|
+
const locked = await sdk.fetchLockedTokens({
|
|
590
|
+
tokenName: 'anime',
|
|
591
|
+
address: walletAddress
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
console.log('Available:', available.quantity);
|
|
595
|
+
console.log('Locked:', locked.lockedQuantity);
|
|
596
|
+
\`\`\`
|
|
507
597
|
`,
|
|
508
598
|
// ============================================================================
|
|
509
599
|
// TOKEN CREATION & MANAGEMENT: Launch New Tokens
|
|
@@ -694,7 +784,7 @@ async function transferTokens() {
|
|
|
694
784
|
- \`lockTokens()\` - Lock one or more token types in a single transaction
|
|
695
785
|
- \`unlockTokens()\` - Unlock one or more token types in a single transaction
|
|
696
786
|
- \`burnTokens()\` - Permanently destroy tokens (IRREVERSIBLE)
|
|
697
|
-
- \`
|
|
787
|
+
- \`fetchLockedBalance()\` - Query locked token balances with hold details
|
|
698
788
|
|
|
699
789
|
Lock, unlock, and burn tokens on GalaChain for staking, escrow, vesting, or token management.
|
|
700
790
|
|
|
@@ -819,7 +909,7 @@ async function tokenLockingAndBurning() {
|
|
|
819
909
|
// QUERY LOCKED TOKENS - Check lock status
|
|
820
910
|
// ============================================================================
|
|
821
911
|
|
|
822
|
-
const lockedTokens = await sdk.
|
|
912
|
+
const lockedTokens = await sdk.fetchLockedBalance({
|
|
823
913
|
tokenName: 'anime',
|
|
824
914
|
address: sdk.getAddress()
|
|
825
915
|
});
|
|
@@ -1205,7 +1295,7 @@ const sdk = createLaunchpadSDK({
|
|
|
1205
1295
|
- \`calculateSellAmountExternal()\`
|
|
1206
1296
|
|
|
1207
1297
|
\`\`\`typescript
|
|
1208
|
-
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
1298
|
+
import { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';
|
|
1209
1299
|
|
|
1210
1300
|
async function localCalculationsExample() {
|
|
1211
1301
|
const sdk = createLaunchpadSDK({
|
|
@@ -1275,11 +1365,13 @@ async function localCalculationsExample() {
|
|
|
1275
1365
|
// A/B COMPARISON - Verify local accuracy
|
|
1276
1366
|
// ============================================================================
|
|
1277
1367
|
|
|
1278
|
-
|
|
1279
|
-
const
|
|
1368
|
+
// Use compareAmounts for precise quote comparison
|
|
1369
|
+
const buyComparison = compareAmounts(localBuy.amount, externalBuy.amount);
|
|
1370
|
+
const buyDiff = Math.abs(safeParseNumber(localBuy.amount, 0) - safeParseNumber(externalBuy.amount, 0));
|
|
1371
|
+
const buyPct = (buyDiff / safeParseNumber(externalBuy.amount, 1)) * 100;
|
|
1280
1372
|
|
|
1281
1373
|
console.log('Local vs External Accuracy:');
|
|
1282
|
-
console.log(\` Buy difference: \${buyPct
|
|
1374
|
+
console.log(\` Buy difference: \${toBigNumberFixed(buyPct, 4)}% (should be <0.01%)\`);
|
|
1283
1375
|
|
|
1284
1376
|
// ============================================================================
|
|
1285
1377
|
// PERFORMANCE BENEFIT - Local is instant
|
|
@@ -1353,13 +1445,14 @@ async function analyzePriceHistory() {
|
|
|
1353
1445
|
sortOrder: 'ASC'
|
|
1354
1446
|
});
|
|
1355
1447
|
|
|
1356
|
-
// Price analysis
|
|
1357
|
-
|
|
1448
|
+
// Price analysis - Convert strings to numbers for statistical calculations
|
|
1449
|
+
// Note: For precise trading amounts, use compareAmounts() from SDK instead
|
|
1450
|
+
const prices = allHistory.snapshots.map(s => safeParseNumber(s.price, 0));
|
|
1358
1451
|
const avg = prices.reduce((a, b) => a + b, 0) / prices.length;
|
|
1359
1452
|
const variance = prices.reduce((sum, p) => sum + Math.pow(p - avg, 2), 0) / prices.length;
|
|
1360
1453
|
const volatility = Math.sqrt(variance);
|
|
1361
1454
|
|
|
1362
|
-
console.log(\`Average: $\${avg
|
|
1455
|
+
console.log(\`Average: $\${toBigNumberFixed(avg, 4)}, Volatility: $\${toBigNumberFixed(volatility, 4)}\`);
|
|
1363
1456
|
|
|
1364
1457
|
// Data export (CSV)
|
|
1365
1458
|
const csv = ['timestamp,price'].concat(
|
|
@@ -1478,7 +1571,6 @@ async function analyzeTokenDetails() {
|
|
|
1478
1571
|
|
|
1479
1572
|
**Covers Methods:**
|
|
1480
1573
|
- \`fetchTokenPrice()\` (smart routing)
|
|
1481
|
-
- \`fetchLaunchpadTokenSpotPrice()\`
|
|
1482
1574
|
- \`isTokenGraduated()\`
|
|
1483
1575
|
|
|
1484
1576
|
The SDK intelligently routes pricing requests between DEX and Launchpad backends based on token graduation status - no need to know which backend a token uses!
|
|
@@ -1511,41 +1603,25 @@ async function tokenPricing() {
|
|
|
1511
1603
|
});
|
|
1512
1604
|
console.log(\`DEX Token GALA: $\${dexPrices}\`);
|
|
1513
1605
|
|
|
1514
|
-
// OPTION 3:
|
|
1515
|
-
// Use tokenName for
|
|
1516
|
-
console.log('\\n===
|
|
1517
|
-
const launchpadPrice = await sdk.
|
|
1518
|
-
console.log(\`Launchpad token anime: $\${launchpadPrice}\`);
|
|
1519
|
-
|
|
1520
|
-
// ADVANCED:
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
if (tokenName) {
|
|
1529
|
-
try {
|
|
1530
|
-
return await sdk.fetchLaunchpadTokenSpotPrice(tokenName);
|
|
1531
|
-
} catch (fallbackError) {
|
|
1532
|
-
throw new Error(\`Could not fetch price for \${tokenName}\`);
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
throw error;
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
const fallbackPrice = await getPriceWithFallback(
|
|
1540
|
-
'Token|Unit|ANIME|eth:0x...',
|
|
1541
|
-
'anime'
|
|
1542
|
-
);
|
|
1543
|
-
console.log(\`Fallback price: $\${fallbackPrice}\`);
|
|
1606
|
+
// OPTION 3: TOKEN NAME PRICING - For launchpad tokens by name
|
|
1607
|
+
// Use tokenName for simple lookup of launchpad tokens
|
|
1608
|
+
console.log('\\n=== Token Name Pricing ===');
|
|
1609
|
+
const launchpadPrice = await sdk.fetchTokenPrice({ tokenName: 'anime' });
|
|
1610
|
+
console.log(\`Launchpad token anime: $\${launchpadPrice.price}\`);
|
|
1611
|
+
|
|
1612
|
+
// ADVANCED: The smart router handles fallback automatically!
|
|
1613
|
+
// No need for manual fallback - fetchTokenPrice with tokenId detects
|
|
1614
|
+
// ungraduated tokens and automatically falls back to launchpad pricing
|
|
1615
|
+
console.log('\\n=== Automatic Fallback (Built-in) ===');
|
|
1616
|
+
const autoPrice = await sdk.fetchTokenPrice({
|
|
1617
|
+
tokenId: 'Token|Unit|ANIME|eth:0x...' // Auto-fallback if ungraduated
|
|
1618
|
+
});
|
|
1619
|
+
console.log(\`Auto-routed price: $\${autoPrice.price}\`);
|
|
1544
1620
|
|
|
1545
1621
|
// USECASE: Price comparison and discovery
|
|
1546
1622
|
console.log('\\n=== Price Discovery ===');
|
|
1547
1623
|
async function comparePrices(tokenName: string) {
|
|
1548
|
-
const launchpadPrice = await sdk.
|
|
1624
|
+
const launchpadPrice = await sdk.fetchTokenPrice({ tokenName });
|
|
1549
1625
|
|
|
1550
1626
|
// Check if graduated (on DEX)
|
|
1551
1627
|
const isGraduated = await sdk.isTokenGraduated(tokenName);
|
|
@@ -1554,10 +1630,10 @@ async function tokenPricing() {
|
|
|
1554
1630
|
const dexPrice = await sdk.fetchTokenPrice({
|
|
1555
1631
|
tokenId: \`Token|Unit|\${tokenName.toUpperCase()}|eth:0x...\`
|
|
1556
1632
|
});
|
|
1557
|
-
console.log(\`Launchpad: $\${launchpadPrice}, DEX: $\${dexPrice}\`);
|
|
1633
|
+
console.log(\`Launchpad: $\${launchpadPrice.price}, DEX: $\${dexPrice.price}\`);
|
|
1558
1634
|
return { launchpadPrice, dexPrice, graduated: true };
|
|
1559
1635
|
} else {
|
|
1560
|
-
console.log(\`Launchpad: $\${launchpadPrice} (not on DEX yet)\`);
|
|
1636
|
+
console.log(\`Launchpad: $\${launchpadPrice.price} (not on DEX yet)\`);
|
|
1561
1637
|
return { launchpadPrice, graduated: false };
|
|
1562
1638
|
}
|
|
1563
1639
|
}
|
|
@@ -1577,14 +1653,14 @@ async function tokenPricing() {
|
|
|
1577
1653
|
| Method | Use Case | Token Status |
|
|
1578
1654
|
|--------|----------|--------------|
|
|
1579
1655
|
| \`fetchTokenPrice({ tokenId })\` | Smart routing (recommended) | Any (DEX or Launchpad) |
|
|
1580
|
-
| \`
|
|
1656
|
+
| \`fetchTokenPrice({ tokenName })\` | Token name pricing | Any |
|
|
1581
1657
|
| \`isTokenGraduated(name)\` | Check token status | Any |
|
|
1582
1658
|
|
|
1583
1659
|
**Key Differences:**
|
|
1584
1660
|
|
|
1585
1661
|
**Ungraduated Tokens (Launchpad):**
|
|
1586
1662
|
- Priced on exponential bonding curve
|
|
1587
|
-
- Token name parameter works: \`
|
|
1663
|
+
- Token name parameter works: \`fetchTokenPrice({ tokenName: 'anime' })\`
|
|
1588
1664
|
- Price affected by supply/demand
|
|
1589
1665
|
|
|
1590
1666
|
**Graduated Tokens (DEX):**
|
|
@@ -1713,6 +1789,7 @@ async function manageUserProfiles() {
|
|
|
1713
1789
|
- \`fetchProfile(address?)\` - Get user profile
|
|
1714
1790
|
- \`updateProfile(data)\` - Update profile info
|
|
1715
1791
|
- \`uploadProfileImage(options)\` - Upload avatar (Node.js)
|
|
1792
|
+
- \`getManagedTokens()\` - Get tokens you manage (creator, moderator, manager, technical producer)
|
|
1716
1793
|
|
|
1717
1794
|
**Profile Fields:**
|
|
1718
1795
|
- \`fullName\` - Display name (max 100 chars)
|
|
@@ -1732,15 +1809,17 @@ async function manageUserProfiles() {
|
|
|
1732
1809
|
- \`gala_launchpad_fetch_profile\`
|
|
1733
1810
|
- \`gala_launchpad_update_profile\`
|
|
1734
1811
|
- \`gala_launchpad_upload_profile_image\`
|
|
1812
|
+
- \`gala_launchpad_get_managed_tokens\`
|
|
1735
1813
|
`,
|
|
1736
1814
|
'token-distribution': `
|
|
1737
1815
|
## Token Holder Distribution with SDK
|
|
1738
1816
|
|
|
1739
1817
|
**Covers Methods:**
|
|
1740
1818
|
- \`fetchTokenDistribution()\`
|
|
1819
|
+
- \`fetchUserHolderContext()\`
|
|
1741
1820
|
|
|
1742
1821
|
\`\`\`typescript
|
|
1743
|
-
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
1822
|
+
import { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';
|
|
1744
1823
|
|
|
1745
1824
|
async function analyzeTokenDistribution() {
|
|
1746
1825
|
const sdk = createLaunchpadSDK({
|
|
@@ -1755,35 +1834,36 @@ async function analyzeTokenDistribution() {
|
|
|
1755
1834
|
console.log(\`Last updated: \${distribution.lastUpdated.toISOString()}\`);
|
|
1756
1835
|
|
|
1757
1836
|
// Analyze top holders
|
|
1837
|
+
// Use compareAmounts for precise balance sorting with large numbers
|
|
1758
1838
|
distribution.holders
|
|
1759
|
-
.sort((a, b) =>
|
|
1839
|
+
.sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)
|
|
1760
1840
|
.slice(0, 5)
|
|
1761
1841
|
.forEach((holder, index) => {
|
|
1762
1842
|
console.log(\`#\${index + 1}: \${holder.address}\`);
|
|
1763
1843
|
console.log(\` Balance: \${holder.balance}\`);
|
|
1764
|
-
console.log(\` Ownership: \${holder.percentage
|
|
1844
|
+
console.log(\` Ownership: \${toBigNumberFixed(holder.percentage, 2)}%\`);
|
|
1765
1845
|
});
|
|
1766
1846
|
|
|
1767
1847
|
// Check concentration risk (e.g., top 5 holders own >80%)
|
|
1768
1848
|
const top5Ownership = distribution.holders
|
|
1769
|
-
.sort((a, b) =>
|
|
1849
|
+
.sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)
|
|
1770
1850
|
.slice(0, 5)
|
|
1771
1851
|
.reduce((sum, holder) => sum + holder.percentage, 0);
|
|
1772
1852
|
|
|
1773
|
-
console.log(\`Top 5 holders control: \${top5Ownership
|
|
1853
|
+
console.log(\`Top 5 holders control: \${toBigNumberFixed(top5Ownership, 2)}%\`);
|
|
1774
1854
|
|
|
1775
1855
|
// Find specific holder
|
|
1776
1856
|
const myAddress = sdk.getAddress();
|
|
1777
1857
|
const myHolding = distribution.holders.find(h => h.address === myAddress);
|
|
1778
1858
|
|
|
1779
1859
|
if (myHolding) {
|
|
1780
|
-
console.log(\`Your ownership: \${myHolding.percentage
|
|
1860
|
+
console.log(\`Your ownership: \${toBigNumberFixed(myHolding.percentage, 4)}%\`);
|
|
1781
1861
|
console.log(\`Your balance: \${myHolding.balance}\`);
|
|
1782
1862
|
}
|
|
1783
1863
|
|
|
1784
1864
|
// Calculate concentration metrics
|
|
1785
1865
|
const giniCoefficient = calculateGini(distribution.holders);
|
|
1786
|
-
console.log(\`Gini coefficient: \${giniCoefficient
|
|
1866
|
+
console.log(\`Gini coefficient: \${toBigNumberFixed(giniCoefficient, 4)}\`);
|
|
1787
1867
|
|
|
1788
1868
|
// Count whales (holders with >5%)
|
|
1789
1869
|
const whales = distribution.holders.filter(h => h.percentage > 5);
|
|
@@ -1792,7 +1872,7 @@ async function analyzeTokenDistribution() {
|
|
|
1792
1872
|
|
|
1793
1873
|
// Helper: Calculate Gini coefficient for wealth distribution
|
|
1794
1874
|
function calculateGini(holders: Array<{balance: string}>) {
|
|
1795
|
-
const balances = holders.map(h =>
|
|
1875
|
+
const balances = holders.map(h => safeParseFloat(h.balance, 0)).sort((a, b) => a - b);
|
|
1796
1876
|
const n = balances.length;
|
|
1797
1877
|
const sum = balances.reduce((a, b) => a + b, 0);
|
|
1798
1878
|
|
|
@@ -1820,6 +1900,61 @@ function calculateGini(holders: Array<{balance: string}>) {
|
|
|
1820
1900
|
- Calculate distribution metrics (Gini coefficient, etc.)
|
|
1821
1901
|
|
|
1822
1902
|
**MCP Tool Equivalent:** \`gala_launchpad_fetch_token_distribution\`
|
|
1903
|
+
|
|
1904
|
+
---
|
|
1905
|
+
|
|
1906
|
+
## User Holder Context (Single User Lookup)
|
|
1907
|
+
|
|
1908
|
+
**Covers Methods:**
|
|
1909
|
+
- \`fetchUserHolderContext()\`
|
|
1910
|
+
|
|
1911
|
+
Use this when you need holder info for a **specific user** rather than the full holder list.
|
|
1912
|
+
Perfect for user cards in comments/chat.
|
|
1913
|
+
|
|
1914
|
+
\`\`\`typescript
|
|
1915
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
1916
|
+
|
|
1917
|
+
async function getUserCard() {
|
|
1918
|
+
const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
|
|
1919
|
+
|
|
1920
|
+
// Fetch single user's holder context for a token
|
|
1921
|
+
const holderContext = await sdk.fetchUserHolderContext('anime', 'eth|abc123...');
|
|
1922
|
+
|
|
1923
|
+
// Response shape:
|
|
1924
|
+
// {
|
|
1925
|
+
// tokenName: 'anime',
|
|
1926
|
+
// userAddress: 'abc123...',
|
|
1927
|
+
// quantity: '25000' | null, // null if not a holder
|
|
1928
|
+
// percentage: 2.5 | null, // null if not a holder
|
|
1929
|
+
// rank: 3 | null, // 1-indexed rank (null if not a holder)
|
|
1930
|
+
// holderTier: { tier: 3, tierName: 'Major Holder' } | null,
|
|
1931
|
+
// isCreator: false
|
|
1932
|
+
// }
|
|
1933
|
+
|
|
1934
|
+
if (holderContext.quantity !== null) {
|
|
1935
|
+
console.log(\`Rank: #\${holderContext.rank}\`);
|
|
1936
|
+
console.log(\`Holder Tier: \${holderContext.holderTier?.tierName}\`);
|
|
1937
|
+
console.log(\`Owns: \${holderContext.percentage ? toBigNumberFixed(holderContext.percentage, 4) : 'N/A'}%\`);
|
|
1938
|
+
} else {
|
|
1939
|
+
console.log('User is not a holder of this token');
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
if (holderContext.isCreator) {
|
|
1943
|
+
console.log('This user created the token!');
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
\`\`\`
|
|
1947
|
+
|
|
1948
|
+
**Holder Tiers (based on % of max supply):**
|
|
1949
|
+
| Tier | Name | Min % |
|
|
1950
|
+
|------|------|-------|
|
|
1951
|
+
| 5 | Whale | 5% |
|
|
1952
|
+
| 4 | Top Holder | 1% |
|
|
1953
|
+
| 3 | Major Holder | 0.1% |
|
|
1954
|
+
| 2 | Strong Holder | 0.01% |
|
|
1955
|
+
| 1 | Holder | 0.001% |
|
|
1956
|
+
|
|
1957
|
+
**MCP Tool Equivalent:** \`gala_launchpad_fetch_user_holder_context\`
|
|
1823
1958
|
`,
|
|
1824
1959
|
// ============================================================================
|
|
1825
1960
|
// LIQUIDITY MANAGEMENT: GalaSwap LP Positions
|
|
@@ -1957,7 +2092,7 @@ async function advancedDexAnalysis() {
|
|
|
1957
2092
|
console.log('Local calculation:', localQuote.outputAmount);
|
|
1958
2093
|
console.log('External API:', externalQuote.outputAmount);
|
|
1959
2094
|
console.log('Price difference:',
|
|
1960
|
-
Math.abs(
|
|
2095
|
+
Math.abs(safeParseFloat(localQuote.outputAmount, 0) - safeParseFloat(externalQuote.outputAmount, 0))
|
|
1961
2096
|
);
|
|
1962
2097
|
|
|
1963
2098
|
// Step 3: Use smart routing for best price
|
|
@@ -1982,7 +2117,8 @@ async function advancedDexAnalysis() {
|
|
|
1982
2117
|
## Trading History and Analytics
|
|
1983
2118
|
|
|
1984
2119
|
**Covers Methods:**
|
|
1985
|
-
- \`fetchTrades()\`
|
|
2120
|
+
- \`fetchTrades()\` - Legacy trade fetching by token
|
|
2121
|
+
- \`getV1Trades()\` - Flexible trade queries with tokenName/userAddress filters
|
|
1986
2122
|
|
|
1987
2123
|
Analyze individual trades for technical analysis and bot development.
|
|
1988
2124
|
|
|
@@ -1991,6 +2127,7 @@ Analyze individual trades for technical analysis and bot development.
|
|
|
1991
2127
|
- Calculate average trade size
|
|
1992
2128
|
- Identify whale transactions
|
|
1993
2129
|
- Build trading bots with historical data
|
|
2130
|
+
- Query a user's trading history across all tokens
|
|
1994
2131
|
|
|
1995
2132
|
\`\`\`typescript
|
|
1996
2133
|
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
@@ -1998,7 +2135,7 @@ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
|
1998
2135
|
async function tradingAnalytics() {
|
|
1999
2136
|
const sdk = createLaunchpadSDK({ environment: 'production' });
|
|
2000
2137
|
|
|
2001
|
-
// Fetch recent trades
|
|
2138
|
+
// Fetch recent trades for a token (legacy method)
|
|
2002
2139
|
const trades = await sdk.fetchTrades('anime', {
|
|
2003
2140
|
limit: 100,
|
|
2004
2141
|
page: 1
|
|
@@ -2007,9 +2144,9 @@ async function tradingAnalytics() {
|
|
|
2007
2144
|
console.log(\`Analyzing \${trades.total} trades\`);
|
|
2008
2145
|
|
|
2009
2146
|
// Calculate analytics
|
|
2010
|
-
const totalVolume = trades.trades.reduce((sum, t) => sum +
|
|
2147
|
+
const totalVolume = trades.trades.reduce((sum, t) => sum + safeParseFloat(t.galaAmount, 0), 0);
|
|
2011
2148
|
const averageTradeSize = totalVolume / trades.trades.length;
|
|
2012
|
-
const whaleTrades = trades.trades.filter(t =>
|
|
2149
|
+
const whaleTrades = trades.trades.filter(t => safeParseFloat(t.galaAmount, 0) > 1000);
|
|
2013
2150
|
|
|
2014
2151
|
console.log(\`Total volume: \${totalVolume} GALA\`);
|
|
2015
2152
|
console.log(\`Average trade size: \${averageTradeSize} GALA\`);
|
|
@@ -2020,6 +2157,35 @@ async function tradingAnalytics() {
|
|
|
2020
2157
|
console.log(\`\${trade.type}: \${trade.galaAmount} GALA at \${trade.timestamp}\`);
|
|
2021
2158
|
});
|
|
2022
2159
|
}
|
|
2160
|
+
|
|
2161
|
+
// V1 Trades API - Flexible queries with filters
|
|
2162
|
+
async function queryTradesV1() {
|
|
2163
|
+
const sdk = createLaunchpadSDK({ environment: 'production' });
|
|
2164
|
+
|
|
2165
|
+
// Query all trades for a specific token
|
|
2166
|
+
const { trades, meta } = await sdk.getV1Trades({ tokenName: 'anime' });
|
|
2167
|
+
console.log(\`Found \${meta.totalItems} trades for anime\`);
|
|
2168
|
+
|
|
2169
|
+
// Query all trades by a specific user
|
|
2170
|
+
const userTrades = await sdk.getV1Trades({
|
|
2171
|
+
userAddress: 'eth|1234567890abcdef...'
|
|
2172
|
+
});
|
|
2173
|
+
console.log(\`User has \${userTrades.meta.totalItems} trades across all tokens\`);
|
|
2174
|
+
|
|
2175
|
+
// Query a user's trades on a specific token with pagination
|
|
2176
|
+
const filteredTrades = await sdk.getV1Trades({
|
|
2177
|
+
tokenName: 'anime',
|
|
2178
|
+
userAddress: 'eth|1234567890abcdef...',
|
|
2179
|
+
page: 2,
|
|
2180
|
+
limit: 20
|
|
2181
|
+
});
|
|
2182
|
+
console.log(\`Page \${filteredTrades.meta.currentPage} of \${filteredTrades.meta.totalPages}\`);
|
|
2183
|
+
|
|
2184
|
+
// Analyze trade types
|
|
2185
|
+
filteredTrades.trades.forEach(trade => {
|
|
2186
|
+
console.log(\`\${trade.txnType}: \${trade.inputAmount} -> \${trade.outputAmount}\`);
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2023
2189
|
\`\`\`
|
|
2024
2190
|
|
|
2025
2191
|
**Related Topics:**
|
|
@@ -2027,7 +2193,8 @@ async function tradingAnalytics() {
|
|
|
2027
2193
|
- See \`dex-trading\` for executing trades
|
|
2028
2194
|
|
|
2029
2195
|
**MCP Tools:**
|
|
2030
|
-
- \`gala_launchpad_fetch_trades\`
|
|
2196
|
+
- \`gala_launchpad_fetch_trades\` - Legacy trade fetching
|
|
2197
|
+
- \`gala_launchpad_get_v1_trades\` - Flexible trade queries with filters
|
|
2031
2198
|
`,
|
|
2032
2199
|
'utilities-and-helpers': `
|
|
2033
2200
|
## Utility Methods and Helpers
|
|
@@ -2101,6 +2268,26 @@ console.log(\`Initial buy: \${buyAmount} tokens\`);
|
|
|
2101
2268
|
await sdk.cleanup();
|
|
2102
2269
|
\`\`\`
|
|
2103
2270
|
|
|
2271
|
+
### Monitor Bundler Transactions
|
|
2272
|
+
|
|
2273
|
+
\`\`\`typescript
|
|
2274
|
+
// After a trade, monitor transaction status
|
|
2275
|
+
const tradeResult = await sdk.buy({ tokenName, amount, type: 'native', expectedAmount, slippageToleranceFactor: 0.01 });
|
|
2276
|
+
|
|
2277
|
+
// Poll for completion
|
|
2278
|
+
const status = await sdk.getBundlerTransactionResult(tradeResult.transactionId);
|
|
2279
|
+
console.log('Status:', status.status); // PENDING, PROCESSING, COMPLETED, FAILED
|
|
2280
|
+
|
|
2281
|
+
// Wait with polling
|
|
2282
|
+
let attempts = 0;
|
|
2283
|
+
while (status.status === 'PENDING' || status.status === 'PROCESSING') {
|
|
2284
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
2285
|
+
const updated = await sdk.getBundlerTransactionResult(tradeResult.transactionId);
|
|
2286
|
+
if (updated.status === 'COMPLETED') break;
|
|
2287
|
+
if (++attempts > 30) throw new Error('Transaction timeout');
|
|
2288
|
+
}
|
|
2289
|
+
\`\`\`
|
|
2290
|
+
|
|
2104
2291
|
**MCP Tools:**
|
|
2105
2292
|
- \`gala_launchpad_fetch_gala_price\`
|
|
2106
2293
|
- \`gala_launchpad_fetch_token_classes_with_supply\`
|
|
@@ -2239,9 +2426,9 @@ async function analyzeVolumeTrends() {
|
|
|
2239
2426
|
const trend7d = summary.volume7dDelta > 0 ? '📈 UP' : '📉 DOWN';
|
|
2240
2427
|
const trend30d = summary.volume30dDelta > 0 ? '📈 UP' : '📉 DOWN';
|
|
2241
2428
|
|
|
2242
|
-
console.log(\`1-Day Trend: \${trend1d} (\${(summary.volume1dDelta * 100
|
|
2243
|
-
console.log(\`7-Day Trend: \${trend7d} (\${(summary.volume7dDelta * 100
|
|
2244
|
-
console.log(\`30-Day Trend: \${trend30d} (\${(summary.volume30dDelta * 100
|
|
2429
|
+
console.log(\`1-Day Trend: \${trend1d} (\${toBigNumberFixed(summary.volume1dDelta * 100, 2)}%)\`);
|
|
2430
|
+
console.log(\`7-Day Trend: \${trend7d} (\${toBigNumberFixed(summary.volume7dDelta * 100, 2)}%)\`);
|
|
2431
|
+
console.log(\`30-Day Trend: \${trend30d} (\${toBigNumberFixed(summary.volume30dDelta * 100, 2)}%)\`);
|
|
2245
2432
|
|
|
2246
2433
|
// Growth analysis
|
|
2247
2434
|
if (summary.volume30dDelta > 0.1) {
|
|
@@ -2290,8 +2477,8 @@ async function queryDexPools() {
|
|
|
2290
2477
|
console.log(\`Total pools: \${allPools.pools.length}\`);
|
|
2291
2478
|
|
|
2292
2479
|
// Analyze pool metrics
|
|
2293
|
-
const avgTvl = allPools.pools.reduce((sum, p) => sum +
|
|
2294
|
-
console.log(\`Average TVL: $\${avgTvl
|
|
2480
|
+
const avgTvl = allPools.pools.reduce((sum, p) => sum + safeParseFloat(p.tvl, 0), 0) / allPools.pools.length;
|
|
2481
|
+
console.log(\`Average TVL: $\${toBigNumberFixed(avgTvl, 2)}\`);
|
|
2295
2482
|
}
|
|
2296
2483
|
\`\`\`
|
|
2297
2484
|
|
|
@@ -2637,7 +2824,7 @@ async function sdkUtilities() {
|
|
|
2637
2824
|
Subscribe to real-time WebSocket events for DEX trading, liquidity changes, and token launches.
|
|
2638
2825
|
|
|
2639
2826
|
\`\`\`typescript
|
|
2640
|
-
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
2827
|
+
import { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';
|
|
2641
2828
|
|
|
2642
2829
|
async function subscribeToEvents() {
|
|
2643
2830
|
const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
|
|
@@ -2776,7 +2963,8 @@ async function subscribeToEvents() {
|
|
|
2776
2963
|
|
|
2777
2964
|
// Check if pool has sufficient depth for arbitrage
|
|
2778
2965
|
const poolInfo = await sdk.getSwapPoolInfo(event.token0, event.token1);
|
|
2779
|
-
|
|
2966
|
+
// Use compareAmounts for precise liquidity threshold comparison
|
|
2967
|
+
if (compareAmounts(poolInfo.liquidity, '100000') > 0) {
|
|
2780
2968
|
console.log('Pool has sufficient liquidity for arbitrage');
|
|
2781
2969
|
}
|
|
2782
2970
|
});
|
|
@@ -2798,7 +2986,8 @@ async function subscribeToEvents() {
|
|
|
2798
2986
|
const poolInfo = await sdk.getSwapPoolInfo(pool.token0, pool.token1);
|
|
2799
2987
|
|
|
2800
2988
|
// Add liquidity if TVL is high enough
|
|
2801
|
-
|
|
2989
|
+
// Use compareAmounts for precise liquidity threshold comparison
|
|
2990
|
+
if (compareAmounts(poolInfo.liquidity, '50000') > 0) {
|
|
2802
2991
|
await sdk.addSwapLiquidityByPrice({
|
|
2803
2992
|
token0: pool.token0,
|
|
2804
2993
|
token1: pool.token1,
|
|
@@ -2879,6 +3068,50 @@ async function subscribeToEvents() {
|
|
|
2879
3068
|
- **Position Monitoring**: Track liquidity changes in your positions
|
|
2880
3069
|
- **Market Analysis**: Analyze trading patterns and volumes
|
|
2881
3070
|
|
|
3071
|
+
### WebSocket Connection Lifecycle
|
|
3072
|
+
|
|
3073
|
+
\`\`\`typescript
|
|
3074
|
+
// Handle connection lifecycle events
|
|
3075
|
+
await sdk.connectStreamWebSocket({
|
|
3076
|
+
onConnect: () => {
|
|
3077
|
+
console.log('WebSocket connected');
|
|
3078
|
+
},
|
|
3079
|
+
onDisconnect: (reason) => {
|
|
3080
|
+
console.log('WebSocket disconnected:', reason);
|
|
3081
|
+
// Implement reconnection logic if needed
|
|
3082
|
+
},
|
|
3083
|
+
onError: (error) => {
|
|
3084
|
+
console.error('WebSocket error:', error);
|
|
3085
|
+
}
|
|
3086
|
+
});
|
|
3087
|
+
|
|
3088
|
+
// Check connection state
|
|
3089
|
+
if (sdk.isStreamWebSocketConnected()) {
|
|
3090
|
+
console.log('Ready to send/receive messages');
|
|
3091
|
+
}
|
|
3092
|
+
\`\`\`
|
|
3093
|
+
|
|
3094
|
+
### Typing Indicators
|
|
3095
|
+
|
|
3096
|
+
\`\`\`typescript
|
|
3097
|
+
// Subscribe to typing indicators in chat
|
|
3098
|
+
await sdk.connectStreamWebSocket({
|
|
3099
|
+
onTypingIndicator: (event) => {
|
|
3100
|
+
if (event.isTyping) {
|
|
3101
|
+
console.log(\`\${event.userAddress} is typing...\`);
|
|
3102
|
+
} else {
|
|
3103
|
+
console.log(\`\${event.userAddress} stopped typing\`);
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
});
|
|
3107
|
+
|
|
3108
|
+
// Send typing indicator (auto-expires after 5 seconds)
|
|
3109
|
+
await sdk.sendTypingIndicator({
|
|
3110
|
+
tokenName: 'anime',
|
|
3111
|
+
isTyping: true
|
|
3112
|
+
});
|
|
3113
|
+
\`\`\`
|
|
3114
|
+
|
|
2882
3115
|
**MCP Tool Equivalents:**
|
|
2883
3116
|
- \`gala_launchpad_subscribe_to_dex_liquidity_added\`
|
|
2884
3117
|
- \`gala_launchpad_subscribe_to_dex_liquidity_changed\`
|
|
@@ -2907,13 +3140,13 @@ This is a conceptual guide showing how MCP (Model Context Protocol) tools map to
|
|
|
2907
3140
|
\`\`\`
|
|
2908
3141
|
┌─────────────────────────────────────────────────────────────┐
|
|
2909
3142
|
│ MCP Server Layer │
|
|
2910
|
-
│ (
|
|
3143
|
+
│ (181 tools - user-friendly wrappers with validation) │
|
|
2911
3144
|
└─────────────────────────────────────────────────────────────┘
|
|
2912
3145
|
│
|
|
2913
3146
|
▼
|
|
2914
3147
|
┌─────────────────────────────────────────────────────────────┐
|
|
2915
3148
|
│ LaunchpadSDK Layer │
|
|
2916
|
-
│ (
|
|
3149
|
+
│ (116 methods - low-level programmatic access) │
|
|
2917
3150
|
└─────────────────────────────────────────────────────────────┘
|
|
2918
3151
|
│
|
|
2919
3152
|
▼
|
|
@@ -3588,6 +3821,1574 @@ interface RegisterAccountResult {
|
|
|
3588
3821
|
|
|
3589
3822
|
**MCP Tool Equivalents:**
|
|
3590
3823
|
- \`gala_launchpad_register_account\`
|
|
3824
|
+
`,
|
|
3825
|
+
// ============================================================================
|
|
3826
|
+
// LIVE STREAMING: Stream Management & Recordings
|
|
3827
|
+
// ============================================================================
|
|
3828
|
+
'streaming': `
|
|
3829
|
+
# Live Streaming SDK
|
|
3830
|
+
|
|
3831
|
+
The SDK provides comprehensive live streaming management including stream control,
|
|
3832
|
+
recordings management, and simulcast to external platforms.
|
|
3833
|
+
|
|
3834
|
+
## Starting a Stream
|
|
3835
|
+
|
|
3836
|
+
\`\`\`typescript
|
|
3837
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
3838
|
+
|
|
3839
|
+
async function manageStream() {
|
|
3840
|
+
const sdk = createLaunchpadSDK({
|
|
3841
|
+
wallet: 'your-private-key',
|
|
3842
|
+
streamWebSocketUrl: 'wss://stream.example.com', // Required for streaming
|
|
3843
|
+
streamAdminApiKey: 'your-admin-key', // Optional: for admin operations
|
|
3844
|
+
});
|
|
3845
|
+
|
|
3846
|
+
// Start a stream for your token
|
|
3847
|
+
const stream = await sdk.startStream('mytoken');
|
|
3848
|
+
console.log('Stream Key:', stream.streamKey);
|
|
3849
|
+
console.log('RTMP URL:', stream.rtmpUrl);
|
|
3850
|
+
console.log('Playback URL:', stream.playbackUrl);
|
|
3851
|
+
// Use stream.streamKey in OBS or other RTMP software
|
|
3852
|
+
|
|
3853
|
+
// Get stream info (public endpoint)
|
|
3854
|
+
const info = await sdk.getStreamInfo('mytoken');
|
|
3855
|
+
console.log('Status:', info.status); // IDLE, ACTIVE, DISABLED
|
|
3856
|
+
console.log('Is Live:', info.isLive);
|
|
3857
|
+
console.log('Viewers:', info.viewerCount);
|
|
3858
|
+
|
|
3859
|
+
// Stop the stream when done
|
|
3860
|
+
await sdk.stopStream('mytoken');
|
|
3861
|
+
console.log('Stream stopped');
|
|
3862
|
+
|
|
3863
|
+
// Reset stream key if compromised
|
|
3864
|
+
const newKey = await sdk.resetStreamKey('mytoken');
|
|
3865
|
+
console.log('New Stream Key:', newKey.streamKey);
|
|
3866
|
+
}
|
|
3867
|
+
\`\`\`
|
|
3868
|
+
|
|
3869
|
+
## Recordings Management
|
|
3870
|
+
|
|
3871
|
+
\`\`\`typescript
|
|
3872
|
+
async function manageRecordings() {
|
|
3873
|
+
const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
|
|
3874
|
+
|
|
3875
|
+
// List recordings (paginated)
|
|
3876
|
+
const recordings = await sdk.getStreamRecordings({
|
|
3877
|
+
tokenName: 'mytoken',
|
|
3878
|
+
page: 1,
|
|
3879
|
+
limit: 20,
|
|
3880
|
+
});
|
|
3881
|
+
console.log('Total recordings:', recordings.total);
|
|
3882
|
+
|
|
3883
|
+
for (const rec of recordings.recordings) {
|
|
3884
|
+
console.log('Asset ID:', rec.assetId);
|
|
3885
|
+
console.log('Duration:', rec.duration, 'seconds');
|
|
3886
|
+
console.log('Status:', rec.status); // READY, PROCESSING, ERRORED
|
|
3887
|
+
}
|
|
3888
|
+
|
|
3889
|
+
// Get download URL for a recording
|
|
3890
|
+
const download = await sdk.getRecordingDownload('mytoken', 'asset-123');
|
|
3891
|
+
console.log('Download URL:', download.downloadUrl);
|
|
3892
|
+
console.log('Expires:', download.expiresAt);
|
|
3893
|
+
|
|
3894
|
+
// Delete a recording
|
|
3895
|
+
await sdk.deleteRecording('mytoken', 'asset-123');
|
|
3896
|
+
}
|
|
3897
|
+
\`\`\`
|
|
3898
|
+
|
|
3899
|
+
## Simulcast Management
|
|
3900
|
+
|
|
3901
|
+
Rebroadcast your stream to external platforms (YouTube, Twitch, Facebook).
|
|
3902
|
+
|
|
3903
|
+
\`\`\`typescript
|
|
3904
|
+
async function manageSimulcast() {
|
|
3905
|
+
const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
|
|
3906
|
+
|
|
3907
|
+
// Get existing simulcast targets
|
|
3908
|
+
const targets = await sdk.getSimulcastTargets('mytoken');
|
|
3909
|
+
console.log('Max targets:', targets.maxTargets);
|
|
3910
|
+
console.log('Current targets:', targets.targets.length);
|
|
3911
|
+
|
|
3912
|
+
// Add YouTube simulcast
|
|
3913
|
+
const youtube = await sdk.addSimulcastTarget({
|
|
3914
|
+
tokenName: 'mytoken',
|
|
3915
|
+
platform: 'YOUTUBE',
|
|
3916
|
+
rtmpUrl: 'rtmp://a.rtmp.youtube.com/live2',
|
|
3917
|
+
streamKey: 'your-youtube-stream-key',
|
|
3918
|
+
name: 'My YouTube Channel',
|
|
3919
|
+
});
|
|
3920
|
+
console.log('Added target:', youtube.target.targetId);
|
|
3921
|
+
|
|
3922
|
+
// Add Twitch simulcast
|
|
3923
|
+
await sdk.addSimulcastTarget({
|
|
3924
|
+
tokenName: 'mytoken',
|
|
3925
|
+
platform: 'TWITCH',
|
|
3926
|
+
rtmpUrl: 'rtmp://live.twitch.tv/app',
|
|
3927
|
+
streamKey: 'live_123456_abcdef',
|
|
3928
|
+
name: 'Twitch Stream',
|
|
3929
|
+
});
|
|
3930
|
+
|
|
3931
|
+
// Remove a simulcast target
|
|
3932
|
+
await sdk.removeSimulcastTarget('mytoken', youtube.target.targetId);
|
|
3933
|
+
}
|
|
3934
|
+
\`\`\`
|
|
3935
|
+
|
|
3936
|
+
## Admin Operations
|
|
3937
|
+
|
|
3938
|
+
Enable/disable streaming globally or per-token (requires admin API key).
|
|
3939
|
+
|
|
3940
|
+
\`\`\`typescript
|
|
3941
|
+
async function adminOperations() {
|
|
3942
|
+
const sdk = createLaunchpadSDK({
|
|
3943
|
+
wallet: 'your-private-key',
|
|
3944
|
+
streamAdminApiKey: 'your-admin-key',
|
|
3945
|
+
});
|
|
3946
|
+
|
|
3947
|
+
// Disable streaming for a specific token (admin-only)
|
|
3948
|
+
await sdk.disableStream('mytoken');
|
|
3949
|
+
|
|
3950
|
+
// Re-enable streaming for a token (admin-only)
|
|
3951
|
+
await sdk.enableStream('mytoken');
|
|
3952
|
+
|
|
3953
|
+
// Get global streaming status
|
|
3954
|
+
const globalStatus = await sdk.getGlobalStreamingStatus();
|
|
3955
|
+
console.log('Global streaming enabled:', globalStatus.enabled);
|
|
3956
|
+
|
|
3957
|
+
// Enable/disable streaming globally (maintenance mode)
|
|
3958
|
+
await sdk.setGlobalStreamingEnabled(false); // Disable all streams
|
|
3959
|
+
await sdk.setGlobalStreamingEnabled(true); // Re-enable
|
|
3960
|
+
}
|
|
3961
|
+
\`\`\`
|
|
3962
|
+
|
|
3963
|
+
**Available SDK Methods:**
|
|
3964
|
+
| Method | Description | Auth |
|
|
3965
|
+
|--------|-------------|------|
|
|
3966
|
+
| \`startStream(tokenName)\` | Start a stream | Wallet |
|
|
3967
|
+
| \`stopStream(tokenName)\` | Stop a stream | Wallet |
|
|
3968
|
+
| \`getStreamInfo(tokenName)\` | Get stream status | Public |
|
|
3969
|
+
| \`resetStreamKey(tokenName)\` | Generate new stream key | Wallet |
|
|
3970
|
+
| \`disableStream(tokenName)\` | Disable token streaming | Admin |
|
|
3971
|
+
| \`enableStream(tokenName)\` | Enable token streaming | Admin |
|
|
3972
|
+
| \`getStreamRecordings(options)\` | List recordings | Public |
|
|
3973
|
+
| \`getRecordingDownload(tokenName, assetId)\` | Get download URL | Wallet |
|
|
3974
|
+
| \`deleteRecording(tokenName, assetId)\` | Delete recording | Wallet |
|
|
3975
|
+
| \`getSimulcastTargets(tokenName)\` | List simulcast targets | Public |
|
|
3976
|
+
| \`addSimulcastTarget(options)\` | Add simulcast target | Wallet |
|
|
3977
|
+
| \`removeSimulcastTarget(tokenName, targetId)\` | Remove target | Wallet |
|
|
3978
|
+
| \`getGlobalStreamingStatus()\` | Get global status | Public |
|
|
3979
|
+
| \`setGlobalStreamingEnabled(enabled)\` | Enable/disable globally | Admin |
|
|
3980
|
+
| \`getAvailableRoles()\` | Get list of available streaming roles | Public |
|
|
3981
|
+
| \`getStreamRole(options)\` | Get user's role for a token | JWT |
|
|
3982
|
+
| \`getTokenAccess(options)\` | Check user's access to a token stream | JWT (optional) |
|
|
3983
|
+
|
|
3984
|
+
**MCP Tool Equivalents:**
|
|
3985
|
+
- \`gala_launchpad_start_stream\`
|
|
3986
|
+
- \`gala_launchpad_stop_stream\`
|
|
3987
|
+
- \`gala_launchpad_get_stream_info\`
|
|
3988
|
+
- \`gala_launchpad_reset_stream_key\`
|
|
3989
|
+
- \`gala_launchpad_disable_stream\`
|
|
3990
|
+
- \`gala_launchpad_enable_stream\`
|
|
3991
|
+
- \`gala_launchpad_get_stream_recordings\`
|
|
3992
|
+
- \`gala_launchpad_get_recording_download\`
|
|
3993
|
+
- \`gala_launchpad_delete_recording\`
|
|
3994
|
+
- \`gala_launchpad_get_simulcast_targets\`
|
|
3995
|
+
- \`gala_launchpad_add_simulcast_target\`
|
|
3996
|
+
- \`gala_launchpad_remove_simulcast_target\`
|
|
3997
|
+
- \`gala_launchpad_get_global_streaming_status\`
|
|
3998
|
+
- \`gala_launchpad_set_global_streaming_enabled\`
|
|
3999
|
+
- \`gala_launchpad_get_available_roles\`
|
|
4000
|
+
- \`gala_launchpad_get_stream_role\`
|
|
4001
|
+
- \`gala_launchpad_get_token_access\`
|
|
4002
|
+
`,
|
|
4003
|
+
// ============================================================================
|
|
4004
|
+
// STREAM CHAT: Real-time Chat Operations
|
|
4005
|
+
// ============================================================================
|
|
4006
|
+
'stream-chat': `
|
|
4007
|
+
# Stream Chat SDK
|
|
4008
|
+
|
|
4009
|
+
The SDK provides chat functionality for live streams, including REST API and
|
|
4010
|
+
WebSocket real-time messaging.
|
|
4011
|
+
|
|
4012
|
+
## REST API Chat
|
|
4013
|
+
|
|
4014
|
+
\`\`\`typescript
|
|
4015
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
4016
|
+
|
|
4017
|
+
async function restChat() {
|
|
4018
|
+
const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
|
|
4019
|
+
|
|
4020
|
+
// Get chat messages (public endpoint)
|
|
4021
|
+
const messages = await sdk.getChatMessages({
|
|
4022
|
+
tokenName: 'mytoken',
|
|
4023
|
+
page: 1,
|
|
4024
|
+
limit: 50,
|
|
4025
|
+
});
|
|
4026
|
+
|
|
4027
|
+
for (const msg of messages.messages) {
|
|
4028
|
+
console.log(\`[\${msg.createdAt}] \${msg.user?.fullName}: \${msg.content}\`);
|
|
4029
|
+
}
|
|
4030
|
+
|
|
4031
|
+
// Send a chat message via REST
|
|
4032
|
+
const sent = await sdk.sendChatMessage({
|
|
4033
|
+
tokenName: 'mytoken',
|
|
4034
|
+
content: 'Hello everyone!',
|
|
4035
|
+
});
|
|
4036
|
+
console.log('Message ID:', sent.message.messageId);
|
|
4037
|
+
|
|
4038
|
+
// Delete a chat message (user can delete own, admin can delete any)
|
|
4039
|
+
const deleted = await sdk.deleteChatMessage({
|
|
4040
|
+
tokenName: 'mytoken',
|
|
4041
|
+
messageId: sent.message.messageId,
|
|
4042
|
+
});
|
|
4043
|
+
console.log('Message deleted:', deleted.deleted);
|
|
4044
|
+
|
|
4045
|
+
// Check chat status
|
|
4046
|
+
const status = await sdk.getChatStatus('mytoken');
|
|
4047
|
+
console.log('Chat enabled:', status.enabled);
|
|
4048
|
+
if (!status.enabled) {
|
|
4049
|
+
console.log('Reason:', status.reason); // 'global' or 'token'
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
\`\`\`
|
|
4053
|
+
|
|
4054
|
+
## WebSocket Real-time Chat
|
|
4055
|
+
|
|
4056
|
+
Lower latency messaging with real-time updates.
|
|
4057
|
+
|
|
4058
|
+
\`\`\`typescript
|
|
4059
|
+
async function webSocketChat() {
|
|
4060
|
+
const sdk = createLaunchpadSDK({
|
|
4061
|
+
wallet: 'your-private-key',
|
|
4062
|
+
streamWebSocketUrl: 'wss://stream.example.com',
|
|
4063
|
+
});
|
|
4064
|
+
|
|
4065
|
+
// Connect with event callbacks
|
|
4066
|
+
await sdk.connectStreamWebSocket({
|
|
4067
|
+
onConnect: () => console.log('Connected!'),
|
|
4068
|
+
onDisconnect: (reason) => console.log('Disconnected:', reason),
|
|
4069
|
+
onError: (error) => console.error('Error:', error),
|
|
4070
|
+
onChatMessage: (msg) => {
|
|
4071
|
+
console.log(\`[\${msg.tokenName}] \${msg.userAddress}: \${msg.content}\`);
|
|
4072
|
+
},
|
|
4073
|
+
onViewerCount: (data) => {
|
|
4074
|
+
console.log(\`Viewers on \${data.tokenName}: \${data.count}\`);
|
|
4075
|
+
},
|
|
4076
|
+
onStreamStatus: (status) => {
|
|
4077
|
+
console.log(\`Stream \${status.tokenName}: \${status.status}\`);
|
|
4078
|
+
},
|
|
4079
|
+
});
|
|
4080
|
+
|
|
4081
|
+
// Authenticate (required for sending messages)
|
|
4082
|
+
await sdk.authenticateStreamWebSocket();
|
|
4083
|
+
|
|
4084
|
+
// Subscribe to a stream's events
|
|
4085
|
+
const subscribed = await sdk.subscribeToStream('mytoken');
|
|
4086
|
+
console.log('Subscribed, stream status:', subscribed.status);
|
|
4087
|
+
|
|
4088
|
+
// Send message via WebSocket (lower latency)
|
|
4089
|
+
await sdk.sendStreamChatViaWebSocket('mytoken', 'Hello via WebSocket!');
|
|
4090
|
+
|
|
4091
|
+
// Send emoji reaction (ephemeral, not persisted)
|
|
4092
|
+
await sdk.sendStreamReaction('mytoken', '🔥', 0);
|
|
4093
|
+
|
|
4094
|
+
// Unsubscribe when done
|
|
4095
|
+
await sdk.unsubscribeFromStream('mytoken');
|
|
4096
|
+
|
|
4097
|
+
// Disconnect
|
|
4098
|
+
sdk.disconnectStreamWebSocket();
|
|
4099
|
+
}
|
|
4100
|
+
\`\`\`
|
|
4101
|
+
|
|
4102
|
+
## Admin Chat Operations
|
|
4103
|
+
|
|
4104
|
+
\`\`\`typescript
|
|
4105
|
+
async function adminChat() {
|
|
4106
|
+
const sdk = createLaunchpadSDK({
|
|
4107
|
+
wallet: 'your-private-key',
|
|
4108
|
+
streamAdminApiKey: 'your-admin-key',
|
|
4109
|
+
});
|
|
4110
|
+
|
|
4111
|
+
// Disable chat for a token
|
|
4112
|
+
await sdk.disableChat('mytoken');
|
|
4113
|
+
|
|
4114
|
+
// Re-enable chat
|
|
4115
|
+
await sdk.enableChat('mytoken');
|
|
4116
|
+
|
|
4117
|
+
// Get global chat status
|
|
4118
|
+
const globalStatus = await sdk.getGlobalChatStatus();
|
|
4119
|
+
console.log('Global chat enabled:', globalStatus.enabled);
|
|
4120
|
+
|
|
4121
|
+
// Disable/enable chat globally
|
|
4122
|
+
await sdk.setGlobalChatEnabled(false); // Disable all chat
|
|
4123
|
+
await sdk.setGlobalChatEnabled(true); // Re-enable
|
|
4124
|
+
}
|
|
4125
|
+
\`\`\`
|
|
4126
|
+
|
|
4127
|
+
**WebSocket Events:**
|
|
4128
|
+
| Event | Description | Payload |
|
|
4129
|
+
|-------|-------------|---------|
|
|
4130
|
+
| \`chat_message\` | New chat message | \`{ tokenName, messageId, content, userAddress, user? }\` |
|
|
4131
|
+
| \`viewer_count\` | Viewer count update | \`{ tokenName, count }\` |
|
|
4132
|
+
| \`stream_status\` | Stream status change | \`{ tokenName, status, isLive, playbackId }\` |
|
|
4133
|
+
| \`chat_status\` | Chat enabled/disabled | \`{ tokenName, enabled }\` |
|
|
4134
|
+
|
|
4135
|
+
**Available SDK Methods:**
|
|
4136
|
+
| Method | Description | Auth |
|
|
4137
|
+
|--------|-------------|------|
|
|
4138
|
+
| \`getChatMessages(options)\` | Get chat history | Public |
|
|
4139
|
+
| \`sendChatMessage(options)\` | Send via REST | Wallet |
|
|
4140
|
+
| \`deleteChatMessage(options)\` | Delete message | Wallet/Admin |
|
|
4141
|
+
| \`getChatStatus(tokenName)\` | Check chat status | Public |
|
|
4142
|
+
| \`disableChat(tokenName)\` | Disable token chat | Admin |
|
|
4143
|
+
| \`enableChat(tokenName)\` | Enable token chat | Admin |
|
|
4144
|
+
| \`getGlobalChatStatus()\` | Get global status | Public |
|
|
4145
|
+
| \`setGlobalChatEnabled(enabled)\` | Enable/disable globally | Admin |
|
|
4146
|
+
| \`connectStreamWebSocket(callbacks)\` | Connect WebSocket | None |
|
|
4147
|
+
| \`authenticateStreamWebSocket()\` | Authenticate WS | Wallet |
|
|
4148
|
+
| \`subscribeToStream(tokenName)\` | Subscribe to events | None |
|
|
4149
|
+
| \`unsubscribeFromStream(tokenName)\` | Unsubscribe | None |
|
|
4150
|
+
| \`sendStreamChatViaWebSocket(tokenName, content)\` | Send via WS | Wallet |
|
|
4151
|
+
| \`sendStreamReaction(tokenName, emoji, streamTime)\` | Send emoji reaction | Wallet |
|
|
4152
|
+
| \`disconnectStreamWebSocket()\` | Close connection | None |
|
|
4153
|
+
| \`getEngagementStats(tokenName)\` | Get viewer and chat engagement stats | Public |
|
|
4154
|
+
|
|
4155
|
+
**MCP Tool Equivalents:**
|
|
4156
|
+
- \`gala_launchpad_get_chat_messages\`
|
|
4157
|
+
- \`gala_launchpad_send_chat_message\`
|
|
4158
|
+
- \`gala_launchpad_delete_chat_message\`
|
|
4159
|
+
- \`gala_launchpad_get_chat_status\`
|
|
4160
|
+
- \`gala_launchpad_set_chat_enabled\`
|
|
4161
|
+
- \`gala_launchpad_get_global_chat_status\`
|
|
4162
|
+
- \`gala_launchpad_set_global_chat_enabled\`
|
|
4163
|
+
- \`gala_launchpad_connect_stream_websocket\`
|
|
4164
|
+
- \`gala_launchpad_subscribe_to_stream\`
|
|
4165
|
+
- \`gala_launchpad_send_stream_chat_websocket\`
|
|
4166
|
+
- \`gala_launchpad_send_stream_reaction\`
|
|
4167
|
+
- \`gala_launchpad_get_engagement_stats\`
|
|
4168
|
+
`,
|
|
4169
|
+
// ============================================================================
|
|
4170
|
+
// SESSION AUTHENTICATION (JWT)
|
|
4171
|
+
// ============================================================================
|
|
4172
|
+
'session-auth': `
|
|
4173
|
+
# Session Authentication (JWT) - SDK v5.1.0+
|
|
4174
|
+
|
|
4175
|
+
JWT-based session authentication for protected operations (streaming, chat, profile updates).
|
|
4176
|
+
|
|
4177
|
+
## Authentication Flow
|
|
4178
|
+
|
|
4179
|
+
\`\`\`typescript
|
|
4180
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
4181
|
+
|
|
4182
|
+
const sdk = createLaunchpadSDK({
|
|
4183
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
4184
|
+
environment: 'production',
|
|
4185
|
+
});
|
|
4186
|
+
|
|
4187
|
+
// 1. Login to get JWT token
|
|
4188
|
+
const session = await sdk.login();
|
|
4189
|
+
console.log('Authenticated:', session.address);
|
|
4190
|
+
console.log('Token expires in:', session.expiresIn, 'seconds');
|
|
4191
|
+
|
|
4192
|
+
// 2. Check authentication status
|
|
4193
|
+
if (sdk.isAuthenticated()) {
|
|
4194
|
+
console.log('Session is valid');
|
|
4195
|
+
}
|
|
4196
|
+
|
|
4197
|
+
// 3. Get current session info
|
|
4198
|
+
const info = await sdk.getSession();
|
|
4199
|
+
console.log('Session issued at:', info.issuedAt);
|
|
4200
|
+
console.log('Session expires at:', info.expiresAt);
|
|
4201
|
+
|
|
4202
|
+
// 4. Access token directly (for custom requests)
|
|
4203
|
+
const token = sdk.getAccessToken();
|
|
4204
|
+
console.log('JWT token:', token);
|
|
4205
|
+
|
|
4206
|
+
// 5. Refresh token before expiry
|
|
4207
|
+
if (sdk.shouldRefreshToken()) {
|
|
4208
|
+
const refreshed = await sdk.refreshToken();
|
|
4209
|
+
console.log('Token refreshed, new expiry:', refreshed.expiresIn);
|
|
4210
|
+
}
|
|
4211
|
+
|
|
4212
|
+
// 6. Ensure valid token (auto-refreshes if needed)
|
|
4213
|
+
const validToken = await sdk.ensureValidToken();
|
|
4214
|
+
console.log('Valid token obtained');
|
|
4215
|
+
|
|
4216
|
+
// 7. Logout when done
|
|
4217
|
+
sdk.logout();
|
|
4218
|
+
console.log('Logged out');
|
|
4219
|
+
\`\`\`
|
|
4220
|
+
|
|
4221
|
+
## Auto-Refresh Behavior
|
|
4222
|
+
|
|
4223
|
+
The SDK automatically refreshes tokens when:
|
|
4224
|
+
- Token expires within 5 minutes (default threshold)
|
|
4225
|
+
- Making requests to JWT-protected endpoints
|
|
4226
|
+
|
|
4227
|
+
\`\`\`typescript
|
|
4228
|
+
// Manual refresh threshold check
|
|
4229
|
+
const shouldRefresh = sdk.shouldRefreshToken(10 * 60 * 1000); // 10 min threshold
|
|
4230
|
+
|
|
4231
|
+
// ensureValidToken auto-refreshes if needed
|
|
4232
|
+
const token = await sdk.ensureValidToken(5 * 60 * 1000); // 5 min threshold
|
|
4233
|
+
\`\`\`
|
|
4234
|
+
|
|
4235
|
+
## Protected Endpoints
|
|
4236
|
+
|
|
4237
|
+
These operations require JWT authentication (call \\\`login()\\\` first):
|
|
4238
|
+
|
|
4239
|
+
**Streaming:**
|
|
4240
|
+
- \\\`startStream()\\\` - Start live stream
|
|
4241
|
+
- \\\`resetStreamKey()\\\` - Reset RTMP key
|
|
4242
|
+
- \\\`getRecordingDownload()\\\` - Download recordings
|
|
4243
|
+
- \\\`deleteRecording()\\\` - Delete recordings
|
|
4244
|
+
- \\\`addSimulcastTarget()\\\` - Add simulcast
|
|
4245
|
+
- \\\`removeSimulcastTarget()\\\` - Remove simulcast
|
|
4246
|
+
|
|
4247
|
+
**Chat:**
|
|
4248
|
+
- \\\`sendChatMessage()\\\` - Send chat messages
|
|
4249
|
+
|
|
4250
|
+
**Profile:**
|
|
4251
|
+
- \\\`updateProfile()\\\` - Update user profile
|
|
4252
|
+
|
|
4253
|
+
**Uploads:**
|
|
4254
|
+
- \\\`uploadTokenImage()\\\` - Upload token images
|
|
4255
|
+
- \\\`uploadProfileImage()\\\` - Upload profile images
|
|
4256
|
+
|
|
4257
|
+
## Error Handling
|
|
4258
|
+
|
|
4259
|
+
\`\`\`typescript
|
|
4260
|
+
try {
|
|
4261
|
+
await sdk.login();
|
|
4262
|
+
} catch (error) {
|
|
4263
|
+
if (error.message.includes('signature')) {
|
|
4264
|
+
console.error('Wallet signature failed');
|
|
4265
|
+
} else if (error.message.includes('network')) {
|
|
4266
|
+
console.error('Network error during login');
|
|
4267
|
+
}
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
// Check auth before protected operations
|
|
4271
|
+
if (!sdk.isAuthenticated()) {
|
|
4272
|
+
await sdk.login();
|
|
4273
|
+
}
|
|
4274
|
+
|
|
4275
|
+
try {
|
|
4276
|
+
await sdk.startStream('mytoken');
|
|
4277
|
+
} catch (error) {
|
|
4278
|
+
if (error.message.includes('JWT') || error.message.includes('token')) {
|
|
4279
|
+
// Re-authenticate and retry
|
|
4280
|
+
await sdk.login();
|
|
4281
|
+
await sdk.startStream('mytoken');
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
\`\`\`
|
|
4285
|
+
|
|
4286
|
+
## Session Methods Reference
|
|
4287
|
+
|
|
4288
|
+
| Method | Description | Returns |
|
|
4289
|
+
|--------|-------------|---------|
|
|
4290
|
+
| \\\`login()\\\` | Authenticate with wallet signature | \\\`{ accessToken, expiresIn, address }\\\` |
|
|
4291
|
+
| \\\`logout()\\\` | Clear JWT token (client-side) | \\\`void\\\` |
|
|
4292
|
+
| \\\`refreshToken()\\\` | Get new JWT token | \\\`{ accessToken, expiresIn, address }\\\` |
|
|
4293
|
+
| \\\`getSession()\\\` | Get session info | \\\`{ address, issuedAt, expiresAt }\\\` |
|
|
4294
|
+
| \\\`isAuthenticated()\\\` | Check if token exists and valid | \\\`boolean\\\` |
|
|
4295
|
+
| \\\`shouldRefreshToken(threshold?)\\\` | Check if refresh needed | \\\`boolean\\\` |
|
|
4296
|
+
| \\\`getAccessToken()\\\` | Get raw JWT token | \\\`string | null\\\` |
|
|
4297
|
+
| \\\`ensureValidToken(threshold?)\\\` | Auto-refresh if needed | \\\`Promise<string>\\\` |
|
|
4298
|
+
|
|
4299
|
+
## Dev Bypass (STAGE Only)
|
|
4300
|
+
|
|
4301
|
+
For testing in STAGE environment without JWT:
|
|
4302
|
+
|
|
4303
|
+
\`\`\`typescript
|
|
4304
|
+
const sdk = createLaunchpadSDK({
|
|
4305
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
4306
|
+
environment: 'development',
|
|
4307
|
+
devBypass: true, // Skip JWT auth in STAGE
|
|
4308
|
+
});
|
|
4309
|
+
|
|
4310
|
+
// Protected methods work without login() in STAGE
|
|
4311
|
+
await sdk.startStream('testtoken');
|
|
4312
|
+
\`\`\`
|
|
4313
|
+
|
|
4314
|
+
**Note:** Dev bypass only works in STAGE/development environments.
|
|
4315
|
+
`,
|
|
4316
|
+
// ============================================================================
|
|
4317
|
+
// BAN/MODERATION OPERATIONS
|
|
4318
|
+
// ============================================================================
|
|
4319
|
+
'ban-management': `
|
|
4320
|
+
# Ban/Moderation Operations - SDK v5.5.0+
|
|
4321
|
+
|
|
4322
|
+
User ban management for stream moderation, including creating bans, removing bans,
|
|
4323
|
+
listing banned users, checking ban status, and viewing active users.
|
|
4324
|
+
|
|
4325
|
+
## Creating and Removing Bans
|
|
4326
|
+
|
|
4327
|
+
\`\`\`typescript
|
|
4328
|
+
import { createLaunchpadSDK, BAN_DURATIONS } from '@gala-chain/launchpad-sdk';
|
|
4329
|
+
|
|
4330
|
+
const sdk = createLaunchpadSDK({
|
|
4331
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
4332
|
+
streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY, // Admin key for ban ops
|
|
4333
|
+
});
|
|
4334
|
+
|
|
4335
|
+
// Create a permanent ban
|
|
4336
|
+
const permanentBan = await sdk.createBan({
|
|
4337
|
+
tokenName: 'mytoken',
|
|
4338
|
+
userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',
|
|
4339
|
+
reason: 'Spamming chat',
|
|
4340
|
+
});
|
|
4341
|
+
console.log('Permanent ban created:', permanentBan.ban.id);
|
|
4342
|
+
|
|
4343
|
+
// Create a temporary ban (1 hour)
|
|
4344
|
+
const tempBan = await sdk.createBan({
|
|
4345
|
+
tokenName: 'mytoken',
|
|
4346
|
+
userAddress: 'eth|0xabcdef1234567890abcdef1234567890abcdef12',
|
|
4347
|
+
reason: 'Inappropriate behavior',
|
|
4348
|
+
durationSeconds: BAN_DURATIONS.ONE_HOUR, // 3600 seconds
|
|
4349
|
+
});
|
|
4350
|
+
console.log('Temp ban expires:', tempBan.ban.expiresAt);
|
|
4351
|
+
|
|
4352
|
+
// Remove a ban (unban user)
|
|
4353
|
+
const unbanned = await sdk.removeBan({
|
|
4354
|
+
tokenName: 'mytoken',
|
|
4355
|
+
userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',
|
|
4356
|
+
});
|
|
4357
|
+
console.log('User unbanned:', unbanned.removed);
|
|
4358
|
+
\`\`\`
|
|
4359
|
+
|
|
4360
|
+
## Duration Presets
|
|
4361
|
+
|
|
4362
|
+
\`\`\`typescript
|
|
4363
|
+
import { BAN_DURATIONS } from '@gala-chain/launchpad-sdk';
|
|
4364
|
+
|
|
4365
|
+
// Available presets
|
|
4366
|
+
BAN_DURATIONS.ONE_HOUR // 3600 seconds (1 hour)
|
|
4367
|
+
BAN_DURATIONS.ONE_DAY // 86400 seconds (24 hours)
|
|
4368
|
+
BAN_DURATIONS.ONE_WEEK // 604800 seconds (7 days)
|
|
4369
|
+
BAN_DURATIONS.ONE_MONTH // 2592000 seconds (30 days)
|
|
4370
|
+
|
|
4371
|
+
// Custom duration (min: 60 sec, max: 31536000 sec / 1 year)
|
|
4372
|
+
const customBan = await sdk.createBan({
|
|
4373
|
+
tokenName: 'mytoken',
|
|
4374
|
+
userAddress: 'eth|0x...',
|
|
4375
|
+
durationSeconds: 7200, // 2 hours
|
|
4376
|
+
});
|
|
4377
|
+
\`\`\`
|
|
4378
|
+
|
|
4379
|
+
## Listing Bans
|
|
4380
|
+
|
|
4381
|
+
\`\`\`typescript
|
|
4382
|
+
// List all bans for a token
|
|
4383
|
+
const allBans = await sdk.listBans({
|
|
4384
|
+
tokenName: 'mytoken',
|
|
4385
|
+
page: 1,
|
|
4386
|
+
limit: 20,
|
|
4387
|
+
});
|
|
4388
|
+
console.log('Total bans:', allBans.meta.total);
|
|
4389
|
+
|
|
4390
|
+
for (const ban of allBans.bans) {
|
|
4391
|
+
console.log(\`- \${ban.userAddress}: \${ban.reason || 'No reason'}\`);
|
|
4392
|
+
console.log(\` Permanent: \${ban.isPermanent}\`);
|
|
4393
|
+
console.log(\` Expires: \${ban.expiresAt || 'Never'}\`);
|
|
4394
|
+
}
|
|
4395
|
+
|
|
4396
|
+
// Search bans by user
|
|
4397
|
+
const searchResults = await sdk.listBans({
|
|
4398
|
+
tokenName: 'mytoken',
|
|
4399
|
+
search: '0x1234', // Searches userAddress OR fullName
|
|
4400
|
+
});
|
|
4401
|
+
|
|
4402
|
+
// Filter by specific field
|
|
4403
|
+
const filteredBans = await sdk.listBans({
|
|
4404
|
+
tokenName: 'mytoken',
|
|
4405
|
+
userAddress: '0x1234', // Filter by address only
|
|
4406
|
+
name: 'John', // Filter by display name only
|
|
4407
|
+
});
|
|
4408
|
+
\`\`\`
|
|
4409
|
+
|
|
4410
|
+
## Checking Ban Status
|
|
4411
|
+
|
|
4412
|
+
\`\`\`typescript
|
|
4413
|
+
// Check if specific user is banned
|
|
4414
|
+
const status = await sdk.getBanStatus({
|
|
4415
|
+
tokenName: 'mytoken',
|
|
4416
|
+
userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',
|
|
4417
|
+
});
|
|
4418
|
+
|
|
4419
|
+
if (status.banned) {
|
|
4420
|
+
console.log('User is banned!');
|
|
4421
|
+
console.log('Reason:', status.ban?.reason);
|
|
4422
|
+
console.log('Permanent:', status.ban?.isPermanent);
|
|
4423
|
+
console.log('Expires:', status.ban?.expiresAt);
|
|
4424
|
+
} else {
|
|
4425
|
+
console.log('User is not banned');
|
|
4426
|
+
}
|
|
4427
|
+
\`\`\`
|
|
4428
|
+
|
|
4429
|
+
## Viewing Active Users
|
|
4430
|
+
|
|
4431
|
+
\`\`\`typescript
|
|
4432
|
+
import { ACTIVE_USER_TYPE } from '@gala-chain/launchpad-sdk';
|
|
4433
|
+
|
|
4434
|
+
// Get all active viewers
|
|
4435
|
+
const viewers = await sdk.getActiveUsers({
|
|
4436
|
+
tokenName: 'mytoken',
|
|
4437
|
+
type: ACTIVE_USER_TYPE.VIEWERS, // or 'viewers'
|
|
4438
|
+
});
|
|
4439
|
+
console.log('Active viewers:', viewers.total);
|
|
4440
|
+
|
|
4441
|
+
// Get only chat participants
|
|
4442
|
+
const chatters = await sdk.getActiveUsers({
|
|
4443
|
+
tokenName: 'mytoken',
|
|
4444
|
+
type: ACTIVE_USER_TYPE.CHAT_PARTICIPANTS, // or 'chat_participants'
|
|
4445
|
+
});
|
|
4446
|
+
console.log('Chat participants:', chatters.total);
|
|
4447
|
+
|
|
4448
|
+
// Search active users
|
|
4449
|
+
const searchActive = await sdk.getActiveUsers({
|
|
4450
|
+
tokenName: 'mytoken',
|
|
4451
|
+
search: 'john', // Search by name or address
|
|
4452
|
+
});
|
|
4453
|
+
|
|
4454
|
+
for (const user of searchActive.users) {
|
|
4455
|
+
console.log(\`- \${user.fullName || user.userAddress}\`);
|
|
4456
|
+
console.log(\` In chat: \${user.isChatParticipant}\`);
|
|
4457
|
+
}
|
|
4458
|
+
\`\`\`
|
|
4459
|
+
|
|
4460
|
+
## Authentication
|
|
4461
|
+
|
|
4462
|
+
Ban operations support two authentication modes:
|
|
4463
|
+
|
|
4464
|
+
1. **Admin API Key** (streamAdminApiKey) - Full moderation access
|
|
4465
|
+
2. **JWT Auth** (login()) - Token owner moderation only
|
|
4466
|
+
|
|
4467
|
+
\`\`\`typescript
|
|
4468
|
+
// Admin mode - can moderate any token
|
|
4469
|
+
const adminSdk = createLaunchpadSDK({
|
|
4470
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
4471
|
+
streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY,
|
|
4472
|
+
});
|
|
4473
|
+
|
|
4474
|
+
// Owner mode - can only moderate own tokens
|
|
4475
|
+
const ownerSdk = createLaunchpadSDK({
|
|
4476
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
4477
|
+
});
|
|
4478
|
+
await ownerSdk.login(); // JWT authentication required
|
|
4479
|
+
\`\`\`
|
|
4480
|
+
|
|
4481
|
+
## WebSocket Events
|
|
4482
|
+
|
|
4483
|
+
Ban events are broadcast to affected users via WebSocket:
|
|
4484
|
+
|
|
4485
|
+
\`\`\`typescript
|
|
4486
|
+
// Listen for ban events
|
|
4487
|
+
sdk.connectStreamWebSocket({
|
|
4488
|
+
onUserBanned: (event) => {
|
|
4489
|
+
console.log('User banned:', event.userAddress);
|
|
4490
|
+
console.log('Reason:', event.reason);
|
|
4491
|
+
console.log('Expires:', event.expiresAt);
|
|
4492
|
+
},
|
|
4493
|
+
onUserUnbanned: (event) => {
|
|
4494
|
+
console.log('User unbanned:', event.userAddress);
|
|
4495
|
+
},
|
|
4496
|
+
onBanEnforcement: (event) => {
|
|
4497
|
+
// Received when banned user tries to chat/react
|
|
4498
|
+
console.log('Ban enforced for action:', event.action);
|
|
4499
|
+
console.log('Reason:', event.reason);
|
|
4500
|
+
},
|
|
4501
|
+
});
|
|
4502
|
+
\`\`\`
|
|
4503
|
+
|
|
4504
|
+
## SDK Methods Reference
|
|
4505
|
+
|
|
4506
|
+
| Method | Description | Auth |
|
|
4507
|
+
|--------|-------------|------|
|
|
4508
|
+
| \`createBan(options)\` | Create a new ban | Admin/Owner |
|
|
4509
|
+
| \`removeBan(options)\` | Remove a ban (unban user) | Admin/Owner |
|
|
4510
|
+
| \`listBans(options)\` | List banned users | Admin/Owner |
|
|
4511
|
+
| \`getBanStatus(options)\` | Check if user is banned | Admin/Owner |
|
|
4512
|
+
| \`getActiveUsers(options)\` | Get active viewers/chatters | Admin/Owner |
|
|
4513
|
+
|
|
4514
|
+
**MCP Tool Equivalents:**
|
|
4515
|
+
- \`gala_launchpad_create_ban\`
|
|
4516
|
+
- \`gala_launchpad_remove_ban\`
|
|
4517
|
+
- \`gala_launchpad_list_bans\`
|
|
4518
|
+
- \`gala_launchpad_get_ban_status\`
|
|
4519
|
+
- \`gala_launchpad_get_active_users\`
|
|
4520
|
+
`,
|
|
4521
|
+
'api-key-management': `
|
|
4522
|
+
# API Key Management - SDK v5.6.0+
|
|
4523
|
+
|
|
4524
|
+
User-managed API keys with role-based permissions for delegating token management
|
|
4525
|
+
authority to third-party services or automated systems.
|
|
4526
|
+
|
|
4527
|
+
**CRITICAL**: Raw API keys are ONLY shown once at creation time. Store them
|
|
4528
|
+
securely immediately - they cannot be retrieved again.
|
|
4529
|
+
|
|
4530
|
+
## Creating API Keys
|
|
4531
|
+
|
|
4532
|
+
\`\`\`typescript
|
|
4533
|
+
import { createLaunchpadSDK, API_KEY_ROLE } from '@gala-chain/launchpad-sdk';
|
|
4534
|
+
|
|
4535
|
+
const sdk = createLaunchpadSDK({
|
|
4536
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
4537
|
+
});
|
|
4538
|
+
|
|
4539
|
+
// MUST authenticate first
|
|
4540
|
+
await sdk.login();
|
|
4541
|
+
|
|
4542
|
+
// Create a moderator key for specific tokens
|
|
4543
|
+
const result = await sdk.createApiKey({
|
|
4544
|
+
role: API_KEY_ROLE.MODERATOR,
|
|
4545
|
+
description: 'Chat moderation bot',
|
|
4546
|
+
delegateAllTokens: false,
|
|
4547
|
+
tokenNames: ['mytoken', 'othertoken'],
|
|
4548
|
+
expiresAt: '2025-12-31T23:59:59Z', // Optional expiration
|
|
4549
|
+
});
|
|
4550
|
+
|
|
4551
|
+
// CRITICAL: Save this immediately - shown only once!
|
|
4552
|
+
console.log('Raw Key:', result.rawKey);
|
|
4553
|
+
// Format: glp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
4554
|
+
console.log('Key ID:', result.id);
|
|
4555
|
+
console.log('Prefix:', result.keyPrefix);
|
|
4556
|
+
\`\`\`
|
|
4557
|
+
|
|
4558
|
+
## Role Hierarchy
|
|
4559
|
+
|
|
4560
|
+
\`\`\`typescript
|
|
4561
|
+
import { API_KEY_ROLE, API_KEY_ROLE_HIERARCHY } from '@gala-chain/launchpad-sdk';
|
|
4562
|
+
|
|
4563
|
+
// Available roles (hierarchical)
|
|
4564
|
+
API_KEY_ROLE.MODERATOR // Chat, comments, bans
|
|
4565
|
+
API_KEY_ROLE.TECHNICAL_PRODUCER // Simulcast, stream key, stop/start
|
|
4566
|
+
API_KEY_ROLE.MANAGER // Moderator + Technical Producer + recordings
|
|
4567
|
+
API_KEY_ROLE.OWNER // Full access (indistinguishable from normal auth)
|
|
4568
|
+
|
|
4569
|
+
// Role hierarchy levels
|
|
4570
|
+
API_KEY_ROLE_HIERARCHY.MODERATOR // 1
|
|
4571
|
+
API_KEY_ROLE_HIERARCHY.TECHNICAL_PRODUCER // 1
|
|
4572
|
+
API_KEY_ROLE_HIERARCHY.MANAGER // 2
|
|
4573
|
+
API_KEY_ROLE_HIERARCHY.OWNER // 3
|
|
4574
|
+
|
|
4575
|
+
// Check if role has sufficient permission
|
|
4576
|
+
import { roleHasSufficientPermission } from '@gala-chain/launchpad-sdk';
|
|
4577
|
+
|
|
4578
|
+
const canManage = roleHasSufficientPermission('MANAGER', 'MODERATOR'); // true
|
|
4579
|
+
const canOwn = roleHasSufficientPermission('MODERATOR', 'OWNER'); // false
|
|
4580
|
+
\`\`\`
|
|
4581
|
+
|
|
4582
|
+
## Token Delegation
|
|
4583
|
+
|
|
4584
|
+
\`\`\`typescript
|
|
4585
|
+
// Delegate all tokens (current and future)
|
|
4586
|
+
const allTokensKey = await sdk.createApiKey({
|
|
4587
|
+
role: API_KEY_ROLE.MODERATOR,
|
|
4588
|
+
description: 'All tokens moderator',
|
|
4589
|
+
delegateAllTokens: true,
|
|
4590
|
+
});
|
|
4591
|
+
|
|
4592
|
+
// Delegate specific tokens only
|
|
4593
|
+
const specificKey = await sdk.createApiKey({
|
|
4594
|
+
role: API_KEY_ROLE.MANAGER,
|
|
4595
|
+
description: 'Project manager for specific tokens',
|
|
4596
|
+
delegateAllTokens: false,
|
|
4597
|
+
tokenNames: ['token1', 'token2', 'token3'], // Case-insensitive
|
|
4598
|
+
});
|
|
4599
|
+
\`\`\`
|
|
4600
|
+
|
|
4601
|
+
## Listing and Getting API Keys
|
|
4602
|
+
|
|
4603
|
+
\`\`\`typescript
|
|
4604
|
+
// List all API keys (paginated)
|
|
4605
|
+
const list = await sdk.listApiKeys({
|
|
4606
|
+
page: 1,
|
|
4607
|
+
limit: 20,
|
|
4608
|
+
});
|
|
4609
|
+
console.log('Total keys:', list.meta.total);
|
|
4610
|
+
|
|
4611
|
+
for (const key of list.apiKeys) {
|
|
4612
|
+
console.log(\`- \${key.keyPrefix}: \${key.role}\`);
|
|
4613
|
+
console.log(\` Description: \${key.description || 'None'}\`);
|
|
4614
|
+
console.log(\` Last used: \${key.lastUsedAt || 'Never'}\`);
|
|
4615
|
+
console.log(\` Expires: \${key.expiresAt || 'Never'}\`);
|
|
4616
|
+
}
|
|
4617
|
+
|
|
4618
|
+
// Get single API key by ID
|
|
4619
|
+
const key = await sdk.getApiKey(123);
|
|
4620
|
+
console.log('Key details:', key);
|
|
4621
|
+
\`\`\`
|
|
4622
|
+
|
|
4623
|
+
## Updating API Keys
|
|
4624
|
+
|
|
4625
|
+
\`\`\`typescript
|
|
4626
|
+
// Update description
|
|
4627
|
+
const updated = await sdk.updateApiKey(123, {
|
|
4628
|
+
description: 'Updated description',
|
|
4629
|
+
});
|
|
4630
|
+
|
|
4631
|
+
// Upgrade role
|
|
4632
|
+
await sdk.updateApiKey(123, {
|
|
4633
|
+
role: API_KEY_ROLE.MANAGER,
|
|
4634
|
+
});
|
|
4635
|
+
|
|
4636
|
+
// Change token delegation
|
|
4637
|
+
await sdk.updateApiKey(123, {
|
|
4638
|
+
delegateAllTokens: true,
|
|
4639
|
+
});
|
|
4640
|
+
|
|
4641
|
+
// Update specific token access (replaces existing)
|
|
4642
|
+
await sdk.updateApiKey(123, {
|
|
4643
|
+
delegateAllTokens: false,
|
|
4644
|
+
tokenNames: ['newtoken1', 'newtoken2'],
|
|
4645
|
+
});
|
|
4646
|
+
|
|
4647
|
+
// Update expiration (null to remove)
|
|
4648
|
+
await sdk.updateApiKey(123, {
|
|
4649
|
+
expiresAt: '2026-12-31T23:59:59Z',
|
|
4650
|
+
});
|
|
4651
|
+
|
|
4652
|
+
// Remove expiration
|
|
4653
|
+
await sdk.updateApiKey(123, {
|
|
4654
|
+
expiresAt: null,
|
|
4655
|
+
});
|
|
4656
|
+
\`\`\`
|
|
4657
|
+
|
|
4658
|
+
## Revoking API Keys
|
|
4659
|
+
|
|
4660
|
+
\`\`\`typescript
|
|
4661
|
+
// Revoke (soft delete) an API key
|
|
4662
|
+
await sdk.revokeApiKey(123);
|
|
4663
|
+
console.log('API key revoked');
|
|
4664
|
+
|
|
4665
|
+
// Key is now unusable - attempts to use it will fail with 401
|
|
4666
|
+
\`\`\`
|
|
4667
|
+
|
|
4668
|
+
## Getting Available Roles
|
|
4669
|
+
|
|
4670
|
+
\`\`\`typescript
|
|
4671
|
+
// Get list of valid roles
|
|
4672
|
+
const roles = sdk.getApiKeyRoles();
|
|
4673
|
+
console.log('Available roles:', roles);
|
|
4674
|
+
// ['MODERATOR', 'TECHNICAL_PRODUCER', 'MANAGER', 'OWNER']
|
|
4675
|
+
\`\`\`
|
|
4676
|
+
|
|
4677
|
+
## Validation Helpers
|
|
4678
|
+
|
|
4679
|
+
\`\`\`typescript
|
|
4680
|
+
import {
|
|
4681
|
+
isValidApiKeyRole,
|
|
4682
|
+
validateCreateApiKeyOptions,
|
|
4683
|
+
validateUpdateApiKeyOptions,
|
|
4684
|
+
} from '@gala-chain/launchpad-sdk';
|
|
4685
|
+
|
|
4686
|
+
// Validate role string
|
|
4687
|
+
if (isValidApiKeyRole('MODERATOR')) {
|
|
4688
|
+
console.log('Valid role');
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4691
|
+
// Validate creation options
|
|
4692
|
+
const createErrors = validateCreateApiKeyOptions({
|
|
4693
|
+
role: 'MODERATOR',
|
|
4694
|
+
description: 'Test key',
|
|
4695
|
+
});
|
|
4696
|
+
if (createErrors.length > 0) {
|
|
4697
|
+
console.error('Validation errors:', createErrors);
|
|
4698
|
+
}
|
|
4699
|
+
|
|
4700
|
+
// Validate update options
|
|
4701
|
+
const updateErrors = validateUpdateApiKeyOptions({
|
|
4702
|
+
role: 'MANAGER',
|
|
4703
|
+
expiresAt: '2025-12-31T23:59:59Z',
|
|
4704
|
+
});
|
|
4705
|
+
\`\`\`
|
|
4706
|
+
|
|
4707
|
+
## SDK Methods Reference
|
|
4708
|
+
|
|
4709
|
+
| Method | Description | Auth |
|
|
4710
|
+
|--------|-------------|------|
|
|
4711
|
+
| \`createApiKey(options)\` | Create new API key | JWT |
|
|
4712
|
+
| \`listApiKeys(options?)\` | List API keys (paginated) | JWT |
|
|
4713
|
+
| \`getApiKey(id)\` | Get API key by ID | JWT |
|
|
4714
|
+
| \`updateApiKey(id, options)\` | Update API key | JWT |
|
|
4715
|
+
| \`revokeApiKey(id)\` | Revoke (soft delete) key | JWT |
|
|
4716
|
+
| \`getApiKeyRoles()\` | Get valid role list | None |
|
|
4717
|
+
|
|
4718
|
+
**MCP Tool Equivalents:**
|
|
4719
|
+
- \`gala_launchpad_create_api_key\`
|
|
4720
|
+
- \`gala_launchpad_list_api_keys\`
|
|
4721
|
+
- \`gala_launchpad_get_api_key\`
|
|
4722
|
+
- \`gala_launchpad_update_api_key\`
|
|
4723
|
+
- \`gala_launchpad_revoke_api_key\`
|
|
4724
|
+
- \`gala_launchpad_get_api_key_roles\`
|
|
4725
|
+
`,
|
|
4726
|
+
'moderator-invites': `
|
|
4727
|
+
# Moderator Invites - SDK v5.7.0+
|
|
4728
|
+
|
|
4729
|
+
Magic link-based moderator delegation system. Token owners can create invite
|
|
4730
|
+
links to grant stream management access to other users without needing their
|
|
4731
|
+
wallet address upfront.
|
|
4732
|
+
|
|
4733
|
+
## Flow Overview
|
|
4734
|
+
|
|
4735
|
+
1. **Owner creates invite** → Gets magic link URL
|
|
4736
|
+
2. **Owner shares link** (email, Slack, Discord, etc.)
|
|
4737
|
+
3. **Recipient clicks link** → Redirected to claim page
|
|
4738
|
+
4. **Recipient logs in** → Claims invite with their wallet
|
|
4739
|
+
5. **Recipient gains access** → Token appears in their /studio dashboard
|
|
4740
|
+
|
|
4741
|
+
## Creating Moderator Invites
|
|
4742
|
+
|
|
4743
|
+
\`\`\`typescript
|
|
4744
|
+
import { createLaunchpadSDK, MODERATOR_ROLE } from '@gala-chain/launchpad-sdk';
|
|
4745
|
+
|
|
4746
|
+
const sdk = createLaunchpadSDK({
|
|
4747
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
4748
|
+
});
|
|
4749
|
+
|
|
4750
|
+
// MUST authenticate first
|
|
4751
|
+
await sdk.login();
|
|
4752
|
+
|
|
4753
|
+
// Create an invite for a moderator
|
|
4754
|
+
const result = await sdk.createModeratorInvite({
|
|
4755
|
+
tokenName: 'mytoken',
|
|
4756
|
+
role: MODERATOR_ROLE.MODERATOR,
|
|
4757
|
+
description: 'John - Friday stream moderator',
|
|
4758
|
+
expiresAt: '2025-12-31T23:59:59Z', // Optional expiration
|
|
4759
|
+
});
|
|
4760
|
+
|
|
4761
|
+
// Share this URL with the intended moderator
|
|
4762
|
+
console.log('Invite URL:', result.invite.inviteUrl);
|
|
4763
|
+
console.log('Invite Code:', result.invite.inviteCode);
|
|
4764
|
+
console.log('Status:', result.invite.status); // PENDING
|
|
4765
|
+
\`\`\`
|
|
4766
|
+
|
|
4767
|
+
## Moderator Roles
|
|
4768
|
+
|
|
4769
|
+
\`\`\`typescript
|
|
4770
|
+
import { MODERATOR_ROLE } from '@gala-chain/launchpad-sdk';
|
|
4771
|
+
|
|
4772
|
+
// Available roles (OWNER not available for invites)
|
|
4773
|
+
MODERATOR_ROLE.MODERATOR // Chat, comments, bans
|
|
4774
|
+
MODERATOR_ROLE.TECHNICAL_PRODUCER // Simulcast, stream key, stop/start
|
|
4775
|
+
MODERATOR_ROLE.MANAGER // All of the above + recordings + stream settings
|
|
4776
|
+
\`\`\`
|
|
4777
|
+
|
|
4778
|
+
## Listing Invites
|
|
4779
|
+
|
|
4780
|
+
\`\`\`typescript
|
|
4781
|
+
// List all invites for a token (owner only)
|
|
4782
|
+
const list = await sdk.listModeratorInvites({
|
|
4783
|
+
tokenName: 'mytoken',
|
|
4784
|
+
status: 'PENDING', // Optional filter: PENDING, CLAIMED, REVOKED, EXPIRED
|
|
4785
|
+
page: 1,
|
|
4786
|
+
limit: 20,
|
|
4787
|
+
});
|
|
4788
|
+
|
|
4789
|
+
console.log('Total invites:', list.meta.totalItems);
|
|
4790
|
+
|
|
4791
|
+
for (const invite of list.invites) {
|
|
4792
|
+
console.log(\`- ID \${invite.id}: \${invite.role}\`);
|
|
4793
|
+
console.log(\` Status: \${invite.status}\`);
|
|
4794
|
+
console.log(\` Description: \${invite.description || 'None'}\`);
|
|
4795
|
+
console.log(\` Created: \${invite.createdAt}\`);
|
|
4796
|
+
console.log(\` Expires: \${invite.expiresAt || 'Never'}\`);
|
|
4797
|
+
}
|
|
4798
|
+
\`\`\`
|
|
4799
|
+
|
|
4800
|
+
## Claiming Invites (Recipient Side)
|
|
4801
|
+
|
|
4802
|
+
\`\`\`typescript
|
|
4803
|
+
// Extract code from magic link URL
|
|
4804
|
+
const inviteCode = 'abc123...'; // 64-character hex code
|
|
4805
|
+
|
|
4806
|
+
// Recipient authenticates and claims
|
|
4807
|
+
await sdk.login();
|
|
4808
|
+
|
|
4809
|
+
const result = await sdk.claimModeratorInvite({
|
|
4810
|
+
inviteCode: inviteCode,
|
|
4811
|
+
});
|
|
4812
|
+
|
|
4813
|
+
console.log('Claimed token:', result.token.tokenName);
|
|
4814
|
+
console.log('Your role:', result.token.role);
|
|
4815
|
+
console.log('Claimed at:', result.token.claimedAt);
|
|
4816
|
+
// Token now appears in /studio dashboard
|
|
4817
|
+
\`\`\`
|
|
4818
|
+
|
|
4819
|
+
## Previewing Invites (Public)
|
|
4820
|
+
|
|
4821
|
+
\`\`\`typescript
|
|
4822
|
+
// Preview invite details before logging in (public endpoint)
|
|
4823
|
+
const preview = await sdk.getModeratorInviteByCode('abc123...');
|
|
4824
|
+
|
|
4825
|
+
console.log('Token:', preview.tokenName);
|
|
4826
|
+
console.log('Symbol:', preview.tokenSymbol);
|
|
4827
|
+
console.log('Role offered:', preview.role);
|
|
4828
|
+
console.log('Status:', preview.status);
|
|
4829
|
+
console.log('Invited by:', preview.invitedBy.fullName);
|
|
4830
|
+
\`\`\`
|
|
4831
|
+
|
|
4832
|
+
## Getting Moderated Tokens (Studio Dashboard)
|
|
4833
|
+
|
|
4834
|
+
\`\`\`typescript
|
|
4835
|
+
// Get all tokens where you have moderator access
|
|
4836
|
+
await sdk.login();
|
|
4837
|
+
|
|
4838
|
+
const tokens = await sdk.getModeratedTokens({
|
|
4839
|
+
page: 1,
|
|
4840
|
+
limit: 20,
|
|
4841
|
+
});
|
|
4842
|
+
|
|
4843
|
+
for (const token of tokens.tokens) {
|
|
4844
|
+
console.log(\`- \${token.tokenName} (\${token.tokenSymbol})\`);
|
|
4845
|
+
console.log(\` Role: \${token.role}\`);
|
|
4846
|
+
console.log(\` Stream status: \${token.muxStreamStatus}\`);
|
|
4847
|
+
}
|
|
4848
|
+
\`\`\`
|
|
4849
|
+
|
|
4850
|
+
## Revoking Invites
|
|
4851
|
+
|
|
4852
|
+
\`\`\`typescript
|
|
4853
|
+
// Revoke by invite ID (owner only)
|
|
4854
|
+
await sdk.revokeModeratorInvite(123);
|
|
4855
|
+
console.log('Invite revoked');
|
|
4856
|
+
|
|
4857
|
+
// If already claimed, moderator loses access immediately
|
|
4858
|
+
// If pending, invite can no longer be claimed
|
|
4859
|
+
\`\`\`
|
|
4860
|
+
|
|
4861
|
+
## SDK Methods Reference
|
|
4862
|
+
|
|
4863
|
+
| Method | Description | Auth |
|
|
4864
|
+
|--------|-------------|------|
|
|
4865
|
+
| \`createModeratorInvite(options)\` | Create magic link invite | JWT (owner) |
|
|
4866
|
+
| \`claimModeratorInvite(options)\` | Claim invite with code | JWT |
|
|
4867
|
+
| \`getModeratedTokens(options?)\` | Get tokens you moderate | JWT |
|
|
4868
|
+
| \`listModeratorInvites(options)\` | List invites for token | JWT (owner) |
|
|
4869
|
+
| \`revokeModeratorInvite(id)\` | Revoke invite by ID | JWT (owner) |
|
|
4870
|
+
| \`getModeratorInviteByCode(code)\` | Preview invite details | None |
|
|
4871
|
+
|
|
4872
|
+
**MCP Tool Equivalents:**
|
|
4873
|
+
- \`gala_launchpad_create_moderator_invite\`
|
|
4874
|
+
- \`gala_launchpad_claim_moderator_invite\`
|
|
4875
|
+
- \`gala_launchpad_get_moderated_tokens\`
|
|
4876
|
+
- \`gala_launchpad_list_moderator_invites\`
|
|
4877
|
+
- \`gala_launchpad_revoke_moderator_invite\`
|
|
4878
|
+
- \`gala_launchpad_get_moderator_invite\`
|
|
4879
|
+
`,
|
|
4880
|
+
'overseer-invites': `
|
|
4881
|
+
# Overseer System - SDK v5.9.0+
|
|
4882
|
+
|
|
4883
|
+
Global platform oversight via magic link invites. Overseers have MANAGER-level
|
|
4884
|
+
access to ALL tokens (current and future), unlike moderators who have token-scoped access.
|
|
4885
|
+
|
|
4886
|
+
## Key Differences from Moderators
|
|
4887
|
+
|
|
4888
|
+
| Feature | Moderator | Overseer |
|
|
4889
|
+
|---------|-----------|----------|
|
|
4890
|
+
| Scope | Per-token or blanket (owner's tokens) | ALL tokens on platform |
|
|
4891
|
+
| Access Level | MODERATOR, TECHNICAL_PRODUCER, or MANAGER | Always MANAGER |
|
|
4892
|
+
| Grant Authority | Token owner | Admin or existing Overseer |
|
|
4893
|
+
| Use Case | Stream management delegation | Platform-wide oversight |
|
|
4894
|
+
|
|
4895
|
+
## Creating Overseer Invites
|
|
4896
|
+
|
|
4897
|
+
\`\`\`typescript
|
|
4898
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
4899
|
+
|
|
4900
|
+
const sdk = createLaunchpadSDK({
|
|
4901
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
4902
|
+
streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY, // Admin key OR JWT auth
|
|
4903
|
+
});
|
|
4904
|
+
|
|
4905
|
+
// Option 1: Using Admin API key
|
|
4906
|
+
const result = await sdk.createOverseerInvite({
|
|
4907
|
+
description: 'John - Platform Support Team',
|
|
4908
|
+
expiresAt: '2025-12-31T23:59:59Z', // Optional
|
|
4909
|
+
});
|
|
4910
|
+
|
|
4911
|
+
// Option 2: Using JWT (as existing Overseer)
|
|
4912
|
+
await sdk.login();
|
|
4913
|
+
const result = await sdk.createOverseerInvite({
|
|
4914
|
+
description: 'Platform team member',
|
|
4915
|
+
});
|
|
4916
|
+
|
|
4917
|
+
console.log('Share this link:', result.invite.inviteUrl);
|
|
4918
|
+
console.log('Invite Code:', result.invite.inviteCode);
|
|
4919
|
+
\`\`\`
|
|
4920
|
+
|
|
4921
|
+
## Claiming Overseer Invites
|
|
4922
|
+
|
|
4923
|
+
\`\`\`typescript
|
|
4924
|
+
// Recipient must be authenticated
|
|
4925
|
+
await sdk.login();
|
|
4926
|
+
|
|
4927
|
+
// Claim the invite
|
|
4928
|
+
const claimed = await sdk.claimOverseerInvite('abc123...');
|
|
4929
|
+
console.log('Now an overseer!');
|
|
4930
|
+
console.log('Status:', claimed.invite.status); // CLAIMED
|
|
4931
|
+
|
|
4932
|
+
// Check own status
|
|
4933
|
+
const status = await sdk.getMyOverseerStatus();
|
|
4934
|
+
console.log('Is Overseer:', status.isOverseer); // true
|
|
4935
|
+
console.log('Granted at:', status.overseer?.createdAt);
|
|
4936
|
+
\`\`\`
|
|
4937
|
+
|
|
4938
|
+
## Listing Overseers and Invites
|
|
4939
|
+
|
|
4940
|
+
\`\`\`typescript
|
|
4941
|
+
// List all overseer invites (paginated)
|
|
4942
|
+
const invites = await sdk.listOverseerInvites({
|
|
4943
|
+
status: 'PENDING', // PENDING, CLAIMED, REVOKED, EXPIRED
|
|
4944
|
+
page: 1,
|
|
4945
|
+
limit: 20,
|
|
4946
|
+
});
|
|
4947
|
+
|
|
4948
|
+
for (const invite of invites.invites) {
|
|
4949
|
+
console.log(\`#\${invite.id}: \${invite.description || 'No description'}\`);
|
|
4950
|
+
console.log(\` Status: \${invite.status}\`);
|
|
4951
|
+
console.log(\` Created by: \${invite.invitedBy.fullName || invite.invitedBy.address}\`);
|
|
4952
|
+
}
|
|
4953
|
+
|
|
4954
|
+
// List all active overseers
|
|
4955
|
+
const overseers = await sdk.listOverseers({
|
|
4956
|
+
status: 'ACTIVE', // ACTIVE or REVOKED
|
|
4957
|
+
page: 1,
|
|
4958
|
+
limit: 20,
|
|
4959
|
+
});
|
|
4960
|
+
|
|
4961
|
+
for (const overseer of overseers.overseers) {
|
|
4962
|
+
console.log(\`Overseer: \${overseer.userAddress}\`);
|
|
4963
|
+
console.log(\` Since: \${overseer.createdAt}\`);
|
|
4964
|
+
}
|
|
4965
|
+
\`\`\`
|
|
4966
|
+
|
|
4967
|
+
## Public Invite Preview
|
|
4968
|
+
|
|
4969
|
+
\`\`\`typescript
|
|
4970
|
+
// Get public info about an invite (no auth required)
|
|
4971
|
+
const preview = await sdk.getOverseerInviteByCode('abc123...');
|
|
4972
|
+
|
|
4973
|
+
console.log('Status:', preview.status);
|
|
4974
|
+
console.log('Description:', preview.description);
|
|
4975
|
+
console.log('Invited by:', preview.invitedBy.fullName);
|
|
4976
|
+
console.log('Expires:', preview.expiresAt);
|
|
4977
|
+
\`\`\`
|
|
4978
|
+
|
|
4979
|
+
## Revoking Access
|
|
4980
|
+
|
|
4981
|
+
\`\`\`typescript
|
|
4982
|
+
// Revoke an invite by ID
|
|
4983
|
+
await sdk.revokeOverseerInvite(123);
|
|
4984
|
+
console.log('Invite revoked');
|
|
4985
|
+
|
|
4986
|
+
// Revoke an overseer by wallet address
|
|
4987
|
+
await sdk.revokeOverseer('eth|1234567890abcdef...');
|
|
4988
|
+
console.log('Overseer access revoked');
|
|
4989
|
+
\`\`\`
|
|
4990
|
+
|
|
4991
|
+
## SDK Methods Reference
|
|
4992
|
+
|
|
4993
|
+
| Method | Description | Auth |
|
|
4994
|
+
|--------|-------------|------|
|
|
4995
|
+
| \`createOverseerInvite(options?)\` | Create magic link invite | Admin API key OR JWT (Overseer) |
|
|
4996
|
+
| \`claimOverseerInvite(code)\` | Claim invite with code | JWT |
|
|
4997
|
+
| \`listOverseerInvites(options?)\` | List all overseer invites | Admin API key OR JWT (Overseer) |
|
|
4998
|
+
| \`getOverseerInviteByCode(code)\` | Preview invite details | None (public) |
|
|
4999
|
+
| \`revokeOverseerInvite(id)\` | Revoke invite by ID | Admin API key OR JWT (Overseer) |
|
|
5000
|
+
| \`listOverseers(options?)\` | List all overseers | Admin API key OR JWT (Overseer) |
|
|
5001
|
+
| \`revokeOverseer(address)\` | Revoke overseer by address | Admin API key OR JWT (Overseer) |
|
|
5002
|
+
| \`getMyOverseerStatus()\` | Check own overseer status | JWT |
|
|
5003
|
+
|
|
5004
|
+
**MCP Tool Equivalents:**
|
|
5005
|
+
- \`gala_launchpad_create_overseer_invite\`
|
|
5006
|
+
- \`gala_launchpad_claim_overseer_invite\`
|
|
5007
|
+
- \`gala_launchpad_list_overseer_invites\`
|
|
5008
|
+
- \`gala_launchpad_get_overseer_invite\`
|
|
5009
|
+
- \`gala_launchpad_revoke_overseer_invite\`
|
|
5010
|
+
- \`gala_launchpad_list_overseers\`
|
|
5011
|
+
- \`gala_launchpad_revoke_overseer\`
|
|
5012
|
+
- \`gala_launchpad_get_my_overseer_status\`
|
|
5013
|
+
- \`gala_launchpad_get_overseer_summary\`
|
|
5014
|
+
`,
|
|
5015
|
+
'content-flag-management': `
|
|
5016
|
+
# Content Flag Management - SDK v5.11.0+
|
|
5017
|
+
|
|
5018
|
+
Content moderation via flags and comments. Moderators can flag content for review,
|
|
5019
|
+
take action on flags (delete content, ban users), and manage pool comments.
|
|
5020
|
+
|
|
5021
|
+
## Content Types
|
|
5022
|
+
|
|
5023
|
+
Flags can be created for:
|
|
5024
|
+
- \`MESSAGE\` - Chat messages
|
|
5025
|
+
- \`COMMENT\` - Pool comments
|
|
5026
|
+
- \`STREAM\` - Live streams (admin only)
|
|
5027
|
+
|
|
5028
|
+
## Creating Content Flags
|
|
5029
|
+
|
|
5030
|
+
\`\`\`typescript
|
|
5031
|
+
import { createLaunchpadSDK, CONTENT_TYPE } from '@gala-chain/launchpad-sdk';
|
|
5032
|
+
|
|
5033
|
+
const sdk = createLaunchpadSDK({
|
|
5034
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
5035
|
+
});
|
|
5036
|
+
|
|
5037
|
+
await sdk.login();
|
|
5038
|
+
|
|
5039
|
+
// Flag a chat message
|
|
5040
|
+
const flag = await sdk.createFlag({
|
|
5041
|
+
tokenName: 'mytoken',
|
|
5042
|
+
contentType: CONTENT_TYPE.MESSAGE,
|
|
5043
|
+
contentId: 'msg-123',
|
|
5044
|
+
reason: 'Spam/harassment',
|
|
5045
|
+
});
|
|
5046
|
+
|
|
5047
|
+
console.log('Flag ID:', flag.id);
|
|
5048
|
+
console.log('Status:', flag.status); // PENDING
|
|
5049
|
+
\`\`\`
|
|
5050
|
+
|
|
5051
|
+
## Listing Flags
|
|
5052
|
+
|
|
5053
|
+
\`\`\`typescript
|
|
5054
|
+
// List all pending flags for a token
|
|
5055
|
+
const flags = await sdk.listFlags({
|
|
5056
|
+
tokenName: 'mytoken',
|
|
5057
|
+
status: 'PENDING',
|
|
5058
|
+
page: 1,
|
|
5059
|
+
limit: 20,
|
|
5060
|
+
});
|
|
5061
|
+
|
|
5062
|
+
for (const flag of flags.flags) {
|
|
5063
|
+
console.log(\`Flag #\${flag.id}: \${flag.contentType}\`);
|
|
5064
|
+
console.log(\` Reason: \${flag.reason}\`);
|
|
5065
|
+
console.log(\` Reporter: \${flag.reporterAddress}\`);
|
|
5066
|
+
}
|
|
5067
|
+
\`\`\`
|
|
5068
|
+
|
|
5069
|
+
## Taking Action on Flags
|
|
5070
|
+
|
|
5071
|
+
\`\`\`typescript
|
|
5072
|
+
// Dismiss a flag (no action taken)
|
|
5073
|
+
await sdk.dismissFlag(flagId);
|
|
5074
|
+
|
|
5075
|
+
// Take action - delete content only
|
|
5076
|
+
await sdk.actionFlag(flagId, {
|
|
5077
|
+
action: 'DELETE_CONTENT',
|
|
5078
|
+
});
|
|
5079
|
+
|
|
5080
|
+
// Take action - ban the user
|
|
5081
|
+
await sdk.actionFlag(flagId, {
|
|
5082
|
+
action: 'BAN_USER',
|
|
5083
|
+
banDuration: 3600, // 1 hour ban
|
|
5084
|
+
});
|
|
5085
|
+
|
|
5086
|
+
// Take action - delete content AND ban user
|
|
5087
|
+
await sdk.actionFlag(flagId, {
|
|
5088
|
+
action: 'DELETE_AND_BAN',
|
|
5089
|
+
banDuration: 86400, // 24 hour ban
|
|
5090
|
+
});
|
|
5091
|
+
\`\`\`
|
|
5092
|
+
|
|
5093
|
+
## Managing Pool Comments with Reactions
|
|
5094
|
+
|
|
5095
|
+
Comments include a \`messageId\` for reactions integration and optional \`reactions\` data.
|
|
5096
|
+
|
|
5097
|
+
\`\`\`typescript
|
|
5098
|
+
// Fetch comments for a pool (with reactions data)
|
|
5099
|
+
const comments = await sdk.getComments({
|
|
5100
|
+
tokenName: 'mytoken',
|
|
5101
|
+
page: 1,
|
|
5102
|
+
limit: 20,
|
|
5103
|
+
});
|
|
5104
|
+
|
|
5105
|
+
for (const comment of comments.comments) {
|
|
5106
|
+
console.log(\`ID: \${comment.id}, MessageId: \${comment.messageId}\`);
|
|
5107
|
+
console.log(\`\${comment.userAddress}: \${comment.content}\`);
|
|
5108
|
+
|
|
5109
|
+
// Check reactions on this comment
|
|
5110
|
+
if (comment.reactions) {
|
|
5111
|
+
console.log(\`Total reactions: \${comment.reactions.totalCount}\`);
|
|
5112
|
+
for (const reaction of comment.reactions.reactions) {
|
|
5113
|
+
console.log(\` \${reaction.reactionType}: \${reaction.count} (you reacted: \${reaction.userReacted})\`);
|
|
5114
|
+
}
|
|
5115
|
+
}
|
|
5116
|
+
}
|
|
5117
|
+
|
|
5118
|
+
// Post a comment (requires JWT auth)
|
|
5119
|
+
await sdk.login();
|
|
5120
|
+
const newComment = await sdk.createComment({
|
|
5121
|
+
tokenName: 'mytoken',
|
|
5122
|
+
content: 'Great project! Looking forward to the launch.',
|
|
5123
|
+
});
|
|
5124
|
+
console.log('Comment messageId:', newComment.comment.messageId);
|
|
5125
|
+
|
|
5126
|
+
// Add a reaction to a comment using its messageId
|
|
5127
|
+
await sdk.addReaction({
|
|
5128
|
+
messageId: newComment.comment.messageId,
|
|
5129
|
+
reaction: '👍',
|
|
5130
|
+
});
|
|
5131
|
+
|
|
5132
|
+
// Remove a reaction
|
|
5133
|
+
await sdk.removeReaction({
|
|
5134
|
+
messageId: newComment.comment.messageId,
|
|
5135
|
+
reaction: '👍',
|
|
5136
|
+
});
|
|
5137
|
+
|
|
5138
|
+
// Delete a comment (moderator only)
|
|
5139
|
+
await sdk.deleteComment({ commentId: comment.id });
|
|
5140
|
+
\`\`\`
|
|
5141
|
+
|
|
5142
|
+
## SDK Methods Reference
|
|
5143
|
+
|
|
5144
|
+
| Method | Description | Auth |
|
|
5145
|
+
|--------|-------------|------|
|
|
5146
|
+
| \`createFlag(options)\` | Flag content for review | JWT |
|
|
5147
|
+
| \`listFlags(options)\` | List flags for a token | API key OR JWT (Moderator) |
|
|
5148
|
+
| \`dismissFlag(flagId)\` | Dismiss flag (no action) | API key OR JWT (Moderator) |
|
|
5149
|
+
| \`actionFlag(flagId, options)\` | Take action on flag | API key OR JWT (Moderator) |
|
|
5150
|
+
| \`getComments(options)\` | Get pool comments with reactions | None (public) |
|
|
5151
|
+
| \`createComment(options)\` | Post a comment, returns messageId | JWT |
|
|
5152
|
+
| \`deleteComment(options)\` | Delete a comment | API key OR JWT (Moderator) |
|
|
5153
|
+
| \`addReaction(options)\` | Add reaction to comment/message | JWT |
|
|
5154
|
+
| \`removeReaction(options)\` | Remove reaction from comment/message | JWT |
|
|
5155
|
+
|
|
5156
|
+
**MCP Tool Equivalents:**
|
|
5157
|
+
- \`gala_launchpad_create_flag\`
|
|
5158
|
+
- \`gala_launchpad_list_flags\`
|
|
5159
|
+
- \`gala_launchpad_dismiss_flag\`
|
|
5160
|
+
- \`gala_launchpad_action_flag\`
|
|
5161
|
+
- \`gala_launchpad_fetch_comments\`
|
|
5162
|
+
- \`gala_launchpad_post_comment\`
|
|
5163
|
+
- \`gala_launchpad_delete_comment\`
|
|
5164
|
+
- \`gala_launchpad_add_reaction\`
|
|
5165
|
+
- \`gala_launchpad_remove_reaction\`
|
|
5166
|
+
`,
|
|
5167
|
+
'trade-history': `
|
|
5168
|
+
## Trade History
|
|
5169
|
+
|
|
5170
|
+
Query and analyze trading activity for tokens.
|
|
5171
|
+
|
|
5172
|
+
### Basic Usage
|
|
5173
|
+
|
|
5174
|
+
\`\`\`typescript
|
|
5175
|
+
import { LaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
5176
|
+
|
|
5177
|
+
const sdk = new LaunchpadSDK({ environment: 'production' });
|
|
5178
|
+
|
|
5179
|
+
// Get recent trades for a token
|
|
5180
|
+
const result = await sdk.getTrades({
|
|
5181
|
+
tokenName: 'anime',
|
|
5182
|
+
limit: 10,
|
|
5183
|
+
page: 1
|
|
5184
|
+
});
|
|
5185
|
+
|
|
5186
|
+
console.log(\`Found \${result.trades.length} trades\`);
|
|
5187
|
+
for (const trade of result.trades) {
|
|
5188
|
+
console.log(\`\${trade.txnType}: \${trade.inputAmount} → \${trade.outputAmount}\`);
|
|
5189
|
+
}
|
|
5190
|
+
\`\`\`
|
|
5191
|
+
|
|
5192
|
+
### Filter by Trade Type
|
|
5193
|
+
|
|
5194
|
+
\`\`\`typescript
|
|
5195
|
+
// Get only buy orders
|
|
5196
|
+
const buyTrades = await sdk.getTrades({
|
|
5197
|
+
tokenName: 'anime',
|
|
5198
|
+
txnType: 'BUY',
|
|
5199
|
+
limit: 50
|
|
5200
|
+
});
|
|
5201
|
+
|
|
5202
|
+
// Get only sell orders
|
|
5203
|
+
const sellTrades = await sdk.getTrades({
|
|
5204
|
+
tokenName: 'anime',
|
|
5205
|
+
txnType: 'SELL',
|
|
5206
|
+
limit: 50
|
|
5207
|
+
});
|
|
5208
|
+
\`\`\`
|
|
5209
|
+
|
|
5210
|
+
### Date Range Queries
|
|
5211
|
+
|
|
5212
|
+
\`\`\`typescript
|
|
5213
|
+
const oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
|
|
5214
|
+
const now = new Date();
|
|
5215
|
+
|
|
5216
|
+
const recentTrades = await sdk.getTrades({
|
|
5217
|
+
tokenName: 'anime',
|
|
5218
|
+
startDate: oneWeekAgo,
|
|
5219
|
+
endDate: now,
|
|
5220
|
+
limit: 50
|
|
5221
|
+
});
|
|
5222
|
+
\`\`\`
|
|
5223
|
+
|
|
5224
|
+
### Filter by User
|
|
5225
|
+
|
|
5226
|
+
\`\`\`typescript
|
|
5227
|
+
// Get trades for a specific wallet
|
|
5228
|
+
const userTrades = await sdk.getTrades({
|
|
5229
|
+
tokenName: 'anime',
|
|
5230
|
+
userAddress: 'eth|0x1234...',
|
|
5231
|
+
limit: 20
|
|
5232
|
+
});
|
|
5233
|
+
\`\`\`
|
|
5234
|
+
|
|
5235
|
+
### Pagination
|
|
5236
|
+
|
|
5237
|
+
\`\`\`typescript
|
|
5238
|
+
// Paginate through all trades
|
|
5239
|
+
let page = 1;
|
|
5240
|
+
let hasMore = true;
|
|
5241
|
+
|
|
5242
|
+
while (hasMore) {
|
|
5243
|
+
const result = await sdk.getTrades({ tokenName: 'anime', page, limit: 50 });
|
|
5244
|
+
console.log(\`Page \${page}: \${result.trades.length} trades\`);
|
|
5245
|
+
|
|
5246
|
+
hasMore = result.trades.length === 50;
|
|
5247
|
+
page++;
|
|
5248
|
+
}
|
|
5249
|
+
\`\`\`
|
|
5250
|
+
|
|
5251
|
+
**MCP Tool Equivalents:**
|
|
5252
|
+
- \`gala_launchpad_get_trades\`
|
|
5253
|
+
`,
|
|
5254
|
+
// ============================================================================
|
|
5255
|
+
// TOKEN BAN MANAGEMENT (Overseer Only)
|
|
5256
|
+
// ============================================================================
|
|
5257
|
+
'token-ban-management': `
|
|
5258
|
+
# Token Ban Management - SDK v6.x.0+
|
|
5259
|
+
|
|
5260
|
+
Platform-wide token ban operations for overseers. Banned tokens are hidden from ALL listings
|
|
5261
|
+
and have actions (comments, streaming, chat) blocked. This is different from user bans which
|
|
5262
|
+
only affect specific users on specific tokens.
|
|
5263
|
+
|
|
5264
|
+
**Access Control:** All methods require either:
|
|
5265
|
+
- streamAdminApiKey (server-to-server)
|
|
5266
|
+
- JWT with overseer status (authenticated overseer user)
|
|
5267
|
+
|
|
5268
|
+
**Effects of Token Bans:**
|
|
5269
|
+
- Hidden from ALL pool listings (including creator's profile)
|
|
5270
|
+
- Comments blocked on banned tokens
|
|
5271
|
+
- Live streaming blocked on banned tokens
|
|
5272
|
+
- Chat messages blocked on banned tokens
|
|
5273
|
+
- Trading NOT blocked (GalaChain handles trading independently)
|
|
5274
|
+
|
|
5275
|
+
## Banning a Token
|
|
5276
|
+
|
|
5277
|
+
\`\`\`typescript
|
|
5278
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
5279
|
+
|
|
5280
|
+
// Using Admin API key
|
|
5281
|
+
const sdk = createLaunchpadSDK({
|
|
5282
|
+
streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY,
|
|
5283
|
+
});
|
|
5284
|
+
|
|
5285
|
+
// Or using JWT auth (must be an overseer)
|
|
5286
|
+
const sdkWithAuth = createLaunchpadSDK({
|
|
5287
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
5288
|
+
});
|
|
5289
|
+
await sdkWithAuth.login({ walletAddress: 'eth|0x...' });
|
|
5290
|
+
|
|
5291
|
+
// Ban a token with reason
|
|
5292
|
+
const result = await sdk.banToken({
|
|
5293
|
+
tokenName: 'scamtoken',
|
|
5294
|
+
reason: 'Fraudulent project - reported by multiple users',
|
|
5295
|
+
});
|
|
5296
|
+
console.log('Token banned:', result.tokenName);
|
|
5297
|
+
console.log('Ban ID:', result.ban.id);
|
|
5298
|
+
console.log('Banned by:', result.ban.bannedBy);
|
|
5299
|
+
|
|
5300
|
+
// Ban without reason (optional)
|
|
5301
|
+
await sdk.banToken({ tokenName: 'problematictoken' });
|
|
5302
|
+
\`\`\`
|
|
5303
|
+
|
|
5304
|
+
## Unbanning a Token
|
|
5305
|
+
|
|
5306
|
+
\`\`\`typescript
|
|
5307
|
+
// Remove a token ban
|
|
5308
|
+
const result = await sdk.unbanToken({ tokenName: 'scamtoken' });
|
|
5309
|
+
console.log('Ban removed:', result.removed); // true
|
|
5310
|
+
console.log('Token:', result.tokenName);
|
|
5311
|
+
|
|
5312
|
+
// Token is now:
|
|
5313
|
+
// - Visible in pool listings again
|
|
5314
|
+
// - Comments re-enabled
|
|
5315
|
+
// - Live streaming re-enabled
|
|
5316
|
+
// - Chat re-enabled
|
|
5317
|
+
\`\`\`
|
|
5318
|
+
|
|
5319
|
+
## Checking Token Ban Status
|
|
5320
|
+
|
|
5321
|
+
\`\`\`typescript
|
|
5322
|
+
// Check if a specific token is banned
|
|
5323
|
+
const status = await sdk.isTokenBanned({ tokenName: 'sometoken' });
|
|
5324
|
+
|
|
5325
|
+
if (status.banned) {
|
|
5326
|
+
console.log('Token is banned!');
|
|
5327
|
+
console.log('Reason:', status.ban?.reason);
|
|
5328
|
+
console.log('Banned by:', status.ban?.bannedBy);
|
|
5329
|
+
console.log('Banned at:', status.ban?.createdAt);
|
|
5330
|
+
} else {
|
|
5331
|
+
console.log('Token is not banned');
|
|
5332
|
+
}
|
|
5333
|
+
|
|
5334
|
+
// getTokenBan is an alias - use whichever is more readable
|
|
5335
|
+
const details = await sdk.getTokenBan({ tokenName: 'sometoken' });
|
|
5336
|
+
\`\`\`
|
|
5337
|
+
|
|
5338
|
+
## Listing All Banned Tokens
|
|
5339
|
+
|
|
5340
|
+
\`\`\`typescript
|
|
5341
|
+
// Get first page with default limit (20)
|
|
5342
|
+
const page1 = await sdk.listTokenBans({});
|
|
5343
|
+
console.log('Total banned tokens:', page1.meta.total);
|
|
5344
|
+
|
|
5345
|
+
for (const ban of page1.items) {
|
|
5346
|
+
console.log(\`- \${ban.tokenName}: \${ban.reason || 'No reason'}\`);
|
|
5347
|
+
console.log(\` Banned by: \${ban.bannedBy}\`);
|
|
5348
|
+
console.log(\` Date: \${ban.createdAt}\`);
|
|
5349
|
+
}
|
|
5350
|
+
|
|
5351
|
+
// Search for specific tokens (partial match, case-insensitive)
|
|
5352
|
+
const searchResults = await sdk.listTokenBans({
|
|
5353
|
+
search: 'scam',
|
|
5354
|
+
page: 1,
|
|
5355
|
+
limit: 10,
|
|
5356
|
+
});
|
|
5357
|
+
|
|
5358
|
+
// Paginate through all banned tokens
|
|
5359
|
+
let page = 1;
|
|
5360
|
+
let hasMore = true;
|
|
5361
|
+
while (hasMore) {
|
|
5362
|
+
const results = await sdk.listTokenBans({ page, limit: 20 });
|
|
5363
|
+
console.log(\`Page \${page}: \${results.items.length} bans\`);
|
|
5364
|
+
for (const ban of results.items) {
|
|
5365
|
+
console.log(\` - \${ban.tokenName}\`);
|
|
5366
|
+
}
|
|
5367
|
+
hasMore = page < results.meta.totalPages;
|
|
5368
|
+
page++;
|
|
5369
|
+
}
|
|
5370
|
+
\`\`\`
|
|
5371
|
+
|
|
5372
|
+
## Important Notes
|
|
5373
|
+
|
|
5374
|
+
1. **Permanent Bans Only**: Token bans do not expire. They remain in effect until
|
|
5375
|
+
explicitly removed by an overseer.
|
|
5376
|
+
|
|
5377
|
+
2. **Case Normalization**: Token names are automatically normalized to lowercase
|
|
5378
|
+
in all requests and responses.
|
|
5379
|
+
|
|
5380
|
+
3. **Idempotency**: Banning an already-banned token returns a 409 Conflict error.
|
|
5381
|
+
Unbanning a non-banned token returns a 404 Not Found error.
|
|
5382
|
+
|
|
5383
|
+
4. **Trading Continues**: Token bans do NOT stop trading on GalaChain. The
|
|
5384
|
+
launchpad hides visibility and blocks social features only.
|
|
5385
|
+
|
|
5386
|
+
**MCP Tool Equivalents:**
|
|
5387
|
+
- \`gala_launchpad_ban_token\`
|
|
5388
|
+
- \`gala_launchpad_unban_token\`
|
|
5389
|
+
- \`gala_launchpad_list_token_bans\`
|
|
5390
|
+
- \`gala_launchpad_get_token_ban\`
|
|
5391
|
+
- \`gala_launchpad_is_token_banned\`
|
|
3591
5392
|
`,
|
|
3592
5393
|
};
|
|
3593
5394
|
/**
|
|
@@ -3595,7 +5396,7 @@ interface RegisterAccountResult {
|
|
|
3595
5396
|
*/
|
|
3596
5397
|
exports.explainSdkUsageTool = {
|
|
3597
5398
|
name: 'gala_launchpad_explain_sdk_usage',
|
|
3598
|
-
description: 'Get detailed SDK code examples for all
|
|
5399
|
+
description: 'Get detailed SDK code examples for all 224 MCP tools (mapping to ~208 SDK methods) organized into 48 composite workflow topics covering: buy-tokens, sell-tokens, pool-graduation, fetch-pools, balances, token-creation, token-status, dex-trading, liquidity-positions, advanced-dex-analysis, price-history, token-details, token-distribution, profile-management, multi-wallet, transfers, locks, trading-analytics, utilities-and-helpers, utilities-system, error-handling, installation, local-calculations, spot-prices-smart-routing, event-subscriptions, mcp-to-sdk-mapping, DEX leaderboards, bridge-operations, dex-token-discovery, wrap-unwrap-operations, referral-system, account-management, session-auth, streaming, stream-chat, ban-management, api-key-management, moderator-invites, overseer-invites, content-flag-management, content-reactions, trade-history, and token-ban-management',
|
|
3599
5400
|
inputSchema: {
|
|
3600
5401
|
type: 'object',
|
|
3601
5402
|
properties: {
|
|
@@ -3639,6 +5440,17 @@ exports.explainSdkUsageTool = {
|
|
|
3639
5440
|
'wrap-unwrap-operations',
|
|
3640
5441
|
'referral-system',
|
|
3641
5442
|
'account-management',
|
|
5443
|
+
'streaming',
|
|
5444
|
+
'stream-chat',
|
|
5445
|
+
'session-auth',
|
|
5446
|
+
'ban-management',
|
|
5447
|
+
'api-key-management',
|
|
5448
|
+
'moderator-invites',
|
|
5449
|
+
'overseer-invites',
|
|
5450
|
+
'content-flag-management',
|
|
5451
|
+
'content-reactions',
|
|
5452
|
+
'trade-history',
|
|
5453
|
+
'token-ban-management',
|
|
3642
5454
|
],
|
|
3643
5455
|
description: 'The SDK usage topic to explain',
|
|
3644
5456
|
},
|
|
@@ -3646,14 +5458,14 @@ exports.explainSdkUsageTool = {
|
|
|
3646
5458
|
required: ['topic'],
|
|
3647
5459
|
},
|
|
3648
5460
|
handler: (0, error_handler_js_1.withErrorHandling)(async (_sdk, args) => {
|
|
3649
|
-
const example = SDK_EXAMPLES[args.topic];
|
|
5461
|
+
const example = exports.SDK_EXAMPLES[args.topic];
|
|
3650
5462
|
if (!example) {
|
|
3651
5463
|
throw new Error('Unknown topic: ' + args.topic);
|
|
3652
5464
|
}
|
|
3653
5465
|
return (0, response_formatter_js_1.formatSuccess)({
|
|
3654
5466
|
topic: args.topic,
|
|
3655
5467
|
explanation: example,
|
|
3656
|
-
sdkVersion: '
|
|
5468
|
+
sdkVersion: '5.6.0',
|
|
3657
5469
|
packageName: '@gala-chain/launchpad-sdk',
|
|
3658
5470
|
documentation: 'https://www.npmjs.com/package/@gala-chain/launchpad-sdk',
|
|
3659
5471
|
});
|