Struct 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 publisher(&self) -> Result<Publisher<Chain>, AbstractClientError>

Retrieves the Publisher object from an account

This object is used to publish modules to Abstract

Source

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

Get the AccountId of the 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, 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. Errors if this module already installed

Source

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

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

Source

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

Install an service on the account. if install_on_sub_account is true, the application will be installed on new a sub-account. Errors if this module already installed

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. Errors if this module already installed

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. Errors if this module installed FIXME: Errors if any of the dependencies modules already installed

Source

pub fn install_standalone_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 Standalone module and its dependencies with the provided dependencies config. \

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

Source

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

Upgrades the account to the latest version.

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::Response, AbstractClientError>

Executes a CosmosMsg on the account.

Source

pub fn configure( &self, execute_msg: &ExecuteMsg, funds: &[Coin], ) -> Result<Chain::Response, AbstractClientError>

Executes a account::ExecuteMsg on the account.

Source

pub fn query_module<Q: Serialize + Debug, T: Serialize + DeserializeOwned>( &self, module_id: ModuleId<'_>, msg: &Q, ) -> Result<T, AbstractClientError>

Queries a module on the account.

Source

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

Set IBC status on an 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 module_installed( &self, id: ModuleId<'_>, ) -> Result<bool, AbstractClientError>

Check if module installed on account

Source

pub fn module_version_installed( &self, module: ModuleInfo, ) -> Result<bool, AbstractClientError>

Check if module version installed on account

Source

pub fn ibc_status(&self) -> Result<bool, AbstractClientError>

Check if module installed on account

Source

pub fn sub_account_builder(&self) -> AccountBuilder<'_, Chain>

Builder to create a subaccount from this account

Source

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

Get Sub Accounts of this account

Source

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

Address of the account

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

pub fn claim_namespace( &self, namespace: impl Into<String>, ) -> Result<Chain::Response, AbstractInterfaceError>

Claim a namespace for an existing account

Source§

impl<Chain: MutCwEnv> Account<Chain>

Source

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

Set balance for the Account

Source

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

Add balance to the Account

Trait Implementations§

Source§

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

Source§

fn as_ref(&self) -> &AccountI<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 duplicate 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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§

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>,

Source§

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>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V