Launch
Launch a coin
create_token creates the coin on pump.fun in one transaction, with a Proglet-owned creator account, the coin's pool and its vaults.
create_token
import { ComputeBudgetProgram, Keypair, Transaction } from "@solana/web3.js";
import { createTokenInstruction } from "@proglet/sdk";
const mint = Keypair.generate(); // the new coin's address; it signs once, here
const tx = new Transaction().add(
ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }),
createTokenInstruction({ mint: mint.publicKey, user: wallet.publicKey, name: "Tidewater", symbol: "TIDE", uri }),
);
await wallet.sendTransaction(tx, connection, { signers: [mint] });It costs the launcher about 0.02 SOL in rent. Names are at most 32 characters (COIN_NAME_MAX), tickers 10 (COIN_SYMBOL_MAX), and the URI 200 (COIN_URI_MAX).
Launch and buy
To get the first tokens, put a pump.fun buy in the same transaction. If the buy fails, the coin isn't created either, and nobody can trade between the two. Together they come to about 1,380 bytes, over Solana's 1,232, so send a v0 transaction with the launch lookup table. It holds the accounts every launch shares (launchLookupTableKeys()) and is frozen, so it can't be changed.
import { ComputeBudgetProgram, Keypair, LAMPORTS_PER_SOL, PublicKey, TransactionMessage, VersionedTransaction } from "@solana/web3.js";
import { TOKEN_2022_PROGRAM_ID } from "@solana/spl-token";
import { OnlinePumpSdk, PUMP_SDK, newBondingCurve, getBuyV3TokenAmountFromQuoteAmount } from "@pump-fun/pump-sdk";
import BN from "bn.js";
import { createTokenInstruction, creatorPda } from "@proglet/sdk";
const mint = Keypair.generate();
const pump = new OnlinePumpSdk(connection);
const [global, feeConfig] = await Promise.all([pump.fetchGlobal(), pump.fetchFeeConfig()]);
// The curve doesn't exist yet: quote from pump's starting reserves. create_token makes
// a SOL-paired, non-mayhem curve whose creator is the coin's creator PDA.
const curve = { ...newBondingCurve(global), isMayhemMode: false, creator: creatorPda(mint.publicKey) };
const spend = new BN(0.5 * LAMPORTS_PER_SOL);
const tokens = getBuyV3TokenAmountFromQuoteAmount({
global, feeConfig, bondingCurve: curve, amount: spend,
mintSupply: global.tokenTotalSupply, curveBaseTokenBalance: global.tokenTotalSupply,
});
const ixs = [
ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }),
createTokenInstruction({ mint: mint.publicKey, user: wallet.publicKey, name, symbol, uri }),
...(await PUMP_SDK.buyExactQuoteInV3Instructions({
bondingCurve: curve, associatedUserAccountInfo: null, mint: mint.publicKey, user: wallet.publicKey,
amount: tokens, quoteAmount: spend, slippage: 1,
tokenProgram: TOKEN_2022_PROGRAM_ID, buybackFeeRecipient: global.buybackFeeRecipients[0],
})),
];
const table = (await connection.getAddressLookupTable(new PublicKey(LAUNCH_LUT))).value!;
const { blockhash } = await connection.getLatestBlockhash();
const tx = new VersionedTransaction(
new TransactionMessage({ payerKey: wallet.publicKey, recentBlockhash: blockhash, instructions: ixs }).compileToV0Message([table]),
);
await wallet.sendTransaction(tx, connection, { signers: [mint] });With every metadata field at its maximum length the transaction is 1,172 bytes and uses about 260k compute units. Nothing can trade before the buy, so the quote is exact; the 1% slippage is only a margin.
launchLookupTableKeys(global.buybackFeeRecipients).Metadata
uri points to JSON in pump.fun's format, usually on IPFS:
{
"name": "Tidewater",
"symbol": "TIDE",
"description": "A coin whose pool only grows.",
"image": "https://ipfs.io/ipfs/<image cid>",
"showName": true,
"website": "https://example.com",
"twitter": "https://x.com/example",
"telegram": "https://t.me/example"
}After launch
- The coin trades on pump.fun immediately.
- Creator fees from every pump.fun trade, and from PumpSwap after the coin graduates, collect in the coin's creator account (
creatorPda(mint)). Proglet's crank spends them on buybacks and adds what it buys, with SOL, to the coin's pool. - The pool is empty until the first buyback; from then on it only grows, and lending opens once it holds 0.1 SOL.
