Skip to content

fix: update IDL and buy/sell for current pump.fun program (Mar 2026)#129

Open
venkat22022202 wants to merge 1 commit into
rckprtr:mainfrom
venkat22022202:fix/update-idl-and-accounts-for-current-program
Open

fix: update IDL and buy/sell for current pump.fun program (Mar 2026)#129
venkat22022202 wants to merge 1 commit into
rckprtr:mainfrom
venkat22022202:fix/update-idl-and-accounts-for-current-program

Conversation

@venkat22022202
Copy link
Copy Markdown

Summary

The pump.fun on-chain program has been updated multiple times since this SDK's last release. All buy, sell, and create operations are broken because the SDK passes an outdated set of accounts. This PR brings the SDK fully up to date with the current on-chain program (as of March 2026).

What changed on-chain (since this SDK was last updated)

  1. Creator fee system — new creator_vault PDA account required on buy/sell
  2. Fee program integration — dynamic fee tiers via external fee program (pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ), requires fee_config and fee_program accounts
  3. Volume trackingglobal_volume_accumulator and user_volume_accumulator PDAs required on buy
  4. Cashback systemis_cashback_coin field on BondingCurve
  5. Mayhem modeis_mayhem_mode field on BondingCurve, Token2022 support via create_v2
  6. New buy instructionbuy_exact_sol_in for exact-SOL-input purchases

What this PR changes

IDL (src/IDL/pump-fun.json)

  • Replaced with the official IDL from pump-fun/pump-public-docs (March 2026)
  • Contains all 29 current instructions, 6 account types, 22 events, and 56 error codes

BondingCurveAccount (src/bondingCurveAccount.ts)

  • Added fields: creator (PublicKey), isMayhemMode (boolean), isCashbackCoin (boolean)
  • Updated fromBuffer() deserialization to read new fields

GlobalAccount (src/globalAccount.ts)

  • Added fields: withdrawAuthority, enableMigrate, poolMigrationFee, creatorFeeBasisPoints, feeRecipients (7 pubkeys), setCreatorAuthority
  • Added getTotalFeeBasisPoints() helper (protocol + creator fees)
  • Updated fromBuffer() deserialization

Buy instructions (src/pumpfun.ts)

  • Now passes all 16 required accounts: global, feeRecipient, mint, bondingCurve, associatedBondingCurve, associatedUser, user, systemProgram, tokenProgram, creatorVault, eventAuthority, program, globalVolumeAccumulator, userVolumeAccumulator, feeConfig, feeProgram
  • Passes track_volume: null as third argument for backward compatibility

Sell instructions (src/pumpfun.ts)

  • Now passes all 14 required accounts including creatorVault, feeConfig, feeProgram
  • Sell price calculation now accounts for both protocol and creator fees

PDA helpers

  • Added: getCreatorVaultPDA(), getEventAuthorityPDA(), getGlobalVolumeAccumulatorPDA(), getUserVolumeAccumulatorPDA(), getFeeConfigPDA(), getGlobalPDA()

Browser compatibility

  • Fixed: use Uint8Array instead of Buffer at module scope to avoid "Buffer is not defined" in browsers

Account ordering reference

The on-chain program uses different account orderings for buy and sell:

Buy (16 accounts):

Idx Account
0 global
1 fee_recipient
2 mint
3 bonding_curve
4 associated_bonding_curve
5 associated_user
6 user
7 system_program
8 token_program
9 creator_vault
10 event_authority
11 program
12 global_volume_accumulator
13 user_volume_accumulator
14 fee_config
15 fee_program

Sell (14 accounts):

Idx Account
0 global
1 fee_recipient
2 mint
3 bonding_curve
4 associated_bonding_curve
5 associated_user
6 user
7 system_program
8 creator_vault
9 token_program
10 event_authority
11 program
12 fee_config
13 fee_program

Note: creator_vault and token_program are swapped between buy (idx 8,9) and sell (idx 9,8).

Test plan

  • TypeScript compiles cleanly (npx tsc --noEmit)
  • ESM build passes
  • CJS build passes
  • Browser build passes (fixed Buffer issue)
  • Buy transaction on devnet
  • Sell transaction on devnet
  • Create token on devnet

Fixes #108, #109, #112, #120
Supersedes #112 (which only added creator_vault but is missing fee_program, volume accumulators, and fee_config accounts added in later program updates)

🤖 Generated with Claude Code

…ogram

The on-chain pump program has been updated multiple times since this SDK's
last release, adding creator fees, fee program integration, volume tracking,
cashback, and mayhem mode support. This broke all buy/sell/create operations.

Changes:
- Replace IDL with the official one from pump-fun/pump-public-docs (Mar 2026)
- Update BondingCurveAccount: add creator, isMayhemMode, isCashbackCoin fields
- Update GlobalAccount: add creatorFeeBasisPoints, feeRecipients,
  withdrawAuthority, enableMigrate, poolMigrationFee, setCreatorAuthority
- Update buy instructions to pass all 16 required accounts:
  creator_vault, global_volume_accumulator, user_volume_accumulator,
  fee_config, fee_program
- Update sell instructions to pass all 14 required accounts
- Update sell price calculation to include creator fees
- Add PDA derivation helpers for all new accounts
- Fix browser compatibility (use Uint8Array instead of Buffer at module level)

Fixes rckprtr#108, rckprtr#109, rckprtr#112, rckprtr#120

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pump.fun new IDL

1 participant