├── constants ├── index.ts └── constants.ts ├── utils ├── index.ts ├── logger.ts ├── swapOnlyAmm.ts └── utils.ts ├── image ├── 1.jpg └── 2.jpg ├── src ├── idl │ ├── index.ts │ ├── pump-fun-old.ts │ ├── pump-fun-old.json │ └── pump-fun.ts ├── metadata.ts ├── events.ts ├── types.ts ├── uploadToIpfs.ts ├── globalAccount.ts ├── bondingCurveAccount.ts ├── pumpfun.ts └── util.ts ├── tsconfig.json ├── README.md ├── .env.example ├── tsconfig.base.json ├── executor ├── jito.ts └── legacy.ts ├── package.json ├── gather.ts ├── status.ts ├── closeLut.ts ├── .gitignore └── index.ts /constants/index.ts: -------------------------------------------------------------------------------- 1 | export * from './constants'; -------------------------------------------------------------------------------- /utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './utils'; 2 | export * from './logger'; -------------------------------------------------------------------------------- /image/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeudev/solana-pumpfun-bundler/HEAD/image/1.jpg -------------------------------------------------------------------------------- /image/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeudev/solana-pumpfun-bundler/HEAD/image/2.jpg -------------------------------------------------------------------------------- /src/idl/index.ts: -------------------------------------------------------------------------------- 1 | export { default as IDL } from "./pump-fun.json"; 2 | export { PumpFun } from "./pump-fun"; 3 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "compilerOptions": { 4 | "moduleResolution": "node", 5 | "module": "es2022", 6 | "target": "es2022", 7 | "outDir": "dist/esm/", 8 | "rootDir": "", 9 | } 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # solana-pumpfun-bundler 2 | solana pumpfun bundler: pumpfun bundler bundling pump.fun. It bundles buy/sell to 20+ wallets. It uses jito for bundling. It's not a full code. If you want full code or need guidence / custom requirements, ping me to telegram[https://t.me/SavantCat]. 3 | 4 | - You can config several options here, reference .env.example. 5 | -------------------------------------------------------------------------------- /utils/logger.ts: -------------------------------------------------------------------------------- 1 | import pino from "pino"; 2 | 3 | const transport = pino.transport({ 4 | target: 'pino-pretty', 5 | }); 6 | 7 | export const logger = pino( 8 | { 9 | level: 'info', 10 | redact: ['poolKeys'], 11 | serializers: { 12 | error: pino.stdSerializers.err, 13 | }, 14 | base: undefined, 15 | }, 16 | transport, 17 | ); 18 | -------------------------------------------------------------------------------- /src/metadata.ts: -------------------------------------------------------------------------------- 1 | const metadata = { 2 | "name": "TrustPump", 3 | "symbol": "TrustPump", 4 | "description": "pumpfun bundler test", 5 | "image": "", 6 | "showName": true, 7 | "createdOn": "https://pump.fun", 8 | "twitter": "https://x.com/TrustPump", 9 | "telegram": "https://t.me/TrustPump", 10 | "website": "https://www.TrustPump.com" 11 | } 12 | 13 | export default metadata; -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | PRIVATE_KEY= 2 | RPC_ENDPOINT=https://mainnet.helius-rpc.com/?api-key= 3 | RPC_WEBSOCKET_ENDPOINT=wss://mainnet.helius-rpc.com/?api-key= 4 | 5 | SWAP_AMOUNT=0.001 6 | DISTRIBUTION_WALLETNUM=20 7 | 8 | JITO_FEE=0.001 9 | 10 | TOKEN_NAME="Verify Pump" 11 | TOKEN_SYMBOL="VEPP" 12 | DESCRIPTION="I will give you" 13 | TOKEN_SHOW_NAME="Desk" 14 | TOKEN_CREATE_ON="yesterday" 15 | TWITTER="https://x.com/rrr" 16 | TELEGRAM="https://t.me/www" 17 | WEBSITE="https://sisi.com" 18 | FILE="./image/1.jpg" 19 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src/**/*", "./src/**/*.json"], 3 | "compilerOptions": { 4 | "sourceMap": true, 5 | "declaration": true, 6 | "declarationMap": true, 7 | "allowSyntheticDefaultImports": true, 8 | "experimentalDecorators": true, 9 | "emitDecoratorMetadata": true, 10 | "noImplicitAny": false, 11 | "strictNullChecks": true, 12 | "esModuleInterop": true, 13 | "resolveJsonModule": true, 14 | "skipLibCheck": true 15 | }, 16 | "ts-node": { 17 | "compilerOptions": { 18 | "module": "commonjs" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /executor/jito.ts: -------------------------------------------------------------------------------- 1 | import { Commitment, Connection, Keypair, LAMPORTS_PER_SOL, PublicKey, SystemProgram, TransactionMessage, VersionedTransaction } from "@solana/web3.js"; 2 | import base58 from "bs58"; 3 | import axios from "axios"; 4 | import { JITO_FEE, RPC_ENDPOINT, RPC_WEBSOCKET_ENDPOINT } from "../constants"; 5 | 6 | const solanaConnection = new Connection(RPC_ENDPOINT, { 7 | wsEndpoint: RPC_WEBSOCKET_ENDPOINT, 8 | }) 9 | 10 | export const executeJitoTx = async (transactions: VersionedTransaction[], payer: Keypair, commitment: Commitment) => { 11 | 12 | try { 13 | 14 | } catch (error) { 15 | console.log('Error during transaction execution', error); 16 | return null 17 | } 18 | } 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pumpdotfun-bundler", 3 | "author": "Rabnail-SOL", 4 | "scripts": { 5 | "start": "ts-node index.ts", 6 | "close": "ts-node closeLut.ts", 7 | "gather": "ts-node gather.ts", 8 | "status": "ts-node status.ts" 9 | }, 10 | "license": "ISC", 11 | "devDependencies": { 12 | "@coral-xyz/anchor": "^0.30.1", 13 | "@solana/spl-token": "^0.4.0", 14 | "@solana/web3.js": "^1.89.1", 15 | "@types/bn.js": "^5.1.5", 16 | "@types/node": "^20.14.1", 17 | "axios": "^1.6.8", 18 | "dotenv": "^16.4.5", 19 | "js-sha256": "^0.11.0", 20 | "pino": "^8.18.0", 21 | "pino-pretty": "^10.3.1", 22 | "pino-std-serializers": "^6.2.2", 23 | "rimraf": "^3.0.2", 24 | "rollup": "^4.18.0", 25 | "ts-node": "^10.9.2" 26 | }, 27 | "dependencies": { 28 | "@fleekxyz/sdk": "^1.4.2", 29 | "@raydium-io/raydium-sdk": "^1.3.1-beta.58", 30 | "@types/bs58": "^4.0.4", 31 | "bs58": "^6.0.0", 32 | "typescript": "^5.3.3", 33 | "undici": "^6.19.2" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /gather.ts: -------------------------------------------------------------------------------- 1 | import base58 from "bs58" 2 | import { readJson, retrieveEnvVariable, sleep } from "./utils" 3 | import { ComputeBudgetProgram, Connection, Keypair, SystemProgram, Transaction, TransactionInstruction, sendAndConfirmTransaction } from "@solana/web3.js" 4 | import { TOKEN_PROGRAM_ID, createAssociatedTokenAccountIdempotentInstruction, createCloseAccountInstruction, createTransferCheckedInstruction, getAssociatedTokenAddress } from "@solana/spl-token"; 5 | import { SPL_ACCOUNT_LAYOUT, TokenAccount } from "@raydium-io/raydium-sdk"; 6 | import { getSellTxWithJupiter } from "./utils/swapOnlyAmm"; 7 | import { execute } from "./executor/legacy"; 8 | import { RPC_ENDPOINT, RPC_WEBSOCKET_ENDPOINT } from "./constants"; 9 | 10 | export const solanaConnection = new Connection(RPC_ENDPOINT, { 11 | wsEndpoint: RPC_WEBSOCKET_ENDPOINT, commitment: "processed" 12 | }) 13 | 14 | const rpcUrl = retrieveEnvVariable("RPC_ENDPOINT"); 15 | const mainKpStr = retrieveEnvVariable('PRIVATE_KEY'); 16 | const connection = new Connection(rpcUrl, { commitment: "processed" }); 17 | const mainKp = Keypair.fromSecretKey(base58.decode(mainKpStr)) 18 | 19 | const main = async () => { 20 | // Contact with savant-cat 21 | } 22 | 23 | main() 24 | -------------------------------------------------------------------------------- /constants/constants.ts: -------------------------------------------------------------------------------- 1 | import { retrieveEnvVariable } from "../utils" 2 | import { PublicKey } from "@solana/web3.js"; 3 | 4 | export const PRIVATE_KEY = retrieveEnvVariable('PRIVATE_KEY') 5 | export const RPC_ENDPOINT = retrieveEnvVariable('RPC_ENDPOINT') 6 | export const RPC_WEBSOCKET_ENDPOINT = retrieveEnvVariable('RPC_WEBSOCKET_ENDPOINT') 7 | 8 | export const TOKEN_NAME = retrieveEnvVariable('TOKEN_NAME') 9 | export const TOKEN_SYMBOL = retrieveEnvVariable('TOKEN_SYMBOL') 10 | export const DESCRIPTION = retrieveEnvVariable('DESCRIPTION') 11 | export const TOKEN_SHOW_NAME = retrieveEnvVariable('TOKEN_SHOW_NAME') 12 | export const TOKEN_CREATE_ON = retrieveEnvVariable('TOKEN_CREATE_ON') 13 | export const TWITTER = retrieveEnvVariable('TWITTER') 14 | export const TELEGRAM = retrieveEnvVariable('TELEGRAM') 15 | export const WEBSITE = retrieveEnvVariable('WEBSITE') 16 | export const FILE = retrieveEnvVariable('FILE') 17 | 18 | export const SWAP_AMOUNT = Number(retrieveEnvVariable('SWAP_AMOUNT')) 19 | export const DISTRIBUTION_WALLETNUM = Number(retrieveEnvVariable('DISTRIBUTION_WALLETNUM')) 20 | 21 | export const JITO_FEE = Number(retrieveEnvVariable('JITO_FEE')) 22 | 23 | export const global_mint = new PublicKey("p89evAyzjd9fphjJx7G3RFA48sbZdpGEppRcfRNpump") 24 | export const PUMP_PROGRAM = new PublicKey("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"); 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /status.ts: -------------------------------------------------------------------------------- 1 | import { Connection, Keypair, PublicKey,} from "@solana/web3.js" 2 | import { getAssociatedTokenAddressSync, getMint } from "@solana/spl-token"; 3 | import { BN } from "bn.js"; 4 | import base58 from "bs58" 5 | 6 | import { readJson, retrieveEnvVariable, sleep } from "./utils" 7 | import { RPC_ENDPOINT, RPC_WEBSOCKET_ENDPOINT } from "./constants"; 8 | 9 | const connection = new Connection(RPC_ENDPOINT, {wsEndpoint: RPC_WEBSOCKET_ENDPOINT, commitment: "confirmed" }); 10 | 11 | export const displayStatus = async () => { 12 | try { 13 | const walletsData = readJson() 14 | const mintStr = readJson("mint.json")[0] 15 | const mint = new PublicKey(mintStr) 16 | 17 | const wallets = walletsData.map((kp) => Keypair.fromSecretKey(base58.decode(kp))) 18 | 19 | const mintInfo = await getMint(connection, mint) 20 | wallets.map(async (kp, i) => { 21 | const ata = getAssociatedTokenAddressSync(mint, kp.publicKey) 22 | const tokenBalance = (await connection.getTokenAccountBalance(ata)).value.uiAmount 23 | if (!tokenBalance) { 24 | console.log("Token balance not retrieved, Error...") 25 | return 26 | } 27 | const percent = new BN(tokenBalance).div(new BN((mintInfo.supply).toString()).div(new BN(10 ** mintInfo.decimals))).mul(new BN(100)).toString() 28 | console.log("Wallet ", i, " : ", kp.publicKey.toBase58(), ", Holding Percent -> ", percent, "%, Token Balance -> ", tokenBalance.toFixed(2)) 29 | }) 30 | } catch (error) { 31 | console.log("Error in displaying wallets status") 32 | return 33 | } 34 | } 35 | 36 | displayStatus() -------------------------------------------------------------------------------- /utils/swapOnlyAmm.ts: -------------------------------------------------------------------------------- 1 | 2 | import { 3 | PublicKey, 4 | Keypair, 5 | Connection, 6 | VersionedTransaction 7 | } from '@solana/web3.js'; 8 | const SLIPPAGE = 50 9 | 10 | export const getBuyTxWithJupiter = async (wallet: Keypair, baseMint: PublicKey, amount: number) => { 11 | try { 12 | 13 | } catch (error) { 14 | console.log("Failed to get buy transaction") 15 | return null 16 | } 17 | }; 18 | 19 | 20 | export const getSellTxWithJupiter = async (wallet: Keypair, baseMint: PublicKey, amount: string) => { 21 | try { 22 | const quoteResponse = await ( 23 | await fetch( 24 | `https://quote-api.jup.ag/v6/quote?inputMint=${baseMint.toBase58()}&outputMint=So11111111111111111111111111111111111111112&amount=${amount}&slippageBps=${SLIPPAGE}` 25 | ) 26 | ).json(); 27 | 28 | // get serialized transactions for the swap 29 | const { swapTransaction } = await ( 30 | await fetch("https://quote-api.jup.ag/v6/swap", { 31 | method: "POST", 32 | headers: { 33 | "Content-Type": "application/json", 34 | }, 35 | body: JSON.stringify({ 36 | quoteResponse, 37 | userPublicKey: wallet.publicKey.toString(), 38 | wrapAndUnwrapSol: true, 39 | dynamicComputeUnitLimit: true, 40 | prioritizationFeeLamports: 52000 41 | }), 42 | }) 43 | ).json(); 44 | 45 | // deserialize the transaction 46 | const swapTransactionBuf = Buffer.from(swapTransaction, "base64"); 47 | var transaction = VersionedTransaction.deserialize(swapTransactionBuf); 48 | 49 | // sign the transaction 50 | transaction.sign([wallet]); 51 | return transaction 52 | } catch (error) { 53 | console.log("Failed to get sell transaction") 54 | return null 55 | } 56 | }; -------------------------------------------------------------------------------- /src/events.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from "@solana/web3.js"; 2 | import { 3 | CompleteEvent, 4 | CreateEvent, 5 | SetParamsEvent, 6 | TradeEvent, 7 | } from "./types"; 8 | 9 | export function toCreateEvent(event: CreateEvent): CreateEvent { 10 | return { 11 | name: event.name, 12 | symbol: event.symbol, 13 | uri: event.uri, 14 | mint: new PublicKey(event.mint), 15 | bondingCurve: new PublicKey(event.bondingCurve), 16 | user: new PublicKey(event.user), 17 | }; 18 | } 19 | 20 | export function toCompleteEvent(event: CompleteEvent): CompleteEvent { 21 | return { 22 | user: new PublicKey(event.user), 23 | mint: new PublicKey(event.mint), 24 | bondingCurve: new PublicKey(event.bondingCurve), 25 | timestamp: event.timestamp, 26 | }; 27 | } 28 | 29 | export function toTradeEvent(event: TradeEvent): TradeEvent { 30 | return { 31 | mint: new PublicKey(event.mint), 32 | solAmount: BigInt(event.solAmount), 33 | tokenAmount: BigInt(event.tokenAmount), 34 | isBuy: event.isBuy, 35 | user: new PublicKey(event.user), 36 | timestamp: Number(event.timestamp), 37 | virtualSolReserves: BigInt(event.virtualSolReserves), 38 | virtualTokenReserves: BigInt(event.virtualTokenReserves), 39 | realSolReserves: BigInt(event.realSolReserves), 40 | realTokenReserves: BigInt(event.realTokenReserves), 41 | }; 42 | } 43 | 44 | export function toSetParamsEvent(event: SetParamsEvent): SetParamsEvent { 45 | return { 46 | feeRecipient: new PublicKey(event.feeRecipient), 47 | initialVirtualTokenReserves: BigInt(event.initialVirtualTokenReserves), 48 | initialVirtualSolReserves: BigInt(event.initialVirtualSolReserves), 49 | initialRealTokenReserves: BigInt(event.initialRealTokenReserves), 50 | tokenTotalSupply: BigInt(event.tokenTotalSupply), 51 | feeBasisPoints: BigInt(event.feeBasisPoints), 52 | }; 53 | } 54 | -------------------------------------------------------------------------------- /src/types.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey, VersionedTransactionResponse } from "@solana/web3.js"; 2 | 3 | export type CreateTokenMetadata = { 4 | name: string; 5 | symbol: string; 6 | description: string; 7 | file: Blob; 8 | twitter?: string; 9 | telegram?: string; 10 | website?: string; 11 | }; 12 | 13 | export type TokenMetadata = { 14 | name: string; 15 | symbol: string; 16 | description: string; 17 | image: string; 18 | showName: boolean; 19 | createdOn: string; 20 | twitter: string; 21 | }; 22 | 23 | export type CreateEvent = { 24 | name: string; 25 | symbol: string; 26 | uri: string; 27 | mint: PublicKey; 28 | bondingCurve: PublicKey; 29 | user: PublicKey; 30 | }; 31 | 32 | export type TradeEvent = { 33 | mint: PublicKey; 34 | solAmount: bigint; 35 | tokenAmount: bigint; 36 | isBuy: boolean; 37 | user: PublicKey; 38 | timestamp: number; 39 | virtualSolReserves: bigint; 40 | virtualTokenReserves: bigint; 41 | realSolReserves: bigint; 42 | realTokenReserves: bigint; 43 | }; 44 | 45 | export type CompleteEvent = { 46 | user: PublicKey; 47 | mint: PublicKey; 48 | bondingCurve: PublicKey; 49 | timestamp: number; 50 | }; 51 | 52 | export type SetParamsEvent = { 53 | feeRecipient: PublicKey; 54 | initialVirtualTokenReserves: bigint; 55 | initialVirtualSolReserves: bigint; 56 | initialRealTokenReserves: bigint; 57 | tokenTotalSupply: bigint; 58 | feeBasisPoints: bigint; 59 | }; 60 | 61 | export interface PumpFunEventHandlers { 62 | createEvent: CreateEvent; 63 | tradeEvent: TradeEvent; 64 | completeEvent: CompleteEvent; 65 | setParamsEvent: SetParamsEvent; 66 | } 67 | 68 | export type PumpFunEventType = keyof PumpFunEventHandlers; 69 | 70 | export type PriorityFee = { 71 | unitLimit: number; 72 | unitPrice: number; 73 | }; 74 | 75 | export type TransactionResult = { 76 | signature?: string; 77 | error?: unknown; 78 | results?: VersionedTransactionResponse; 79 | success: boolean; 80 | }; 81 | -------------------------------------------------------------------------------- /src/uploadToIpfs.ts: -------------------------------------------------------------------------------- 1 | 2 | import fs from 'fs'; 3 | import { FleekSdk, PersonalAccessTokenService } from '@fleekxyz/sdk'; 4 | import dotenv from 'dotenv'; 5 | import metadata from './metadata'; 6 | dotenv.config(); 7 | 8 | const pat = process.env.PAT || ''; 9 | const project_id = process.env.PROJECT_ID || ''; 10 | const imageName = "./upload/bolt.jpg"; 11 | const metadataName = "./upload/metadata.json"; 12 | 13 | const patService = new PersonalAccessTokenService({ 14 | personalAccessToken: pat, 15 | projectId: project_id, 16 | }) 17 | 18 | const fleekSdk = new FleekSdk({ accessTokenService: patService }) 19 | 20 | async function uploadFileToIPFS(filename: string, content: Buffer) { 21 | const result = await fleekSdk.ipfs().add({ 22 | path: filename, 23 | content: content 24 | }); 25 | return result; 26 | } 27 | 28 | export const getUploadedMetadataURI = async (): Promise => { 29 | const fileContent = fs.readFileSync(imageName); 30 | 31 | try { 32 | const imageUploadResult = await uploadFileToIPFS(imageName, fileContent); 33 | console.log('Image uploaded to IPFS:', imageUploadResult); 34 | console.log('IPFS URL:', `https://cf-ipfs.com/ipfs/${imageUploadResult.cid}`); 35 | 36 | const data = { 37 | "name": metadata.name, 38 | "symbol": metadata.symbol, 39 | "description": metadata.description, 40 | "image": `https://cf-ipfs.com/ipfs/${imageUploadResult.cid}`, 41 | "showName": metadata.showName, 42 | "createdOn": metadata.createdOn, 43 | "twitter": metadata.twitter, 44 | "telegram": metadata.telegram, 45 | "website": metadata.website 46 | } 47 | const metadataString = JSON.stringify(data); 48 | const bufferContent = Buffer.from(metadataString, 'utf-8'); 49 | fs.writeFileSync(metadataName, bufferContent); 50 | const metadataContent = fs.readFileSync(metadataName); 51 | 52 | const metadataUploadResult = await uploadFileToIPFS(metadataName, metadataContent); 53 | console.log('File uploaded to IPFS:', metadataUploadResult); 54 | console.log('IPFS URL:', `https://cf-ipfs.com/ipfs/${metadataUploadResult.cid}`) 55 | return `https://cf-ipfs.com/ipfs/${metadataUploadResult.cid}`; 56 | } catch (error) { 57 | return ""; 58 | } 59 | } -------------------------------------------------------------------------------- /closeLut.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey, Keypair, AddressLookupTableProgram, ComputeBudgetProgram, Transaction, sendAndConfirmTransaction, Connection } from "@solana/web3.js" 2 | import base58 from 'bs58' 3 | import { readJson, sleep } from "./utils" 4 | import { PRIVATE_KEY, RPC_ENDPOINT, RPC_WEBSOCKET_ENDPOINT } from "./constants" 5 | 6 | const commitment = "confirmed" 7 | 8 | const mainKp = Keypair.fromSecretKey(base58.decode(PRIVATE_KEY)) 9 | const connection = new Connection(RPC_ENDPOINT, { 10 | wsEndpoint: RPC_WEBSOCKET_ENDPOINT, commitment 11 | }) 12 | 13 | const closeLut = async () => { 14 | try { 15 | const lutData = readJson("lut.json") 16 | if (lutData.length == 0) { 17 | console.log("No lut data saved as file") 18 | return 19 | } 20 | const lookupTableAddress = new PublicKey(lutData[0]) 21 | try { 22 | const cooldownTx = new Transaction().add( 23 | ComputeBudgetProgram.setComputeUnitLimit({ units: 15_000_000 }), 24 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 5_000 }), 25 | AddressLookupTableProgram.deactivateLookupTable({ 26 | lookupTable: lookupTableAddress, // Address of the lookup table to deactivate 27 | authority: mainKp.publicKey, // Authority to modify the lookup table 28 | }) 29 | ) 30 | const coolDownSig = await sendAndConfirmTransaction(connection, cooldownTx, [mainKp]) 31 | console.log("Cool Down sig:", coolDownSig) 32 | 33 | } catch (error) { 34 | console.log("Deactivating LUT error:", error) 35 | } 36 | 37 | await sleep(250000) 38 | console.log("\n******************************* You need to wait for 250 seconds until the LUT is fully deactivated, then the SOL in lut can be reclaimed *******************************\n") 39 | 40 | try { 41 | const closeTx = new Transaction().add( 42 | ComputeBudgetProgram.setComputeUnitLimit({ units: 15_000_000 }), 43 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 5_000 }), 44 | AddressLookupTableProgram.closeLookupTable({ 45 | lookupTable: lookupTableAddress, // Address of the lookup table to close 46 | authority: mainKp.publicKey, // Authority to close the LUT 47 | recipient: mainKp.publicKey, // Recipient of the reclaimed rent balance 48 | }) 49 | ) 50 | const closeSig = await sendAndConfirmTransaction(connection, closeTx, [mainKp]) 51 | console.log("Close LUT Sig:", closeSig) 52 | } catch (error) { 53 | console.log("Close LUT error:", error) 54 | } 55 | } catch (error) { 56 | console.log("Unexpected error while closing the LUT") 57 | } 58 | } 59 | 60 | 61 | closeLut() 62 | -------------------------------------------------------------------------------- /src/globalAccount.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from "@solana/web3.js"; 2 | import { struct, bool, u64, publicKey, Layout } from "@coral-xyz/borsh"; 3 | 4 | export class GlobalAccount { 5 | public discriminator: bigint; 6 | public initialized: boolean = false; 7 | public authority: PublicKey; 8 | public feeRecipient: PublicKey; 9 | public initialVirtualTokenReserves: bigint; 10 | public initialVirtualSolReserves: bigint; 11 | public initialRealTokenReserves: bigint; 12 | public tokenTotalSupply: bigint; 13 | public feeBasisPoints: bigint; 14 | 15 | constructor( 16 | discriminator: bigint, 17 | initialized: boolean, 18 | authority: PublicKey, 19 | feeRecipient: PublicKey, 20 | initialVirtualTokenReserves: bigint, 21 | initialVirtualSolReserves: bigint, 22 | initialRealTokenReserves: bigint, 23 | tokenTotalSupply: bigint, 24 | feeBasisPoints: bigint 25 | ) { 26 | this.discriminator = discriminator; 27 | this.initialized = initialized; 28 | this.authority = authority; 29 | this.feeRecipient = feeRecipient; 30 | this.initialVirtualTokenReserves = initialVirtualTokenReserves; 31 | this.initialVirtualSolReserves = initialVirtualSolReserves; 32 | this.initialRealTokenReserves = initialRealTokenReserves; 33 | this.tokenTotalSupply = tokenTotalSupply; 34 | this.feeBasisPoints = feeBasisPoints; 35 | } 36 | 37 | getInitialBuyPrice(amount: bigint): bigint { 38 | if (amount <= 0n) { 39 | return 0n; 40 | } 41 | 42 | let n = this.initialVirtualSolReserves * this.initialVirtualTokenReserves; 43 | let i = this.initialVirtualSolReserves + amount; 44 | let r = n / i + 1n; 45 | let s = this.initialVirtualTokenReserves - r; 46 | return s < this.initialRealTokenReserves 47 | ? s 48 | : this.initialRealTokenReserves; 49 | } 50 | 51 | public static fromBuffer(buffer: Buffer): GlobalAccount { 52 | const structure: Layout = struct([ 53 | u64("discriminator"), 54 | bool("initialized"), 55 | publicKey("authority"), 56 | publicKey("feeRecipient"), 57 | u64("initialVirtualTokenReserves"), 58 | u64("initialVirtualSolReserves"), 59 | u64("initialRealTokenReserves"), 60 | u64("tokenTotalSupply"), 61 | u64("feeBasisPoints"), 62 | ]); 63 | 64 | let value = structure.decode(buffer); 65 | return new GlobalAccount( 66 | BigInt(value.discriminator), 67 | value.initialized, 68 | value.authority, 69 | value.feeRecipient, 70 | BigInt(value.initialVirtualTokenReserves), 71 | BigInt(value.initialVirtualSolReserves), 72 | BigInt(value.initialRealTokenReserves), 73 | BigInt(value.tokenTotalSupply), 74 | BigInt(value.feeBasisPoints) 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | .pnpm-debug.log* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Snowpack dependency directory (https://snowpack.dev/) 46 | web_modules/ 47 | 48 | # TypeScript cache 49 | *.tsbuildinfo 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional stylelint cache 58 | .stylelintcache 59 | 60 | # Microbundle cache 61 | .rpt2_cache/ 62 | .rts2_cache_cjs/ 63 | .rts2_cache_es/ 64 | .rts2_cache_umd/ 65 | 66 | # Optional REPL history 67 | .node_repl_history 68 | 69 | # Output of 'npm pack' 70 | *.tgz 71 | 72 | # Yarn Integrity file 73 | .yarn-integrity 74 | 75 | # dotenv environment variable files 76 | .env 77 | .env.development.local 78 | .env.test.local 79 | .env.production.local 80 | .env.local 81 | 82 | # parcel-bundler cache (https://parceljs.org/) 83 | .cache 84 | .parcel-cache 85 | 86 | # Next.js build output 87 | .next 88 | out 89 | 90 | # Nuxt.js build / generate output 91 | .nuxt 92 | dist 93 | 94 | # Gatsby files 95 | .cache/ 96 | # Comment in the public line in if your project uses Gatsby and not Next.js 97 | # https://nextjs.org/blog/next-9-1#public-directory-support 98 | # public 99 | 100 | # vuepress build output 101 | .vuepress/dist 102 | 103 | # vuepress v2.x temp and cache directory 104 | .temp 105 | .cache 106 | 107 | # Docusaurus cache and generated files 108 | .docusaurus 109 | 110 | # Serverless directories 111 | .serverless/ 112 | 113 | # FuseBox cache 114 | .fusebox/ 115 | 116 | # DynamoDB Local files 117 | .dynamodb/ 118 | 119 | # TernJS port file 120 | .tern-port 121 | 122 | # Stores VSCode versions used for testing VSCode extensions 123 | .vscode-test 124 | 125 | # PNPM 126 | pnpm-lock.yaml 127 | 128 | # yarn v2 129 | .yarn/cache 130 | .yarn/unplugged 131 | .yarn/build-state.yml 132 | .yarn/install-state.gz 133 | .pnp.* 134 | 135 | # JetBrains 136 | .idea 137 | 138 | # Visual Studio Code 139 | *.code-workspace 140 | 141 | data.json 142 | keys/* -------------------------------------------------------------------------------- /executor/legacy.ts: -------------------------------------------------------------------------------- 1 | import { Connection, Keypair, SignatureStatus, TransactionConfirmationStatus, TransactionInstruction, TransactionMessage, TransactionSignature, VersionedTransaction } from "@solana/web3.js"; 2 | import { RPC_ENDPOINT, RPC_WEBSOCKET_ENDPOINT } from "../constants"; 3 | import { logger } from "../utils"; 4 | 5 | 6 | interface Blockhash { 7 | blockhash: string; 8 | lastValidBlockHeight: number; 9 | } 10 | 11 | export const execute = async (transaction: VersionedTransaction, latestBlockhash: Blockhash, isBuy: boolean | 1 = true) => { 12 | const solanaConnection = new Connection(RPC_ENDPOINT, { 13 | wsEndpoint: RPC_WEBSOCKET_ENDPOINT, 14 | }) 15 | 16 | const signature = await solanaConnection.sendRawTransaction(transaction.serialize(), { skipPreflight: true }) 17 | const confirmation = await solanaConnection.confirmTransaction( 18 | { 19 | signature, 20 | lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, 21 | blockhash: latestBlockhash.blockhash, 22 | } 23 | ); 24 | 25 | if (confirmation.value.err) { 26 | console.log("Confirmtaion error") 27 | return "" 28 | } else { 29 | if (isBuy === 1) { 30 | return signature 31 | } else if (isBuy) 32 | console.log(`Success in buy transaction: https://solscan.io/tx/${signature}`) 33 | else 34 | console.log(`Success in Sell transaction: https://solscan.io/tx/${signature}`) 35 | } 36 | return signature 37 | } 38 | 39 | export const createAndSendV0Tx = async (txInstructions: TransactionInstruction[], kp: Keypair, connection: Connection) => { 40 | try { 41 | // Step 1 - Fetch Latest Blockhash 42 | let latestBlockhash = await connection.getLatestBlockhash(); 43 | // console.log(" ✅ - Fetched latest blockhash. Last valid height:", latestBlockhash.lastValidBlockHeight); 44 | 45 | // Step 2 - Generate Transaction Message 46 | const messageV0 = new TransactionMessage({ 47 | payerKey: kp.publicKey, 48 | recentBlockhash: latestBlockhash.blockhash, 49 | instructions: txInstructions 50 | }).compileToV0Message(); 51 | // console.log(" ✅ - Compiled transaction message"); 52 | const transaction = new VersionedTransaction(messageV0); 53 | 54 | // Step 3 - Sign your transaction with the required `Signers` 55 | transaction.sign([kp]); 56 | // console.log(` ✅ - Transaction Signed by the wallet ${(kp.publicKey).toBase58()}`); 57 | 58 | // Step 4 - Send our v0 transaction to the cluster 59 | const txid = await connection.sendTransaction(transaction, { maxRetries: 5 }); 60 | // console.log(" ✅ - Transaction sent to network"); 61 | 62 | // Step 5 - Confirm Transaction 63 | const confirmation = await confirmTransaction(connection, txid); 64 | console.log('LUT transaction successfully confirmed!', '\n', `https://explorer.solana.com/tx/${txid}`); 65 | return confirmation.err == null 66 | 67 | } catch (error) { 68 | console.log("Error in transaction") 69 | return false 70 | } 71 | } 72 | 73 | async function confirmTransaction( 74 | connection: Connection, 75 | signature: TransactionSignature, 76 | desiredConfirmationStatus: TransactionConfirmationStatus = 'confirmed', 77 | timeout: number = 30000, 78 | pollInterval: number = 1000, 79 | searchTransactionHistory: boolean = false 80 | ): Promise { 81 | const start = Date.now(); 82 | 83 | while (Date.now() - start < timeout) { 84 | const { value: statuses } = await connection.getSignatureStatuses([signature], { searchTransactionHistory }); 85 | 86 | if (!statuses || statuses.length === 0) { 87 | throw new Error('Failed to get signature status'); 88 | } 89 | 90 | const status = statuses[0]; 91 | 92 | if (status === null) { 93 | // If status is null, the transaction is not yet known 94 | await new Promise(resolve => setTimeout(resolve, pollInterval)); 95 | continue; 96 | } 97 | 98 | if (status.err) { 99 | throw new Error(`Transaction failed: ${JSON.stringify(status.err)}`); 100 | } 101 | 102 | if (status.confirmationStatus && status.confirmationStatus === desiredConfirmationStatus) { 103 | return status; 104 | } 105 | 106 | if (status.confirmationStatus === 'finalized') { 107 | return status; 108 | } 109 | 110 | await new Promise(resolve => setTimeout(resolve, pollInterval)); 111 | } 112 | 113 | throw new Error(`Transaction confirmation timeout after ${timeout}ms`); 114 | } 115 | 116 | -------------------------------------------------------------------------------- /src/bondingCurveAccount.ts: -------------------------------------------------------------------------------- 1 | import { struct, bool, u64, Layout } from "@coral-xyz/borsh"; 2 | 3 | export class BondingCurveAccount { 4 | public discriminator: bigint; 5 | public virtualTokenReserves: bigint; 6 | public virtualSolReserves: bigint; 7 | public realTokenReserves: bigint; 8 | public realSolReserves: bigint; 9 | public tokenTotalSupply: bigint; 10 | public complete: boolean; 11 | 12 | constructor( 13 | discriminator: bigint, 14 | virtualTokenReserves: bigint, 15 | virtualSolReserves: bigint, 16 | realTokenReserves: bigint, 17 | realSolReserves: bigint, 18 | tokenTotalSupply: bigint, 19 | complete: boolean 20 | ) { 21 | this.discriminator = discriminator; 22 | this.virtualTokenReserves = virtualTokenReserves; 23 | this.virtualSolReserves = virtualSolReserves; 24 | this.realTokenReserves = realTokenReserves; 25 | this.realSolReserves = realSolReserves; 26 | this.tokenTotalSupply = tokenTotalSupply; 27 | this.complete = complete; 28 | } 29 | 30 | getBuyPrice(amount: bigint): bigint { 31 | if (this.complete) { 32 | throw new Error("Curve is complete"); 33 | } 34 | 35 | if (amount <= 0n) { 36 | return 0n; 37 | } 38 | 39 | // Calculate the product of virtual reserves 40 | let n = this.virtualSolReserves * this.virtualTokenReserves; 41 | 42 | // Calculate the new virtual sol reserves after the purchase 43 | let i = this.virtualSolReserves + amount; 44 | 45 | // Calculate the new virtual token reserves after the purchase 46 | let r = n / i + 1n; 47 | 48 | // Calculate the amount of tokens to be purchased 49 | let s = this.virtualTokenReserves - r; 50 | 51 | // Return the minimum of the calculated tokens and real token reserves 52 | return s < this.realTokenReserves ? s : this.realTokenReserves; 53 | } 54 | 55 | getSellPrice(amount: bigint, feeBasisPoints: bigint): bigint { 56 | if (this.complete) { 57 | throw new Error("Curve is complete"); 58 | } 59 | 60 | if (amount <= 0n) { 61 | return 0n; 62 | } 63 | 64 | // Calculate the proportional amount of virtual sol reserves to be received 65 | let n = 66 | (amount * this.virtualSolReserves) / (this.virtualTokenReserves + amount); 67 | 68 | // Calculate the fee amount in the same units 69 | let a = (n * feeBasisPoints) / 10000n; 70 | 71 | // Return the net amount after deducting the fee 72 | return n - a; 73 | } 74 | 75 | getMarketCapSOL(): bigint { 76 | if (this.virtualTokenReserves === 0n) { 77 | return 0n; 78 | } 79 | 80 | return ( 81 | (this.tokenTotalSupply * this.virtualSolReserves) / 82 | this.virtualTokenReserves 83 | ); 84 | } 85 | 86 | getFinalMarketCapSOL(feeBasisPoints: bigint): bigint { 87 | let totalSellValue = this.getBuyOutPrice( 88 | this.realTokenReserves, 89 | feeBasisPoints 90 | ); 91 | let totalVirtualValue = this.virtualSolReserves + totalSellValue; 92 | let totalVirtualTokens = this.virtualTokenReserves - this.realTokenReserves; 93 | 94 | if (totalVirtualTokens === 0n) { 95 | return 0n; 96 | } 97 | 98 | return (this.tokenTotalSupply * totalVirtualValue) / totalVirtualTokens; 99 | } 100 | 101 | getBuyOutPrice(amount: bigint, feeBasisPoints: bigint): bigint { 102 | let solTokens = 103 | amount < this.realSolReserves ? this.realSolReserves : amount; 104 | let totalSellValue = 105 | (solTokens * this.virtualSolReserves) / 106 | (this.virtualTokenReserves - solTokens) + 107 | 1n; 108 | let fee = (totalSellValue * feeBasisPoints) / 10000n; 109 | return totalSellValue + fee; 110 | } 111 | 112 | public static fromBuffer(buffer: Buffer): BondingCurveAccount { 113 | const structure: Layout = struct([ 114 | u64("discriminator"), 115 | u64("virtualTokenReserves"), 116 | u64("virtualSolReserves"), 117 | u64("realTokenReserves"), 118 | u64("realSolReserves"), 119 | u64("tokenTotalSupply"), 120 | bool("complete"), 121 | ]); 122 | 123 | let value = structure.decode(buffer); 124 | return new BondingCurveAccount( 125 | BigInt(value.discriminator), 126 | BigInt(value.virtualTokenReserves), 127 | BigInt(value.virtualSolReserves), 128 | BigInt(value.realTokenReserves), 129 | BigInt(value.realSolReserves), 130 | BigInt(value.tokenTotalSupply), 131 | value.complete 132 | ); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /utils/utils.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | import fs from 'fs'; 3 | import path from 'path'; 4 | 5 | dotenv.config(); 6 | 7 | export const retrieveEnvVariable = (variableName: string) => { 8 | const variable = process.env[variableName] || ''; 9 | if (!variable) { 10 | console.log(`${variableName} is not set`); 11 | process.exit(1); 12 | } 13 | return variable; 14 | }; 15 | 16 | // Define the type for the JSON file content 17 | 18 | export const randVal = (min: number, max: number, count: number, total: number, isEven: boolean): number[] => { 19 | 20 | const arr: number[] = Array(count).fill(total / count); 21 | if (isEven) return arr 22 | 23 | if (max * count < total) 24 | throw new Error("Invalid input: max * count must be greater than or equal to total.") 25 | if (min * count > total) 26 | throw new Error("Invalid input: min * count must be less than or equal to total.") 27 | const average = total / count 28 | // Randomize pairs of elements 29 | for (let i = 0; i < count; i += 2) { 30 | // Generate a random adjustment within the range 31 | const adjustment = Math.random() * Math.min(max - average, average - min) 32 | // Add adjustment to one element and subtract from the other 33 | arr[i] += adjustment 34 | arr[i + 1] -= adjustment 35 | } 36 | // if (count % 2) arr.pop() 37 | return arr; 38 | } 39 | 40 | 41 | // export const saveDataToFile = (newData: string[], filePath: string = "data.json") => { 42 | // try { 43 | // let existingData: string[] = []; 44 | 45 | // // Check if the file exists 46 | // if (fs.existsSync(filePath)) { 47 | // // If the file exists, read its content 48 | // const fileContent = fs.readFileSync(filePath, 'utf-8'); 49 | // existingData = JSON.parse(fileContent); 50 | // } 51 | 52 | // // Add the new data to the existing array 53 | // existingData.push(...newData); 54 | 55 | // // Write the updated data back to the file 56 | // fs.writeFileSync(filePath, JSON.stringify(existingData, null, 2)); 57 | 58 | // } catch (error) { 59 | // try { 60 | // if (fs.existsSync(filePath)) { 61 | // fs.unlinkSync(filePath); 62 | // console.log(`File ${filePath} deleted and create new file.`); 63 | // } 64 | // fs.writeFileSync(filePath, JSON.stringify(newData, null, 2)); 65 | // console.log("File is saved successfully.") 66 | // } catch (error) { 67 | // console.log('Error saving data to JSON file:', error); 68 | // } 69 | // } 70 | // }; 71 | 72 | 73 | export const saveDataToFile = (newData: string[], fileName: string = "data.json") => { 74 | const folderPath = 'keys'; 75 | const filePath = path.join(folderPath, fileName); 76 | 77 | try { 78 | // Create the folder if it doesn't exist 79 | if (!fs.existsSync(folderPath)) { 80 | fs.mkdirSync(folderPath, { recursive: true }); 81 | } 82 | 83 | let existingData: string[] = []; 84 | 85 | // Check if the file exists 86 | if (fs.existsSync(filePath)) { 87 | // If the file exists, read its content 88 | const fileContent = fs.readFileSync(filePath, 'utf-8'); 89 | existingData = JSON.parse(fileContent); 90 | } 91 | 92 | // Add the new data to the existing array 93 | existingData.push(...newData); 94 | 95 | // Write the updated data back to the file 96 | fs.writeFileSync(filePath, JSON.stringify(existingData, null, 2)); 97 | 98 | console.log("File is saved successfully."); 99 | 100 | } catch (error) { 101 | try { 102 | if (fs.existsSync(filePath)) { 103 | fs.unlinkSync(filePath); 104 | console.log(`File ${filePath} deleted and will be recreated.`); 105 | } 106 | fs.writeFileSync(filePath, JSON.stringify(newData, null, 2)); 107 | console.log("File is saved successfully."); 108 | } catch (error) { 109 | console.log('Error saving data to JSON file:', error); 110 | } 111 | } 112 | }; 113 | 114 | 115 | export const sleep = async (ms: number) => { 116 | await new Promise((resolve) => setTimeout(resolve, ms)) 117 | } 118 | 119 | // // Function to read JSON file 120 | // export function readJson(filename: string = "data.json"): string[] { 121 | // if (!fs.existsSync(filename)) { 122 | // // If the file does not exist, create an empty array 123 | // fs.writeFileSync(filename, '[]', 'utf-8'); 124 | // } 125 | // const data = fs.readFileSync(filename, 'utf-8'); 126 | // return JSON.parse(data) as string[]; 127 | // } 128 | 129 | // Function to read JSON file from the "keys" folder 130 | export function readJson(fileName: string = "data.json"): string[] { 131 | const folderPath = 'keys'; 132 | const filePath = path.join(folderPath, fileName); 133 | 134 | if (!fs.existsSync(filePath)) { 135 | // If the file does not exist, create an empty array file in the "keys" folder 136 | fs.writeFileSync(filePath, '[]', 'utf-8'); 137 | } 138 | 139 | const data = fs.readFileSync(filePath, 'utf-8'); 140 | return JSON.parse(data) as string[]; 141 | } 142 | 143 | export function deleteConsoleLines(numLines: number) { 144 | for (let i = 0; i < numLines; i++) { 145 | process.stdout.moveCursor(0, -1); // Move cursor up one line 146 | process.stdout.clearLine(-1); // Clear the line 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /src/pumpfun.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Commitment, 3 | Connection, 4 | Finality, 5 | Keypair, 6 | PublicKey, 7 | Transaction, 8 | VersionedTransaction, 9 | } from "@solana/web3.js"; 10 | import { Program, Provider } from "@coral-xyz/anchor"; 11 | import { setGlobalDispatcher, Agent } from 'undici' 12 | import { GlobalAccount } from "./globalAccount"; 13 | import { 14 | CompleteEvent, 15 | CreateEvent, 16 | CreateTokenMetadata, 17 | PriorityFee, 18 | PumpFunEventHandlers, 19 | PumpFunEventType, 20 | SetParamsEvent, 21 | TradeEvent, 22 | TransactionResult, 23 | } from "./types"; 24 | import { 25 | toCompleteEvent, 26 | toCreateEvent, 27 | toSetParamsEvent, 28 | toTradeEvent, 29 | } from "./events"; 30 | import { 31 | createAssociatedTokenAccountInstruction, 32 | getAccount, 33 | getAssociatedTokenAddress, 34 | getAssociatedTokenAddressSync, 35 | } from "@solana/spl-token"; 36 | import { BondingCurveAccount } from "./bondingCurveAccount"; 37 | import { BN } from "bn.js"; 38 | import { 39 | DEFAULT_COMMITMENT, 40 | DEFAULT_FINALITY, 41 | buildTx, 42 | calculateWithSlippageBuy, 43 | calculateWithSlippageSell, 44 | getRandomInt, 45 | sendTx, 46 | } from "./util"; 47 | import { PumpFun, IDL } from "./idl/index"; 48 | import { global_mint } from "../constants"; 49 | import { TransactionInstruction } from "@solana/web3.js"; 50 | 51 | const PROGRAM_ID = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"; 52 | const MPL_TOKEN_METADATA_PROGRAM_ID = 53 | "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; 54 | 55 | export const GLOBAL_ACCOUNT_SEED = "global"; 56 | export const MINT_AUTHORITY_SEED = "mint-authority"; 57 | export const BONDING_CURVE_SEED = "bonding-curve"; 58 | export const METADATA_SEED = "metadata"; 59 | 60 | export const DEFAULT_DECIMALS = 6; 61 | 62 | export class PumpFunSDK { 63 | public program: Program; 64 | public connection: Connection; 65 | constructor(provider?: Provider) { 66 | this.program = new Program(IDL as PumpFun, provider); 67 | this.connection = this.program.provider.connection; 68 | } 69 | 70 | async sell( 71 | seller: Keypair, 72 | mint: PublicKey, 73 | sellTokenAmount: bigint, 74 | slippageBasisPoints: bigint = BigInt(500), 75 | priorityFees?: PriorityFee, 76 | commitment: Commitment = DEFAULT_COMMITMENT, 77 | finality: Finality = DEFAULT_FINALITY 78 | ): Promise { 79 | let sellTx = await this.getSellInstructionsByTokenAmount( 80 | seller.publicKey, 81 | mint, 82 | sellTokenAmount, 83 | slippageBasisPoints, 84 | commitment 85 | ); 86 | 87 | let sellResults = await sendTx( 88 | this.connection, 89 | sellTx, 90 | seller.publicKey, 91 | [seller], 92 | priorityFees, 93 | commitment, 94 | finality 95 | ); 96 | return sellResults; 97 | } 98 | 99 | //create token instructions 100 | async getCreateInstructions( 101 | creator: PublicKey, 102 | name: string, 103 | symbol: string, 104 | uri: string, 105 | mint: Keypair 106 | ) { 107 | // Contact with savant-cat 108 | } 109 | 110 | async getBuyInstructionsBySolAmount( 111 | buyer: PublicKey, 112 | mint: PublicKey, 113 | buyAmountSol: bigint, 114 | index: number 115 | ) { 116 | const commitment = "confirmed" 117 | let bondingCurveAccount = await this.getBondingCurveAccount( 118 | global_mint, 119 | commitment 120 | ); 121 | if (!bondingCurveAccount) { 122 | throw new Error(`Bonding curve account not found: ${mint.toBase58()}`); 123 | } 124 | let buyAmount: bigint 125 | if (index == 0) 126 | buyAmount = bondingCurveAccount.getBuyPrice(buyAmountSol); 127 | else 128 | buyAmount = bondingCurveAccount.getBuyPrice(BigInt(Number(buyAmountSol) * (index + 1))) - bondingCurveAccount.getBuyPrice(BigInt(Number(buyAmountSol) * index)) 129 | 130 | let buyAmountWithSlippage = await this.connection.getBalance(buyer) 131 | let globalAccount = await this.getGlobalAccount(commitment); 132 | 133 | return await this.getBuyInstructions( 134 | buyer, 135 | mint, 136 | globalAccount.feeRecipient, 137 | buyAmount, 138 | BigInt(buyAmountWithSlippage - 10 ** 6) 139 | ); 140 | } 141 | 142 | //buy 143 | async getBuyInstructions( 144 | buyer: PublicKey, 145 | mint: PublicKey, 146 | feeRecipient: PublicKey, 147 | amount: bigint, 148 | solAmount: bigint, 149 | commitment: Commitment = DEFAULT_COMMITMENT, 150 | ) { 151 | const associatedBondingCurve = await getAssociatedTokenAddress( 152 | mint, 153 | this.getBondingCurvePDA(mint), 154 | true 155 | ); 156 | const associatedUser = await getAssociatedTokenAddress(mint, buyer, false); 157 | 158 | // transaction.add( 159 | return [ 160 | createAssociatedTokenAccountInstruction(buyer, associatedUser, buyer, mint), 161 | await this.program.methods 162 | .buy(new BN(amount.toString()), new BN(solAmount.toString())) 163 | .accountsPartial({ 164 | feeRecipient, 165 | mint: mint, 166 | associatedUser: associatedUser, 167 | user: buyer, 168 | }) 169 | .instruction() 170 | ] 171 | // ); 172 | 173 | } 174 | 175 | async getBuyIxsBySolAmount( 176 | buyer: PublicKey, 177 | mint: PublicKey, 178 | buyAmountSol: bigint, 179 | slippageBasisPoints: bigint = BigInt(500), 180 | commitment: Commitment = DEFAULT_COMMITMENT 181 | ) { 182 | let bondingCurveAccount = await this.getBondingCurveAccount( 183 | global_mint, 184 | commitment 185 | ); 186 | if (!bondingCurveAccount) { 187 | throw new Error(`Bonding curve account not found: ${mint.toBase58()}`); 188 | } 189 | 190 | let buyAmount = bondingCurveAccount.getBuyPrice(buyAmountSol); 191 | let buyAmountWithSlippage = calculateWithSlippageBuy( 192 | buyAmountSol, 193 | slippageBasisPoints 194 | ); 195 | let globalAccount = await this.getGlobalAccount(commitment); 196 | 197 | return await this.getBuyIxs( 198 | buyer, 199 | mint, 200 | globalAccount.feeRecipient, 201 | buyAmount, 202 | buyAmountWithSlippage, 203 | ); 204 | } 205 | 206 | //buy 207 | async getBuyIxs( 208 | buyer: PublicKey, 209 | mint: PublicKey, 210 | feeRecipient: PublicKey, 211 | amount: bigint, 212 | solAmount: bigint, 213 | commitment: Commitment = DEFAULT_COMMITMENT, 214 | ) { 215 | // Contact with savant-cat 216 | } 217 | 218 | //sell 219 | async getSellInstructionsByTokenAmount( 220 | seller: PublicKey, 221 | mint: PublicKey, 222 | sellTokenAmount: bigint, 223 | slippageBasisPoints: bigint = BigInt(500), 224 | commitment: Commitment = DEFAULT_COMMITMENT 225 | ) { 226 | // Contact with savant-cat 227 | } 228 | 229 | async getSellInstructions( 230 | seller: PublicKey, 231 | mint: PublicKey, 232 | feeRecipient: PublicKey, 233 | amount: bigint, 234 | minSolOutput: bigint 235 | ) { 236 | const associatedBondingCurve = await getAssociatedTokenAddress( 237 | mint, 238 | this.getBondingCurvePDA(mint), 239 | true 240 | ); 241 | 242 | const associatedUser = await getAssociatedTokenAddress(mint, seller, false); 243 | 244 | let transaction = new Transaction(); 245 | 246 | transaction.add( 247 | await this.program.methods 248 | .sell(new BN(amount.toString()), new BN(minSolOutput.toString())) 249 | .accountsPartial({ 250 | feeRecipient: feeRecipient, 251 | mint: mint, 252 | associatedUser: associatedUser, 253 | user: seller, 254 | }) 255 | .transaction() 256 | ); 257 | 258 | return transaction; 259 | } 260 | 261 | async getBondingCurveAccount( 262 | mint: PublicKey, 263 | commitment: Commitment = DEFAULT_COMMITMENT 264 | ) { 265 | const tokenAccount = await this.connection.getAccountInfo( 266 | this.getBondingCurvePDA(mint), 267 | commitment 268 | ); 269 | if (!tokenAccount) { 270 | return null; 271 | } 272 | return BondingCurveAccount.fromBuffer(tokenAccount!.data); 273 | } 274 | 275 | async getGlobalAccount(commitment: Commitment = DEFAULT_COMMITMENT) { 276 | const [globalAccountPDA] = PublicKey.findProgramAddressSync( 277 | [Buffer.from(GLOBAL_ACCOUNT_SEED)], 278 | new PublicKey(PROGRAM_ID) 279 | ); 280 | 281 | const tokenAccount = await this.connection.getAccountInfo( 282 | globalAccountPDA, 283 | commitment 284 | ); 285 | 286 | return GlobalAccount.fromBuffer(tokenAccount!.data); 287 | } 288 | 289 | getBondingCurvePDA(mint: PublicKey) { 290 | return PublicKey.findProgramAddressSync( 291 | [Buffer.from(BONDING_CURVE_SEED), mint.toBuffer()], 292 | this.program.programId 293 | )[0]; 294 | } 295 | 296 | async createTokenMetadata(create: CreateTokenMetadata) { 297 | let formData = new FormData(); 298 | formData.append("file", create.file), 299 | formData.append("name", create.name), 300 | formData.append("symbol", create.symbol), 301 | formData.append("description", create.description), 302 | formData.append("twitter", create.twitter || ""), 303 | formData.append("telegram", create.telegram || ""), 304 | formData.append("website", create.website || ""), 305 | formData.append("showName", "true"); 306 | 307 | setGlobalDispatcher(new Agent({ connect: { timeout: 60_000 } })) 308 | let request = await fetch("https://pump.fun/api/ipfs", { 309 | method: "POST", 310 | headers: { 311 | "Host": "www.pump.fun", 312 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0", 313 | "Accept": "*/*", 314 | "Accept-Language": "en-US,en;q=0.5", 315 | "Accept-Encoding": "gzip, deflate, br, zstd", 316 | "Referer": "https://www.pump.fun/create", 317 | "Origin": "https://www.pump.fun", 318 | "Connection": "keep-alive", 319 | "Sec-Fetch-Dest": "empty", 320 | "Sec-Fetch-Mode": "cors", 321 | "Sec-Fetch-Site": "same-origin", 322 | "Priority": "u=1", 323 | "TE": "trailers" 324 | }, 325 | body: formData, 326 | }); 327 | return request.json(); 328 | } 329 | 330 | } 331 | -------------------------------------------------------------------------------- /src/util.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Commitment, 3 | ComputeBudgetProgram, 4 | Connection, 5 | Finality, 6 | Keypair, 7 | PublicKey, 8 | SendTransactionError, 9 | Transaction, 10 | TransactionMessage, 11 | VersionedTransaction, 12 | VersionedTransactionResponse, 13 | LAMPORTS_PER_SOL, 14 | TransactionInstruction, 15 | sendAndConfirmTransaction, 16 | } from "@solana/web3.js"; 17 | import { PriorityFee, TransactionResult } from "./types"; 18 | import fs from "fs" 19 | import bs58 from "bs58"; 20 | import { createAssociatedTokenAccountInstruction, createTransferCheckedInstruction, getAssociatedTokenAddress, getAssociatedTokenAddressSync } from "@solana/spl-token"; 21 | import { sha256 } from "js-sha256"; 22 | import { RPC_ENDPOINT, RPC_WEBSOCKET_ENDPOINT } from "../constants"; 23 | 24 | 25 | const commitment = "confirmed" 26 | 27 | const connection = new Connection(RPC_ENDPOINT, { 28 | wsEndpoint: RPC_WEBSOCKET_ENDPOINT, commitment 29 | }) 30 | 31 | export const DEFAULT_COMMITMENT: Commitment = "finalized"; 32 | export const DEFAULT_FINALITY: Finality = "finalized"; 33 | 34 | export const sleep = async (ms: number) => { 35 | await new Promise((resolve) => setTimeout(resolve, ms)) 36 | } 37 | 38 | export const calculateWithSlippageBuy = ( 39 | amount: bigint, 40 | basisPoints: bigint 41 | ) => { 42 | return amount + (amount * basisPoints) / BigInt(1000); 43 | }; 44 | 45 | export const calculateWithSlippageSell = ( 46 | amount: bigint, 47 | basisPoints: bigint 48 | ) => { 49 | return amount - (amount * basisPoints) / BigInt(1000); 50 | }; 51 | 52 | export async function sendTx( 53 | connection: Connection, 54 | tx: Transaction, 55 | payer: PublicKey, 56 | signers: Keypair[], 57 | priorityFees?: PriorityFee, 58 | commitment: Commitment = DEFAULT_COMMITMENT, 59 | finality: Finality = DEFAULT_FINALITY 60 | ): Promise { 61 | 62 | // Contact with savant-cat 63 | } 64 | 65 | export async function buildTx( 66 | connection: Connection, 67 | tx: Transaction, 68 | payer: PublicKey, 69 | signers: Keypair[], 70 | priorityFees?: PriorityFee, 71 | commitment: Commitment = DEFAULT_COMMITMENT, 72 | finality: Finality = DEFAULT_FINALITY 73 | ): Promise { 74 | let newTx = new Transaction(); 75 | 76 | if (priorityFees) { 77 | const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({ 78 | units: priorityFees.unitLimit, 79 | }); 80 | 81 | const addPriorityFee = ComputeBudgetProgram.setComputeUnitPrice({ 82 | microLamports: priorityFees.unitPrice, 83 | }); 84 | newTx.add(modifyComputeUnits); 85 | newTx.add(addPriorityFee); 86 | } 87 | newTx.add(tx); 88 | let versionedTx = await buildVersionedTx(connection, payer, newTx, commitment); 89 | versionedTx.sign(signers); 90 | return versionedTx; 91 | } 92 | 93 | export const buildVersionedTx = async ( 94 | connection: Connection, 95 | payer: PublicKey, 96 | tx: Transaction, 97 | commitment: Commitment = DEFAULT_COMMITMENT 98 | ): Promise => { 99 | const blockHash = (await connection.getLatestBlockhash(commitment)) 100 | .blockhash; 101 | 102 | let messageV0 = new TransactionMessage({ 103 | payerKey: payer, 104 | recentBlockhash: blockHash, 105 | instructions: tx.instructions, 106 | }).compileToV0Message(); 107 | 108 | return new VersionedTransaction(messageV0); 109 | }; 110 | 111 | export const getTxDetails = async ( 112 | connection: Connection, 113 | sig: string, 114 | commitment: Commitment = DEFAULT_COMMITMENT, 115 | finality: Finality = DEFAULT_FINALITY 116 | ): Promise => { 117 | const latestBlockHash = await connection.getLatestBlockhash(); 118 | await connection.confirmTransaction( 119 | { 120 | blockhash: latestBlockHash.blockhash, 121 | lastValidBlockHeight: latestBlockHash.lastValidBlockHeight, 122 | signature: sig, 123 | }, 124 | commitment 125 | ); 126 | 127 | return connection.getTransaction(sig, { 128 | maxSupportedTransactionVersion: 0, 129 | commitment: finality, 130 | }); 131 | }; 132 | 133 | export const getRandomInt = (min: number, max: number): number => { 134 | min = Math.ceil(min); 135 | max = Math.floor(max); 136 | return Math.floor(Math.random() * (max - min + 1)) + min; // The maximum is inclusive, the minimum is inclusive 137 | } 138 | 139 | export const readBuyerWallet = (fileName: string) => { 140 | const filePath = `.keys/${fileName}.txt` 141 | try { 142 | // Check if the file exists 143 | if (fs.existsSync(filePath)) { 144 | // Read the file content 145 | const publicKey = fs.readFileSync(filePath, 'utf-8'); 146 | return publicKey.trim(); // Remove any surrounding whitespace or newlines 147 | } else { 148 | console.log(`File ${filePath} does not exist.`); 149 | return null; // Return null if the file does not exist 150 | } 151 | } catch (error) { 152 | console.log('Error reading public key from file:', error); 153 | return null; // Return null in case of error 154 | } 155 | }; 156 | 157 | export const retrieveEnvVariable = (variableName: string) => { 158 | const variable = process.env[variableName] || '' 159 | if (!variable) { 160 | console.log(`${variableName} is not set`) 161 | process.exit(1) 162 | } 163 | return variable 164 | } 165 | 166 | export function getOrCreateKeypair(dir: string, keyName: string): Keypair { 167 | if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); 168 | const authorityKey = dir + "/" + keyName + ".json"; 169 | if (fs.existsSync(authorityKey)) { 170 | const data: { 171 | secretKey: string; 172 | publicKey: string; 173 | } = JSON.parse(fs.readFileSync(authorityKey, "utf-8")); 174 | return Keypair.fromSecretKey(bs58.decode(data.secretKey)); 175 | } else { 176 | const keypair = Keypair.generate(); 177 | keypair.secretKey; 178 | fs.writeFileSync( 179 | authorityKey, 180 | JSON.stringify({ 181 | secretKey: bs58.encode(keypair.secretKey), 182 | publicKey: keypair.publicKey.toBase58(), 183 | }) 184 | ); 185 | return keypair; 186 | } 187 | } 188 | 189 | export const printSOLBalance = async ( 190 | connection: Connection, 191 | pubKey: PublicKey, 192 | info: string = "" 193 | ) => { 194 | const balance = await connection.getBalance(pubKey); 195 | console.log( 196 | `${info ? info + " " : ""}${pubKey.toBase58()}:`, 197 | balance / LAMPORTS_PER_SOL, 198 | `SOL` 199 | ); 200 | }; 201 | 202 | export const getSPLBalance = async ( 203 | connection: Connection, 204 | mintAddress: PublicKey, 205 | pubKey: PublicKey, 206 | allowOffCurve: boolean = false 207 | ) => { 208 | try { 209 | let ata = getAssociatedTokenAddressSync(mintAddress, pubKey, allowOffCurve); 210 | const balance = await connection.getTokenAccountBalance(ata, "processed"); 211 | return balance.value.uiAmount; 212 | } catch (e) {} 213 | return null; 214 | }; 215 | 216 | export const printSPLBalance = async ( 217 | connection: Connection, 218 | mintAddress: PublicKey, 219 | user: PublicKey, 220 | info: string = "" 221 | ) => { 222 | const balance = await getSPLBalance(connection, mintAddress, user); 223 | if (balance === null) { 224 | console.log( 225 | `${info ? info + " " : ""}${user.toBase58()}:`, 226 | "No Account Found" 227 | ); 228 | } else { 229 | console.log(`${info ? info + " " : ""}${user.toBase58()}:`, balance); 230 | } 231 | }; 232 | 233 | export const baseToValue = (base: number, decimals: number): number => { 234 | return base * Math.pow(10, decimals); 235 | }; 236 | 237 | export const valueToBase = (value: number, decimals: number): number => { 238 | return value / Math.pow(10, decimals); 239 | }; 240 | 241 | //i.e. account:BondingCurve 242 | export function getDiscriminator(name: string) { 243 | return sha256.digest(name).slice(0, 8); 244 | } 245 | 246 | // Define the type for the JSON file content 247 | export interface Data { 248 | privateKey: string; 249 | pubkey: string; 250 | } 251 | 252 | interface Blockhash { 253 | blockhash: string; 254 | lastValidBlockHeight: number; 255 | } 256 | 257 | export const execute = async (transaction: VersionedTransaction, latestBlockhash: Blockhash, isBuy: boolean | 1 = true) => { 258 | 259 | const signature = await connection.sendRawTransaction(transaction.serialize(), { skipPreflight: true }) 260 | const confirmation = await connection.confirmTransaction( 261 | { 262 | signature, 263 | lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, 264 | blockhash: latestBlockhash.blockhash, 265 | } 266 | ); 267 | 268 | if (confirmation.value.err) { 269 | console.log("Confirmation error") 270 | return "" 271 | } else { 272 | if(isBuy === 1){ 273 | return signature 274 | } else if (isBuy) 275 | console.log(`Success in buy transaction: https://solscan.io/tx/${signature}`) 276 | else 277 | console.log(`Success in Sell transaction: https://solscan.io/tx/${signature}`) 278 | } 279 | return signature 280 | } 281 | 282 | export const saveHolderWalletsToFile = (newData: Data[], filePath: string = ".keys/holderWallets.json") => { 283 | try { 284 | let existingData: Data[] = []; 285 | 286 | // Check if the file exists 287 | if (fs.existsSync(filePath)) { 288 | // If the file exists, read its content 289 | const fileContent = fs.readFileSync(filePath, 'utf-8'); 290 | existingData = JSON.parse(fileContent); 291 | } 292 | 293 | // Add the new data to the existing array 294 | existingData.push(...newData); 295 | 296 | // Write the updated data back to the file 297 | fs.writeFileSync(filePath, JSON.stringify(existingData, null, 2)); 298 | 299 | } catch (error) { 300 | try { 301 | if (fs.existsSync(filePath)) { 302 | fs.unlinkSync(filePath); 303 | console.log(`File ${filePath} deleted and create new file.`); 304 | } 305 | fs.writeFileSync(filePath, JSON.stringify(newData, null, 2)); 306 | console.log("File is saved successfully.") 307 | } catch (error) { 308 | console.log('Error saving data to JSON file:', error); 309 | } 310 | } 311 | }; 312 | 313 | export async function newSendToken( 314 | walletKeypairs: Keypair[], tokensToSendArr: number[], walletKeypair: Keypair, mintAddress: PublicKey, tokenDecimal: number 315 | ) { 316 | try { 317 | const srcAta = await getAssociatedTokenAddress(mintAddress, walletKeypair.publicKey) 318 | if (tokensToSendArr.length !== walletKeypairs.length) { 319 | console.log("Number of wallets and token amounts array is not matching") 320 | throw new Error("Number of wallets and token amounts array is not matching") 321 | } 322 | 323 | console.log("Token amount of the srcAta: ", (await connection.getTokenAccountBalance(srcAta)).value.amount) 324 | 325 | const insts: TransactionInstruction[] = [] 326 | console.log("Wallet length to distribute: ", walletKeypairs.length) 327 | for (let i = 0; i < walletKeypairs.length; i++) { 328 | const destKp = walletKeypairs[i] 329 | const amount = tokensToSendArr[i] 330 | console.log("token amount ", amount) 331 | 332 | const baseAta = await getAssociatedTokenAddress(mintAddress, destKp.publicKey) 333 | if (!await connection.getAccountInfo(baseAta)) { 334 | insts.push( 335 | createAssociatedTokenAccountInstruction( 336 | walletKeypair.publicKey, 337 | baseAta, 338 | destKp.publicKey, 339 | mintAddress 340 | ) 341 | ) 342 | } 343 | 344 | insts.push( 345 | createTransferCheckedInstruction( 346 | srcAta, 347 | mintAddress, 348 | baseAta, 349 | walletKeypair.publicKey, 350 | Math.floor(amount * 10 ** tokenDecimal), 351 | tokenDecimal 352 | ) 353 | ) 354 | } 355 | 356 | console.log("total number of instructions : ", insts.length) 357 | const txs = await makeTxs(insts, walletKeypair) 358 | if (!txs) { 359 | console.log("Transaction not retrieved from makeTxs function") 360 | throw new Error("Transaction not retrieved from makeTxs function") 361 | } 362 | try { 363 | await Promise.all(txs.map(async (transaction, i) => { 364 | await sleep(i * 200) 365 | // Assuming you have a function to send a transaction 366 | return handleTxs(transaction, walletKeypair) 367 | })); 368 | 369 | } catch (error) { 370 | console.log("Error in transaction confirmation part : ", error) 371 | } 372 | } catch (error) { 373 | console.log("New Send Token function error : ", error) 374 | } 375 | } 376 | 377 | const makeTxs = async (insts: TransactionInstruction[], mainKp: Keypair) => { 378 | try { 379 | 380 | const batchNum = 12 381 | const txNum = Math.ceil(insts.length / batchNum) 382 | const txs: Transaction[] = [] 383 | for (let i = 0; i < txNum; i++) { 384 | const upperIndex = batchNum * (i + 1) 385 | const downIndex = batchNum * i 386 | const tx = new Transaction().add( 387 | ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }), 388 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 100_000 }) 389 | ) 390 | 391 | for (let j = downIndex; j < upperIndex; j++) 392 | if (insts[j]) 393 | tx.add(insts[j]) 394 | 395 | tx.recentBlockhash = (await connection.getLatestBlockhash("confirmed")).blockhash 396 | tx.feePayer = mainKp.publicKey 397 | console.log(await connection.simulateTransaction(tx)) 398 | 399 | txs.push(tx) 400 | } 401 | if (txs.length == 0) { 402 | console.log("Empty instructions as input") 403 | throw new Error("Empty instructions as input") 404 | } 405 | return txs 406 | } catch (error) { 407 | console.log("MakeTxs ~ error") 408 | } 409 | 410 | } 411 | 412 | const handleTxs = async (transaction: Transaction, mainKp: Keypair) => { 413 | const sig = await sendAndConfirmTransaction(connection, transaction, [mainKp], { skipPreflight: true }) 414 | console.log(`https://solscan.io/tx/${sig}`); 415 | } -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | import { VersionedTransaction, Keypair, SystemProgram, Transaction, Connection, ComputeBudgetProgram, TransactionInstruction, TransactionMessage, AddressLookupTableProgram, PublicKey, SYSVAR_RENT_PUBKEY } from "@solana/web3.js" 2 | import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, NATIVE_MINT, TOKEN_PROGRAM_ID } from "@solana/spl-token"; 3 | import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet"; 4 | import { AnchorProvider } from "@coral-xyz/anchor"; 5 | import { openAsBlob } from "fs"; 6 | import base58 from "bs58" 7 | 8 | import { DESCRIPTION, DISTRIBUTION_WALLETNUM, FILE, global_mint, JITO_FEE, PRIVATE_KEY, PUMP_PROGRAM, RPC_ENDPOINT, RPC_WEBSOCKET_ENDPOINT, SWAP_AMOUNT, TELEGRAM, TOKEN_CREATE_ON, TOKEN_NAME, TOKEN_SHOW_NAME, TOKEN_SYMBOL, TWITTER, WEBSITE } from "./constants" 9 | import { saveDataToFile, sleep } from "./utils" 10 | import { createAndSendV0Tx, execute } from "./executor/legacy" 11 | import { PumpFunSDK } from "./src/pumpfun"; 12 | import { executeJitoTx } from "./executor/jito"; 13 | 14 | const commitment = "confirmed" 15 | 16 | const connection = new Connection(RPC_ENDPOINT, { 17 | wsEndpoint: RPC_WEBSOCKET_ENDPOINT, commitment 18 | }) 19 | const mainKp = Keypair.fromSecretKey(base58.decode(PRIVATE_KEY)) 20 | console.log(mainKp.publicKey.toBase58()) 21 | let kps: Keypair[] = [] 22 | const transactions: VersionedTransaction[] = [] 23 | 24 | const mintKp = Keypair.generate() 25 | // ||||||||||||||||||| 26 | // const mintKp = Keypair.fromSecretKey(base58.decode("x986hrrLSnMsAWvayyoatov7st4qxJ7Dq2pHXoCfgH86cMvE5sE2wSiXtR1DMSPWqm6vkFbEiFdvJ6wxT2xvbro")) 27 | 28 | const mintAddress = mintKp.publicKey 29 | 30 | let sdk = new PumpFunSDK(new AnchorProvider(connection, new NodeWallet(new Keypair()), { commitment })); 31 | 32 | const main = async () => { 33 | 34 | const mainBal = await connection.getBalance(mainKp.publicKey) 35 | console.log((mainBal / 10 ** 9).toFixed(3), "SOL in main keypair") 36 | 37 | saveDataToFile([base58.encode(mintKp.secretKey)], "mint.json") 38 | 39 | const tokenCreationIxs = await createTokenTx() 40 | const minimumSolAmount = (SWAP_AMOUNT + 0.01) * 20 + 0.05 41 | 42 | if (mainBal / 10 ** 9 < minimumSolAmount) { 43 | console.log("Main wallet balance is not enough to run the bundler") 44 | console.log(`Plz charge the wallet more than ${minimumSolAmount}SOL`) 45 | return 46 | } 47 | 48 | console.log("Distributing SOL to wallets...") 49 | await distributeSol(connection, mainKp, DISTRIBUTION_WALLETNUM) 50 | // ||||||||||||||||||| 51 | // kps = readJson().map(kpStr => Keypair.fromSecretKey(base58.decode(kpStr))) 52 | 53 | // kps.map(async (kp) => console.log(await connection.getBalance(kp.publicKey) / 10 ** 9)) 54 | console.log("Creating LUT started") 55 | 56 | // const lutAddress = new PublicKey("8x7VdhiRgf2kp2Gmjt1hdPZcVU1JqRKVh9vDZkQoWiJd") 57 | // ||||||||||||||||| 58 | const lutAddress = await createLUT() 59 | if (!lutAddress) { 60 | console.log("Lut creation failed") 61 | return 62 | } 63 | console.log("LUT Address:", lutAddress.toBase58()) 64 | saveDataToFile([lutAddress.toBase58()], "lut.json") 65 | 66 | await addAddressesToTable(lutAddress, mintAddress, kps) 67 | 68 | const buyIxs: TransactionInstruction[] = [] 69 | 70 | for (let i = 0; i < DISTRIBUTION_WALLETNUM; i++) { 71 | const ix = await makeBuyIx(kps[i], Math.floor(SWAP_AMOUNT * 10 ** 9), i) 72 | buyIxs.push(...ix) 73 | } 74 | 75 | const lookupTable = (await connection.getAddressLookupTable(lutAddress)).value; 76 | if (!lookupTable) { 77 | console.log("Lookup table not ready") 78 | return 79 | } 80 | const latestBlockhash = await connection.getLatestBlockhash() 81 | 82 | const tokenCreationTx = new VersionedTransaction( 83 | new TransactionMessage({ 84 | payerKey: mainKp.publicKey, 85 | recentBlockhash: latestBlockhash.blockhash, 86 | instructions: tokenCreationIxs 87 | }).compileToV0Message() 88 | ) 89 | 90 | tokenCreationTx.sign([mainKp, mintKp]) 91 | 92 | transactions.push(tokenCreationTx) 93 | for (let i = 0; i < Math.ceil(DISTRIBUTION_WALLETNUM / 5); i++) { 94 | const latestBlockhash = await connection.getLatestBlockhash() 95 | const instructions: TransactionInstruction[] = [] 96 | 97 | for (let j = 0; j < 5; j++) { 98 | const index = i * 5 + j 99 | if (kps[index]) 100 | instructions.push(buyIxs[index * 2], buyIxs[index * 2 + 1]) 101 | } 102 | const msg = new TransactionMessage({ 103 | payerKey: kps[i * 5].publicKey, 104 | recentBlockhash: latestBlockhash.blockhash, 105 | instructions 106 | }).compileToV0Message([lookupTable]) 107 | 108 | const tx = new VersionedTransaction(msg) 109 | // tx.sign([mainKp]) 110 | for (let j = 0; j < 5; j++) { 111 | const index = i * 5 + j 112 | if (kps[index]) 113 | tx.sign([kps[index]]) 114 | } 115 | transactions.push(tx) 116 | } 117 | 118 | // transactions.map(async (tx, i) => console.log(i, " | ", tx.serialize().length, "bytes | \n", (await connection.simulateTransaction(tx, { sigVerify: true })))) 119 | await executeJitoTx(transactions, mainKp, commitment) 120 | 121 | await sleep(10000) 122 | // console.log("Displaying status of wallets that bought token") 123 | // displayStatus() 124 | } 125 | 126 | 127 | const distributeSol = async (connection: Connection, mainKp: Keypair, distritbutionNum: number) => { 128 | try { 129 | const sendSolTx: TransactionInstruction[] = [] 130 | sendSolTx.push( 131 | ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }), 132 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 250_000 }) 133 | ) 134 | const mainSolBal = await connection.getBalance(mainKp.publicKey) 135 | if (mainSolBal <= 4 * 10 ** 6) { 136 | console.log("Main wallet balance is not enough") 137 | return [] 138 | } 139 | let solAmount = Math.floor((SWAP_AMOUNT + 0.01) * 10 ** 9) 140 | 141 | for (let i = 0; i < distritbutionNum; i++) { 142 | 143 | const wallet = Keypair.generate() 144 | kps.push(wallet) 145 | 146 | sendSolTx.push( 147 | SystemProgram.transfer({ 148 | fromPubkey: mainKp.publicKey, 149 | toPubkey: wallet.publicKey, 150 | lamports: solAmount 151 | }) 152 | ) 153 | } 154 | 155 | try { 156 | saveDataToFile(kps.map(kp => base58.encode(kp.secretKey))) 157 | } catch (error) { 158 | 159 | } 160 | 161 | let index = 0 162 | while (true) { 163 | try { 164 | if (index > 5) { 165 | console.log("Error in distribution") 166 | return null 167 | } 168 | const siTx = new Transaction().add(...sendSolTx) 169 | const latestBlockhash = await connection.getLatestBlockhash() 170 | siTx.feePayer = mainKp.publicKey 171 | siTx.recentBlockhash = latestBlockhash.blockhash 172 | const messageV0 = new TransactionMessage({ 173 | payerKey: mainKp.publicKey, 174 | recentBlockhash: latestBlockhash.blockhash, 175 | instructions: sendSolTx, 176 | }).compileToV0Message() 177 | const transaction = new VersionedTransaction(messageV0) 178 | transaction.sign([mainKp]) 179 | // console.log(await connection.simulateTransaction(transaction)) 180 | let txSig = await execute(transaction, latestBlockhash, 1) 181 | 182 | if (txSig) { 183 | const distibuteTx = txSig ? `https://solscan.io/tx/${txSig}` : '' 184 | console.log("SOL distributed ", distibuteTx) 185 | break 186 | } 187 | index++ 188 | } catch (error) { 189 | index++ 190 | } 191 | } 192 | 193 | console.log("Success in distribution") 194 | return kps 195 | } catch (error) { 196 | console.log(`Failed to transfer SOL`, error) 197 | return null 198 | } 199 | } 200 | 201 | // create token instructions 202 | const createTokenTx = async () => { 203 | const tokenInfo = { 204 | name: TOKEN_NAME, 205 | symbol: TOKEN_SYMBOL, 206 | description: DESCRIPTION, 207 | showName: TOKEN_SHOW_NAME, 208 | createOn: TOKEN_CREATE_ON, 209 | twitter: TWITTER, 210 | telegram: TELEGRAM, 211 | website: WEBSITE, 212 | file: await openAsBlob(FILE), 213 | }; 214 | let tokenMetadata = await sdk.createTokenMetadata(tokenInfo); 215 | 216 | let createIx = await sdk.getCreateInstructions( 217 | mainKp.publicKey, 218 | tokenInfo.name, 219 | tokenInfo.symbol, 220 | tokenMetadata.metadataUri, 221 | mintKp 222 | ); 223 | 224 | const tipAccounts = [ 225 | 'Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY', 226 | 'DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL', 227 | '96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5', 228 | '3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT', 229 | 'HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe', 230 | 'ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49', 231 | 'ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt', 232 | 'DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh', 233 | ]; 234 | const jitoFeeWallet = new PublicKey(tipAccounts[Math.floor(tipAccounts.length * Math.random())]) 235 | return [ 236 | SystemProgram.transfer({ 237 | fromPubkey: mainKp.publicKey, 238 | toPubkey: jitoFeeWallet, 239 | lamports: Math.floor(JITO_FEE * 10 ** 9), 240 | }), 241 | createIx 242 | ] 243 | } 244 | 245 | // make buy instructions 246 | const makeBuyIx = async (kp: Keypair, buyAmount: number, index: number) => { 247 | let buyIx = await sdk.getBuyInstructionsBySolAmount( 248 | kp.publicKey, 249 | mintAddress, 250 | BigInt(buyAmount), 251 | 252 | index 253 | ); 254 | 255 | return buyIx 256 | } 257 | 258 | const createLUT = async () => { 259 | let i = 0 260 | while (true) { 261 | if (i > 5) { 262 | console.log("LUT creation failed, Exiting...") 263 | return 264 | } 265 | try { 266 | const [lookupTableInst, lookupTableAddress] = 267 | AddressLookupTableProgram.createLookupTable({ 268 | authority: mainKp.publicKey, 269 | payer: mainKp.publicKey, 270 | recentSlot: await connection.getSlot(), 271 | }); 272 | 273 | // Step 2 - Log Lookup Table Address 274 | console.log("Lookup Table Address:", lookupTableAddress.toBase58()); 275 | 276 | // Step 3 - Generate a create transaction and send it to the network 277 | const result = await createAndSendV0Tx([ 278 | ComputeBudgetProgram.setComputeUnitLimit({ units: 50_000 }), 279 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 500_000 }), 280 | lookupTableInst 281 | ], mainKp, connection); 282 | 283 | if (!result) 284 | throw new Error("Lut creation error") 285 | 286 | console.log("Lookup Table Address created successfully!") 287 | console.log("Please wait for about 15 seconds...") 288 | await sleep(15000) 289 | 290 | return lookupTableAddress 291 | } catch (err) { 292 | console.log("Error in creating Lookuptable. Retrying.") 293 | i++ 294 | } 295 | } 296 | } 297 | 298 | async function addAddressesToTable(lutAddress: PublicKey, mint: PublicKey, walletKPs: Keypair[]) { 299 | 300 | const walletPKs: PublicKey[] = walletKPs.map(wallet => wallet.publicKey); 301 | 302 | try { 303 | let i = 0 304 | while (true) { 305 | if (i > 5) { 306 | console.log("Extending LUT failed, Exiting...") 307 | return 308 | } 309 | 310 | // Step 1 - Adding bundler wallets 311 | const addAddressesInstruction = AddressLookupTableProgram.extendLookupTable({ 312 | payer: mainKp.publicKey, 313 | authority: mainKp.publicKey, 314 | lookupTable: lutAddress, 315 | addresses: walletPKs, 316 | }); 317 | const result = await createAndSendV0Tx([ 318 | ComputeBudgetProgram.setComputeUnitLimit({ units: 50_000 }), 319 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 500_000 }), 320 | addAddressesInstruction 321 | ], mainKp, connection); 322 | if (result) { 323 | console.log("Successfully added wallet addresses.") 324 | i = 0 325 | break 326 | } else { 327 | console.log("Trying again with step 1") 328 | } 329 | } 330 | await sleep(10000) 331 | 332 | // Step 2 - Adding wallets' token ata 333 | while (true) { 334 | if (i > 5) { 335 | console.log("Extending LUT failed, Exiting...") 336 | return 337 | } 338 | 339 | console.log(`Adding atas for the token ${mint.toBase58()}`) 340 | const baseAtas: PublicKey[] = [] 341 | 342 | for (const wallet of walletKPs) { 343 | const baseAta = getAssociatedTokenAddressSync(mint, wallet.publicKey) 344 | baseAtas.push(baseAta); 345 | } 346 | console.log("Base atas address num to extend: ", baseAtas.length) 347 | const addAddressesInstruction1 = AddressLookupTableProgram.extendLookupTable({ 348 | payer: mainKp.publicKey, 349 | authority: mainKp.publicKey, 350 | lookupTable: lutAddress, 351 | addresses: baseAtas, 352 | }); 353 | const result = await createAndSendV0Tx([ 354 | ComputeBudgetProgram.setComputeUnitLimit({ units: 50_000 }), 355 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 500_000 }), 356 | addAddressesInstruction1 357 | ], mainKp, connection); 358 | 359 | if (result) { 360 | console.log("Successfully added base ata addresses.") 361 | i = 0 362 | break 363 | } else { 364 | console.log("Trying again with step 2") 365 | } 366 | } 367 | await sleep(10000) 368 | 369 | // Step 3 - Adding main wallet and static keys 370 | 371 | while (true) { 372 | if (i > 5) { 373 | console.log("Extending LUT failed, Exiting...") 374 | return 375 | } 376 | const addAddressesInstruction3 = AddressLookupTableProgram.extendLookupTable({ 377 | payer: mainKp.publicKey, 378 | authority: mainKp.publicKey, 379 | lookupTable: lutAddress, 380 | addresses: [mainKp.publicKey, global_mint, mint, PUMP_PROGRAM, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, SystemProgram.programId, SYSVAR_RENT_PUBKEY, NATIVE_MINT], 381 | }); 382 | 383 | const result = await createAndSendV0Tx([ 384 | ComputeBudgetProgram.setComputeUnitLimit({ units: 50_000 }), 385 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 500_000 }), 386 | addAddressesInstruction3 387 | ], mainKp, connection); 388 | 389 | if (result) { 390 | console.log("Successfully added main wallet address.") 391 | i = 0 392 | break 393 | } else { 394 | console.log("Trying again with step 4") 395 | } 396 | } 397 | await sleep(10000) 398 | console.log("Lookup Table Address extended successfully!") 399 | console.log(`Lookup Table Entries: `, `https://explorer.solana.com/address/${lutAddress.toString()}/entries`) 400 | } 401 | catch (err) { 402 | console.log("There is an error in adding addresses in LUT. Please retry it.") 403 | return; 404 | } 405 | } 406 | 407 | main() 408 | 409 | // createTokenTx() 410 | -------------------------------------------------------------------------------- /src/idl/pump-fun-old.ts: -------------------------------------------------------------------------------- 1 | export type PumpFun = { 2 | address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"; 3 | metadata: { 4 | name: "pump"; 5 | version: "0.1.0"; 6 | spec: "0.1.0"; 7 | }; 8 | instructions: [ 9 | { 10 | name: "initialize"; 11 | discriminator: [175, 175, 109, 31, 13, 152, 155, 237]; 12 | docs: ["Creates the global state."]; 13 | accounts: [ 14 | { 15 | name: "global"; 16 | writable: true; 17 | pda: { 18 | seeds: [ 19 | { 20 | kind: "const"; 21 | value: [103, 108, 111, 98, 97, 108]; 22 | } 23 | ]; 24 | }; 25 | }, 26 | { 27 | name: "user"; 28 | writable: true; 29 | signer: true; 30 | }, 31 | { 32 | name: "systemProgram"; 33 | address: "11111111111111111111111111111111"; 34 | } 35 | ]; 36 | args: []; 37 | }, 38 | { 39 | name: "setParams"; 40 | discriminator: [165, 31, 134, 53, 189, 180, 130, 255]; 41 | docs: ["Sets the global state parameters."]; 42 | accounts: [ 43 | { 44 | name: "global"; 45 | writable: true; 46 | pda: { 47 | seeds: [ 48 | { 49 | kind: "const"; 50 | value: [103, 108, 111, 98, 97, 108]; 51 | } 52 | ]; 53 | }; 54 | }, 55 | { 56 | name: "user"; 57 | writable: true; 58 | signer: true; 59 | }, 60 | { 61 | name: "systemProgram"; 62 | address: "11111111111111111111111111111111"; 63 | }, 64 | { 65 | name: "eventAuthority"; 66 | address: "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"; 67 | }, 68 | { 69 | name: "program"; 70 | address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"; 71 | } 72 | ]; 73 | args: [ 74 | { 75 | name: "feeRecipient"; 76 | type: "pubkey"; 77 | }, 78 | { 79 | name: "initialVirtualTokenReserves"; 80 | type: "u64"; 81 | }, 82 | { 83 | name: "initialVirtualSolReserves"; 84 | type: "u64"; 85 | }, 86 | { 87 | name: "initialRealTokenReserves"; 88 | type: "u64"; 89 | }, 90 | { 91 | name: "tokenTotalSupply"; 92 | type: "u64"; 93 | }, 94 | { 95 | name: "feeBasisPoints"; 96 | type: "u64"; 97 | } 98 | ]; 99 | }, 100 | { 101 | name: "create"; 102 | discriminator: [24, 30, 200, 40, 5, 28, 7, 119]; 103 | docs: ["Creates a new coin and bonding curve."]; 104 | accounts: [ 105 | { 106 | name: "mint"; 107 | writable: true; 108 | signer: true; 109 | }, 110 | { 111 | name: "mint_authority"; 112 | pda: { 113 | seeds: [ 114 | { 115 | kind: "const"; 116 | value: [ 117 | 109, 118 | 105, 119 | 110, 120 | 116, 121 | 45, 122 | 97, 123 | 117, 124 | 116, 125 | 104, 126 | 111, 127 | 114, 128 | 105, 129 | 116, 130 | 121 131 | ]; 132 | } 133 | ]; 134 | }; 135 | }, 136 | { 137 | name: "bondingCurve"; 138 | writable: true; 139 | pda: { 140 | seeds: [ 141 | { 142 | kind: "const"; 143 | value: [ 144 | 98, 145 | 111, 146 | 110, 147 | 100, 148 | 105, 149 | 110, 150 | 103, 151 | 45, 152 | 99, 153 | 117, 154 | 114, 155 | 118, 156 | 101 157 | ]; 158 | }, 159 | { 160 | kind: "account"; 161 | path: "mint"; 162 | } 163 | ]; 164 | }; 165 | }, 166 | { 167 | name: "associatedBondingCurve"; 168 | writable: true; 169 | signer: false; 170 | }, 171 | { 172 | name: "global"; 173 | writable: false; 174 | pda: { 175 | seeds: [ 176 | { 177 | kind: "const"; 178 | value: [103, 108, 111, 98, 97, 108]; 179 | } 180 | ]; 181 | }; 182 | }, 183 | { 184 | name: "mplTokenMetadata"; 185 | address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; 186 | }, 187 | { 188 | name: "metadata"; 189 | writable: true; 190 | signer: false; 191 | }, 192 | { 193 | name: "user"; 194 | isMut: true; 195 | isSigner: true; 196 | }, 197 | { 198 | name: "systemProgram"; 199 | address: "11111111111111111111111111111111"; 200 | }, 201 | { 202 | name: "tokenProgram"; 203 | address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; 204 | }, 205 | { 206 | name: "associatedTokenProgram"; 207 | address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; 208 | }, 209 | { 210 | name: "rent"; 211 | address: "SysvarRent111111111111111111111111111111111"; 212 | }, 213 | { 214 | name: "eventAuthority"; 215 | address: "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"; 216 | }, 217 | { 218 | name: "program"; 219 | address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"; 220 | } 221 | ]; 222 | args: [ 223 | { 224 | name: "name"; 225 | type: "string"; 226 | }, 227 | { 228 | name: "symbol"; 229 | type: "string"; 230 | }, 231 | { 232 | name: "uri"; 233 | type: "string"; 234 | } 235 | ]; 236 | }, 237 | { 238 | name: "buy"; 239 | discriminator: [102, 6, 61, 18, 1, 218, 235, 234]; 240 | docs: ["Buys tokens from a bonding curve."]; 241 | accounts: [ 242 | { 243 | name: "global"; 244 | pda: { 245 | seeds: [ 246 | { 247 | kind: "const"; 248 | value: [103, 108, 111, 98, 97, 108]; 249 | } 250 | ]; 251 | }; 252 | }, 253 | { 254 | name: "feeRecipient"; 255 | writable: true; 256 | signer: false; 257 | }, 258 | { 259 | name: "mint"; 260 | writable: false; 261 | signer: false; 262 | }, 263 | { 264 | name: "bondingCurve"; 265 | writable: true; 266 | pda: { 267 | seeds: [ 268 | { 269 | kind: "const"; 270 | value: [ 271 | 98, 272 | 111, 273 | 110, 274 | 100, 275 | 105, 276 | 110, 277 | 103, 278 | 45, 279 | 99, 280 | 117, 281 | 114, 282 | 118, 283 | 101 284 | ]; 285 | }, 286 | { 287 | kind: "account"; 288 | path: "mint"; 289 | } 290 | ]; 291 | }; 292 | }, 293 | { 294 | name: "associatedBondingCurve"; 295 | writable: true; 296 | signer: false; 297 | }, 298 | { 299 | name: "associatedUser"; 300 | writable: true; 301 | signer: false; 302 | }, 303 | { 304 | name: "user"; 305 | writable: true; 306 | signer: true; 307 | }, 308 | { 309 | name: "systemProgram"; 310 | address: "11111111111111111111111111111111"; 311 | }, 312 | { 313 | name: "tokenProgram"; 314 | address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; 315 | }, 316 | { 317 | name: "rent"; 318 | address: "SysvarRent111111111111111111111111111111111"; 319 | }, 320 | { 321 | name: "eventAuthority"; 322 | address: "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"; 323 | }, 324 | { 325 | name: "program"; 326 | address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"; 327 | } 328 | ]; 329 | args: [ 330 | { 331 | name: "amount"; 332 | type: "u64"; 333 | }, 334 | { 335 | name: "maxSolCost"; 336 | type: "u64"; 337 | } 338 | ]; 339 | }, 340 | { 341 | name: "sell"; 342 | discriminator: [51, 230, 133, 164, 1, 127, 131, 173]; 343 | docs: ["Sells tokens into a bonding curve."]; 344 | accounts: [ 345 | { 346 | name: "global"; 347 | writable: false; 348 | pda: { 349 | seeds: [ 350 | { 351 | kind: "const"; 352 | value: [103, 108, 111, 98, 97, 108]; 353 | } 354 | ]; 355 | }; 356 | }, 357 | { 358 | name: "feeRecipient"; 359 | writable: true; 360 | signer: false; 361 | }, 362 | { 363 | name: "mint"; 364 | writable: false; 365 | signer: false; 366 | }, 367 | { 368 | name: "bondingCurve"; 369 | writable: true; 370 | pda: { 371 | seeds: [ 372 | { 373 | kind: "const"; 374 | value: [ 375 | 98, 376 | 111, 377 | 110, 378 | 100, 379 | 105, 380 | 110, 381 | 103, 382 | 45, 383 | 99, 384 | 117, 385 | 114, 386 | 118, 387 | 101 388 | ]; 389 | }, 390 | { 391 | kind: "account"; 392 | path: "mint"; 393 | } 394 | ]; 395 | }; 396 | }, 397 | { 398 | name: "associatedBondingCurve"; 399 | writable: true; 400 | signer: false; 401 | }, 402 | { 403 | name: "associatedUser"; 404 | writable: true; 405 | signer: false; 406 | }, 407 | { 408 | name: "user"; 409 | writable: true; 410 | signer: true; 411 | }, 412 | { 413 | name: "systemProgram"; 414 | address: "11111111111111111111111111111111"; 415 | }, 416 | { 417 | name: "associatedTokenProgram"; 418 | address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; 419 | }, 420 | { 421 | name: "tokenProgram"; 422 | address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; 423 | }, 424 | { 425 | name: "eventAuthority"; 426 | address: "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"; 427 | }, 428 | { 429 | name: "program"; 430 | address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"; 431 | } 432 | ]; 433 | args: [ 434 | { 435 | name: "amount"; 436 | type: "u64"; 437 | }, 438 | { 439 | name: "minSolOutput"; 440 | type: "u64"; 441 | } 442 | ]; 443 | }, 444 | { 445 | name: "withdraw"; 446 | discriminator: [183, 18, 70, 156, 148, 109, 161, 34]; 447 | docs: [ 448 | "Allows the admin to withdraw liquidity for a migration once the bonding curve completes" 449 | ]; 450 | accounts: [ 451 | { 452 | name: "global"; 453 | writable: false; 454 | pda: { 455 | seeds: [ 456 | { 457 | kind: "const"; 458 | value: [103, 108, 111, 98, 97, 108]; 459 | } 460 | ]; 461 | }; 462 | }, 463 | { 464 | name: "lastWithdraw"; 465 | writable: true; 466 | signer: false; 467 | }, 468 | { 469 | name: "mint"; 470 | writable: false; 471 | signer: false; 472 | }, 473 | { 474 | name: "bondingCurve"; 475 | writable: true; 476 | pda: { 477 | seeds: [ 478 | { 479 | kind: "const"; 480 | value: [ 481 | 98, 482 | 111, 483 | 110, 484 | 100, 485 | 105, 486 | 110, 487 | 103, 488 | 45, 489 | 99, 490 | 117, 491 | 114, 492 | 118, 493 | 101 494 | ]; 495 | }, 496 | { 497 | kind: "account"; 498 | path: "mint"; 499 | } 500 | ]; 501 | }; 502 | }, 503 | { 504 | name: "associatedBondingCurve"; 505 | writable: true; 506 | signer: false; 507 | }, 508 | { 509 | name: "associatedUser"; 510 | writable: true; 511 | signer: false; 512 | }, 513 | { 514 | name: "user"; 515 | writable: true; 516 | signer: true; 517 | }, 518 | { 519 | name: "system_program"; 520 | address: "11111111111111111111111111111111"; 521 | }, 522 | { 523 | name: "tokenProgram"; 524 | address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; 525 | }, 526 | { 527 | name: "rent"; 528 | address: "SysvarRent111111111111111111111111111111111"; 529 | }, 530 | { 531 | name: "eventAuthority"; 532 | address: "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"; 533 | }, 534 | { 535 | name: "program"; 536 | address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"; 537 | } 538 | ]; 539 | args: []; 540 | } 541 | ]; 542 | accounts: [ 543 | { 544 | name: "bondingCurve"; 545 | discriminator: [23, 183, 248, 55, 96, 216, 172, 96]; 546 | }, 547 | { 548 | name: "global"; 549 | discriminator: [167, 232, 232, 177, 200, 108, 114, 127]; 550 | } 551 | ]; 552 | events: [ 553 | { 554 | name: "createEvent"; 555 | discriminator: [27, 114, 169, 77, 222, 235, 99, 118]; 556 | }, 557 | { 558 | name: "tradeEvent"; 559 | discriminator: [189, 219, 127, 211, 78, 230, 97, 238]; 560 | }, 561 | { 562 | name: "completeEvent"; 563 | discriminator: [95, 114, 97, 156, 212, 46, 152, 8]; 564 | }, 565 | { 566 | name: "setParamsEvent"; 567 | discriminator: [223, 195, 159, 246, 62, 48, 143, 131]; 568 | } 569 | ]; 570 | types: [ 571 | { 572 | name: "global"; 573 | type: { 574 | kind: "struct"; 575 | fields: [ 576 | { 577 | name: "initialized"; 578 | type: "bool"; 579 | }, 580 | { 581 | name: "authority"; 582 | type: "pubkey"; 583 | }, 584 | { 585 | name: "feeRecipient"; 586 | type: "pubkey"; 587 | }, 588 | { 589 | name: "initialVirtualTokenReserves"; 590 | type: "u64"; 591 | }, 592 | { 593 | name: "initialVirtualSolReserves"; 594 | type: "u64"; 595 | }, 596 | { 597 | name: "initialRealTokenReserves"; 598 | type: "u64"; 599 | }, 600 | { 601 | name: "tokenTotalSupply"; 602 | type: "u64"; 603 | }, 604 | { 605 | name: "feeBasisPoints"; 606 | type: "u64"; 607 | } 608 | ]; 609 | }; 610 | }, 611 | { 612 | name: "lastWithdraw"; 613 | type: { 614 | kind: "struct"; 615 | fields: [ 616 | { 617 | name: "lastWithdrawTimestamp"; 618 | type: "i64"; 619 | } 620 | ]; 621 | }; 622 | }, 623 | { 624 | name: "bondingCurve"; 625 | type: { 626 | kind: "struct"; 627 | fields: [ 628 | { 629 | name: "virtualTokenReserves"; 630 | type: "u64"; 631 | }, 632 | { 633 | name: "virtualSolReserves"; 634 | type: "u64"; 635 | }, 636 | { 637 | name: "realTokenReserves"; 638 | type: "u64"; 639 | }, 640 | { 641 | name: "realSolReserves"; 642 | type: "u64"; 643 | }, 644 | { 645 | name: "tokenTotalSupply"; 646 | type: "u64"; 647 | }, 648 | { 649 | name: "complete"; 650 | type: "bool"; 651 | } 652 | ]; 653 | }; 654 | }, 655 | { 656 | name: "createEvent"; 657 | type: { 658 | kind: "struct"; 659 | fields: [ 660 | { 661 | name: "name"; 662 | type: "string"; 663 | index: false; 664 | }, 665 | { 666 | name: "symbol"; 667 | type: "string"; 668 | index: false; 669 | }, 670 | { 671 | name: "uri"; 672 | type: "string"; 673 | index: false; 674 | }, 675 | { 676 | name: "mint"; 677 | type: "pubkey"; 678 | index: false; 679 | }, 680 | { 681 | name: "bondingCurve"; 682 | type: "pubkey"; 683 | index: false; 684 | }, 685 | { 686 | name: "user"; 687 | type: "pubkey"; 688 | index: false; 689 | } 690 | ]; 691 | }; 692 | }, 693 | { 694 | name: "tradeEvent"; 695 | type: { 696 | kind: "struct"; 697 | fields: [ 698 | { 699 | name: "mint"; 700 | type: "pubkey"; 701 | index: false; 702 | }, 703 | { 704 | name: "solAmount"; 705 | type: "u64"; 706 | index: false; 707 | }, 708 | { 709 | name: "tokenAmount"; 710 | type: "u64"; 711 | index: false; 712 | }, 713 | { 714 | name: "isBuy"; 715 | type: "bool"; 716 | index: false; 717 | }, 718 | { 719 | name: "user"; 720 | type: "pubkey"; 721 | index: false; 722 | }, 723 | { 724 | name: "timestamp"; 725 | type: "i64"; 726 | index: false; 727 | }, 728 | { 729 | name: "virtualSolReserves"; 730 | type: "u64"; 731 | index: false; 732 | }, 733 | { 734 | name: "virtualTokenReserves"; 735 | type: "u64"; 736 | index: false; 737 | }, 738 | { 739 | name: "realSolReserves"; 740 | type: "u64"; 741 | index: false; 742 | }, 743 | { 744 | name: "realTokenReserves"; 745 | type: "u64"; 746 | index: false; 747 | } 748 | ]; 749 | }; 750 | }, 751 | { 752 | name: "completeEvent"; 753 | type: { 754 | kind: "struct"; 755 | fields: [ 756 | { 757 | name: "user"; 758 | type: "pubkey"; 759 | index: false; 760 | }, 761 | { 762 | name: "mint"; 763 | type: "pubkey"; 764 | index: false; 765 | }, 766 | { 767 | name: "bondingCurve"; 768 | type: "pubkey"; 769 | index: false; 770 | }, 771 | { 772 | name: "timestamp"; 773 | type: "i64"; 774 | index: false; 775 | } 776 | ]; 777 | }; 778 | }, 779 | { 780 | name: "setParamsEvent"; 781 | type: { 782 | kind: "struct"; 783 | fields: [ 784 | { 785 | name: "feeRecipient"; 786 | type: "pubkey"; 787 | index: false; 788 | }, 789 | { 790 | name: "initialVirtualTokenReserves"; 791 | type: "u64"; 792 | index: false; 793 | }, 794 | { 795 | name: "initialVirtualSolReserves"; 796 | type: "u64"; 797 | index: false; 798 | }, 799 | { 800 | name: "initialRealTokenReserves"; 801 | type: "u64"; 802 | index: false; 803 | }, 804 | { 805 | name: "tokenTotalSupply"; 806 | type: "u64"; 807 | index: false; 808 | }, 809 | { 810 | name: "feeBasisPoints"; 811 | type: "u64"; 812 | index: false; 813 | } 814 | ]; 815 | }; 816 | } 817 | ]; 818 | errors: [ 819 | { 820 | code: 6000; 821 | name: "NotAuthorized"; 822 | msg: "The given account is not authorized to execute this instruction."; 823 | }, 824 | { 825 | code: 6001; 826 | name: "AlreadyInitialized"; 827 | msg: "The program is already initialized."; 828 | }, 829 | { 830 | code: 6002; 831 | name: "TooMuchSolRequired"; 832 | msg: "slippage: Too much SOL required to buy the given amount of tokens."; 833 | }, 834 | { 835 | code: 6003; 836 | name: "TooLittleSolReceived"; 837 | msg: "slippage: Too little SOL received to sell the given amount of tokens."; 838 | }, 839 | { 840 | code: 6004; 841 | name: "MintDoesNotMatchBondingCurve"; 842 | msg: "The mint does not match the bonding curve."; 843 | }, 844 | { 845 | code: 6005; 846 | name: "BondingCurveComplete"; 847 | msg: "The bonding curve has completed and liquidity migrated to raydium."; 848 | }, 849 | { 850 | code: 6006; 851 | name: "BondingCurveNotComplete"; 852 | msg: "The bonding curve has not completed."; 853 | }, 854 | { 855 | code: 6007; 856 | name: "NotInitialized"; 857 | msg: "The program is not initialized."; 858 | }, 859 | { 860 | code: 6008; 861 | name: "WithdrawTooFrequent"; 862 | msg: "Withdraw too frequent"; 863 | } 864 | ]; 865 | }; -------------------------------------------------------------------------------- /src/idl/pump-fun-old.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 3 | "metadata": { 4 | "name": "pump", 5 | "version": "0.1.0", 6 | "spec": "0.1.0" 7 | }, 8 | "instructions": [ 9 | { 10 | "name": "initialize", 11 | "discriminator": [175, 175, 109, 31, 13, 152, 155, 237], 12 | "docs": ["Creates the global state."], 13 | "accounts": [ 14 | { 15 | "name": "global", 16 | "writable": true, 17 | "pda": { 18 | "seeds": [ 19 | { 20 | "kind": "const", 21 | "value": [ 22 | 103, 23 | 108, 24 | 111, 25 | 98, 26 | 97, 27 | 108 28 | ] 29 | } 30 | ] 31 | } 32 | }, 33 | { 34 | "name": "user", 35 | "writable": true, 36 | "signer": true 37 | }, 38 | { 39 | "name": "system_program", 40 | "address": "11111111111111111111111111111111" 41 | } 42 | ], 43 | "args": [] 44 | }, 45 | { 46 | "name": "setParams", 47 | "discriminator": [165, 31, 134, 53, 189, 180, 130, 255], 48 | "docs": ["Sets the global state parameters."], 49 | "accounts": [ 50 | { 51 | "name": "global", 52 | "writable": true, 53 | "pda": { 54 | "seeds": [ 55 | { 56 | "kind": "const", 57 | "value": [ 58 | 103, 59 | 108, 60 | 111, 61 | 98, 62 | 97, 63 | 108 64 | ] 65 | } 66 | ] 67 | } 68 | }, 69 | { 70 | "name": "user", 71 | "writable": true, 72 | "signer": true 73 | }, 74 | { 75 | "name": "system_program", 76 | "address": "11111111111111111111111111111111" 77 | }, 78 | { 79 | "name": "event_authority", 80 | "address": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 81 | }, 82 | { 83 | "name": "program", 84 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 85 | } 86 | ], 87 | "args": [ 88 | { 89 | "name": "feeRecipient", 90 | "type": "pubkey" 91 | }, 92 | { 93 | "name": "initialVirtualTokenReserves", 94 | "type": "u64" 95 | }, 96 | { 97 | "name": "initialVirtualSolReserves", 98 | "type": "u64" 99 | }, 100 | { 101 | "name": "initialRealTokenReserves", 102 | "type": "u64" 103 | }, 104 | { 105 | "name": "tokenTotalSupply", 106 | "type": "u64" 107 | }, 108 | { 109 | "name": "feeBasisPoints", 110 | "type": "u64" 111 | } 112 | ] 113 | }, 114 | { 115 | "name": "create", 116 | "discriminator": [24, 30, 200, 40, 5, 28, 7, 119], 117 | "docs": ["Creates a new coin and bonding curve."], 118 | "accounts": [ 119 | { 120 | "name": "mint", 121 | "writable": true, 122 | "signer": true 123 | }, 124 | { 125 | "name": "mint_authority", 126 | "pda": { 127 | "seeds": [ 128 | { 129 | "kind": "const", 130 | "value": [ 131 | 109, 132 | 105, 133 | 110, 134 | 116, 135 | 45, 136 | 97, 137 | 117, 138 | 116, 139 | 104, 140 | 111, 141 | 114, 142 | 105, 143 | 116, 144 | 121 145 | ] 146 | } 147 | ] 148 | } 149 | }, 150 | { 151 | "name": "bonding_curve", 152 | "writable": true, 153 | "pda": { 154 | "seeds": [ 155 | { 156 | "kind": "const", 157 | "value": [ 158 | 98, 159 | 111, 160 | 110, 161 | 100, 162 | 105, 163 | 110, 164 | 103, 165 | 45, 166 | 99, 167 | 117, 168 | 114, 169 | 118, 170 | 101 171 | ] 172 | }, 173 | { 174 | "kind": "account", 175 | "path": "mint" 176 | } 177 | ] 178 | } 179 | }, 180 | { 181 | "name": "associated_bonding_curve", 182 | "writable": true, 183 | "signer": false 184 | }, 185 | { 186 | "name": "global", 187 | "writable": false, 188 | "pda": { 189 | "seeds": [ 190 | { 191 | "kind": "const", 192 | "value": [ 193 | 103, 194 | 108, 195 | 111, 196 | 98, 197 | 97, 198 | 108 199 | ] 200 | } 201 | ] 202 | } 203 | }, 204 | { 205 | "name": "mpl_token_metadata", 206 | "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" 207 | }, 208 | { 209 | "name": "metadata", 210 | "writable": true, 211 | "signer": false 212 | }, 213 | { 214 | "name": "user", 215 | "isMut": true, 216 | "isSigner": true 217 | }, 218 | { 219 | "name": "system_program", 220 | "address": "11111111111111111111111111111111" 221 | }, 222 | { 223 | "name": "token_program", 224 | "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 225 | }, 226 | { 227 | "name": "associated_token_program", 228 | "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" 229 | }, 230 | { 231 | "name": "rent", 232 | "address": "SysvarRent111111111111111111111111111111111" 233 | }, 234 | { 235 | "name": "event_authority", 236 | "address": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 237 | }, 238 | { 239 | "name": "program", 240 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 241 | } 242 | ], 243 | "args": [ 244 | { 245 | "name": "name", 246 | "type": "string" 247 | }, 248 | { 249 | "name": "symbol", 250 | "type": "string" 251 | }, 252 | { 253 | "name": "uri", 254 | "type": "string" 255 | } 256 | ] 257 | }, 258 | { 259 | "name": "buy", 260 | "discriminator": [102, 6, 61, 18, 1, 218, 235, 234], 261 | "docs": ["Buys tokens from a bonding curve."], 262 | "accounts": [ 263 | { 264 | "name": "global", 265 | "pda": { 266 | "seeds": [ 267 | { 268 | "kind": "const", 269 | "value": [ 270 | 103, 271 | 108, 272 | 111, 273 | 98, 274 | 97, 275 | 108 276 | ] 277 | } 278 | ] 279 | } 280 | }, 281 | { 282 | "name": "fee_recipient", 283 | "writable": true, 284 | "signer": false 285 | }, 286 | { 287 | "name": "mint", 288 | "writable": false, 289 | "signer": false 290 | }, 291 | { 292 | "name": "bonding_curve", 293 | "writable": true, 294 | "pda": { 295 | "seeds": [ 296 | { 297 | "kind": "const", 298 | "value": [ 299 | 98, 300 | 111, 301 | 110, 302 | 100, 303 | 105, 304 | 110, 305 | 103, 306 | 45, 307 | 99, 308 | 117, 309 | 114, 310 | 118, 311 | 101 312 | ] 313 | }, 314 | { 315 | "kind": "account", 316 | "path": "mint" 317 | } 318 | ] 319 | } 320 | }, 321 | { 322 | "name": "associated_bonding_curve", 323 | "writable": true, 324 | "signer": false 325 | }, 326 | { 327 | "name": "associated_user", 328 | "writable": true, 329 | "signer": false 330 | }, 331 | { 332 | "name": "user", 333 | "writable": true, 334 | "signer": true 335 | }, 336 | { 337 | "name": "system_program", 338 | "address": "11111111111111111111111111111111" 339 | }, 340 | { 341 | "name": "token_program", 342 | "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 343 | }, 344 | { 345 | "name": "rent", 346 | "address": "SysvarRent111111111111111111111111111111111" 347 | }, 348 | { 349 | "name": "event_authority", 350 | "address": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 351 | }, 352 | { 353 | "name": "program", 354 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 355 | } 356 | ], 357 | "args": [ 358 | { 359 | "name": "amount", 360 | "type": "u64" 361 | }, 362 | { 363 | "name": "maxSolCost", 364 | "type": "u64" 365 | } 366 | ] 367 | }, 368 | { 369 | "name": "sell", 370 | "discriminator": [51, 230, 133, 164, 1, 127, 131, 173], 371 | "docs": ["Sells tokens into a bonding curve."], 372 | "accounts": [ 373 | { 374 | "name": "global", 375 | "writable": false, 376 | "pda": { 377 | "seeds": [ 378 | { 379 | "kind": "const", 380 | "value": [ 381 | 103, 382 | 108, 383 | 111, 384 | 98, 385 | 97, 386 | 108 387 | ] 388 | } 389 | ] 390 | } 391 | }, 392 | { 393 | "name": "feeRecipient", 394 | "writable": true, 395 | "signer": false 396 | }, 397 | { 398 | "name": "mint", 399 | "writable": false, 400 | "signer": false 401 | }, 402 | { 403 | "name": "bonding_curve", 404 | "writable": true, 405 | "pda": { 406 | "seeds": [ 407 | { 408 | "kind": "const", 409 | "value": [ 410 | 98, 411 | 111, 412 | 110, 413 | 100, 414 | 105, 415 | 110, 416 | 103, 417 | 45, 418 | 99, 419 | 117, 420 | 114, 421 | 118, 422 | 101 423 | ] 424 | }, 425 | { 426 | "kind": "account", 427 | "path": "mint" 428 | } 429 | ] 430 | } 431 | }, 432 | { 433 | "name": "associatedBondingCurve", 434 | "writable": true, 435 | "signer": false 436 | }, 437 | { 438 | "name": "associatedUser", 439 | "writable": true, 440 | "signer": false 441 | }, 442 | { 443 | "name": "user", 444 | "writable": true, 445 | "signer": true 446 | }, 447 | { 448 | "name": "system_program", 449 | "address": "11111111111111111111111111111111" 450 | }, 451 | { 452 | "name": "associated_token_program", 453 | "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" 454 | }, 455 | { 456 | "name": "token_program", 457 | "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 458 | }, 459 | { 460 | "name": "event_authority", 461 | "address": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 462 | }, 463 | { 464 | "name": "program", 465 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 466 | } 467 | ], 468 | "args": [ 469 | { 470 | "name": "amount", 471 | "type": "u64" 472 | }, 473 | { 474 | "name": "minSolOutput", 475 | "type": "u64" 476 | } 477 | ] 478 | }, 479 | { 480 | "name": "withdraw", 481 | "discriminator": [183, 18, 70, 156, 148, 109, 161, 34], 482 | "docs": [ 483 | "Allows the admin to withdraw liquidity for a migration once the bonding curve completes" 484 | ], 485 | "accounts": [ 486 | { 487 | "name": "global", 488 | "writable": false, 489 | "pda": { 490 | "seeds": [ 491 | { 492 | "kind": "const", 493 | "value": [ 494 | 103, 495 | 108, 496 | 111, 497 | 98, 498 | 97, 499 | 108 500 | ] 501 | } 502 | ] 503 | } 504 | }, 505 | { 506 | "name": "lastWithdraw", 507 | "writable": true, 508 | "signer": false 509 | }, 510 | { 511 | "name": "mint", 512 | "writable": false, 513 | "signer": false 514 | }, 515 | { 516 | "name": "bonding_curve", 517 | "writable": true, 518 | "pda": { 519 | "seeds": [ 520 | { 521 | "kind": "const", 522 | "value": [ 523 | 98, 524 | 111, 525 | 110, 526 | 100, 527 | 105, 528 | 110, 529 | 103, 530 | 45, 531 | 99, 532 | 117, 533 | 114, 534 | 118, 535 | 101 536 | ] 537 | }, 538 | { 539 | "kind": "account", 540 | "path": "mint" 541 | } 542 | ] 543 | } 544 | }, 545 | { 546 | "name": "associatedBondingCurve", 547 | "writable": true, 548 | "signer": false 549 | }, 550 | { 551 | "name": "associatedUser", 552 | "writable": true, 553 | "signer": false 554 | }, 555 | { 556 | "name": "user", 557 | "writable": true, 558 | "signer": true 559 | }, 560 | { 561 | "name": "system_program", 562 | "address": "11111111111111111111111111111111" 563 | }, 564 | { 565 | "name": "token_program", 566 | "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 567 | }, 568 | { 569 | "name": "rent", 570 | "address": "SysvarRent111111111111111111111111111111111" 571 | }, 572 | { 573 | "name": "event_authority", 574 | "address": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 575 | }, 576 | { 577 | "name": "program", 578 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 579 | } 580 | ], 581 | "args": [] 582 | } 583 | ], 584 | "accounts": [ 585 | { 586 | "name": "BondingCurve", 587 | "discriminator": [ 588 | 23, 589 | 183, 590 | 248, 591 | 55, 592 | 96, 593 | 216, 594 | 172, 595 | 96 596 | ] 597 | }, 598 | { 599 | "name": "Global", 600 | "discriminator": [ 601 | 167, 602 | 232, 603 | 232, 604 | 177, 605 | 200, 606 | 108, 607 | 114, 608 | 127 609 | ] 610 | } 611 | ], 612 | "events": [ 613 | { 614 | "name": "CreateEvent", 615 | "discriminator": [27, 114, 169, 77, 222, 235, 99, 118] 616 | }, 617 | { 618 | "name": "TradeEvent", 619 | "discriminator": [189, 219, 127, 211, 78, 230, 97, 238] 620 | }, 621 | { 622 | "name": "CompleteEvent", 623 | "discriminator": [95, 114, 97, 156, 212, 46, 152, 8] 624 | }, 625 | { 626 | "name": "SetParamsEvent", 627 | "discriminator": [223, 195, 159, 246, 62, 48, 143, 131] 628 | } 629 | ], 630 | "types": [ 631 | { 632 | "name": "Global", 633 | "type": { 634 | "kind": "struct", 635 | "fields": [ 636 | { 637 | "name": "initialized", 638 | "type": "bool" 639 | }, 640 | { 641 | "name": "authority", 642 | "type": "pubkey" 643 | }, 644 | { 645 | "name": "feeRecipient", 646 | "type": "pubkey" 647 | }, 648 | { 649 | "name": "initialVirtualTokenReserves", 650 | "type": "u64" 651 | }, 652 | { 653 | "name": "initialVirtualSolReserves", 654 | "type": "u64" 655 | }, 656 | { 657 | "name": "initialRealTokenReserves", 658 | "type": "u64" 659 | }, 660 | { 661 | "name": "tokenTotalSupply", 662 | "type": "u64" 663 | }, 664 | { 665 | "name": "feeBasisPoints", 666 | "type": "u64" 667 | } 668 | ] 669 | } 670 | }, 671 | { 672 | "name": "LastWithdraw", 673 | "type": { 674 | "kind": "struct", 675 | "fields": [ 676 | { 677 | "name": "lastWithdrawTimestamp", 678 | "type": "i64" 679 | } 680 | ] 681 | } 682 | }, 683 | { 684 | "name": "BondingCurve", 685 | "type": { 686 | "kind": "struct", 687 | "fields": [ 688 | { 689 | "name": "virtualTokenReserves", 690 | "type": "u64" 691 | }, 692 | { 693 | "name": "virtualSolReserves", 694 | "type": "u64" 695 | }, 696 | { 697 | "name": "realTokenReserves", 698 | "type": "u64" 699 | }, 700 | { 701 | "name": "realSolReserves", 702 | "type": "u64" 703 | }, 704 | { 705 | "name": "tokenTotalSupply", 706 | "type": "u64" 707 | }, 708 | { 709 | "name": "complete", 710 | "type": "bool" 711 | } 712 | ] 713 | } 714 | }, 715 | { 716 | "name": "CreateEvent", 717 | "type": { 718 | "kind": "struct", 719 | "fields": [ 720 | { 721 | "name": "name", 722 | "type": "string", 723 | "index": false 724 | }, 725 | { 726 | "name": "symbol", 727 | "type": "string", 728 | "index": false 729 | }, 730 | { 731 | "name": "uri", 732 | "type": "string", 733 | "index": false 734 | }, 735 | { 736 | "name": "mint", 737 | "type": "pubkey", 738 | "index": false 739 | }, 740 | { 741 | "name": "bondingCurve", 742 | "type": "pubkey", 743 | "index": false 744 | }, 745 | { 746 | "name": "user", 747 | "type": "pubkey", 748 | "index": false 749 | } 750 | ] 751 | } 752 | }, 753 | { 754 | "name": "TradeEvent", 755 | "type": { 756 | "kind": "struct", 757 | "fields": [ 758 | { 759 | "name": "mint", 760 | "type": "pubkey", 761 | "index": false 762 | }, 763 | { 764 | "name": "solAmount", 765 | "type": "u64", 766 | "index": false 767 | }, 768 | { 769 | "name": "tokenAmount", 770 | "type": "u64", 771 | "index": false 772 | }, 773 | { 774 | "name": "isBuy", 775 | "type": "bool", 776 | "index": false 777 | }, 778 | { 779 | "name": "user", 780 | "type": "pubkey", 781 | "index": false 782 | }, 783 | { 784 | "name": "timestamp", 785 | "type": "i64", 786 | "index": false 787 | }, 788 | { 789 | "name": "virtualSolReserves", 790 | "type": "u64", 791 | "index": false 792 | }, 793 | { 794 | "name": "virtualTokenReserves", 795 | "type": "u64", 796 | "index": false 797 | }, 798 | { 799 | "name": "realSolReserves", 800 | "type": "u64", 801 | "index": false 802 | }, 803 | { 804 | "name": "realTokenReserves", 805 | "type": "u64", 806 | "index": false 807 | } 808 | ] 809 | } 810 | }, 811 | { 812 | "name": "CompleteEvent", 813 | "type": { 814 | "kind": "struct", 815 | "fields": [ 816 | { 817 | "name": "user", 818 | "type": "pubkey", 819 | "index": false 820 | }, 821 | { 822 | "name": "mint", 823 | "type": "pubkey", 824 | "index": false 825 | }, 826 | { 827 | "name": "bondingCurve", 828 | "type": "pubkey", 829 | "index": false 830 | }, 831 | { 832 | "name": "timestamp", 833 | "type": "i64", 834 | "index": false 835 | } 836 | ] 837 | } 838 | }, 839 | { 840 | "name": "SetParamsEvent", 841 | "type": { 842 | "kind": "struct", 843 | "fields": [ 844 | { 845 | "name": "feeRecipient", 846 | "type": "pubkey", 847 | "index": false 848 | }, 849 | { 850 | "name": "initialVirtualTokenReserves", 851 | "type": "u64", 852 | "index": false 853 | }, 854 | { 855 | "name": "initialVirtualSolReserves", 856 | "type": "u64", 857 | "index": false 858 | }, 859 | { 860 | "name": "initialRealTokenReserves", 861 | "type": "u64", 862 | "index": false 863 | }, 864 | { 865 | "name": "tokenTotalSupply", 866 | "type": "u64", 867 | "index": false 868 | }, 869 | { 870 | "name": "feeBasisPoints", 871 | "type": "u64", 872 | "index": false 873 | } 874 | ] 875 | } 876 | } 877 | ], 878 | "errors": [ 879 | { 880 | "code": 6000, 881 | "name": "NotAuthorized", 882 | "msg": "The given account is not authorized to execute this instruction." 883 | }, 884 | { 885 | "code": 6001, 886 | "name": "AlreadyInitialized", 887 | "msg": "The program is already initialized." 888 | }, 889 | { 890 | "code": 6002, 891 | "name": "TooMuchSolRequired", 892 | "msg": "slippage: Too much SOL required to buy the given amount of tokens." 893 | }, 894 | { 895 | "code": 6003, 896 | "name": "TooLittleSolReceived", 897 | "msg": "slippage: Too little SOL received to sell the given amount of tokens." 898 | }, 899 | { 900 | "code": 6004, 901 | "name": "MintDoesNotMatchBondingCurve", 902 | "msg": "The mint does not match the bonding curve." 903 | }, 904 | { 905 | "code": 6005, 906 | "name": "BondingCurveComplete", 907 | "msg": "The bonding curve has completed and liquidity migrated to raydium." 908 | }, 909 | { 910 | "code": 6006, 911 | "name": "BondingCurveNotComplete", 912 | "msg": "The bonding curve has not completed." 913 | }, 914 | { 915 | "code": 6007, 916 | "name": "NotInitialized", 917 | "msg": "The program is not initialized." 918 | }, 919 | { 920 | "code": 6008, 921 | "name": "WithdrawTooFrequent", 922 | "msg": "Withdraw too frequent" 923 | } 924 | ] 925 | } 926 | -------------------------------------------------------------------------------- /src/idl/pump-fun.ts: -------------------------------------------------------------------------------- 1 | export type PumpFun = { 2 | address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"; 3 | metadata: { 4 | name: "pump"; 5 | version: "0.1.0"; 6 | spec: "0.1.0"; 7 | description: "Created with Anchor" 8 | }, 9 | instructions: [ 10 | { 11 | name: "buy"; 12 | docs: [ 13 | "Buys tokens from a bonding curve." 14 | ]; 15 | discriminator: [ 16 | 102, 17 | 6, 18 | 61, 19 | 18, 20 | 1, 21 | 218, 22 | 235, 23 | 234 24 | ]; 25 | accounts: [ 26 | { 27 | name: "global"; 28 | pda: { 29 | seeds: [ 30 | { 31 | kind: "const"; 32 | value: [ 33 | 103, 34 | 108, 35 | 111, 36 | 98, 37 | 97, 38 | 108 39 | ] 40 | } 41 | ] 42 | } 43 | }, 44 | { 45 | name: "feeRecipient"; 46 | writable: true 47 | }, 48 | { 49 | name: "mint" 50 | }, 51 | { 52 | name: "bondingCurve"; 53 | writable: true, 54 | pda: { 55 | seeds: [ 56 | { 57 | kind: "const"; 58 | value: [ 59 | 98, 60 | 111, 61 | 110, 62 | 100, 63 | 105, 64 | 110, 65 | 103, 66 | 45, 67 | 99, 68 | 117, 69 | 114, 70 | 118, 71 | 101 72 | ] 73 | }, 74 | { 75 | kind: "account"; 76 | path: "mint" 77 | } 78 | ] 79 | } 80 | }, 81 | { 82 | name: "associatedBondingCurve"; 83 | writable: true, 84 | pda: { 85 | seeds: [ 86 | { 87 | kind: "account"; 88 | path: "bondingCurve" 89 | }, 90 | { 91 | kind: "const"; 92 | value: [ 93 | 6, 94 | 221, 95 | 246, 96 | 225, 97 | 215, 98 | 101, 99 | 161, 100 | 147, 101 | 217, 102 | 203, 103 | 225, 104 | 70, 105 | 206, 106 | 235, 107 | 121, 108 | 172, 109 | 28, 110 | 180, 111 | 133, 112 | 237, 113 | 95, 114 | 91, 115 | 55, 116 | 145, 117 | 58, 118 | 140, 119 | 245, 120 | 133, 121 | 126, 122 | 255, 123 | 0, 124 | 169 125 | ] 126 | }, 127 | { 128 | kind: "account"; 129 | path: "mint" 130 | } 131 | ]; 132 | program: { 133 | kind: "const"; 134 | value: [ 135 | 140, 136 | 151, 137 | 37, 138 | 143, 139 | 78, 140 | 36, 141 | 137, 142 | 241, 143 | 187, 144 | 61, 145 | 16, 146 | 41, 147 | 20, 148 | 142, 149 | 13, 150 | 131, 151 | 11, 152 | 90, 153 | 19, 154 | 153, 155 | 218, 156 | 255, 157 | 16, 158 | 132, 159 | 4, 160 | 142, 161 | 123, 162 | 216, 163 | 219, 164 | 233, 165 | 248, 166 | 89 167 | ] 168 | } 169 | } 170 | }, 171 | { 172 | name: "associatedUser"; 173 | writable: true 174 | }, 175 | { 176 | name: "user"; 177 | writable: true, 178 | signer: true 179 | }, 180 | { 181 | name: "systemProgram"; 182 | address: "11111111111111111111111111111111" 183 | }, 184 | { 185 | name: "tokenProgram"; 186 | address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 187 | }, 188 | { 189 | name: "rent"; 190 | docs: [ 191 | "Unused" 192 | ]; 193 | address: "SysvarRent111111111111111111111111111111111" 194 | }, 195 | { 196 | name: "eventAuthority"; 197 | pda: { 198 | seeds: [ 199 | { 200 | kind: "const"; 201 | value: [ 202 | 95, 203 | 95, 204 | 101, 205 | 118, 206 | 101, 207 | 110, 208 | 116, 209 | 95, 210 | 97, 211 | 117, 212 | 116, 213 | 104, 214 | 111, 215 | 114, 216 | 105, 217 | 116, 218 | 121 219 | ] 220 | } 221 | ] 222 | } 223 | }, 224 | { 225 | name: "program" 226 | } 227 | ]; 228 | args: [ 229 | { 230 | name: "amount"; 231 | type: "u64" 232 | }, 233 | { 234 | name: "maxSolCost"; 235 | type: "u64" 236 | } 237 | ] 238 | }, 239 | { 240 | name: "create"; 241 | docs: [ 242 | "Creates a new coin and bonding curve." 243 | ]; 244 | discriminator: [ 245 | 24, 246 | 30, 247 | 200, 248 | 40, 249 | 5, 250 | 28, 251 | 7, 252 | 119 253 | ]; 254 | accounts: [ 255 | { 256 | name: "mint"; 257 | writable: true, 258 | signer: true 259 | }, 260 | { 261 | name: "mintAuthority"; 262 | pda: { 263 | seeds: [ 264 | { 265 | kind: "const"; 266 | value: [ 267 | 109, 268 | 105, 269 | 110, 270 | 116, 271 | 45, 272 | 97, 273 | 117, 274 | 116, 275 | 104, 276 | 111, 277 | 114, 278 | 105, 279 | 116, 280 | 121 281 | ] 282 | } 283 | ] 284 | } 285 | }, 286 | { 287 | name: "bondingCurve"; 288 | writable: true, 289 | pda: { 290 | seeds: [ 291 | { 292 | kind: "const"; 293 | value: [ 294 | 98, 295 | 111, 296 | 110, 297 | 100, 298 | 105, 299 | 110, 300 | 103, 301 | 45, 302 | 99, 303 | 117, 304 | 114, 305 | 118, 306 | 101 307 | ] 308 | }, 309 | { 310 | kind: "account"; 311 | path: "mint" 312 | } 313 | ] 314 | } 315 | }, 316 | { 317 | name: "associatedBondingCurve"; 318 | writable: true, 319 | pda: { 320 | seeds: [ 321 | { 322 | kind: "account"; 323 | path: "bondingCurve" 324 | }, 325 | { 326 | kind: "const"; 327 | value: [ 328 | 6, 329 | 221, 330 | 246, 331 | 225, 332 | 215, 333 | 101, 334 | 161, 335 | 147, 336 | 217, 337 | 203, 338 | 225, 339 | 70, 340 | 206, 341 | 235, 342 | 121, 343 | 172, 344 | 28, 345 | 180, 346 | 133, 347 | 237, 348 | 95, 349 | 91, 350 | 55, 351 | 145, 352 | 58, 353 | 140, 354 | 245, 355 | 133, 356 | 126, 357 | 255, 358 | 0, 359 | 169 360 | ] 361 | }, 362 | { 363 | kind: "account"; 364 | path: "mint" 365 | } 366 | ]; 367 | program: { 368 | kind: "const"; 369 | value: [ 370 | 140, 371 | 151, 372 | 37, 373 | 143, 374 | 78, 375 | 36, 376 | 137, 377 | 241, 378 | 187, 379 | 61, 380 | 16, 381 | 41, 382 | 20, 383 | 142, 384 | 13, 385 | 131, 386 | 11, 387 | 90, 388 | 19, 389 | 153, 390 | 218, 391 | 255, 392 | 16, 393 | 132, 394 | 4, 395 | 142, 396 | 123, 397 | 216, 398 | 219, 399 | 233, 400 | 248, 401 | 89 402 | ] 403 | } 404 | } 405 | }, 406 | { 407 | name: "global"; 408 | pda: { 409 | seeds: [ 410 | { 411 | kind: "const"; 412 | value: [ 413 | 103, 414 | 108, 415 | 111, 416 | 98, 417 | 97, 418 | 108 419 | ] 420 | } 421 | ] 422 | } 423 | }, 424 | { 425 | name: "mplTokenMetadata"; 426 | address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" 427 | }, 428 | { 429 | name: "metadata"; 430 | writable: true, 431 | pda: { 432 | seeds: [ 433 | { 434 | kind: "const"; 435 | value: [ 436 | 109, 437 | 101, 438 | 116, 439 | 97, 440 | 100, 441 | 97, 442 | 116, 443 | 97 444 | ] 445 | }, 446 | { 447 | kind: "const"; 448 | value: [ 449 | 11, 450 | 112, 451 | 101, 452 | 177, 453 | 227, 454 | 209, 455 | 124, 456 | 69, 457 | 56, 458 | 157, 459 | 82, 460 | 127, 461 | 107, 462 | 4, 463 | 195, 464 | 205, 465 | 88, 466 | 184, 467 | 108, 468 | 115, 469 | 26, 470 | 160, 471 | 253, 472 | 181, 473 | 73, 474 | 182, 475 | 209, 476 | 188, 477 | 3, 478 | 248, 479 | 41, 480 | 70 481 | ] 482 | }, 483 | { 484 | kind: "account"; 485 | path: "mint" 486 | } 487 | ]; 488 | program: { 489 | kind: "const"; 490 | value: [ 491 | 11, 492 | 112, 493 | 101, 494 | 177, 495 | 227, 496 | 209, 497 | 124, 498 | 69, 499 | 56, 500 | 157, 501 | 82, 502 | 127, 503 | 107, 504 | 4, 505 | 195, 506 | 205, 507 | 88, 508 | 184, 509 | 108, 510 | 115, 511 | 26, 512 | 160, 513 | 253, 514 | 181, 515 | 73, 516 | 182, 517 | 209, 518 | 188, 519 | 3, 520 | 248, 521 | 41, 522 | 70 523 | ] 524 | } 525 | } 526 | }, 527 | { 528 | name: "user"; 529 | writable: true, 530 | signer: true 531 | }, 532 | { 533 | name: "systemProgram"; 534 | address: "11111111111111111111111111111111" 535 | }, 536 | { 537 | name: "tokenProgram"; 538 | address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 539 | }, 540 | { 541 | name: "associatedTokenProgram"; 542 | address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" 543 | }, 544 | { 545 | name: "rent"; 546 | address: "SysvarRent111111111111111111111111111111111" 547 | }, 548 | { 549 | name: "eventAuthority"; 550 | pda: { 551 | seeds: [ 552 | { 553 | kind: "const"; 554 | value: [ 555 | 95, 556 | 95, 557 | 101, 558 | 118, 559 | 101, 560 | 110, 561 | 116, 562 | 95, 563 | 97, 564 | 117, 565 | 116, 566 | 104, 567 | 111, 568 | 114, 569 | 105, 570 | 116, 571 | 121 572 | ] 573 | } 574 | ] 575 | } 576 | }, 577 | { 578 | name: "program" 579 | } 580 | ]; 581 | args: [ 582 | { 583 | name: "name"; 584 | type: "string" 585 | }, 586 | { 587 | name: "symbol"; 588 | type: "string" 589 | }, 590 | { 591 | name: "uri"; 592 | type: "string" 593 | }, 594 | { 595 | name: "creator"; 596 | type: "pubkey" 597 | } 598 | ] 599 | }, 600 | { 601 | name: "extendAccount"; 602 | docs: [ 603 | "Extends the size of program-owned accounts" 604 | ]; 605 | discriminator: [ 606 | 234, 607 | 102, 608 | 194, 609 | 203, 610 | 150, 611 | 72, 612 | 62, 613 | 229 614 | ]; 615 | accounts: [ 616 | { 617 | name: "account"; 618 | writable: true 619 | }, 620 | { 621 | name: "user"; 622 | signer: true 623 | }, 624 | { 625 | name: "systemProgram"; 626 | address: "11111111111111111111111111111111" 627 | }, 628 | { 629 | name: "eventAuthority"; 630 | pda: { 631 | seeds: [ 632 | { 633 | kind: "const"; 634 | value: [ 635 | 95, 636 | 95, 637 | 101, 638 | 118, 639 | 101, 640 | 110, 641 | 116, 642 | 95, 643 | 97, 644 | 117, 645 | 116, 646 | 104, 647 | 111, 648 | 114, 649 | 105, 650 | 116, 651 | 121 652 | ] 653 | } 654 | ] 655 | } 656 | }, 657 | { 658 | name: "program" 659 | } 660 | ]; 661 | args: [] 662 | }, 663 | { 664 | name: "initialize"; 665 | docs: [ 666 | "Creates the global state." 667 | ]; 668 | discriminator: [ 669 | 175, 670 | 175, 671 | 109, 672 | 31, 673 | 13, 674 | 152, 675 | 155, 676 | 237 677 | ]; 678 | accounts: [ 679 | { 680 | name: "global"; 681 | writable: true, 682 | pda: { 683 | seeds: [ 684 | { 685 | kind: "const"; 686 | value: [ 687 | 103, 688 | 108, 689 | 111, 690 | 98, 691 | 97, 692 | 108 693 | ] 694 | } 695 | ] 696 | } 697 | }, 698 | { 699 | name: "user"; 700 | writable: true, 701 | signer: true 702 | }, 703 | { 704 | name: "systemProgram"; 705 | address: "11111111111111111111111111111111" 706 | } 707 | ]; 708 | args: [] 709 | }, 710 | { 711 | name: "migrate"; 712 | docs: [ 713 | "Migrates liquidity to pumpAmm if bonding curve is complete" 714 | ]; 715 | discriminator: [ 716 | 155, 717 | 234, 718 | 231, 719 | 146, 720 | 236, 721 | 158, 722 | 162, 723 | 30 724 | ]; 725 | accounts: [ 726 | { 727 | name: "global"; 728 | pda: { 729 | seeds: [ 730 | { 731 | kind: "const"; 732 | value: [ 733 | 103, 734 | 108, 735 | 111, 736 | 98, 737 | 97, 738 | 108 739 | ] 740 | } 741 | ] 742 | } 743 | }, 744 | { 745 | name: "withdrawAuthority"; 746 | writable: true, 747 | relations: [ 748 | "global" 749 | ] 750 | }, 751 | { 752 | name: "mint" 753 | }, 754 | { 755 | name: "bondingCurve"; 756 | writable: true, 757 | pda: { 758 | seeds: [ 759 | { 760 | kind: "const"; 761 | value: [ 762 | 98, 763 | 111, 764 | 110, 765 | 100, 766 | 105, 767 | 110, 768 | 103, 769 | 45, 770 | 99, 771 | 117, 772 | 114, 773 | 118, 774 | 101 775 | ] 776 | }, 777 | { 778 | kind: "account"; 779 | path: "mint" 780 | } 781 | ] 782 | } 783 | }, 784 | { 785 | name: "associatedBondingCurve"; 786 | writable: true, 787 | pda: { 788 | seeds: [ 789 | { 790 | kind: "account"; 791 | path: "bondingCurve" 792 | }, 793 | { 794 | kind: "const"; 795 | value: [ 796 | 6, 797 | 221, 798 | 246, 799 | 225, 800 | 215, 801 | 101, 802 | 161, 803 | 147, 804 | 217, 805 | 203, 806 | 225, 807 | 70, 808 | 206, 809 | 235, 810 | 121, 811 | 172, 812 | 28, 813 | 180, 814 | 133, 815 | 237, 816 | 95, 817 | 91, 818 | 55, 819 | 145, 820 | 58, 821 | 140, 822 | 245, 823 | 133, 824 | 126, 825 | 255, 826 | 0, 827 | 169 828 | ] 829 | }, 830 | { 831 | kind: "account"; 832 | path: "mint" 833 | } 834 | ]; 835 | program: { 836 | kind: "const"; 837 | value: [ 838 | 140, 839 | 151, 840 | 37, 841 | 143, 842 | 78, 843 | 36, 844 | 137, 845 | 241, 846 | 187, 847 | 61, 848 | 16, 849 | 41, 850 | 20, 851 | 142, 852 | 13, 853 | 131, 854 | 11, 855 | 90, 856 | 19, 857 | 153, 858 | 218, 859 | 255, 860 | 16, 861 | 132, 862 | 4, 863 | 142, 864 | 123, 865 | 216, 866 | 219, 867 | 233, 868 | 248, 869 | 89 870 | ] 871 | } 872 | } 873 | }, 874 | { 875 | name: "user"; 876 | signer: true 877 | }, 878 | { 879 | name: "systemProgram"; 880 | address: "11111111111111111111111111111111" 881 | }, 882 | { 883 | name: "tokenProgram"; 884 | address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 885 | }, 886 | { 887 | name: "metadataAccount"; 888 | pda: { 889 | seeds: [ 890 | { 891 | kind: "const"; 892 | value: [ 893 | 109, 894 | 101, 895 | 116, 896 | 97, 897 | 100, 898 | 97, 899 | 116, 900 | 97 901 | ] 902 | }, 903 | { 904 | kind: "const"; 905 | value: [ 906 | 11, 907 | 112, 908 | 101, 909 | 177, 910 | 227, 911 | 209, 912 | 124, 913 | 69, 914 | 56, 915 | 157, 916 | 82, 917 | 127, 918 | 107, 919 | 4, 920 | 195, 921 | 205, 922 | 88, 923 | 184, 924 | 108, 925 | 115, 926 | 26, 927 | 160, 928 | 253, 929 | 181, 930 | 73, 931 | 182, 932 | 209, 933 | 188, 934 | 3, 935 | 248, 936 | 41, 937 | 70 938 | ] 939 | }, 940 | { 941 | kind: "account"; 942 | path: "mint" 943 | } 944 | ]; 945 | program: { 946 | kind: "const"; 947 | value: [ 948 | 11, 949 | 112, 950 | 101, 951 | 177, 952 | 227, 953 | 209, 954 | 124, 955 | 69, 956 | 56, 957 | 157, 958 | 82, 959 | 127, 960 | 107, 961 | 4, 962 | 195, 963 | 205, 964 | 88, 965 | 184, 966 | 108, 967 | 115, 968 | 26, 969 | 160, 970 | 253, 971 | 181, 972 | 73, 973 | 182, 974 | 209, 975 | 188, 976 | 3, 977 | 248, 978 | 41, 979 | 70 980 | ] 981 | } 982 | } 983 | }, 984 | { 985 | name: "creator"; 986 | docs: [ 987 | "metadata account creators only if creators is not None" 988 | ]; 989 | writable: true 990 | }, 991 | { 992 | name: "pumpAmm"; 993 | address: "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" 994 | }, 995 | { 996 | name: "pool"; 997 | writable: true 998 | }, 999 | { 1000 | name: "poolAuthority"; 1001 | writable: true, 1002 | pda: { 1003 | seeds: [ 1004 | { 1005 | kind: "const"; 1006 | value: [ 1007 | 112, 1008 | 111, 1009 | 111, 1010 | 108, 1011 | 45, 1012 | 97, 1013 | 117, 1014 | 116, 1015 | 104, 1016 | 111, 1017 | 114, 1018 | 105, 1019 | 116, 1020 | 121 1021 | ] 1022 | }, 1023 | { 1024 | kind: "account"; 1025 | path: "mint" 1026 | } 1027 | ] 1028 | } 1029 | }, 1030 | { 1031 | name: "poolAuthorityMintAccount"; 1032 | writable: true 1033 | }, 1034 | { 1035 | name: "poolAuthorityWsolAccount"; 1036 | writable: true 1037 | }, 1038 | { 1039 | name: "ammGlobalConfig" 1040 | }, 1041 | { 1042 | name: "wsolMint"; 1043 | address: "So11111111111111111111111111111111111111112" 1044 | }, 1045 | { 1046 | name: "lpMint"; 1047 | writable: true 1048 | }, 1049 | { 1050 | name: "userPoolTokenAccount"; 1051 | writable: true 1052 | }, 1053 | { 1054 | name: "poolBaseTokenAccount"; 1055 | writable: true 1056 | }, 1057 | { 1058 | name: "poolQuoteTokenAccount"; 1059 | writable: true 1060 | }, 1061 | { 1062 | name: "token2022Program"; 1063 | address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" 1064 | }, 1065 | { 1066 | name: "associatedTokenProgram"; 1067 | address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" 1068 | }, 1069 | { 1070 | name: "pumpAmmEventAuthority" 1071 | }, 1072 | { 1073 | name: "eventAuthority"; 1074 | pda: { 1075 | seeds: [ 1076 | { 1077 | kind: "const"; 1078 | value: [ 1079 | 95, 1080 | 95, 1081 | 101, 1082 | 118, 1083 | 101, 1084 | 110, 1085 | 116, 1086 | 95, 1087 | 97, 1088 | 117, 1089 | 116, 1090 | 104, 1091 | 111, 1092 | 114, 1093 | 105, 1094 | 116, 1095 | 121 1096 | ] 1097 | } 1098 | ] 1099 | } 1100 | }, 1101 | { 1102 | name: "program" 1103 | } 1104 | ]; 1105 | args: [] 1106 | }, 1107 | { 1108 | name: "sell"; 1109 | docs: [ 1110 | "Sells tokens into a bonding curve." 1111 | ]; 1112 | discriminator: [ 1113 | 51, 1114 | 230, 1115 | 133, 1116 | 164, 1117 | 1, 1118 | 127, 1119 | 131, 1120 | 173 1121 | ]; 1122 | accounts: [ 1123 | { 1124 | name: "global"; 1125 | pda: { 1126 | seeds: [ 1127 | { 1128 | kind: "const"; 1129 | value: [ 1130 | 103, 1131 | 108, 1132 | 111, 1133 | 98, 1134 | 97, 1135 | 108 1136 | ] 1137 | } 1138 | ] 1139 | } 1140 | }, 1141 | { 1142 | name: "feeRecipient"; 1143 | writable: true 1144 | }, 1145 | { 1146 | name: "mint" 1147 | }, 1148 | { 1149 | name: "bondingCurve"; 1150 | writable: true, 1151 | pda: { 1152 | seeds: [ 1153 | { 1154 | kind: "const"; 1155 | value: [ 1156 | 98, 1157 | 111, 1158 | 110, 1159 | 100, 1160 | 105, 1161 | 110, 1162 | 103, 1163 | 45, 1164 | 99, 1165 | 117, 1166 | 114, 1167 | 118, 1168 | 101 1169 | ] 1170 | }, 1171 | { 1172 | kind: "account"; 1173 | path: "mint" 1174 | } 1175 | ] 1176 | } 1177 | }, 1178 | { 1179 | name: "associatedBondingCurve"; 1180 | writable: true, 1181 | pda: { 1182 | seeds: [ 1183 | { 1184 | kind: "account"; 1185 | path: "bondingCurve" 1186 | }, 1187 | { 1188 | kind: "const"; 1189 | value: [ 1190 | 6, 1191 | 221, 1192 | 246, 1193 | 225, 1194 | 215, 1195 | 101, 1196 | 161, 1197 | 147, 1198 | 217, 1199 | 203, 1200 | 225, 1201 | 70, 1202 | 206, 1203 | 235, 1204 | 121, 1205 | 172, 1206 | 28, 1207 | 180, 1208 | 133, 1209 | 237, 1210 | 95, 1211 | 91, 1212 | 55, 1213 | 145, 1214 | 58, 1215 | 140, 1216 | 245, 1217 | 133, 1218 | 126, 1219 | 255, 1220 | 0, 1221 | 169 1222 | ] 1223 | }, 1224 | { 1225 | kind: "account"; 1226 | path: "mint" 1227 | } 1228 | ]; 1229 | program: { 1230 | kind: "const"; 1231 | value: [ 1232 | 140, 1233 | 151, 1234 | 37, 1235 | 143, 1236 | 78, 1237 | 36, 1238 | 137, 1239 | 241, 1240 | 187, 1241 | 61, 1242 | 16, 1243 | 41, 1244 | 20, 1245 | 142, 1246 | 13, 1247 | 131, 1248 | 11, 1249 | 90, 1250 | 19, 1251 | 153, 1252 | 218, 1253 | 255, 1254 | 16, 1255 | 132, 1256 | 4, 1257 | 142, 1258 | 123, 1259 | 216, 1260 | 219, 1261 | 233, 1262 | 248, 1263 | 89 1264 | ] 1265 | } 1266 | } 1267 | }, 1268 | { 1269 | name: "associatedUser"; 1270 | writable: true 1271 | }, 1272 | { 1273 | name: "user"; 1274 | writable: true, 1275 | signer: true 1276 | }, 1277 | { 1278 | name: "systemProgram"; 1279 | address: "11111111111111111111111111111111" 1280 | }, 1281 | { 1282 | name: "associatedTokenProgram"; 1283 | docs: [ 1284 | "Unused" 1285 | ]; 1286 | address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" 1287 | }, 1288 | { 1289 | name: "tokenProgram"; 1290 | address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 1291 | }, 1292 | { 1293 | name: "eventAuthority"; 1294 | pda: { 1295 | seeds: [ 1296 | { 1297 | kind: "const"; 1298 | value: [ 1299 | 95, 1300 | 95, 1301 | 101, 1302 | 118, 1303 | 101, 1304 | 110, 1305 | 116, 1306 | 95, 1307 | 97, 1308 | 117, 1309 | 116, 1310 | 104, 1311 | 111, 1312 | 114, 1313 | 105, 1314 | 116, 1315 | 121 1316 | ] 1317 | } 1318 | ] 1319 | } 1320 | }, 1321 | { 1322 | name: "program" 1323 | } 1324 | ]; 1325 | args: [ 1326 | { 1327 | name: "amount"; 1328 | type: "u64" 1329 | }, 1330 | { 1331 | name: "minSolOutput"; 1332 | type: "u64" 1333 | } 1334 | ] 1335 | }, 1336 | { 1337 | name: "setParams"; 1338 | docs: [ 1339 | "Sets the global state parameters." 1340 | ]; 1341 | discriminator: [ 1342 | 27, 1343 | 234, 1344 | 178, 1345 | 52, 1346 | 147, 1347 | 2, 1348 | 187, 1349 | 141 1350 | ]; 1351 | accounts: [ 1352 | { 1353 | name: "global"; 1354 | writable: true, 1355 | pda: { 1356 | seeds: [ 1357 | { 1358 | kind: "const"; 1359 | value: [ 1360 | 103, 1361 | 108, 1362 | 111, 1363 | 98, 1364 | 97, 1365 | 108 1366 | ] 1367 | } 1368 | ] 1369 | } 1370 | }, 1371 | { 1372 | name: "authority"; 1373 | writable: true, 1374 | signer: true, 1375 | relations: [ 1376 | "global" 1377 | ] 1378 | }, 1379 | { 1380 | name: "eventAuthority"; 1381 | pda: { 1382 | seeds: [ 1383 | { 1384 | kind: "const"; 1385 | value: [ 1386 | 95, 1387 | 95, 1388 | 101, 1389 | 118, 1390 | 101, 1391 | 110, 1392 | 116, 1393 | 95, 1394 | 97, 1395 | 117, 1396 | 116, 1397 | 104, 1398 | 111, 1399 | 114, 1400 | 105, 1401 | 116, 1402 | 121 1403 | ] 1404 | } 1405 | ] 1406 | } 1407 | }, 1408 | { 1409 | name: "program" 1410 | } 1411 | ]; 1412 | args: [ 1413 | { 1414 | name: "initialVirtualTokenReserves"; 1415 | type: "u64" 1416 | }, 1417 | { 1418 | name: "initialVirtualSolReserves"; 1419 | type: "u64" 1420 | }, 1421 | { 1422 | name: "initialRealTokenReserves"; 1423 | type: "u64" 1424 | }, 1425 | { 1426 | name: "tokenTotalSupply"; 1427 | type: "u64" 1428 | }, 1429 | { 1430 | name: "feeBasisPoints"; 1431 | type: "u64" 1432 | }, 1433 | { 1434 | name: "withdrawAuthority"; 1435 | type: "pubkey" 1436 | }, 1437 | { 1438 | name: "enableMigrate"; 1439 | type: "bool" 1440 | }, 1441 | { 1442 | name: "poolMigrationFee"; 1443 | type: "u64" 1444 | }, 1445 | { 1446 | name: "creatorFee"; 1447 | type: "u64" 1448 | } 1449 | ] 1450 | }, 1451 | { 1452 | name: "updateGlobalAuthority"; 1453 | discriminator: [ 1454 | 227, 1455 | 181, 1456 | 74, 1457 | 196, 1458 | 208, 1459 | 21, 1460 | 97, 1461 | 213 1462 | ]; 1463 | accounts: [ 1464 | { 1465 | name: "global"; 1466 | writable: true, 1467 | pda: { 1468 | seeds: [ 1469 | { 1470 | kind: "const"; 1471 | value: [ 1472 | 103, 1473 | 108, 1474 | 111, 1475 | 98, 1476 | 97, 1477 | 108 1478 | ] 1479 | } 1480 | ] 1481 | } 1482 | }, 1483 | { 1484 | name: "authority"; 1485 | signer: true, 1486 | relations: [ 1487 | "global" 1488 | ] 1489 | }, 1490 | { 1491 | name: "newAuthority"; 1492 | signer: true 1493 | }, 1494 | { 1495 | name: "eventAuthority"; 1496 | pda: { 1497 | seeds: [ 1498 | { 1499 | kind: "const"; 1500 | value: [ 1501 | 95, 1502 | 95, 1503 | 101, 1504 | 118, 1505 | 101, 1506 | 110, 1507 | 116, 1508 | 95, 1509 | 97, 1510 | 117, 1511 | 116, 1512 | 104, 1513 | 111, 1514 | 114, 1515 | 105, 1516 | 116, 1517 | 121 1518 | ] 1519 | } 1520 | ] 1521 | } 1522 | }, 1523 | { 1524 | name: "program" 1525 | } 1526 | ]; 1527 | args: [] 1528 | }, 1529 | { 1530 | name: "withdraw"; 1531 | docs: [ 1532 | "Allows the admin to withdraw liquidity for a migration once the bonding curve completes" 1533 | ]; 1534 | discriminator: [ 1535 | 183, 1536 | 18, 1537 | 70, 1538 | 156, 1539 | 148, 1540 | 109, 1541 | 161, 1542 | 34 1543 | ]; 1544 | accounts: [ 1545 | { 1546 | name: "global"; 1547 | pda: { 1548 | seeds: [ 1549 | { 1550 | kind: "const"; 1551 | value: [ 1552 | 103, 1553 | 108, 1554 | 111, 1555 | 98, 1556 | 97, 1557 | 108 1558 | ] 1559 | } 1560 | ] 1561 | } 1562 | }, 1563 | { 1564 | name: "lastWithdraw"; 1565 | writable: true, 1566 | pda: { 1567 | seeds: [ 1568 | { 1569 | kind: "const"; 1570 | value: [ 1571 | 108, 1572 | 97, 1573 | 115, 1574 | 116, 1575 | 45, 1576 | 119, 1577 | 105, 1578 | 116, 1579 | 104, 1580 | 100, 1581 | 114, 1582 | 97, 1583 | 119 1584 | ] 1585 | } 1586 | ] 1587 | } 1588 | }, 1589 | { 1590 | name: "mint" 1591 | }, 1592 | { 1593 | name: "bondingCurve"; 1594 | writable: true, 1595 | pda: { 1596 | seeds: [ 1597 | { 1598 | kind: "const"; 1599 | value: [ 1600 | 98, 1601 | 111, 1602 | 110, 1603 | 100, 1604 | 105, 1605 | 110, 1606 | 103, 1607 | 45, 1608 | 99, 1609 | 117, 1610 | 114, 1611 | 118, 1612 | 101 1613 | ] 1614 | }, 1615 | { 1616 | kind: "account"; 1617 | path: "mint" 1618 | } 1619 | ] 1620 | } 1621 | }, 1622 | { 1623 | name: "associatedBondingCurve"; 1624 | writable: true, 1625 | pda: { 1626 | seeds: [ 1627 | { 1628 | kind: "account"; 1629 | path: "bondingCurve" 1630 | }, 1631 | { 1632 | kind: "const"; 1633 | value: [ 1634 | 6, 1635 | 221, 1636 | 246, 1637 | 225, 1638 | 215, 1639 | 101, 1640 | 161, 1641 | 147, 1642 | 217, 1643 | 203, 1644 | 225, 1645 | 70, 1646 | 206, 1647 | 235, 1648 | 121, 1649 | 172, 1650 | 28, 1651 | 180, 1652 | 133, 1653 | 237, 1654 | 95, 1655 | 91, 1656 | 55, 1657 | 145, 1658 | 58, 1659 | 140, 1660 | 245, 1661 | 133, 1662 | 126, 1663 | 255, 1664 | 0, 1665 | 169 1666 | ] 1667 | }, 1668 | { 1669 | kind: "account"; 1670 | path: "mint" 1671 | } 1672 | ]; 1673 | program: { 1674 | kind: "const"; 1675 | value: [ 1676 | 140, 1677 | 151, 1678 | 37, 1679 | 143, 1680 | 78, 1681 | 36, 1682 | 137, 1683 | 241, 1684 | 187, 1685 | 61, 1686 | 16, 1687 | 41, 1688 | 20, 1689 | 142, 1690 | 13, 1691 | 131, 1692 | 11, 1693 | 90, 1694 | 19, 1695 | 153, 1696 | 218, 1697 | 255, 1698 | 16, 1699 | 132, 1700 | 4, 1701 | 142, 1702 | 123, 1703 | 216, 1704 | 219, 1705 | 233, 1706 | 248, 1707 | 89 1708 | ] 1709 | } 1710 | } 1711 | }, 1712 | { 1713 | name: "associatedUser"; 1714 | writable: true 1715 | }, 1716 | { 1717 | name: "user"; 1718 | writable: true, 1719 | signer: true 1720 | }, 1721 | { 1722 | name: "systemProgram"; 1723 | address: "11111111111111111111111111111111" 1724 | }, 1725 | { 1726 | name: "tokenProgram"; 1727 | address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 1728 | }, 1729 | { 1730 | name: "rent"; 1731 | docs: [ 1732 | "Unused" 1733 | ]; 1734 | address: "SysvarRent111111111111111111111111111111111" 1735 | }, 1736 | { 1737 | name: "eventAuthority"; 1738 | pda: { 1739 | seeds: [ 1740 | { 1741 | kind: "const"; 1742 | value: [ 1743 | 95, 1744 | 95, 1745 | 101, 1746 | 118, 1747 | 101, 1748 | 110, 1749 | 116, 1750 | 95, 1751 | 97, 1752 | 117, 1753 | 116, 1754 | 104, 1755 | 111, 1756 | 114, 1757 | 105, 1758 | 116, 1759 | 121 1760 | ] 1761 | } 1762 | ] 1763 | } 1764 | }, 1765 | { 1766 | name: "program" 1767 | } 1768 | ]; 1769 | args: [] 1770 | } 1771 | ]; 1772 | accounts: [ 1773 | { 1774 | name: "BondingCurve"; 1775 | discriminator: [ 1776 | 23, 1777 | 183, 1778 | 248, 1779 | 55, 1780 | 96, 1781 | 216, 1782 | 172, 1783 | 96 1784 | ] 1785 | }, 1786 | { 1787 | name: "Global"; 1788 | discriminator: [ 1789 | 167, 1790 | 232, 1791 | 232, 1792 | 177, 1793 | 200, 1794 | 108, 1795 | 114, 1796 | 127 1797 | ] 1798 | }, 1799 | { 1800 | name: "LastWithdraw"; 1801 | discriminator: [ 1802 | 203, 1803 | 18, 1804 | 220, 1805 | 103, 1806 | 120, 1807 | 145, 1808 | 187, 1809 | 2 1810 | ] 1811 | } 1812 | ]; 1813 | events: [ 1814 | { 1815 | name: "CompleteEvent"; 1816 | discriminator: [ 1817 | 95, 1818 | 114, 1819 | 97, 1820 | 156, 1821 | 212, 1822 | 46, 1823 | 152, 1824 | 8 1825 | ] 1826 | }, 1827 | { 1828 | name: "CompletePumpAmmMigrationEvent"; 1829 | discriminator: [ 1830 | 189, 1831 | 233, 1832 | 93, 1833 | 185, 1834 | 92, 1835 | 148, 1836 | 234, 1837 | 148 1838 | ] 1839 | }, 1840 | { 1841 | name: "CreateEvent"; 1842 | discriminator: [ 1843 | 27, 1844 | 114, 1845 | 169, 1846 | 77, 1847 | 222, 1848 | 235, 1849 | 99, 1850 | 118 1851 | ] 1852 | }, 1853 | { 1854 | name: "ExtendAccountEvent"; 1855 | discriminator: [ 1856 | 97, 1857 | 97, 1858 | 215, 1859 | 144, 1860 | 93, 1861 | 146, 1862 | 22, 1863 | 124 1864 | ] 1865 | }, 1866 | { 1867 | name: "SetParamsEvent"; 1868 | discriminator: [ 1869 | 223, 1870 | 195, 1871 | 159, 1872 | 246, 1873 | 62, 1874 | 48, 1875 | 143, 1876 | 131 1877 | ] 1878 | }, 1879 | { 1880 | name: "TradeEvent"; 1881 | discriminator: [ 1882 | 189, 1883 | 219, 1884 | 127, 1885 | 211, 1886 | 78, 1887 | 230, 1888 | 97, 1889 | 238 1890 | ] 1891 | }, 1892 | { 1893 | name: "UpdateGlobalAuthorityEvent"; 1894 | discriminator: [ 1895 | 182, 1896 | 195, 1897 | 137, 1898 | 42, 1899 | 35, 1900 | 206, 1901 | 207, 1902 | 247 1903 | ] 1904 | } 1905 | ]; 1906 | errors: [ 1907 | { 1908 | code: 6000, 1909 | name: "NotAuthorized"; 1910 | msg: "The given account is not authorized to execute this instruction." 1911 | }, 1912 | { 1913 | code: 6001, 1914 | name: "AlreadyInitialized"; 1915 | msg: "The program is already initialized." 1916 | }, 1917 | { 1918 | code: 6002, 1919 | name: "TooMuchSolRequired"; 1920 | msg: "slippage: Too much SOL required to buy the given amount of tokens." 1921 | }, 1922 | { 1923 | code: 6003, 1924 | name: "TooLittleSolReceived"; 1925 | msg: "slippage: Too little SOL received to sell the given amount of tokens." 1926 | }, 1927 | { 1928 | code: 6004, 1929 | name: "MintDoesNotMatchBondingCurve"; 1930 | msg: "The mint does not match the bonding curve." 1931 | }, 1932 | { 1933 | code: 6005, 1934 | name: "BondingCurveComplete"; 1935 | msg: "The bonding curve has completed and liquidity migrated to raydium." 1936 | }, 1937 | { 1938 | code: 6006, 1939 | name: "BondingCurveNotComplete"; 1940 | msg: "The bonding curve has not completed." 1941 | }, 1942 | { 1943 | code: 6007, 1944 | name: "NotInitialized"; 1945 | msg: "The program is not initialized." 1946 | }, 1947 | { 1948 | code: 6008, 1949 | name: "WithdrawTooFrequent"; 1950 | msg: "Withdraw too frequent" 1951 | }, 1952 | { 1953 | code: 6009, 1954 | name: "NewSizeShouldBeGreaterThanCurrentSize"; 1955 | msg: "newSize should be > currentSize" 1956 | }, 1957 | { 1958 | code: 6010, 1959 | name: "AccountTypeNotSupported"; 1960 | msg: "Account type not supported" 1961 | }, 1962 | { 1963 | code: 6011, 1964 | name: "InitialRealTokenReservesShouldBeLessThanTokenTotalSupply"; 1965 | msg: "initialRealTokenReserves should be less than tokenTotalSupply" 1966 | }, 1967 | { 1968 | code: 6012, 1969 | name: "InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves"; 1970 | msg: "initialVirtualTokenReserves should be greater than initialRealTokenReserves" 1971 | }, 1972 | { 1973 | code: 6013, 1974 | name: "FeeBasisPointsGreaterThanMaximum"; 1975 | msg: "feeBasisPoints greater than maximum" 1976 | }, 1977 | { 1978 | code: 6014, 1979 | name: "AllZerosWithdrawAuthority"; 1980 | msg: "Withdraw authority cannot be set to System Program ID" 1981 | }, 1982 | { 1983 | code: 6015, 1984 | name: "PoolMigrationFeeShouldBeLessThanFinalRealSolReserves"; 1985 | msg: "poolMigrationFee should be less than finalRealSolReserves" 1986 | }, 1987 | { 1988 | code: 6016, 1989 | name: "PoolMigrationFeeShouldBeGreaterThanCreatorFeePlusMaxMigrateFees"; 1990 | msg: "poolMigrationFee should be greater than creatorFee + MAXMIGRATEFEES" 1991 | }, 1992 | { 1993 | code: 6017, 1994 | name: "DisabledWithdraw"; 1995 | msg: "Migrate instruction is disabled" 1996 | }, 1997 | { 1998 | code: 6018, 1999 | name: "DisabledMigrate"; 2000 | msg: "Migrate instruction is disabled" 2001 | }, 2002 | { 2003 | code: 6019, 2004 | name: "InvalidCreator"; 2005 | msg: "Invalid creator pubkey" 2006 | }, 2007 | { 2008 | code: 6020, 2009 | name: "BuyZeroAmount"; 2010 | msg: "Buy zero amount" 2011 | }, 2012 | { 2013 | code: 6021, 2014 | name: "NotEnoughTokensToBuy"; 2015 | msg: "Not enough tokens to buy" 2016 | }, 2017 | { 2018 | code: 6022, 2019 | name: "SellZeroAmount"; 2020 | msg: "Sell zero amount" 2021 | }, 2022 | { 2023 | code: 6023, 2024 | name: "NotEnoughTokensToSell"; 2025 | msg: "Not enough tokens to sell" 2026 | }, 2027 | { 2028 | code: 6024, 2029 | name: "Overflow"; 2030 | msg: "Overflow" 2031 | }, 2032 | { 2033 | code: 6025, 2034 | name: "Truncation"; 2035 | msg: "Truncation" 2036 | }, 2037 | { 2038 | code: 6026, 2039 | name: "DivisionByZero"; 2040 | msg: "Division by zero" 2041 | }, 2042 | { 2043 | code: 6027, 2044 | name: "NotEnoughRemainingAccounts"; 2045 | msg: "Not enough remaining accounts" 2046 | }, 2047 | { 2048 | code: 6028, 2049 | name: "AllFeeRecipientsShouldBeNonZero"; 2050 | msg: "All fee recipients should be non-zero" 2051 | }, 2052 | { 2053 | code: 6029, 2054 | name: "UnsortedNotUniqueFeeRecipients"; 2055 | msg: "Unsorted or not unique fee recipients" 2056 | }, 2057 | { 2058 | code: 6030, 2059 | name: "CreatorShouldNotBeZero"; 2060 | msg: "Creator should not be zero" 2061 | } 2062 | ]; 2063 | types: [ 2064 | { 2065 | name: "BondingCurve"; 2066 | type: { 2067 | kind: "struct"; 2068 | fields: [ 2069 | { 2070 | name: "virtualTokenReserves"; 2071 | type: "u64" 2072 | }, 2073 | { 2074 | name: "virtualSolReserves"; 2075 | type: "u64" 2076 | }, 2077 | { 2078 | name: "realTokenReserves"; 2079 | type: "u64" 2080 | }, 2081 | { 2082 | name: "realSolReserves"; 2083 | type: "u64" 2084 | }, 2085 | { 2086 | name: "tokenTotalSupply"; 2087 | type: "u64" 2088 | }, 2089 | { 2090 | name: "complete"; 2091 | type: "bool" 2092 | } 2093 | ] 2094 | } 2095 | }, 2096 | { 2097 | name: "CompleteEvent"; 2098 | type: { 2099 | kind: "struct"; 2100 | fields: [ 2101 | { 2102 | name: "user"; 2103 | type: "pubkey" 2104 | }, 2105 | { 2106 | name: "mint"; 2107 | type: "pubkey" 2108 | }, 2109 | { 2110 | name: "bondingCurve"; 2111 | type: "pubkey" 2112 | }, 2113 | { 2114 | name: "timestamp"; 2115 | type: "i64" 2116 | } 2117 | ] 2118 | } 2119 | }, 2120 | { 2121 | name: "CompletePumpAmmMigrationEvent"; 2122 | type: { 2123 | kind: "struct"; 2124 | fields: [ 2125 | { 2126 | name: "user"; 2127 | type: "pubkey" 2128 | }, 2129 | { 2130 | name: "mint"; 2131 | type: "pubkey" 2132 | }, 2133 | { 2134 | name: "creator"; 2135 | type: { 2136 | option: "pubkey" 2137 | } 2138 | }, 2139 | { 2140 | name: "mintAmount"; 2141 | type: "u64" 2142 | }, 2143 | { 2144 | name: "solAmount"; 2145 | type: "u64" 2146 | }, 2147 | { 2148 | name: "poolMigrationFee"; 2149 | type: "u64" 2150 | }, 2151 | { 2152 | name: "creatorFee"; 2153 | type: "u64" 2154 | }, 2155 | { 2156 | name: "bondingCurve"; 2157 | type: "pubkey" 2158 | }, 2159 | { 2160 | name: "timestamp"; 2161 | type: "i64" 2162 | }, 2163 | { 2164 | name: "pool"; 2165 | type: "pubkey" 2166 | } 2167 | ] 2168 | } 2169 | }, 2170 | { 2171 | name: "CreateEvent"; 2172 | type: { 2173 | kind: "struct"; 2174 | fields: [ 2175 | { 2176 | name: "name"; 2177 | type: "string" 2178 | }, 2179 | { 2180 | name: "symbol"; 2181 | type: "string" 2182 | }, 2183 | { 2184 | name: "uri"; 2185 | type: "string" 2186 | }, 2187 | { 2188 | name: "mint"; 2189 | type: "pubkey" 2190 | }, 2191 | { 2192 | name: "bondingCurve"; 2193 | type: "pubkey" 2194 | }, 2195 | { 2196 | name: "user"; 2197 | type: "pubkey" 2198 | }, 2199 | { 2200 | name: "creator"; 2201 | type: "pubkey" 2202 | }, 2203 | { 2204 | name: "timestamp"; 2205 | type: "i64" 2206 | } 2207 | ] 2208 | } 2209 | }, 2210 | { 2211 | name: "ExtendAccountEvent"; 2212 | type: { 2213 | kind: "struct"; 2214 | fields: [ 2215 | { 2216 | name: "account"; 2217 | type: "pubkey" 2218 | }, 2219 | { 2220 | name: "user"; 2221 | type: "pubkey" 2222 | }, 2223 | { 2224 | name: "currentSize"; 2225 | type: "u64" 2226 | }, 2227 | { 2228 | name: "newSize"; 2229 | type: "u64" 2230 | }, 2231 | { 2232 | name: "timestamp"; 2233 | type: "i64" 2234 | } 2235 | ] 2236 | } 2237 | }, 2238 | { 2239 | name: "Global"; 2240 | type: { 2241 | kind: "struct"; 2242 | fields: [ 2243 | { 2244 | name: "initialized"; 2245 | type: "bool" 2246 | }, 2247 | { 2248 | name: "authority"; 2249 | type: "pubkey" 2250 | }, 2251 | { 2252 | name: "feeRecipient"; 2253 | type: "pubkey" 2254 | }, 2255 | { 2256 | name: "initialVirtualTokenReserves"; 2257 | type: "u64" 2258 | }, 2259 | { 2260 | name: "initialVirtualSolReserves"; 2261 | type: "u64" 2262 | }, 2263 | { 2264 | name: "initialRealTokenReserves"; 2265 | type: "u64" 2266 | }, 2267 | { 2268 | name: "tokenTotalSupply"; 2269 | type: "u64" 2270 | }, 2271 | { 2272 | name: "feeBasisPoints"; 2273 | type: "u64" 2274 | }, 2275 | { 2276 | name: "withdrawAuthority"; 2277 | type: "pubkey" 2278 | }, 2279 | { 2280 | name: "enableMigrate"; 2281 | type: "bool" 2282 | }, 2283 | { 2284 | name: "poolMigrationFee"; 2285 | type: "u64" 2286 | }, 2287 | { 2288 | name: "creatorFee"; 2289 | type: "u64" 2290 | }, 2291 | { 2292 | name: "feeRecipients"; 2293 | type: { 2294 | array: [ 2295 | "pubkey", 2296 | 7 2297 | ] 2298 | } 2299 | } 2300 | ] 2301 | } 2302 | }, 2303 | { 2304 | name: "LastWithdraw"; 2305 | type: { 2306 | kind: "struct"; 2307 | fields: [ 2308 | { 2309 | name: "lastWithdrawTimestamp"; 2310 | type: "i64" 2311 | } 2312 | ] 2313 | } 2314 | }, 2315 | { 2316 | name: "SetParamsEvent"; 2317 | type: { 2318 | kind: "struct"; 2319 | fields: [ 2320 | { 2321 | name: "initialVirtualTokenReserves"; 2322 | type: "u64" 2323 | }, 2324 | { 2325 | name: "initialVirtualSolReserves"; 2326 | type: "u64" 2327 | }, 2328 | { 2329 | name: "initialRealTokenReserves"; 2330 | type: "u64" 2331 | }, 2332 | { 2333 | name: "finalRealSolReserves"; 2334 | type: "u64" 2335 | }, 2336 | { 2337 | name: "tokenTotalSupply"; 2338 | type: "u64" 2339 | }, 2340 | { 2341 | name: "feeBasisPoints"; 2342 | type: "u64" 2343 | }, 2344 | { 2345 | name: "withdrawAuthority"; 2346 | type: "pubkey" 2347 | }, 2348 | { 2349 | name: "enableMigrate"; 2350 | type: "bool" 2351 | }, 2352 | { 2353 | name: "poolMigrationFee"; 2354 | type: "u64" 2355 | }, 2356 | { 2357 | name: "creatorFee"; 2358 | type: "u64" 2359 | }, 2360 | { 2361 | name: "feeRecipients"; 2362 | type: { 2363 | array: [ 2364 | "pubkey", 2365 | 8 2366 | ] 2367 | } 2368 | }, 2369 | { 2370 | name: "timestamp"; 2371 | type: "i64" 2372 | } 2373 | ] 2374 | } 2375 | }, 2376 | { 2377 | name: "TradeEvent"; 2378 | type: { 2379 | kind: "struct"; 2380 | fields: [ 2381 | { 2382 | name: "mint"; 2383 | type: "pubkey" 2384 | }, 2385 | { 2386 | name: "solAmount"; 2387 | type: "u64" 2388 | }, 2389 | { 2390 | name: "tokenAmount"; 2391 | type: "u64" 2392 | }, 2393 | { 2394 | name: "isBuy"; 2395 | type: "bool" 2396 | }, 2397 | { 2398 | name: "user"; 2399 | type: "pubkey" 2400 | }, 2401 | { 2402 | name: "timestamp"; 2403 | type: "i64" 2404 | }, 2405 | { 2406 | name: "virtualSolReserves"; 2407 | type: "u64" 2408 | }, 2409 | { 2410 | name: "virtualTokenReserves"; 2411 | type: "u64" 2412 | }, 2413 | { 2414 | name: "realSolReserves"; 2415 | type: "u64" 2416 | }, 2417 | { 2418 | name: "realTokenReserves"; 2419 | type: "u64" 2420 | } 2421 | ] 2422 | } 2423 | }, 2424 | { 2425 | name: "UpdateGlobalAuthorityEvent"; 2426 | type: { 2427 | kind: "struct"; 2428 | fields: [ 2429 | { 2430 | name: "global"; 2431 | type: "pubkey" 2432 | }, 2433 | { 2434 | name: "authority"; 2435 | type: "pubkey" 2436 | }, 2437 | { 2438 | name: "newAuthority"; 2439 | type: "pubkey" 2440 | }, 2441 | { 2442 | name: "timestamp"; 2443 | type: "i64" 2444 | } 2445 | ] 2446 | } 2447 | } 2448 | ] 2449 | } 2450 | --------------------------------------------------------------------------------