| Crates.io | evt-store |
| lib.rs | evt-store |
| version | 0.1.0-alpha.2 |
| created_at | 2025-12-29 11:30:12.341002+00 |
| updated_at | 2026-01-02 15:07:11.206685+00 |
| description | Proc-macro to emit events to evt-store-srv from Anchor programs via CPI |
| homepage | |
| repository | https://github.com/solTrust/evt-store |
| max_upload_size | |
| id | 2010467 |
| size | 42,145 |
Procedural macro to emit events to an external evt-store service from Anchor (Solana) programs via CPI. It serializes your event struct with AnchorSerialize, base64‑encodes the bytes, and calls evt_store_srv::cpi::emit(ctx, data_b64, event_type) for you.
Experimental. API may change.
Add to your Anchor program's Cargo.toml:
[dependencies]
evt-store= { version = "0.1"}
anchor-lang = "0.30" # or your version
base64 = { version = "0.22", default-features = false, features = ["alloc"] }
Notes:
anchor_lang, base64, and evt_store_srv at your call site. Ensure they are available in your program.use anchor_lang::prelude::*;
use evt_store_macro::event_store;
#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub struct Transfer {
pub from: Pubkey,
pub to: Pubkey,
pub amount: u64,
}
pub fn handler(ctx: Context<SomeCtx>, from: Pubkey, to: Pubkey, amount: u64) -> Result<()> {
// Build your event as a struct literal so the macro can infer its type name
event_store!(ctx.accounts.evt_store_ctx(), Transfer { from, to, amount })?;
Ok(())
}
What the macro does under the hood:
AnchorSerialize::try_to_vec(&event) to bytes"Transfer")::evt_store_srv::cpi::emit(ctx, data_b64, event_type)event_store!(CTX, EventStruct { ... }) — the second argument must be a struct literal so the type name can be inferred.AnchorSerialize.evt_store_srv::cpi::emit.AGPL-3.0-only. See LICENSE.
This crate is intended for on-chain programs. Carefully validate any data you log and ensure emitted events do not leak sensitive information.
Issues and PRs welcome. By contributing you agree that your contributions are licensed under the AGPL-3.0-only license of this repository.