Skip to content

Commit

Permalink
Fix IbcCallbackData destination field name
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Apr 8, 2024
1 parent 173b410 commit 15eab52
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/std/src/ibc/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,31 @@ pub struct IbcCallbackData {
#[serde(skip_serializing_if = "Option::is_none")]
src_callback: Option<IbcSrcCallback>,
#[serde(skip_serializing_if = "Option::is_none")]
dst_callback: Option<IbcDstCallback>,
dest_callback: Option<IbcDstCallback>,
}

impl IbcCallbackData {
/// Use this if you want to execute callbacks on both the source and destination chain.
pub fn both(src_callback: IbcSrcCallback, dst_callback: IbcDstCallback) -> Self {
pub fn both(src_callback: IbcSrcCallback, dest_callback: IbcDstCallback) -> Self {
IbcCallbackData {
src_callback: Some(src_callback),
dst_callback: Some(dst_callback),
dest_callback: Some(dest_callback),
}
}

/// Use this if you want to execute callbacks on the source chain, but not the destination chain.
pub fn source(src_callback: IbcSrcCallback) -> Self {
IbcCallbackData {
src_callback: Some(src_callback),
dst_callback: None,
dest_callback: None,
}
}

/// Use this if you want to execute callbacks on the destination chain, but not the source chain.
pub fn destination(dst_callback: IbcDstCallback) -> Self {
pub fn destination(dest_callback: IbcDstCallback) -> Self {
IbcCallbackData {
src_callback: None,
dst_callback: Some(dst_callback),
dest_callback: Some(dest_callback),
}
}
}
Expand Down Expand Up @@ -159,14 +159,14 @@ mod tests {

// dst only, without gas limit
let mut src = data.src_callback.take().unwrap();
data.dst_callback.as_mut().unwrap().gas_limit = None;
data.dest_callback.as_mut().unwrap().gas_limit = None;
let json = to_json_string(&data).unwrap();
assert_eq!(json, r#"{"dst_callback":{"address":"dst_address"}}"#);

// source only, without gas limit
src.gas_limit = None;
data.src_callback = Some(src);
data.dst_callback = None;
data.dest_callback = None;
let json = to_json_string(&data).unwrap();
assert_eq!(json, r#"{"src_callback":{"address":"src_address"}}"#);
}
Expand Down

0 comments on commit 15eab52

Please sign in to comment.