Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle "events" in abi registry #343

Merged
merged 10 commits into from
Nov 13, 2023
Merged

Handle "events" in abi registry #343

merged 10 commits into from
Nov 13, 2023

Conversation

andreibancioiu
Copy link
Contributor

@andreibancioiu andreibancioiu commented Oct 25, 2023

Implement ResultsParser.parseEvent().

Usage example:

const eventDefinition = abiRegistry.getEvent("deposit");

// Can be taken from a "TransactionOnNetwork" object
const event = new TransactionEvent({
    identifier: "deposit",
    topics: [
        new TransactionEventTopic("ZGVwb3NpdA=="),
        new TransactionEventTopic("cmzC1LRt1r10pMhNAnFb+FyudjGMq4G8CefCYdQUmmc="),
        new TransactionEventTopic("AAAADFdFR0xELTAxZTQ5ZAAAAAAAAAAAAAAAAWQ="),
    ],
    dataPayload: new TransactionEventData(Buffer.from("AAAAAAAAA9sAAAA=", "base64"))
});

const bundle = parser.parseEvent(event, eventDefinition);
console.log(bundle);

A few examples will be added in this PR:
multiversx/mx-sdk-js-examples#28

Related PR on network-providers (required to decode events for Sirius / Node v1.6.0 - as of 13th November 2023, on Testnet):
multiversx/mx-sdk-js-network-providers#49

@andreibancioiu andreibancioiu self-assigned this Oct 25, 2023
Base automatically changed from array48 to main October 26, 2023 09:05
@andreibancioiu andreibancioiu marked this pull request as ready for review October 26, 2023 19:48
@andreibancioiu
Copy link
Contributor Author

Should fix #285.

dragos-rebegea
dragos-rebegea previously approved these changes Oct 30, 2023
@andreibancioiu andreibancioiu merged commit 082876a into main Nov 13, 2023
1 check passed
@andreibancioiu andreibancioiu deleted the abi-events branch November 13, 2023 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants