/** * Event Parser * * Parses events emitted by sui_ptb_resolver during dry-run execution. * Reconstructs OffchainLookup and PTB instructions from event data. */ import type { SuiClientTypes } from '@mysten/sui/client'; import type { ParsedResolverEvent } from '../types/index.js'; /** * gRPC event shape (from simulateTransaction). `bcs` is already raw bytes (no * base64), and `json` shape varies across APIs — so we always parse `bcs`. */ type GrpcEvent = SuiClientTypes.Event; export declare class EventParser { /** * Parse resolver events from a gRPC simulateTransaction result. * @param events - Events from the simulated transaction * @returns Parsed event result * @throws Error if no resolver event found or parsing fails */ parseResolverEvent(events: GrpcEvent[]): ParsedResolverEvent; private parseNeedsDataEvent; private parseInstructionsEvent; private transformEnum; /** * Reconstruct OffchainLookup from event data * * The lookup_key format depends on the lookup type: * - DynamicFieldByType: type_suffix + 0xff + extract_field * - TableItem (raw key): table_path + 0xff + raw_key * - TableItem (structured key): table_path + 0xff + num_fields(1) + [name_len(1) + name + value_len(2) + value]* * - DynamicField: raw key bytes * - ObjectField: field_path bytes * - DynamicObjectField: raw key bytes * * @param parentObject - Parent object address (32 bytes) * @param lookupKey - Lookup key bytes (format depends on type) * @param keyType - Move type string for table keys (empty for non-table lookups) * @param placeholderName - Semantic key for discovered data * @returns Reconstructed OffchainLookup */ private reconstructLookup; /** * Try to parse length-prefixed structured key fields * * Format: num_fields(1 byte) + [name_len(1 byte) + name + value_len(2 bytes big-endian) + value]* * * @param data - Byte array starting with num_fields * @returns Array of {name, value} pairs or null if parsing fails */ private tryParseLengthPrefixedFields; } export {}; //# sourceMappingURL=event-parser.d.ts.map