File tree 2 files changed +14
-16
lines changed
2 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -638,7 +638,20 @@ impl<T> IbcReceiveResponse<T> {
638
638
/// ```
639
639
pub fn new ( ack : impl Into < Binary > ) -> Self {
640
640
Self {
641
- acknowledgement : ack. into ( ) ,
641
+ acknowledgement : Some ( ack. into ( ) ) ,
642
+ messages : vec ! [ ] ,
643
+ attributes : vec ! [ ] ,
644
+ events : vec ! [ ] ,
645
+ }
646
+ }
647
+
648
+ /// Creates a new response without an acknowledgement.
649
+ ///
650
+ /// This allows you to send the acknowledgement asynchronously later using [`IbcMsg::WriteAcknowledgement`].
651
+ /// If you want to send the acknowledgement immediately, use [`IbcReceiveResponse::new`].
652
+ pub fn without_ack ( ) -> Self {
653
+ Self {
654
+ acknowledgement : None ,
642
655
messages : vec ! [ ] ,
643
656
attributes : vec ! [ ] ,
644
657
events : vec ! [ ] ,
Original file line number Diff line number Diff line change @@ -118,12 +118,6 @@ impl From<StdAck> for Binary {
118
118
}
119
119
}
120
120
121
- impl From < StdAck > for Option < Binary > {
122
- fn from ( original : StdAck ) -> Option < Binary > {
123
- Some ( original. into ( ) )
124
- }
125
- }
126
-
127
121
#[ cfg( test) ]
128
122
mod tests {
129
123
use super :: * ;
@@ -166,13 +160,4 @@ mod tests {
166
160
let ack2 = StdAck :: error ( "kaputt" ) ;
167
161
assert_eq ! ( ack2. to_binary( ) , br#"{"error":"kaputt"}"# ) ;
168
162
}
169
-
170
- #[ test]
171
- fn stdack_to_option_binary_works ( ) {
172
- let ack1 = StdAck :: success ( b"\x01 " ) ;
173
- assert_eq ! ( Option :: <Binary >:: from( ack1. clone( ) ) , Some ( ack1. to_binary( ) ) ) ;
174
-
175
- let ack2 = StdAck :: error ( "kaputt" ) ;
176
- assert_eq ! ( Option :: <Binary >:: from( ack2. clone( ) ) , Some ( ack2. to_binary( ) ) ) ;
177
- }
178
163
}
You can’t perform that action at this time.
0 commit comments