Struct andromeda_std::amp::recipient::Recipient
source · pub struct Recipient {
pub address: AndrAddr,
pub msg: Option<Binary>,
pub ibc_recovery_address: Option<AndrAddr>,
}Expand description
A simple struct used for inter-contract communication. The struct can be used in two ways:
- Simply just providing an
AndrAddrwhich will treat the communication as a transfer of any related funds - Providing an
AndrAddrand aBinarymessage which will be sent to the contract at the resolved address
The Binary message can be any message that the contract at the resolved address can handle.
Fields§
§address: AndrAddr§msg: Option<Binary>§ibc_recovery_address: Option<AndrAddr>Implementations§
source§impl Recipient
impl Recipient
pub fn new(addr: impl Into<String>, msg: Option<Binary>) -> Recipient
sourcepub fn from_string(addr: impl Into<String>) -> Recipient
pub fn from_string(addr: impl Into<String>) -> Recipient
Creates a Recipient from the given string with no attached message
pub fn get_addr(&self) -> String
pub fn get_message(&self) -> Option<Binary>
sourcepub fn generate_direct_msg(
&self,
deps: &Deps<'_>,
funds: Vec<Coin>
) -> Result<SubMsg, ContractError>
pub fn generate_direct_msg( &self, deps: &Deps<'_>, funds: Vec<Coin> ) -> Result<SubMsg, ContractError>
Generates a direct sub message for the given recipient.
sourcepub fn generate_msg_cw20(
&self,
deps: &Deps<'_>,
cw20_coin: Cw20Coin
) -> Result<SubMsg, ContractError>
pub fn generate_msg_cw20( &self, deps: &Deps<'_>, cw20_coin: Cw20Coin ) -> Result<SubMsg, ContractError>
Generates a message to send a CW20 token to the recipient with the attached message.
Assumes the attached message is a valid CW20 Hook message for the receiving address.
sourcepub fn generate_amp_msg(&self, funds: Option<Vec<Coin>>) -> AMPMsg
pub fn generate_amp_msg(&self, funds: Option<Vec<Coin>>) -> AMPMsg
Generates an AMP message from the given Recipient.
This can be attached to an AMP Packet for execution via the aOS.
sourcepub fn with_ibc_recovery(self, addr: impl Into<String>) -> Self
pub fn with_ibc_recovery(self, addr: impl Into<String>) -> Self
Adds an IBC recovery address to the recipient
This address can be used to recover any funds on failed IBC messages
Trait Implementations§
source§impl<'de> Deserialize<'de> for Recipient
impl<'de> Deserialize<'de> for Recipient
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl JsonSchema for Recipient
impl JsonSchema for Recipient
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moresource§impl PartialEq for Recipient
impl PartialEq for Recipient
impl StructuralPartialEq for Recipient
Auto Trait Implementations§
impl RefUnwindSafe for Recipient
impl Send for Recipient
impl Sync for Recipient
impl Unpin for Recipient
impl UnwindSafe for Recipient
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>,
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 moresource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more