Skip to content

Commit

Permalink
Add example to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Nov 8, 2023
1 parent cd5d61c commit 87ee3c7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/std/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,16 @@ impl<T> Default for IbcReceiveResponse<T> {

impl<T> IbcReceiveResponse<T> {
/// Create a new response with the given acknowledgement.
///
/// ## Examples
///
/// ```
/// use cosmwasm_std::{StdAck, IbcReceiveResponse};
///
/// // 0x01 is a FungibleTokenPacketSuccess from ICS-20.
/// let resp: IbcReceiveResponse = IbcReceiveResponse::new(StdAck::success(b"\x01"));
/// assert_eq!(resp.acknowledgement, b"{\"result\":\"AQ==\"}");
/// ```
pub fn new(ack: impl Into<Binary>) -> Self {
Self {
acknowledgement: ack.into(),
Expand Down

0 comments on commit 87ee3c7

Please sign in to comment.