Crates.io | yellowstone-vixen-mock |
lib.rs | yellowstone-vixen-mock |
version | |
source | src |
created_at | 2025-02-28 09:40:18.775172+00 |
updated_at | 2025-05-06 11:08:36.390134+00 |
description | Mock implementation of the Vixen Parsers for testing. |
homepage | |
repository | |
max_upload_size | |
id | 1572611 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Yellowstone Vixen Mock provides tools for testing Vixen parsers without needing a live Solana node. It supports offline fixtures, account replay, and instruction replay โ helping you validate parsing logic quickly and reliably using devnet data.
๐ Offline Testing
Run parser unit tests without connecting to a live Solana node.Fixtures are fetched from Solana Devnet, not Mainnet. This ensures safe and reproducible testing environments.
cargo add yellowstone-vixen-mock
Example Usage
#[cfg(test)]
mod tests {
use yellowstone_vixen_mock::{account_fixture, tx_fixture};
use yellowstone_vixen_parser::{
token_extension_program::InstructionParser as TokenExtensionProgramIxParser,
token_program::{AccountParser as TokenProgramAccParser, TokenProgramState},
};
#[tokio::test]
async fn test_account_parsing() {
let parser = TokenProgramAccParser;
let account = account_fixture!("3SmPYPvZfEmroktLiJsgaNENuPEud3Z52zSfLQ1zJdkK", &parser);
let TokenProgramState::Mint(mint) = account else {
panic!("Unexpected account state");
};
assert_eq!(mint.decimals, 10);
}
#[tokio::test]
async fn test_instruction_parsing() {
let parser = TokenExtensionProgramIxParser;
let ixs = tx_fixture!(
"44gWEyKUkeUabtJr4eT3CQEkFGrD4jMdwUV6Ew5MR5K3RGizs9iwbkb5Q4T3gnAaSgHxn3ERQ8g5YTXuLP1FrWnt",
&parser
);
let Some(first_ix) = ixs.get(0) else {
panic!("No instructions found");
};
tracing::info!("Parsed instruction: {:?}", first_ix);
}
}