circles_rpc/methods/
balance.rs1use crate::client::RpcClient;
2use crate::error::Result;
3use circles_types::{Address, Balance};
4
5#[derive(Clone, Debug)]
7pub struct BalanceMethods {
8 client: RpcClient,
9}
10
11impl BalanceMethods {
12 pub fn new(client: RpcClient) -> Self {
14 Self { client }
15 }
16
17 pub async fn get_total_balance(
19 &self,
20 address: Address,
21 as_time_circles: bool,
22 use_v2: bool,
23 ) -> Result<Balance> {
24 let method = if use_v2 {
25 "circlesV2_getTotalBalance"
26 } else {
27 "circles_getTotalBalance"
28 };
29 self.client.call(method, (address, as_time_circles)).await
30 }
31}