import json import struct import sys import base58 tx_file_path = "" if len(sys.argv) != 2: tx_file_path = "learning-examples/raw_buy_tx_from_getTransaction.json" print(f"No path provided, using the path: {tx_file_path}") else: tx_file_path = sys.argv[1] # Load the IDL with open("idl/pump_fun_idl.json") as f: idl = json.load(f) # Load the transaction log with open(tx_file_path) as f: tx_log = json.load(f) # Extract the transaction data tx_data = tx_log["result"]["transaction"] print(json.dumps(tx_data, indent=2)) def decode_create_instruction(data): """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): length = struct.unpack_from("