Query/Subscribe for messages(events)

How to work with contract event

How to work with contract events

About messages

Account messages are of 3 types:

  • External inbound (msg_type=1 or ExtIn ). It is for example, deploy message or run message.

  • Internal message(msg_type=0). It is when one contract calls another contract it sends an internal message. These messages are constructed with target contract ABI. Can be of 2 subtypes:

    • Internal inbound (IntIn)

    • Internal outbound (IntOut)

  • External outbound messages(msg_type=2 or ExtOut). These can be of 2 subtypes:

Query/subscribe to messages

You can fetch events of you contract like this:

Or subscribe to them:

Usage

Query

See the full sample here https://github.com/everx-labs/sdk-samples/tree/master/core-examples/node-js/paginationarrow-up-right

Read about used API here -> Account messages paginationarrow-up-right.

Subscribe

See the full sample here https://github.com/everx-labs/sdk-samples/tree/master/core-examples/node-js/subscribe-and-decodearrow-up-right

To subscribe to all this. Don't forget to specify your own callback.

Decode

See the full sample here https://github.com/everx-labs/sdk-samples/tree/master/core-examples/node-js/subscribe-and-decodearrow-up-right

Check out AppKit documentationarrow-up-right for this use case.

Last updated