1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use async_trait::async_trait;

use ex3_canister_client::error::CanisterError;

use crate::types::{BlockIndex, QueryBlocksResponse, TransferArgs, TransferResult};

#[cfg(feature = "agent")]
pub mod agent_impl;
#[cfg(feature = "canister")]
pub mod canister_impl;
pub mod types;

// TODO: support full api
pub type CanisterResult<T> = Result<T, CanisterError>;

#[async_trait]
pub trait ICLedger: Send + Sync {
    async fn transfer(&self, args: TransferArgs) -> CanisterResult<TransferResult>;
    async fn query_blocks(
        &self,
        start: BlockIndex,
        count: u64,
    ) -> CanisterResult<QueryBlocksResponse>;
}