Struct abstract_sdk::Bank
source · pub struct Bank<'a, T: TransferInterface> { /* private fields */ }
Implementations§
source§impl<'a, T: TransferInterface> Bank<'a, T>
impl<'a, T: TransferInterface> Bank<'a, T>
sourcepub fn balances(&self, assets: &[AssetEntry]) -> AbstractSdkResult<Vec<Asset>>
pub fn balances(&self, assets: &[AssetEntry]) -> AbstractSdkResult<Vec<Asset>>
Get the balances of the provided assets.
sourcepub fn balance(&self, asset: &AssetEntry) -> AbstractSdkResult<Asset>
pub fn balance(&self, asset: &AssetEntry) -> AbstractSdkResult<Asset>
Get the balance of the provided asset.
sourcepub fn transfer<R: Transferable>(
&self,
funds: Vec<R>,
recipient: &Addr
) -> AbstractSdkResult<CosmosMsg>
pub fn transfer<R: Transferable>( &self, funds: Vec<R>, recipient: &Addr ) -> AbstractSdkResult<CosmosMsg>
Transfer the provided funds from the Account’ vault to the recipient. The caller must be a whitelisted module or authorized address.
features::{AccountIdentification, AbstractNameService, ModuleIdentification},
TransferInterface, AbstractSdkResult,
};
fn transfer_asset_to_sender(app: MockModule, deps: DepsMut, info: MessageInfo, requested_asset: AnsAsset) -> AbstractSdkResult<Response> {
let bank = app.bank(deps.as_ref());
let transfer_msg = bank.transfer(vec![requested_asset.clone()], &info.sender)?;
Ok(Response::new()
.add_message(transfer_msg)
.add_attribute("recipient", info.sender)
.add_attribute("asset_sent", requested_asset.to_string()))
}
sourcepub fn deposit<R: Transferable>(
&self,
funds: Vec<R>
) -> AbstractSdkResult<Vec<CosmosMsg>>
pub fn deposit<R: Transferable>( &self, funds: Vec<R> ) -> AbstractSdkResult<Vec<CosmosMsg>>
Transfer the funds (deposit) into the Account from the current contract.
sourcepub fn deposit_coins(&self, coins: Vec<Coin>) -> AbstractSdkResult<CosmosMsg>
pub fn deposit_coins(&self, coins: Vec<Coin>) -> AbstractSdkResult<CosmosMsg>
Deposit coins into the Account