Struct cosmwasm_std::IbcCallbackRequest
source · pub struct IbcCallbackRequest { /* private fields */ }
Expand description
This is just a type representing the data that has to be sent with the IBC message to receive
callbacks. It should be serialized and sent with the IBC message.
The specific field and format to send it in can vary depending on the IBC message,
but is usually the memo
field by convention.
See IbcSourceCallbackMsg
and IbcDestinationCallbackMsg
for more details.
§Example
Using TransferMsgBuilder
:
use cosmwasm_std::{
to_json_string, Coin, IbcCallbackRequest, TransferMsgBuilder, IbcSrcCallback, IbcTimeout, Response,
Timestamp,
};
let _msg = TransferMsgBuilder::new(
"channel-0".to_string(),
"cosmos1example".to_string(),
Coin::new(10u32, "ucoin"),
Timestamp::from_seconds(12345),
)
.with_src_callback(IbcSrcCallback {
address: env.contract.address,
gas_limit: None,
})
.build();
Manual serialization:
use cosmwasm_std::{
to_json_string, Coin, IbcCallbackRequest, IbcMsg, IbcSrcCallback, IbcTimeout, Response,
Timestamp,
};
let _transfer = IbcMsg::Transfer {
to_address: "cosmos1example".to_string(),
channel_id: "channel-0".to_string(),
amount: Coin::new(10u32, "ucoin"),
timeout: Timestamp::from_seconds(12345).into(),
memo: Some(to_json_string(&IbcCallbackRequest::source(IbcSrcCallback {
address: env.contract.address,
gas_limit: None,
})).unwrap()),
};
Implementations§
source§impl IbcCallbackRequest
impl IbcCallbackRequest
sourcepub fn both(src_callback: IbcSrcCallback, dest_callback: IbcDstCallback) -> Self
pub fn both(src_callback: IbcSrcCallback, dest_callback: IbcDstCallback) -> Self
Use this if you want to execute callbacks on both the source and destination chain.
sourcepub fn source(src_callback: IbcSrcCallback) -> Self
pub fn source(src_callback: IbcSrcCallback) -> Self
Use this if you want to execute callbacks on the source chain, but not the destination chain.
sourcepub fn destination(dest_callback: IbcDstCallback) -> Self
pub fn destination(dest_callback: IbcDstCallback) -> Self
Use this if you want to execute callbacks on the destination chain, but not the source chain.
Trait Implementations§
source§impl Clone for IbcCallbackRequest
impl Clone for IbcCallbackRequest
source§fn clone(&self) -> IbcCallbackRequest
fn clone(&self) -> IbcCallbackRequest
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for IbcCallbackRequest
impl Debug for IbcCallbackRequest
source§impl<'de> Deserialize<'de> for IbcCallbackRequest
impl<'de> Deserialize<'de> for IbcCallbackRequest
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 IbcCallbackRequest
impl JsonSchema for IbcCallbackRequest
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 IbcCallbackRequest
impl PartialEq for IbcCallbackRequest
source§impl Serialize for IbcCallbackRequest
impl Serialize for IbcCallbackRequest
impl Eq for IbcCallbackRequest
impl StructuralPartialEq for IbcCallbackRequest
Auto Trait Implementations§
impl Freeze for IbcCallbackRequest
impl RefUnwindSafe for IbcCallbackRequest
impl Send for IbcCallbackRequest
impl Sync for IbcCallbackRequest
impl Unpin for IbcCallbackRequest
impl UnwindSafe for IbcCallbackRequest
Blanket Implementations§
source§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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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