-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
501 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package stride | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" | ||
) | ||
|
||
// Originally sourced from https://github.com/Stride-Labs/stride/blob/v5.1.1/x/interchainquery/types/codec.go | ||
// Needed for cosmos sdk Msg implementation in messages.go. | ||
|
||
var ( | ||
amino = codec.NewLegacyAmino() | ||
ModuleCdc = codec.NewAminoCodec(amino) | ||
) | ||
|
||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { | ||
cdc.RegisterConcrete(&MsgSubmitQueryResponse{}, "/stride.interchainquery.MsgSubmitQueryResponse", nil) | ||
} | ||
|
||
func init() { | ||
RegisterLegacyAminoCodec(amino) | ||
cryptocodec.RegisterCrypto(amino) | ||
amino.Seal() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package stride | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
) | ||
|
||
// Originally sourced from https://github.com/Stride-Labs/stride/blob/v5.1.1/x/interchainquery/types/msgs.go | ||
// Needed for cosmos sdk Msg implementation. | ||
|
||
// interchainquery message types | ||
const ( | ||
TypeMsgSubmitQueryResponse = "submitqueryresponse" | ||
|
||
// RouterKey is the message route for icq | ||
RouterKey = "interchainquery" | ||
) | ||
|
||
var _ sdk.Msg = &MsgSubmitQueryResponse{} | ||
|
||
// 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 { | ||
// check from address | ||
_, err := sdk.AccAddressFromBech32(msg.FromAddress) | ||
if err != nil { | ||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid fromAddress in ICQ response (%s)", err) | ||
} | ||
// check chain_id is not empty | ||
if msg.ChainId == "" { | ||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "chain_id cannot be empty in ICQ response") | ||
} | ||
|
||
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} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.