Skip to content

Commit 61a3749

Browse files
committed
Update timeout types in the IBC.md file
1 parent dfc584e commit 61a3749

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

IBC.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,26 @@ pub enum IbcMsg {
3232
/// packet data only supports one coin
3333
/// https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20
3434
amount: Coin,
35-
/// block after which the packet times out.
36-
/// at least one of timeout_block, timeout_timestamp is required
37-
timeout_block: Option<IbcTimeoutBlock>,
38-
/// block timestamp (nanoseconds since UNIX epoch) after which the packet times out.
39-
/// See https://golang.org/pkg/time/#Time.UnixNano
40-
/// at least one of timeout_block, timeout_timestamp is required
41-
timeout_timestamp: Option<u64>,
35+
/// when packet times out, measured on remote chain
36+
timeout: IbcTimeout,
4237
}
4338
}
39+
40+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
41+
#[serde(rename_all = "snake_case")]
42+
pub enum IbcTimeout {
43+
/// block timestamp (nanoseconds since UNIX epoch) after which the packet times out
44+
/// (measured on the remote chain)
45+
/// See https://golang.org/pkg/time/#Time.UnixNano
46+
TimestampNanos(u64),
47+
/// block after which the packet times out (measured on remote chain)
48+
Block(IbcTimeoutBlock),
49+
Both {
50+
timestamp_nanos: u64,
51+
block: IbcTimeoutBlock,
52+
},
53+
}
54+
4455
```
4556

4657
Note the `to_address` is likely not a valid `Addr`, as it uses the bech32 prefix
@@ -226,13 +237,8 @@ pub enum IbcMsg {
226237
SendPacket {
227238
channel_id: String,
228239
data: Binary,
229-
/// block height after which the packet times out.
230-
/// at least one of timeout_block, timeout_timestamp is required
231-
timeout_block: Option<IbcTimeoutBlock>,
232-
/// block timestamp (nanoseconds since UNIX epoch) after which the packet times out.
233-
/// See https://golang.org/pkg/time/#Time.UnixNano
234-
/// at least one of timeout_block, timeout_timestamp is required
235-
timeout_timestamp: Option<u64>,
240+
/// when packet times out, measured on remote chain
241+
timeout: IbcTimeout,
236242
},
237243
}
238244
```

0 commit comments

Comments
 (0)