pub trait Event {
    fn to_event_string(&self) -> String;
    fn emit(&self);
}
Expand description

Emit events according to the NEP-297 event standard.

Examples

Normal events

use near_contract_tools::event;

#[event(standard = "nft", version = "1.0.0")]
pub struct MintEvent {
    pub owner_id: String,
    pub token_id: String,
}

let e = MintEvent {
    owner_id: "account".to_string(),
    token_id: "token_1".to_string(),
};

use near_contract_tools::standard::nep297::Event;

e.emit();

Required Methods§

Converts the event into an NEP-297 event-formatted string

Emits the event string to the blockchain

Implementors§