1use af_sui_types::Address as SuiAddress;
5use jsonrpsee::proc_macros::rpc;
6
7use crate::msgs::{Balance, CoinPage, SuiCoinMetadata, Supply};
8
9#[rpc(client, namespace = "suix")]
10pub trait CoinReadApi {
11 #[method(name = "getCoins")]
13 async fn get_coins(
14 &self,
15 owner: SuiAddress,
16 coin_type: Option<String>,
17 cursor: Option<String>,
18 limit: Option<usize>,
19 ) -> RpcResult<CoinPage>;
20
21 #[method(name = "getAllCoins")]
23 async fn get_all_coins(
24 &self,
25 owner: SuiAddress,
26 cursor: Option<String>,
27 limit: Option<usize>,
28 ) -> RpcResult<CoinPage>;
29
30 #[method(name = "getBalance")]
32 async fn get_balance(&self, owner: SuiAddress, coin_type: Option<String>)
33 -> RpcResult<Balance>;
34
35 #[method(name = "getAllBalances")]
37 async fn get_all_balances(&self, owner: SuiAddress) -> RpcResult<Vec<Balance>>;
38
39 #[method(name = "getCoinMetadata")]
45 async fn get_coin_metadata(&self, coin_type: String) -> RpcResult<Option<SuiCoinMetadata>>;
46
47 #[method(name = "getTotalSupply")]
49 async fn get_total_supply(&self, coin_type: String) -> RpcResult<Supply>;
50}