pub struct AMPPkt {
pub messages: Vec<AMPMsg>,
pub ctx: AMPCtx,
}
Expand description
An Andromeda packet contains all message protocol related data, this is what is sent between ADOs when communicating It contains an original sender, if used for authorisation the sender must be authorised The previous sender is the one who sent the message A packet may contain several messages which allows for message batching
Fields§
§messages: Vec<AMPMsg>
Any messages associated with the packet
ctx: AMPCtx
Implementations§
Source§impl AMPPkt
impl AMPPkt
Sourcepub fn new(
origin: impl Into<String>,
previous_sender: impl Into<String>,
messages: Vec<AMPMsg>,
) -> AMPPkt
pub fn new( origin: impl Into<String>, previous_sender: impl Into<String>, messages: Vec<AMPMsg>, ) -> AMPPkt
Creates a new AMP Packet
Sourcepub fn add_message(self, message: AMPMsg) -> Self
pub fn add_message(self, message: AMPMsg) -> Self
Adds a message to the current AMP Packet
Sourcepub fn get_unique_recipients(&self) -> Vec<String>
pub fn get_unique_recipients(&self) -> Vec<String>
Gets all unique recipients for messages
Sourcepub fn get_messages_for_recipient(&self, recipient: String) -> Vec<AMPMsg>
pub fn get_messages_for_recipient(&self, recipient: String) -> Vec<AMPMsg>
Gets all messages for a given recipient
Sourcepub fn verify_origin(
&self,
info: &MessageInfo,
deps: &Deps<'_>,
) -> Result<(), ContractError>
pub fn verify_origin( &self, info: &MessageInfo, deps: &Deps<'_>, ) -> Result<(), ContractError>
Used to verify that the sender of the AMPPkt is authorised to attach the given origin field. A sender is valid if:
- The origin matches the sender
- The sender is the kernel
- The sender has a code ID stored within the ADODB (and as such is a valid ADO)
If the sender is not valid, an error is returned
Sourcepub fn get_verified_origin(
&self,
info: &MessageInfo,
deps: &Deps<'_>,
) -> Result<String, ContractError>
pub fn get_verified_origin( &self, info: &MessageInfo, deps: &Deps<'_>, ) -> Result<String, ContractError>
Verifies the origin of the AMPPkt and returns the origin if it is valid
Sourcepub fn to_sub_msg(
&self,
address: impl Into<String>,
funds: Option<Vec<Coin>>,
id: u64,
) -> Result<SubMsg, ContractError>
pub fn to_sub_msg( &self, address: impl Into<String>, funds: Option<Vec<Coin>>, id: u64, ) -> Result<SubMsg, ContractError>
Generates a SubMsg to send the AMPPkt to the kernel
Sourcepub fn to_ibc_hooks_memo(
&self,
contract_addr: String,
callback_addr: String,
) -> String
pub fn to_ibc_hooks_memo( &self, contract_addr: String, callback_addr: String, ) -> String
Converts a given AMP Packet to an IBC Hook memo for use with Osmosis’ IBC Hooks module
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AMPPkt
impl<'de> Deserialize<'de> for AMPPkt
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>,
Source§impl JsonSchema for AMPPkt
impl JsonSchema for AMPPkt
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more