Struct abstract_client::Account

source ·
pub struct Account<Chain: CwEnv> { /* private fields */ }
Expand description

Represents an existing Abstract account.

Get this struct from AbstractClient::account_from_namespace or create a new account with the AccountBuilder.

Implementations§

source§

impl<Chain: CwEnv> Account<Chain>

source

pub fn id(&self) -> Result<AccountId, AbstractClientError>

Get the AccountId of the Account

source

pub fn install_on_sub_account(&self) -> bool

Wether this account installs his applications on a sub account

source

pub fn query_balance( &self, denom: impl Into<String> ) -> Result<Uint128, AbstractClientError>

Query account balance of a given denom

source

pub fn query_balances(&self) -> Result<Vec<Coin>, AbstractClientError>

Query account balances of all denoms

source

pub fn info(&self) -> Result<AccountInfo<Addr>, AbstractClientError>

Query account info

source

pub fn install_app<M: InstallConfig + From<Contract<Chain>>>( &self, configuration: &M::InitMsg, funds: &[Coin] ) -> Result<Application<Chain, M>, AbstractClientError>

Install an application on the account. if install_on_sub_account is true, the application will be installed on new a sub-account. (default)

source

pub fn install_adapter<M: InstallConfig<InitMsg = Empty> + From<Contract<Chain>>>( &self, funds: &[Coin] ) -> Result<Application<Chain, M>, AbstractClientError>

Install an adapter on current account.

source

pub fn install_app_with_dependencies<M: DependencyCreation + InstallConfig + From<Contract<Chain>>>( &self, module_configuration: &M::InitMsg, dependencies_config: M::DependenciesConfig, funds: &[Coin] ) -> Result<Application<Chain, M>, AbstractClientError>

Creates a new sub-account on the current account and installs an App module and its dependencies with the provided dependencies config.

The returned Application is a wrapper around the sub-account and simplifies interaction with the App module.

source

pub fn upgrade(&self, version: ModuleVersion) -> Result<(), AbstractClientError>

Upgrades the account to the latest version

Migrates manager and proxy contracts to their respective new versions.

source

pub fn ownership(&self) -> Result<Ownership<String>, AbstractClientError>

Returns owner of the account

source

pub fn owner(&self) -> Result<Addr, AbstractClientError>

Returns the owner address of the account. If the account is a sub-account, it will return the top-level owner address.

source

pub fn execute( &self, execute_msgs: impl IntoIterator<Item = impl Into<CosmosMsg>>, funds: &[Coin] ) -> Result<<Chain as TxHandler>::Response, AbstractClientError>

Executes a CosmosMsg on the proxy of the account.

source

pub fn set_ibc_status(&self, enabled: bool) -> Result<(), AbstractClientError>

Set IBC status on an Account.

source

pub fn create_ibc_account( &self, host_chain: impl Into<String>, base_asset: Option<AssetEntry>, namespace: Option<String>, install_modules: Vec<ModuleInstallConfig> ) -> Result<<Chain as TxHandler>::Response, AbstractClientError>

Executes an ibc action on the proxy of the account

source

pub fn module_infos(&self) -> Result<ModuleInfosResponse, AbstractClientError>

Module infos of installed modules on account

source

pub fn module_addresses( &self, ids: Vec<String> ) -> Result<ModuleAddressesResponse, AbstractClientError>

Addresses of installed modules on account

source

pub fn sub_accounts(&self) -> Result<Vec<Account<Chain>>, AbstractClientError>

Get Sub Accounts of this account

source

pub fn proxy(&self) -> Result<Addr, AbstractClientError>

Address of the proxy

source

pub fn manager(&self) -> Result<Addr, AbstractClientError>

Address of the manager

source

pub fn application<M: RegisteredModule + From<Contract<Chain>>>( &self ) -> Result<Application<Chain, M>, AbstractClientError>

Retrieve installed application on account This can’t retrieve sub-account installed applications.

source§

impl<Chain: MutCwEnv> Account<Chain>

source

pub fn set_balance(&self, amount: &[Coin]) -> Result<(), AbstractClientError>

Set balance for the Proxy

source

pub fn add_balance(&self, amount: &[Coin]) -> Result<(), AbstractClientError>

Add balance to the Proxy

Trait Implementations§

source§

impl<Chain: CwEnv> AsRef<AbstractAccount<Chain>> for Account<Chain>

source§

fn as_ref(&self) -> &AbstractAccount<Chain>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<Chain: Clone + CwEnv> Clone for Account<Chain>

source§

fn clone(&self) -> Account<Chain>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Chain: CwEnv> Debug for Account<Chain>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Chain: CwEnv> Display for Account<Chain>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Chain: CwEnv> Environment<Chain> for Account<Chain>

source§

fn environment(&self) -> Chain

Get the execution environment

Auto Trait Implementations§

§

impl<Chain> Freeze for Account<Chain>
where Chain: Freeze,

§

impl<Chain> RefUnwindSafe for Account<Chain>
where Chain: RefUnwindSafe,

§

impl<Chain> Send for Account<Chain>
where Chain: Send,

§

impl<Chain> Sync for Account<Chain>
where Chain: Sync,

§

impl<Chain> Unpin for Account<Chain>
where Chain: Unpin,

§

impl<Chain> UnwindSafe for Account<Chain>
where Chain: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<U> As for U

source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts 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
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.