mirror of
https://github.com/chainstacklabs/pumpfun-bonkfun-bot.git
synced 2026-08-04 11:17:45 +00:00
fix(examples): align listeners and decoders with refreshed pump.fun IDL
Refreshes the read-only learning examples (Phase A3) against the post
Feb–Apr 2026 IDL changes:
- CreateEvent now has 15 fields (timestamp, 4×u64 reserves, token_program,
is_mayhem_mode, is_cashback_enabled). Listener parsers were truncating
after `creator`; the v2 ones were also reading is_mayhem_mode at the
wrong offset.
- BondingCurve account is now 83 bytes (added is_cashback_coin).
- PumpSwap Pool account is now 245 bytes (added is_cashback_coin) — the
listen_programsubscribe dataSize filter was matching nothing.
- IDL instruction `createV2` was renamed to `create_v2`; the legacy
`create` instruction added a `creator: pubkey` arg in March 2026.
- decode_from_blockSubscribe.py decoder now handles bool, i64, u32, u16,
u8, and the OptionBool defined type (1-byte wire format).
Files touched (all under learning-examples/):
bonding-curve-progress/get_bonding_curve_status.py — V4 struct (cashback)
bonding-curve-progress/poll_bonding_curve_progress.py
decode_from_blockSubscribe.py
decode_from_getAccountInfo.py
decode_from_getTransaction.py
listen-migrations/compare_migration_listeners.py
listen-migrations/listen_programsubscribe.py
listen-new-tokens/compare_listeners.py
listen-new-tokens/listen_blocksubscribe.py
listen-new-tokens/listen_geyser.py
listen-new-tokens/listen_logsubscribe.py
listen-new-tokens/listen_logsubscribe_abc.py
Verified live against mainnet — listeners decode tokens including
mayhem-mode and cashback-enabled curves correctly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,8 +27,10 @@ print(json.dumps(tx_data, indent=2))
|
||||
|
||||
|
||||
def decode_create_instruction(data):
|
||||
"""Decode legacy Create instruction (Metaplex tokens)."""
|
||||
# The Create instruction has 3 string arguments: name, symbol, uri
|
||||
"""Decode legacy Create instruction (Metaplex tokens).
|
||||
|
||||
IDL args (March 7, 2026 program upgrade): name, symbol, uri, creator (pubkey).
|
||||
"""
|
||||
offset = 8 # Skip the 8-byte discriminator
|
||||
results = []
|
||||
for _ in range(3):
|
||||
@@ -37,18 +39,25 @@ def decode_create_instruction(data):
|
||||
string_data = data[offset : offset + length].decode("utf-8")
|
||||
results.append(string_data)
|
||||
offset += length
|
||||
|
||||
creator = base58.b58encode(data[offset : offset + 32]).decode("utf-8") if offset + 32 <= len(data) else None
|
||||
|
||||
return {
|
||||
"name": results[0],
|
||||
"symbol": results[1],
|
||||
"uri": results[2],
|
||||
"creator": creator,
|
||||
"token_standard": "legacy",
|
||||
"is_mayhem_mode": False,
|
||||
}
|
||||
|
||||
|
||||
def decode_create_v2_instruction(data):
|
||||
"""Decode CreateV2 instruction (Token2022 tokens)."""
|
||||
# The CreateV2 instruction has 3 string arguments: name, symbol, uri + is_mayhem_mode
|
||||
"""Decode CreateV2 instruction (Token2022 tokens).
|
||||
|
||||
IDL args: name, symbol, uri, creator (pubkey), is_mayhem_mode (bool),
|
||||
is_cashback_enabled (OptionBool = 1 byte).
|
||||
"""
|
||||
offset = 8 # Skip the 8-byte discriminator
|
||||
results = []
|
||||
for _ in range(3):
|
||||
@@ -58,20 +67,22 @@ def decode_create_v2_instruction(data):
|
||||
results.append(string_data)
|
||||
offset += length
|
||||
|
||||
# Skip creator pubkey (32 bytes)
|
||||
creator = base58.b58encode(data[offset : offset + 32]).decode("utf-8") if offset + 32 <= len(data) else None
|
||||
offset += 32
|
||||
|
||||
# Parse is_mayhem_mode (OptionBool at the end)
|
||||
is_mayhem_mode = False
|
||||
if offset < len(data):
|
||||
is_mayhem_mode = bool(data[offset])
|
||||
is_mayhem_mode = bool(data[offset]) if offset < len(data) else False
|
||||
offset += 1
|
||||
|
||||
is_cashback_enabled = bool(data[offset]) if offset < len(data) else False
|
||||
|
||||
return {
|
||||
"name": results[0],
|
||||
"symbol": results[1],
|
||||
"uri": results[2],
|
||||
"creator": creator,
|
||||
"token_standard": "token2022",
|
||||
"is_mayhem_mode": is_mayhem_mode,
|
||||
"is_cashback_enabled": is_cashback_enabled,
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +95,7 @@ def decode_buy_instruction(data):
|
||||
def decode_instruction_data(instruction, accounts, data):
|
||||
if instruction["name"] == "create":
|
||||
return decode_create_instruction(data)
|
||||
elif instruction["name"] == "createV2":
|
||||
elif instruction["name"] == "create_v2":
|
||||
return decode_create_v2_instruction(data)
|
||||
elif instruction["name"] == "buy":
|
||||
return decode_buy_instruction(data)
|
||||
|
||||
Reference in New Issue
Block a user