ic_solidity_bindgen/
providers.rs

1use std::collections::HashMap;
2
3use async_trait::async_trait;
4use ic_web3_rs::contract::tokens::{Detokenize, Tokenize};
5use ic_web3_rs::contract::Options;
6use ic_web3_rs::transports::ic_http_client::CallOptions;
7use ic_web3_rs::Error;
8
9use crate::types::EventLog;
10
11#[async_trait]
12pub trait CallProvider {
13    async fn call<Out: Detokenize + Unpin + Send, Params: Tokenize + Send>(
14        &self,
15        name: &'static str,
16        params: Params,
17    ) -> Result<Out, Error>;
18}
19
20#[async_trait]
21pub trait SendProvider {
22    type Out;
23    async fn send<Params: Tokenize + Send>(
24        &self,
25        func: &'static str,
26        params: Params,
27        options: Option<Options>,
28    ) -> Result<Self::Out, ic_web3_rs::Error>;
29}
30
31#[async_trait]
32pub trait LogProvider {
33    async fn find(
34        &self,
35        event_name: &str,
36        from: u64,
37        to: u64,
38        call_options: CallOptions,
39    ) -> Result<HashMap<u64, Vec<EventLog>>, ic_web3_rs::Error>;
40}