If youβre developing a frontend application, consider using @gofundmeme/sdk-frontend instead.
Why Choose the Frontend SDK? The full SDK includes dependencies like Orca SDK, Raydium SDK, and Meteora SDK, which can cause compatibility issues in frontend environments. The frontend version is optimized for seamless client-side integration.
Use @gofundmeme/sdk-frontend if: β’ You donβt need Harvesting features. β’ You only require pool interactions, swaps, and claims. β’ You want a lightweight, frontend-optimized SDK.
Frontend SDK Documentation: See here: https://www.npmjs.com/package/@gofundmeme/sdk-frontend
The GoFundMeme SDK is the official all-in-one developer toolkit for interacting with the GoFundMeme Protocol (GFM). It enables seamless integration with Fair Launches, Bonding Curves, Staking, Harvesting, and Rewards.
π Full Documentation: docs.gofundmeme.io
This package is optimized for backend development and includes full Harvesting capabilities.
npm install @gofundmeme/sdk @solana/web3.js moment decimal.js
Using yarn:
yarn add @gofundmeme/sdk @solana/web3.js moment decimal.js
π₯ Key Features
βοΈ Fair Launch Pools β Decentralized, transparent fundraising for memecoins & beyond. βοΈ Bonding Curve Pools β Dynamic pricing and token issuance. βοΈ Swaps & Liquidity β Token trading and liquidity management. βοΈ Staking & Rewards β Earn a share of protocol fees through staking. βοΈ Harvesting β (Backend-only feature) Collect LP fees and distribute rewards.
π Getting Started
Initialize the SDK
import { Connection } from "@solana/web3.js";
import { initGoFundMemeSDK } from "@gofundmeme/sdk";
// Replace with your RPC endpoint
const connection = new Connection("https://api.mainnet-beta.solana.com");
(async () => {
const gfmSDK = await initGoFundMemeSDK({ connection });
// Example: Fetch a Fair Launch Pool
const pool = await gfmSDK.pools.fairLaunch.fetchFairLaunchPool({
mintB: "MINT_ADDRESS_HERE"
});
console.log("Pool Data:", pool);
})();
1οΈβ£ Fetching a Fair Launch Pool
const pool = await gfmSDK.pools.fairLaunch.fetchFairLaunchPool({ mintB: "MINT_ADDRESS_HERE" }); console.log("Fair Launch Pool:", pool);
2οΈβ£ Creating a Fair Launch Pool
const { transaction, requestId } = await gfmSDK.api.fairLaunch.createPool.request({
token: {
base64: "IMAGE_BASE64_STRING",
name: "My Token",
symbol: "MTKN",
description: "An example token",
website: "https://example.com",
twitter: "https://twitter.com/example",
discord: "https://discord.gg/example",
telegram: "https://t.me/example"
},
tokenomics: {
supply: 1000000000,
lpPercent: 40, // % for LP
fundersPercent: 40, // % for funders
allocations: [
{ name: "Marketing", percent: 10, destination: "3KgPZdBvh..." },
{ name: "Team", percent: 10, destination: "6KgQZzCvh..." }
]
},
campaignDurationHours: 6,
targetRaise: 50,
amountIn: 5,
network: "mainnet",
creatorWalletAddress: "WALLET_PUBLIC_KEY"
});
// Sign and confirm the transaction
const signedTx = transaction.sign(creatorKeypair);
const { mintAddress, txid } = await gfmSDK.api.fairLaunch.createPool.process({
requestId,
signedTransaction: signedTx
});
console.log(`π Pool Created! Mint Address: ${mintAddress}, TXID: ${txid}`);
3οΈβ£ Fetching a Bonding Curve Pool
const bondingCurvePool = await gfmSDK.pools.bondingCurve.fetchBondingCurvePool({
mintB: "MINT_ADDRESS_HERE"
});
console.log("Bonding Curve Pool Data:", bondingCurvePool);
4οΈβ£ Buying Tokens on the Bonding Curve
import { Keypair, sendAndConfirmTransaction } from "@solana/web3.js";
import Decimal from "decimal.js";
const payer = Keypair.generate(); // Replace with your actual signer
const { quote: buyQuote, transaction: buyTransaction } =
await bondingCurvePool.actions.swap.buy({
amountInUI: new Decimal(1.2), // Buy with 1.2 SOL
funder: payer.publicKey,
slippage: 1, // 1% slippage tolerance
});
// Sign and send the transaction
const buyTxid = await sendAndConfirmTransaction(connection, buyTransaction, [payer]);
console.log(`π Successfully bought tokens! TXID: ${buyTxid}`);
5οΈβ£ Harvesting LP Fees
const harvestTransaction = await bondingCurvePool.actions.harvestUtils.harvest({
cranker: payer.publicKey,
});
const harvestTxid = await sendAndConfirmTransaction(
connection,
harvestTransaction,
[payer]
);
console.log(`πΎ Successfully harvested LP fees! TXID: ${harvestTxid}`);
π Learn More
π Full Documentation: docs.gofundmeme.io π¨ Frontend SDK (@gofundmeme/sdk-frontend): See Here π» Contribute to GFM: GitHub π Join the Community: Telegram | X (Twitter)