Struct abstract_sdk::apis::bank::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 transfer(
&self,
funds: Vec<AnsAsset>,
recipient: &Addr
) -> StdResult<CosmosMsg>
pub fn transfer(
&self,
funds: Vec<AnsAsset>,
recipient: &Addr
) -> StdResult<CosmosMsg>
Transfer the provided funds from the OS’ vault to the recipient. The caller must be a whitelisted module or trader.
use cosmwasm_std::{Addr, Response, StdResult, Deps, DepsMut, Env, MessageInfo};
use abstract_os::objects::AnsAsset;
use abstract_sdk::{
TransferInterface
};
fn transfer_asset_to_sender(app: MockModule, deps: DepsMut, info: MessageInfo, requested_asset: AnsAsset) -> StdResult<Response> {
// check that the caller has the rights to the asset
// ...
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 transfer_coins(
&self,
coins: Vec<Coin>,
recipient: &Addr
) -> StdResult<CosmosMsg>
pub fn transfer_coins(
&self,
coins: Vec<Coin>,
recipient: &Addr
) -> StdResult<CosmosMsg>
Transfer coins from the OS’ vault to the recipient. The caller must be a whitelisted module or trader.