/** * Event Parser for Moonshot Blindbox Smart Contract * * This class handles parsing of event CPI (Cross-Program Invocation) data from transaction logs. * It automatically decodes events emitted by the smart contract and provides utilities * for event management and validation. * * The decoder registry is auto-generated based on IDL events, making it easy to add * new events without manual updates. * * @example * ```typescript * import { EventParser } from '@moonshot-blindbox/sdk'; * * // Parse event CPI data * const result = EventParser.parseEventCPI(eventCPIData); * console.log(`Event: ${result.name}`, result.data); * * // Get available events * const events = EventParser.getAvailableEvents(); * console.log('Available events:', events); * * // Check if event is supported * const isSupported = EventParser.isEventSupported('BuyEvent'); * console.log('BuyEvent supported:', isSupported); * ``` */ export declare class EventParser { /** * Parses event CPI data from a transaction log. * * This method takes raw event CPI data and decodes it into a structured format * with the event name and parsed data. It automatically matches the event * discriminator and uses the appropriate decoder. * * @param eventCPIData - The base58 encoded event CPI data from transaction logs * @returns An object containing the parsed event data and its name * @throws Error if the event CPI has an invalid tag, no event is matched, or the decoder function is not available * * @example * ```typescript * // Parse event from transaction * const eventCPIData = Buffer.from(base58EncodedData, 'base58'); * const result = EventParser.parseEventCPI(eventCPIData); * * if (result.name === 'BuyEvent') { * console.log('Purchase made:', result.data); * } * ``` */ static parseEventCPI(eventCPIData: Buffer): { data: any; name: string; }; /** * Returns a list of all available event names from the IDL. * * This method provides a way to discover what events are available * in the current version of the smart contract. * * @returns An array of event names that can be parsed * * @example * ```typescript * const events = EventParser.getAvailableEvents(); * console.log('Available events:', events); * // Output: ['BuyEvent', 'CreateCampaignEvent', 'AddCampaignItemEvent', ...] * ``` */ static getAvailableEvents(): string[]; /** * Checks if a given event name is supported by the parser. * * This method verifies whether the parser has a decoder function * available for the specified event type. * * @param eventName - The name of the event to check (e.g., 'BuyEvent', 'CreateCampaignEvent') * @returns True if the event is supported and can be parsed, false otherwise * * @example * ```typescript * const isBuySupported = EventParser.isEventSupported('BuyEvent'); * console.log('BuyEvent supported:', isBuySupported); // true * * const isCustomSupported = EventParser.isEventSupported('CustomEvent'); * console.log('CustomEvent supported:', isCustomSupported); // false * ``` */ static isEventSupported(eventName: string): boolean; } //# sourceMappingURL=EventParser.d.ts.map