-
Notifications
You must be signed in to change notification settings - Fork 46
/
msg.go
129 lines (107 loc) · 4.81 KB
/
msg.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//nolint:revive,stylecheck // if we change the names of var-naming things here, we harm some kind of mapping.
package bindings
import (
sdk "github.com/cosmos/cosmos-sdk/types"
paramChange "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
feetypes "github.com/neutron-org/neutron/x/feerefunder/types"
icqtypes "github.com/neutron-org/neutron/x/interchainqueries/types"
transferwrappertypes "github.com/neutron-org/neutron/x/transfer/types"
)
// ProtobufAny is a hack-struct to serialize protobuf Any message into JSON object.
type ProtobufAny struct {
TypeURL string `json:"type_url"`
Value []byte `json:"value"`
}
// NeutronMsg is used like a sum type to hold one of custom Neutron messages.
// Follow https://github.com/neutron-org/neutron-contracts/tree/main/packages/bindings/src/msg.rs
// for more information.
type NeutronMsg struct {
SubmitTx *SubmitTx `json:"submit_tx,omitempty"`
RegisterInterchainAccount *RegisterInterchainAccount `json:"register_interchain_account,omitempty"`
RegisterInterchainQuery *RegisterInterchainQuery `json:"register_interchain_query,omitempty"`
UpdateInterchainQuery *UpdateInterchainQuery `json:"update_interchain_query,omitempty"`
RemoveInterchainQuery *RemoveInterchainQuery `json:"remove_interchain_query,omitempty"`
IBCTransfer *transferwrappertypes.MsgTransfer `json:"ibc_transfer,omitempty"`
// Contractmanager types
/// A contract that has failed acknowledgement can resubmit it
ResubmitFailure *ResubmitFailure `json:"resubmit_failure,omitempty"`
}
// SubmitTx submits interchain transaction on a remote chain.
type SubmitTx struct {
ConnectionId string `json:"connection_id"`
InterchainAccountId string `json:"interchain_account_id"`
Msgs []ProtobufAny `json:"msgs"`
Memo string `json:"memo"`
Timeout uint64 `json:"timeout"`
Fee feetypes.Fee `json:"fee"`
}
// SubmitTxResponse holds response from SubmitTx.
type SubmitTxResponse struct {
// SequenceId is a channel's sequence_id for outgoing ibc packet. Unique per a channel.
SequenceId uint64 `json:"sequence_id"`
// Channel is a src channel on neutron side transaction was submitted from
Channel string `json:"channel"`
}
// RegisterInterchainAccount creates account on remote chain.
type RegisterInterchainAccount struct {
ConnectionId string `json:"connection_id"`
InterchainAccountId string `json:"interchain_account_id"`
RegisterFee sdk.Coins `json:"register_fee,omitempty"`
}
// RegisterInterchainAccountResponse holds response for RegisterInterchainAccount.
type RegisterInterchainAccountResponse struct{}
// RegisterInterchainQuery creates a query for remote chain.
type RegisterInterchainQuery struct {
QueryType string `json:"query_type"`
Keys []*icqtypes.KVKey `json:"keys"`
TransactionsFilter string `json:"transactions_filter"`
ConnectionId string `json:"connection_id"`
UpdatePeriod uint64 `json:"update_period"`
}
type ParamChangeProposal struct {
Title string `json:"title"`
Description string `json:"description"`
ParamChanges []paramChange.ParamChange `json:"param_changes"`
}
type SoftwareUpgradeProposal struct {
Title string `json:"title"`
Description string `json:"description"`
Plan Plan `json:"plan"`
}
type CancelSoftwareUpgradeProposal struct {
Title string `json:"title"`
Description string `json:"description"`
}
type Plan struct {
Name string `json:"name"`
Height int64 `json:"height"`
Info string `json:"info"`
}
// RegisterInterchainQueryResponse holds response for RegisterInterchainQuery.
type RegisterInterchainQueryResponse struct {
Id uint64 `json:"id"`
}
type RemoveInterchainQuery struct {
QueryId uint64 `json:"query_id"`
}
type RemoveInterchainQueryResponse struct{}
type UpdateInterchainQuery struct {
QueryId uint64 `json:"query_id,omitempty"`
NewKeys []*icqtypes.KVKey `json:"new_keys,omitempty"`
NewUpdatePeriod uint64 `json:"new_update_period,omitempty"`
NewTransactionsFilter string `json:"new_transactions_filter,omitempty"`
}
type UpdateInterchainQueryResponse struct{}
// MsgExecuteContract defined separate from wasmtypes since we can get away with just passing the string into bindings.
type MsgExecuteContract struct {
// Contract is the address of the smart contract
Contract string `json:"contract,omitempty"`
// Msg json encoded message to be passed to the contract
Msg string `json:"msg,omitempty"`
}
type ResubmitFailure struct {
FailureId uint64 `json:"failure_id"`
}
type ResubmitFailureResponse struct {
FailureId uint64 `json:"failure_id"`
}