Struct abstract_client::AbstractClient
source · pub struct AbstractClient<Chain: CwEnv> { /* private fields */ }Expand description
Client to interact with Abstract accounts and modules
Implementations§
source§impl<Chain: CwEnv> AbstractClient<Chain>
impl<Chain: CwEnv> AbstractClient<Chain>
sourcepub fn builder(chain: Chain) -> AbstractClientBuilder<Chain>
pub fn builder(chain: Chain) -> AbstractClientBuilder<Chain>
Abstract client builder
sourcepub fn cw20_builder(
&self,
name: impl Into<String>,
symbol: impl Into<String>,
decimals: u8
) -> Cw20Builder<Chain>
pub fn cw20_builder( &self, name: impl Into<String>, symbol: impl Into<String>, decimals: u8 ) -> Cw20Builder<Chain>
Cw20 contract builder
source§impl<Chain: CwEnv> AbstractClient<Chain>
impl<Chain: CwEnv> AbstractClient<Chain>
sourcepub fn new(chain: Chain) -> Result<Self, AbstractClientError>
pub fn new(chain: Chain) -> Result<Self, AbstractClientError>
Get AbstractClient from a chosen environment. Abstract should
already be deployed to this environment.
use abstract_client::AbstractClient;
let client = AbstractClient::new(chain)?;sourcepub fn version_control(&self) -> &VersionControl<Chain>
pub fn version_control(&self) -> &VersionControl<Chain>
Version Control contract API
The Version Control contract is a database contract that stores all module-related information.
use abstract_core::objects::{module_reference::ModuleReference, module::ModuleInfo};
// For getting version control address
use cw_orch::prelude::*;
let version_control = client.version_control();
let vc_module = version_control.module(ModuleInfo::from_id_latest("abstract:version-control")?)?;
assert_eq!(vc_module.reference, ModuleReference::Native(version_control.address()?));sourcepub fn name_service(&self) -> &AnsHost<Chain>
pub fn name_service(&self) -> &AnsHost<Chain>
Abstract Name Service contract API
The Abstract Name Service contract is a database contract that stores all asset-related information.
use abstract_client::{AbstractClient, ClientResolve};
use cw_asset::AssetInfo;
use abstract_app::objects::AssetEntry;
// For getting version control address
use cw_orch::prelude::*;
let denom = "test_denom";
let entry = "denom";
let name_service = client.name_service();
let asset_entry = AssetEntry::new(entry);
let asset = asset_entry.resolve(name_service)?;
assert_eq!(asset, AssetInfo::Native(denom.to_owned()));sourcepub fn block_info(&self) -> Result<BlockInfo, AbstractClientError>
pub fn block_info(&self) -> Result<BlockInfo, AbstractClientError>
Return current block info see BlockInfo.
sourcepub fn publisher_builder(
&self,
namespace: Namespace
) -> PublisherBuilder<'_, Chain>
pub fn publisher_builder( &self, namespace: Namespace ) -> PublisherBuilder<'_, Chain>
Publisher builder for creating new [Publisher] Abstract Account
To publish any modules your account requires to have claimed a namespace.
sourcepub fn account_builder(&self) -> AccountBuilder<'_, Chain>
pub fn account_builder(&self) -> AccountBuilder<'_, Chain>
Publisher builder for creating a new Abstract Account.
sourcepub fn query_balance(
&self,
address: &Addr,
denom: impl Into<String>
) -> Result<Uint128, AbstractClientError>
pub fn query_balance( &self, address: &Addr, denom: impl Into<String> ) -> Result<Uint128, AbstractClientError>
Retrieve denom balance for provided address
sourcepub fn query_balances(
&self,
address: &Addr
) -> Result<Vec<Coin>, AbstractClientError>
pub fn query_balances( &self, address: &Addr ) -> Result<Vec<Coin>, AbstractClientError>
Retrieve balances of all denoms for provided address
sourcepub fn wait_blocks(&self, amount: u64) -> Result<(), AbstractClientError>
pub fn wait_blocks(&self, amount: u64) -> Result<(), AbstractClientError>
Waits for a specified number of blocks.
sourcepub fn wait_seconds(&self, secs: u64) -> Result<(), AbstractClientError>
pub fn wait_seconds(&self, secs: u64) -> Result<(), AbstractClientError>
Waits for a specified number of blocks.
sourcepub fn next_block(&self) -> Result<(), AbstractClientError>
pub fn next_block(&self) -> Result<(), AbstractClientError>
Waits for next block.
sourcepub fn get_last_account(
&self
) -> Result<Option<Account<Chain>>, AbstractClientError>
pub fn get_last_account( &self ) -> Result<Option<Account<Chain>>, AbstractClientError>
Returns None if no account has been created yet.
Note: This only returns accounts that were created with the Client. Any accounts created through the web-app will not be returned.
source§impl<Chain: MutCwEnv> AbstractClient<Chain>
impl<Chain: MutCwEnv> AbstractClient<Chain>
sourcepub fn set_balance(
&self,
address: impl Into<String>,
amount: &[Coin]
) -> Result<(), AbstractClientError>
pub fn set_balance( &self, address: impl Into<String>, amount: &[Coin] ) -> Result<(), AbstractClientError>
Set balance for an address
sourcepub fn set_balances<'a>(
&self,
balances: impl IntoIterator<Item = (impl Into<String>, &'a [Coin])>
) -> Result<(), AbstractClientError>
pub fn set_balances<'a>( &self, balances: impl IntoIterator<Item = (impl Into<String>, &'a [Coin])> ) -> Result<(), AbstractClientError>
Set on chain balance of addresses
sourcepub fn add_balance(
&self,
address: impl Into<String>,
amount: &[Coin]
) -> Result<(), AbstractClientError>
pub fn add_balance( &self, address: impl Into<String>, amount: &[Coin] ) -> Result<(), AbstractClientError>
Add balance for the address
sourcepub fn add_balances<'a>(
&self,
balances: impl IntoIterator<Item = (impl Into<String>, &'a [Coin])>
) -> Result<(), AbstractClientError>
pub fn add_balances<'a>( &self, balances: impl IntoIterator<Item = (impl Into<String>, &'a [Coin])> ) -> Result<(), AbstractClientError>
Add balance for the addresses
Trait Implementations§
source§impl<Chain: CwEnv> Environment<Chain> for AbstractClient<Chain>
impl<Chain: CwEnv> Environment<Chain> for AbstractClient<Chain>
source§fn environment(&self) -> Chain
fn environment(&self) -> Chain
Auto Trait Implementations§
impl<Chain> RefUnwindSafe for AbstractClient<Chain>where
Chain: RefUnwindSafe,
impl<Chain> Send for AbstractClient<Chain>where
Chain: Send,
impl<Chain> Sync for AbstractClient<Chain>where
Chain: Sync,
impl<Chain> Unpin for AbstractClient<Chain>where
Chain: Unpin,
impl<Chain> UnwindSafe for AbstractClient<Chain>where
Chain: UnwindSafe,
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more