EVENT_JSON: followed by a JSON object with a fixed schema:
Defining and Emitting Events
- 🦀 Rust
- 🌐 JavaScript
The Call The macro automatically serializes the enum variant to the
near-sdk provides a high-level macro-based API for defining and emitting events. Annotate an enum with #[near(event_json(standard = "..."))] and mark each variant with #[event_version("...")]..emit() on an event variant to write it to the on-chain log:EVENT_JSON: format and calls env::log_str under the hood.Custom Events
You are not limited to standard NEP events. Define your own standard name for application-specific activity:- 🦀 Rust
- 🌐 JavaScript
Standard Events (FT & NFT)
If you are implementing Fungible Tokens or Non-Fungible Tokens, the standard events are already defined:- NEP-141 (FT):
ft_transfer,ft_mint,ft_burn— see the Fungible Token docs. - NEP-171 (NFT):
nft_mint,nft_transfer,nft_burn— see the Non-Fungible Token docs.
Consuming Events with Indexers
Emitted events are stored as transaction logs on-chain and can be consumed by any indexer that listens forEVENT_JSON: prefixed log lines. See the NFT Indexer tutorial for a step-by-step example of parsing NFT events from the blockchain.