@gofundmeme/sdk
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 β€’ Public β€’ Published

πŸš€ GoFundMeme SDK

Website
X (Twitter)
Telegram
NPM


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

🌟 Introduction

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


πŸ›  Installation

This package is optimized for backend development and includes full Harvesting capabilities.

Using npm:

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);
})();

πŸ—οΈ Example Use Cases

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)

Dependents (0)

Package Sidebar

Install

npm i @gofundmeme/sdk

Weekly Downloads

196

Version

1.1.2

License

MIT

Unpacked Size

2.3 MB

Total Files

257

Last publish

Collaborators

  • workprob