Developers
Contexts
EVM Provider Context

EVM Provider Context

The EvmInstrumentedClientContext trait provides a standardized alloy-rs (opens in a new tab) EVM provider for interacting with EVM-compatible blockchain networks in your Blueprint.

Overview

The EvmInstrumentedClientContext trait provides access to an EVM provider:

EvmInstrumentedClientContext Trait Definition
Lines 3-7
/// `EvmInstrumentedClientContext` trait provides access to the EVM provider from the context.
pub trait EvmInstrumentedClientContext {
    async fn evm_client(&self) -> InstrumentedClient;
}

Using the Context

1. Define Your Context

First, define your context struct that implements the EvmProviderContext trait:

EVM Provider Context Definition
Lines 22-31
}

#[allow(dead_code)]
fn main() {
    let body = async {
        let ctx = MyContext {
            foo: "bar".to_string(),
            config: BlueprintEnvironment::default(),
            store: Arc::new(LocalDatabase::open("test.json").unwrap()),
            call_id: None,

2. Access Provider Parameters

You can then use this context to access EVM provider parameters:

Accessing EVM Provider Parameters
Lines 45-45
// Test blueprint ID retrieval
Last updated on