/
sudo.go
65 lines (56 loc) · 2.03 KB
/
sudo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package types
import (
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
)
const TransferPort = "transfer"
// MessageTxQueryResult is passed to a contract's sudo() entrypoint when a tx was submitted
// for a transaction query.
type MessageTxQueryResult struct {
TxQueryResult struct {
QueryID uint64 `json:"query_id"`
Height ibcclienttypes.Height `json:"height"`
Data []byte `json:"data"`
} `json:"tx_query_result"`
}
// MessageKVQueryResult is passed to a contract's sudo() entrypoint when a result
// was submitted for a kv-query.
type MessageKVQueryResult struct {
KVQueryResult struct {
QueryID uint64 `json:"query_id"`
} `json:"kv_query_result"`
}
// MessageTimeout is passed to a contract's sudo() entrypoint when an interchain
// transaction failed with a timeout.
type MessageTimeout struct {
Timeout struct {
Request channeltypes.Packet `json:"request"`
} `json:"timeout"`
}
// MessageResponse is passed to a contract's sudo() entrypoint when an interchain
// transaction was executed successfully.
type MessageResponse struct {
Response struct {
Request channeltypes.Packet `json:"request"`
Data []byte `json:"data"` // Message data
} `json:"response"`
}
// MessageError is passed to a contract's sudo() entrypoint when an interchain
// transaction was executed with an error.
type MessageError struct {
Error struct {
Request channeltypes.Packet `json:"request"`
Details string `json:"details"`
} `json:"error"`
}
// MessageOnChanOpenAck is passed to a contract's sudo() entrypoint when an interchain
// account was successfully registered.
type MessageOnChanOpenAck struct {
OpenAck OpenAckDetails `json:"open_ack"`
}
type OpenAckDetails struct {
PortID string `json:"port_id"`
ChannelID string `json:"channel_id"`
CounterpartyChannelID string `json:"counterparty_channel_id"`
CounterpartyVersion string `json:"counterparty_version"`
}