-
Notifications
You must be signed in to change notification settings - Fork 822
Closed
Labels
Type: bugSomething isn't workingSomething isn't working
Description
Encounter issue with parsing events emitted by components:
Sample of code (just take any events that emitted in nested components):
const eventsC = provider.getEvents(....)
const abiEvents = STARKNETJS.events.getAbiEvents(abi);
const abiStructs = STARKNETJS.CallData.getAbiStruct(abi);
const abiEnums = STARKNETJS.CallData.getAbiEnum(abi);
let parsedEvents = STARKNETJS.events.parseEvents(eventsC.events, abiEvents, abiStructs, abiEnums)
console.log(parsedEvents)
produces 0 parsed events
Reason: AbiEvents not handle correctly case for nested events when they defined by extra key that associated with component. In my particular case second key was the correct one to do lookup to abiEvents
Potential solution:
let abiEvent: EventAbi | undefined;
// Loop through all keys and find the first matching event
for (const key of recEvent.keys) {
abiEvent = abiEvents[key];
if (abiEvent) {
break; // Exit the loop once a match is found
}
}
iterate over all keys/or first N instead of just first one. I presume there should be no collisions
Metadata
Metadata
Assignees
Labels
Type: bugSomething isn't workingSomething isn't working