Events Emitted
Crystara's smart contracts emit various events that you can listen for and process to track activities on the platform. This page documents all events emitted by Crystara contracts on both Testnet and Mainnet.
Contract Information
All Crystara contracts are deployed at the same address on both Testnet and Mainnet, but with different module names:
Contract Address: 0xfd566b048d7ea241ebd4d28a3d60a9eaaaa29a718dfff52f2ff4ca8581363b85
Module Names
Feature | Testnet Module Name | Mainnet Module Name |
---|---|---|
Blind Box | BlindBoxContract_Crystara_TestV17 | crystara_blindbox_v1 |
Marketplace | token0x3_marketplace_v3 | token0x3_marketplace_v1 |
Example: Listening for Events Using the RPC API
const eventType = "0xfd566b048d7ea241ebd4d28a3d60a9eaaaa29a718dfff52f2ff4ca8581363b85::"+process.env.NEXT_PUBLIC_COLLECTIONS_MODULE_NAME+"::VRFCallbackReceivedEvent"
const start = 8182426;
const end = 8182436;
const response = await fetch("https://rpc-testnet.supra.com/rpc/v1/events/"+eventType+"?start="+start+"&end="+end, {
method: 'GET',
headers: {
},
});
const data = await response.json();
Processing Events with the Crystara Indexer
For more complex event processing and historical data analysis, we recommend using the Crystara Indexer. See the Start Indexing NFT Data guide for detailed instructions.
Event Schemas
For developers building applications that interact with Crystara, understanding the event schemas is crucial. You can find the complete event schemas in our GitHub repository.
Best Practices
When working with Crystara events:
- Handle Module Name Differences - Remember that module names differ between Testnet and Mainnet
- Version Awareness - Some events have deprecated versions (e.g., TokensClaimedEvent vs TokensClaimedEventV2)
- Timestamp Handling - All events include a timestamp field for chronological ordering
- Error Handling - Implement robust error handling for network issues or schema changes
- Pagination - When querying historical events, use pagination to handle large result sets
Blind Box Events
The following events are emitted by the Blind Box contract:
LootboxCreatedEvent
Emitted when a new lootbox collection is created.
struct LootboxCreatedEvent has copy, drop, store {
creator: address,
collection_management_resource_address: address,
collection_name: vector<u8>,
collection_description: vector<u8>,
collection_uri: vector<u8>,
price: u64,
price_coinType: String,
max_stock: u64,
initial_stock: u64,
is_active: bool,
is_whitelist_mode: bool,
auto_trigger_whitelist_time: u64,
auto_trigger_active_time: u64,
timestamp: u64
}
LootboxPurchaseInitiatedEvent
Emitted when a lootbox purchase is initiated.
struct LootboxPurchaseInitiatedEvent has drop, store {
buyer: address,
creator: address,
collection_name: String,
quantity: u64,
nonce: u64,
timestamp: u64,
price: u64,
price_coinType: String
}
LootboxRewardDistributedEvent
Emitted when a reward is distributed from a lootbox.
struct LootboxRewardDistributedEvent has drop, store {
nonce: u64,
buyer: address,
creator: address,
collection_name: String,
selected_token: String,
selected_rarity: String,
random_number: u256,
timestamp: u64
}
RaritiesSetEvent
Emitted when rarities and weights are set for a lootbox.
struct RaritiesSetEvent has drop, store {
creator: address,
collection_name: String,
rarity_names: vector<String>,
weights: vector<u64>,
show_items_on_roll: vector<bool>,
timestamp: u64
}
VRFCallbackReceivedEvent
Emitted when a VRF callback is received.
struct VRFCallbackReceivedEvent has drop, store {
nonce: u64,
caller_address: address,
random_numbers: vector<u256>,
timestamp: u64
}
TokenAddedEvent
Emitted when a token is added to a lootbox.
struct TokenAddedEvent has drop, store {
creator: address,
collection_name: String,
token_name: String,
token_uri: String,
rarity: String,
max_supply: u64,
timestamp: u64
}
PriceUpdatedEvent
Emitted when the price of a lootbox is updated.
struct PriceUpdatedEvent has drop, store {
creator: address,
collection_name: String,
price: u64,
price_coinType: String,
timestamp: u64
}
TokensClaimedEventV2
Emitted when tokens are claimed.
struct TokensClaimedEventV2 has drop, store {
claimer: address,
claim_resource_address: address,
tokens_claimed: vector<TokenIdentifierV2>,
total_tokens: u64,
timestamp: u64
}
LootboxStatusUpdatedEvent
Emitted when lootbox status is updated.
struct LootboxStatusUpdatedEvent has drop, store {
creator: address,
collection_name: String,
is_active: bool,
is_whitelist_mode: bool,
auto_trigger_whitelist_time: u64,
auto_trigger_active_time: u64,
timestamp: u64
}
RequiresKeyUpdateEvent
Emitted when key requirement is updated.
struct RequiresKeyUpdateEvent has drop, store {
creator: address,
collection_name: String,
requires_key: bool,
timestamp: u64
}
SetKeyCollectionNameEvent
Emitted when key collection name is set.
struct SetKeyCollectionNameEvent has drop, store {
creator: address,
collection_name: String,
key_collection_name: String,
timestamp: u64
}
PriceModifierUpdateEvent
Emitted when price modifiers are updated.
struct PriceModifierUpdateEvent has drop, store {
creator: address,
collection_name: String,
price_modifies_when_lack_of_certain_rarity: bool,
rarities_price_modifier_if_sold_out_keys: vector<String>,
rarities_price_modifier_if_sold_out_values: vector<u64>,
timestamp: u64
}
EscrowAccountCreatedEvent
Emitted when an escrow account is created.
struct EscrowAccountCreatedEvent has drop, store {
owner_address: address,
escrow_address: address,
timestamp: u64
}
WhitelistUpdatedEvent
Emitted when whitelist is updated.
struct WhitelistUpdatedEvent has drop, store {
creator: address,
collection_name: String,
addresses: vector<address>,
amounts: vector<u64>,
replace_existing: bool,
timestamp: u64
}
WhitelistRemovedEvent
Emitted when whitelist is removed.
struct WhitelistRemovedEvent has drop, store {
creator: address,
collection_name: String,
removed_addresses: vector<address>,
timestamp: u64
}
LootboxExtensionUpdatedEventV2
Emitted when lootbox extensions are updated.
struct LootboxExtensionUpdatedEventV2 has drop, store {
creator: address,
collection_name: String,
updated_key_type: String,
updated_key: String,
updated_value: String,
timestamp: u64
}
Marketplace Events
The following events are emitted by the Marketplace contract:
TokenListedEvent
Emitted when a token is listed for sale in the marketplace.
struct TokenListedEvent has drop, store {
seller: address,
creator: address,
collection: String,
token_name: String,
property_version: u64,
price: u64,
coin_type: String,
quantity: u64,
timestamp: u64
}
TokenPurchasedEvent
Emitted when a token is purchased from a listing or bid.
struct TokenPurchasedEvent has drop, store {
seller: address,
buyer: address,
creator: address,
collection: String,
token_name: String,
property_version: u64,
price: u64,
coin_type: String,
quantity: u64,
royalty_amount: u64,
marketplace_fee: u64,
seller_amount: u64,
timestamp: u64
}
TokenUnlistEvent
Emitted when a seller cancels a token listing.
struct TokenUnlistEvent has drop, store {
seller: address,
creator: address,
collection: String,
token_name: String,
property_version: u64,
coin_type: String,
quantity: u64,
timestamp: u64
}
TokenBidEvent
Emitted when a buyer places a bid on a token.
struct TokenBidEvent has drop, store {
buyer: address,
creator: address,
collection: String,
token_name: String,
property_version: u64,
price: u64,
coin_type: String,
quantity: u64,
timestamp: u64
}
TokenBidCancelledEvent
Emitted when a buyer cancels their bid on a token.
struct TokenBidCancelledEvent has drop, store {
buyer: address,
creator: address,
collection: String,
token_name: String,
property_version: u64,
coin_type: String,
quantity: u64,
timestamp: u64
}