use async_trait::async_trait;
use ethers_core::{abi::Token, types::Bytes};
use serde::Serialize;
use serde_json::Value;
use std::sync::Arc;
#[derive(Debug, Clone)]
pub struct RPCCall {
pub to: String,
pub data: Bytes,
}
#[derive(Serialize)]
pub struct RPCResponse {
pub status: u32,
pub body: Value,
}
#[async_trait]
pub trait CCIPReadHandler {
async fn call(
&self,
args: Vec<Token>,
req: RPCCall,
) -> Result<Vec<Token>, Box<dyn std::error::Error>>;
}
#[derive(Debug)]
pub struct HandlerCallback<'a, T: CCIPReadHandler> {
pub name: &'a str,
pub function: Arc<T>,
}
#[derive(Clone, Debug)]
pub struct HandlerDescription<T: CCIPReadHandler> {
pub name: &'static str,
pub function: ethers_core::abi::Function,
pub callback: Arc<T>,
}