pub fn query_balance(&self, wallet_id: &WalletAddress, denom: &Denom) -> Result<u64, Error> {
        let res = self.exec(&[
            "--node",
            &self.rpc_listen_address(),
            "query",
            "bank",
            "balances",
            &wallet_id.0,
            "--denom",
            denom.0.as_str(),
            "--output",
            "json",
        ])?;

        let amount_str = json::from_str::<json::Value>(&res)?
            .get("amount")
            .ok_or_else(|| eyre!("expected amount field"))?
            .as_str()
            .ok_or_else(|| eyre!("expected string field"))?
            .to_string();

        let amount = u64::from_str(&amount_str)?;

        Ok(amount)
    }
/**
       Query for the balances for a given wallet address and denomination
    */
Query for the balances for a given wallet address and denomination
Query for the balances for a given wallet address and denomination
pub fn query_balance(&self, wallet_id: &WalletAddress, denom: &Denom) -> Result<u64, Error> {
        let res = self.exec(&[
            "--node",
            &self.rpc_listen_address(),
            "query",
            "bank",
            "balances",
            &wallet_id.0,
            "--denom",
            denom.0.as_str(),
            "--output",
            "json",
        ])?;
        let amount_str = json::from_str::<json::Value>(&res)?
            .get("amount")
            .ok_or_else(|| eyre!("expected amount field"))?
            .as_str()
            .ok_or_else(|| eyre!("expected string field"))?
            .to_string();
        let amount = u64::from_str(&amount_str)?;
        Ok(amount)
    }
pub fn query_balance ( & self , wallet_id : & WalletAddress , denom : & Denom ) -> Result < u64 , Error > { let res = self . exec ( & [ " " , & self . rpc_listen_address ( ) , " " , " " , " " , & wallet_id . 0 , " " , denom . 0 . as_str ( ) , " " , " " , ] ) ? ; let amount_str = json :: from_str :: < json :: Value > ( & res ) ? . get ( " " ) . ok_or_else ( | | eyre ! ( " " ) ) ? . as_str ( ) . ok_or_else ( | | eyre ! ( " " ) ) ? . to_string ( ) ; let amount = u64 :: from_str ( & amount_str ) ? ; Ok ( amount ) }
Query for the balances for a given wallet address and denomination
Query for the balances for a given wallet address and denomination
&self
wallet_id
&WalletAddress
denom
&Denom
&self
wallet_id
&WalletAddress
denom
&Denom