Subscriptions
📡 Subscriptions API
The GoFundMeme SDK provides a WebSocket-based subscription system that allows real-time updates for Fair Launches, Bonding Curve swaps, Market Capitalization changes, Pool State updates, and more.
With gfmSDK.api.subscription, developers can efficiently listen to live events without polling.
🔥 Key Features
✔️ Real-Time Pool State Updates – Get notified when a pool’s status changes.
✔️ Live Market Cap Updates – Track the market cap of a token dynamically.
✔️ Bonding Curve Swaps – Receive buy/sell events in real-time.
✔️ Fair Launch Funding Events – Monitor funding and defunding actions.
✔️ New & Migrated Pools – Be alerted when a pool is created or migrated.
✔️ Seamless Disconnection – Easily unsubscribe when needed.
📜 How to Use Subscriptions
To start listening to real-time events, you can use the gfmSDK.api.subscription object and call one of the available listeners.
🚀 Quick Example
🛠️ Explanation:
1️⃣ Initialize the SDK with a Solana RPC connection.
2️⃣ Subscribe to a WebSocket event (gfmSDK.api.subscription.fairLaunch.funding.all).
3️⃣ Log incoming events in real time.
📡 Available Subscription Methods
1️⃣ Pool State Updates
Listens for pool state changes, such as raising, launching, or launched.
Subscribe by Network
Subscribe by Mint Address
📌 Event Type:
2️⃣ Market Cap Updates
Tracks market capitalization changes in real-time.
Subscribe by Network
Subscribe by Mint Address
📌 Event Type:
3️⃣ Bonding Curve Swaps
Listens for buy and sell transactions on Bonding Curve pools.
Subscribe by Network
Subscribe by Mint Address
📌 Event Type:
4️⃣ Fair Launch Funding Events
Tracks contributions (funding) and withdrawals (defunding) from Fair Launch pools.
Subscribe by Network
Subscribe by Mint Address
📌 Event Type:
5️⃣ New & Migrated Pools
These subscriptions notify you when a pool is created or migrated.
New Pools (All Networks)
Migrated Pools (All Networks)
📌 Event Type:
🔌 Unsubscribing & Disconnecting
You can unsubscribe from a specific subscription or disconnect from all WebSocket events.
Unsubscribe from a Specific Event
Disconnect from All Subscriptions
🎯 Final Summary
Subscription Type
Method
Pool State Updates
poolState.all(network), poolState.byMintAddress(mintAddress)
Market Cap Updates
marketcap.all(network), marketcap.byMintAddress(mintAddress)
Bonding Curve Swaps
bondingCurve.swaps.all(network), bondingCurve.swaps.byMintAddress(mintAddress)
Fair Launch Funding
fairLaunch.funding.all(network), fairLaunch.funding.byMintAddress(mintAddress)
New Pools
pool.newPools(network)
Migrated Pools
pool.migratedPools(network)
Unsubscribe
listener.disconnect()
Disconnect All
gfmSDK.api.subscription.disconnectAll()
🚀 Instant Updates – No need for manual polling!
⚡ Efficient WebSockets – Optimized real-time data streams.
🔗 Simple API – Easy to integrate, minimal effort required.
Last updated