Appearance
Process and Analyze Different Contract Related Events
To process and analyze different contract-related events, you can use various methods provided by the respective contract classes. Here are some examples:
DIDRegistryContract:
processSetAttributeEvents: This method processes
DIDAttributeChanged
events to return the latest attributes. You need to provide an array of DID attribute change events, each containing the attribute name and values.javascriptconst processedEvents = await didManager.processSetAttributeEvents([ { name: "publicKey", value: eventDetails }, { name: "serviceEndpoint", value: moreEventDetails } ]);
getDIDEventDetails: This method extracts and processes details of DID-related blockchain events. You need to provide raw event data, the event name, and a mapping of event names to attribute structures.
javascriptconst eventDetails = await didManager.getDIDEventDetails( rawBlockchainEvents, "DIDAttributeChanged", customEventStructure );
getDIDEvents: This method retrieves and processes all DID-related events for a specific identity. You need to provide the DID registry contract, the Ethereum address associated with the DID, and a mapping of event names to attribute structures.
javascriptconst allDIDEvents = await didManager.getDIDEvents( didRegistryContract, "0xIdentityAddress", eventStructMapping );
PaymentCommitmentContract:
dischargeRefutationDetails: This method retrieves details of refutation events.
javascriptconst details = await contract.dischargeRefutationDetails();
refutationsTimeline: This method fetches the refutation timeline based on events.
javascriptconst timeline = await contract.refutationsTimeline();
TokenExchange1155Contract:
refutationDetails: This method retrieves the details of refutation events, including exchange refutations and refutation nullifications.
javascriptconst refutationDetails = await contract.refutationDetails();
refutationsTimeline: This method fetches the refutation timeline based on
ExchangeRefuted
andRefutationNullified
events.javascriptconst refutationTimeline = await contract.refutationsTimeline();
By using these methods, you can effectively process and analyze various contract-related events for different types of contracts.