bolt-cw-sdk 1.0.0

SDK for the BOLT protocol, providing utilities for interacting with the BOLT contracts.
Documentation
use crate::oracle::client::OracleAdminClient;
use crate::oracle::error::OracleError;
use cosmrs::tendermint::chain::Id;

impl OracleAdminClient {
    pub async fn chain_id(&self) -> Result<Id, OracleError> {
        Ok(self.public_oracle_client.status().await?.node_info.network)
    }
}

#[cfg(test)]
mod tests {
    use serial_test::serial;

    use super::*;
    use crate::test_utils::helpers::VALID_BECH32_ADDRESS;
    use crate::test_utils::test_scenario::TestScenario;

    #[tokio::test]
    #[serial]
    async fn test_chain_id() {
        let test_scenario = TestScenario::new_from_config("config.json".to_string()).await;

        let oracle_contract_address = VALID_BECH32_ADDRESS.to_string();

        let client = OracleAdminClient::from_scenario(&test_scenario, &oracle_contract_address)
            .expect("Failed to create oracle admin client");
        let result = client.chain_id().await.expect("Failed to get chain id");
        assert_eq!(
            result.to_string(),
            test_scenario.chain_id,
            "Chain id does not match"
        )
    }
}