Solana Program Documentation

This program allows you to specify the exact amount of SOL to spend, rather than the amount of tokens to buy as in usual pump fun programs.

How to Use

  1. Use the program ID: 6sbiyZ7mLKmYkES2AKYPHtg4FjQMaqVx3jTHez6ZtfmX.
  2. The accounts remain the same as in the buy instruction.
  3. The data contains only LE-encoded 8 bytes representing the amount of lamports to spend.

This program is free and open source.

Example

Preview in explorer

const web3 = require('@solana/web3.js')
const splToken = require('@solana/spl-token')
const programId = new web3.PublicKey("6sbiyZ7mLKmYkES2AKYPHtg4FjQMaqVx3jTHez6ZtfmX")
const connection = new web3.Connection('https://testnetpump.fun:18899')
const signer = web3.Keypair.fromSecretKey(new Uint8Array([]))
const mint = new web3.PublicKey("F9Feoq4xrH5wf8CrSQtsbWaihAw7s4AtVVyMM5QuMYnU")
const ata = splToken.getAssociatedTokenAddressSync(mint, signer.publicKey)
const createAtaIx = splToken.createAssociatedTokenAccountIdempotentInstruction(signer.publicKey, ata, signer.publicKey, mint)
const solAmount = 2525000000n
const data = Buffer.alloc(8)
data.writeBigUInt64LE(solAmount)
const instruction = new web3.TransactionInstruction({
    keys: [
        {pubkey: new web3.PublicKey("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"), isSigner: false, isWritable: false},
        {pubkey: new web3.PublicKey("CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM"), isSigner: false, isWritable: true},
        {pubkey: mint, isSigner: false, isWritable: false},
        {pubkey: new web3.PublicKey("EfxG8nkXVbMfDcBScmJXwhEKRU4nVU72VBdVo67Sn5MH"), isSigner: false, isWritable: true},
        {pubkey: new web3.PublicKey("F9vPmsLgjm4o9n4AqXPPNvKo4RNuTwwG2Fba2YgZAmqh"), isSigner: false, isWritable: true},
        {pubkey: ata, isSigner: false, isWritable: true},
        {pubkey: signer.publicKey, isSigner: true, isWritable: true},
        {pubkey: new web3.PublicKey("11111111111111111111111111111111"), isSigner: false, isWritable: true},
        {pubkey: new web3.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), isSigner: false, isWritable: true},
        {pubkey: new web3.PublicKey("SysvarRent111111111111111111111111111111111"), isSigner: false, isWritable: true},
        {pubkey: new web3.PublicKey("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"), isSigner: false, isWritable: true},
        {pubkey: new web3.PublicKey("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"), isSigner: false, isWritable: true},
    ],
    programId,
    data
})
const tx = new web3.Transaction().add(createAtaIx, instruction)
connection.sendTransaction(tx, [signer]).then(console.log).catch(console.error)

Credits

This program was created by the W3E team