ccip_read_server/
types.rs1use async_trait::async_trait;
2use ethers_core::{abi::Token, types::Bytes};
3use serde::Serialize;
4use serde_json::Value;
5use std::sync::Arc;
6
7#[derive(Debug, Clone)]
9pub struct RPCCall {
10 pub to: String,
11 pub data: Bytes,
12}
13
14#[derive(Serialize)]
16pub struct RPCResponse {
17 pub status: u32,
18 pub body: Value,
19}
20
21#[async_trait]
22pub trait CCIPReadHandler {
23 async fn call(
29 &self,
30 args: Vec<Token>,
31 req: RPCCall,
32 ) -> Result<Vec<Token>, Box<dyn std::error::Error>>;
33}
34
35#[derive(Debug)]
37pub struct HandlerCallback<'a, T: CCIPReadHandler> {
38 pub name: &'a str,
40 pub function: Arc<T>,
42}
43
44#[derive(Clone, Debug)]
45pub struct HandlerDescription<T: CCIPReadHandler> {
46 pub name: &'static str,
47 pub function: ethers_core::abi::Function,
48 pub callback: Arc<T>,
49}