yellowstone-vixen-mock

Crates.ioyellowstone-vixen-mock
lib.rsyellowstone-vixen-mock
version
sourcesrc
created_at2025-02-28 09:40:18.775172+00
updated_at2025-05-06 11:08:36.390134+00
descriptionMock implementation of the Vixen Parsers for testing.
homepage
repository
max_upload_size
id1572611
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`
size0
Juanito (Juanito87)

documentation

README

Yellowstone Vixen Mock

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.

Features

  • ๐Ÿ”Œ Offline Testing
    
    Run parser unit tests without connecting to a live Solana node.
  • ๐Ÿ—‚ Fixture Management Load real Solana devnet accounts or transactions as JSON fixtures, reusable across tests.
  • ๐Ÿงช Replay Support Replay devnet account updates and transaction instructions into your custom parsers.
  • ๐Ÿš€ Faster Development Build and debug parsing pipelines locally, with repeatable fixture-based tests.

Fixtures are fetched from Solana Devnet, not Mainnet. This ensures safe and reproducible testing environments.

Installation

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);
    }
}
Commit count: 0

cargo fmt