1use jsonrpsee::proc_macros::rpc;
5use sui_sdk_types::Address;
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: Address,
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: Address,
26 cursor: Option<String>,
27 limit: Option<usize>,
28 ) -> RpcResult<CoinPage>;
29
30 #[method(name = "getBalance")]
32 async fn get_balance(&self, owner: Address, coin_type: Option<String>) -> RpcResult<Balance>;
33
34 #[method(name = "getAllBalances")]
36 async fn get_all_balances(&self, owner: Address) -> RpcResult<Vec<Balance>>;
37
38 #[method(name = "getCoinMetadata")]
44 async fn get_coin_metadata(&self, coin_type: String) -> RpcResult<Option<SuiCoinMetadata>>;
45
46 #[method(name = "getTotalSupply")]
48 async fn get_total_supply(&self, coin_type: String) -> RpcResult<Supply>;
49}