import base64 import hashlib import json import struct import sys from solders.transaction import Transaction, VersionedTransaction def load_idl(file_path): with open(file_path) as f: return json.load(f) def load_transaction(file_path): with open(file_path) as f: data = json.load(f) return data def decode_instruction(ix_data, ix_def): """Decode an instruction's args based on its IDL definition. Supports the primitive scalar types and the `OptionBool` defined type (added in the late-Feb 2026 cashback upgrade — `OptionBool` is a struct wrapping a single bool, so it serializes as 1 byte on the wire). """ args = {} offset = 8 # Skip 8-byte discriminator for arg in ix_def["args"]: t = arg["type"] if t == "u64": value = struct.unpack_from("