-
Notifications
You must be signed in to change notification settings - Fork 204
/
msgs.go
49 lines (36 loc) · 1.31 KB
/
msgs.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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// interchainquery message types
const (
TypeMsgSubmitQueryResponse = "submitqueryresponse"
)
var _ sdk.Msg = &MsgSubmitQueryResponse{}
// NewMsgSubmitQueryResponse - construct a msg to fulfil query request.
//nolint:interfacer
func NewMsgSubmitQueryResponse(chain_id string, result string, from_address sdk.Address) *MsgSubmitQueryResponse {
// TODO: fix me.
return &MsgSubmitQueryResponse{ChainId: chain_id, Result: nil, FromAddress: from_address.String()}
}
// Route Implements Msg.
func (msg MsgSubmitQueryResponse) Route() string { return RouterKey }
// Type Implements Msg.
func (msg MsgSubmitQueryResponse) Type() string { return TypeMsgSubmitQueryResponse }
// ValidateBasic Implements Msg.
func (msg MsgSubmitQueryResponse) ValidateBasic() error {
// TODO: check from address
// TODO: check for valid identifier
// TODO: check for valid chain_id
// TODO: check for valid denominations
return nil
}
// GetSignBytes Implements Msg.
func (msg MsgSubmitQueryResponse) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
// GetSigners Implements Msg.
func (msg MsgSubmitQueryResponse) GetSigners() []sdk.AccAddress {
fromAddress, _ := sdk.AccAddressFromBech32(msg.FromAddress)
return []sdk.AccAddress{fromAddress}
}