refactor: migrate codec/types to type aliases, remove depinject dep on sdk (#24336)

Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
This commit is contained in:
Aaron Craelius
2025-04-02 23:37:19 +00:00
committed by GitHub
co-authored by Alex | Interchain Labs Tyler
parent 41e3e9d004
commit 167f3f12e2
46 changed files with 300 additions and 1775 deletions
+19 -19
View File
@@ -5,12 +5,12 @@ package types
import (
fmt "fmt"
types1 "github.com/cometbft/cometbft/abci/types"
types2 "github.com/cometbft/cometbft/proto/tendermint/types"
types "github.com/cometbft/cometbft/abci/types"
types1 "github.com/cometbft/cometbft/proto/tendermint/types"
_ "github.com/cosmos/cosmos-proto"
types "github.com/cosmos/cosmos-sdk/codec/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
any "github.com/cosmos/gogoproto/types/any"
io "io"
math "math"
math_bits "math/bits"
@@ -54,7 +54,7 @@ type TxResponse struct {
// Amount of gas consumed by transaction.
GasUsed int64 `protobuf:"varint,10,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
// The request transaction bytes.
Tx *types.Any `protobuf:"bytes,11,opt,name=tx,proto3" json:"tx,omitempty"`
Tx *any.Any `protobuf:"bytes,11,opt,name=tx,proto3" json:"tx,omitempty"`
// Time of the previous block. For heights > 1, it's the weighted median of
// the timestamps of the valid votes in the block.LastCommit. For height == 1,
// it's genesis time.
@@ -63,7 +63,7 @@ type TxResponse struct {
// these events include those emitted by processing all the messages and those
// emitted from the ante. Whereas Logs contains the events, with
// additional metadata, emitted only by processing the messages.
Events []types1.Event `protobuf:"bytes,13,rep,name=events,proto3" json:"events"`
Events []types.Event `protobuf:"bytes,13,rep,name=events,proto3" json:"events"`
}
func (m *TxResponse) Reset() { *m = TxResponse{} }
@@ -331,9 +331,9 @@ type Result struct {
Log string `protobuf:"bytes,2,opt,name=log,proto3" json:"log,omitempty"`
// Events contains a slice of Event objects that were emitted during message
// or handler execution.
Events []types1.Event `protobuf:"bytes,3,rep,name=events,proto3" json:"events"`
Events []types.Event `protobuf:"bytes,3,rep,name=events,proto3" json:"events"`
// msg_responses contains the Msg handler responses type packed in Anys.
MsgResponses []*types.Any `protobuf:"bytes,4,rep,name=msg_responses,json=msgResponses,proto3" json:"msg_responses,omitempty"`
MsgResponses []*any.Any `protobuf:"bytes,4,rep,name=msg_responses,json=msgResponses,proto3" json:"msg_responses,omitempty"`
}
func (m *Result) Reset() { *m = Result{} }
@@ -475,7 +475,7 @@ type TxMsgData struct {
// data field is deprecated and not populated.
Data []*MsgData `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` // Deprecated: Do not use.
// msg_responses contains the Msg handler responses packed into Anys.
MsgResponses []*types.Any `protobuf:"bytes,2,rep,name=msg_responses,json=msgResponses,proto3" json:"msg_responses,omitempty"`
MsgResponses []*any.Any `protobuf:"bytes,2,rep,name=msg_responses,json=msgResponses,proto3" json:"msg_responses,omitempty"`
}
func (m *TxMsgData) Reset() { *m = TxMsgData{} }
@@ -518,7 +518,7 @@ func (m *TxMsgData) GetData() []*MsgData {
return nil
}
func (m *TxMsgData) GetMsgResponses() []*types.Any {
func (m *TxMsgData) GetMsgResponses() []*any.Any {
if m != nil {
return m.MsgResponses
}
@@ -628,7 +628,7 @@ type SearchBlocksResult struct {
// Max count blocks per page
Limit int64 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"`
// List of blocks in current page
Blocks []*types2.Block `protobuf:"bytes,6,rep,name=blocks,proto3" json:"blocks,omitempty"`
Blocks []*types1.Block `protobuf:"bytes,6,rep,name=blocks,proto3" json:"blocks,omitempty"`
}
func (m *SearchBlocksResult) Reset() { *m = SearchBlocksResult{} }
@@ -698,7 +698,7 @@ func (m *SearchBlocksResult) GetLimit() int64 {
return 0
}
func (m *SearchBlocksResult) GetBlocks() []*types2.Block {
func (m *SearchBlocksResult) GetBlocks() []*types1.Block {
if m != nil {
return m.Blocks
}
@@ -1748,7 +1748,7 @@ func (this *TxMsgData) String() string {
repeatedStringForData += "}"
repeatedStringForMsgResponses := "[]*Any{"
for _, f := range this.MsgResponses {
repeatedStringForMsgResponses += strings.Replace(fmt.Sprintf("%v", f), "Any", "types.Any", 1) + ","
repeatedStringForMsgResponses += strings.Replace(fmt.Sprintf("%v", f), "Any", "any.Any", 1) + ","
}
repeatedStringForMsgResponses += "}"
s := strings.Join([]string{`&TxMsgData{`,
@@ -1784,7 +1784,7 @@ func (this *SearchBlocksResult) String() string {
}
repeatedStringForBlocks := "[]*Block{"
for _, f := range this.Blocks {
repeatedStringForBlocks += strings.Replace(fmt.Sprintf("%v", f), "Block", "types2.Block", 1) + ","
repeatedStringForBlocks += strings.Replace(fmt.Sprintf("%v", f), "Block", "types1.Block", 1) + ","
}
repeatedStringForBlocks += "}"
s := strings.Join([]string{`&SearchBlocksResult{`,
@@ -2135,7 +2135,7 @@ func (m *TxResponse) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Tx == nil {
m.Tx = &types.Any{}
m.Tx = &any.Any{}
}
if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -2202,7 +2202,7 @@ func (m *TxResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Events = append(m.Events, types1.Event{})
m.Events = append(m.Events, types.Event{})
if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -2805,7 +2805,7 @@ func (m *Result) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Events = append(m.Events, types1.Event{})
m.Events = append(m.Events, types.Event{})
if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -2839,7 +2839,7 @@ func (m *Result) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgResponses = append(m.MsgResponses, &types.Any{})
m.MsgResponses = append(m.MsgResponses, &any.Any{})
if err := m.MsgResponses[len(m.MsgResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -3192,7 +3192,7 @@ func (m *TxMsgData) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgResponses = append(m.MsgResponses, &types.Any{})
m.MsgResponses = append(m.MsgResponses, &any.Any{})
if err := m.MsgResponses[len(m.MsgResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -3550,7 +3550,7 @@ func (m *SearchBlocksResult) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Blocks = append(m.Blocks, &types2.Block{})
m.Blocks = append(m.Blocks, &types1.Block{})
if err := m.Blocks[len(m.Blocks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
+8 -8
View File
@@ -5,9 +5,9 @@ package signing
import (
fmt "fmt"
types "github.com/cosmos/cosmos-sdk/codec/types"
types1 "github.com/cosmos/cosmos-sdk/crypto/types"
types "github.com/cosmos/cosmos-sdk/crypto/types"
proto "github.com/cosmos/gogoproto/proto"
any "github.com/cosmos/gogoproto/types/any"
io "io"
math "math"
math_bits "math/bits"
@@ -147,7 +147,7 @@ func (m *SignatureDescriptors) GetSignatures() []*SignatureDescriptor {
// clients.
type SignatureDescriptor struct {
// public_key is the public key of the signer
PublicKey *types.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
PublicKey *any.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
Data *SignatureDescriptor_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
// sequence is the sequence of the account, which describes the
// number of committed transactions signed by a given address. It is used to prevent
@@ -188,7 +188,7 @@ func (m *SignatureDescriptor) XXX_DiscardUnknown() {
var xxx_messageInfo_SignatureDescriptor proto.InternalMessageInfo
func (m *SignatureDescriptor) GetPublicKey() *types.Any {
func (m *SignatureDescriptor) GetPublicKey() *any.Any {
if m != nil {
return m.PublicKey
}
@@ -356,7 +356,7 @@ func (m *SignatureDescriptor_Data_Single) GetSignature() []byte {
// Multi is the signature data for a multisig public key
type SignatureDescriptor_Data_Multi struct {
// bitarray specifies which keys within the multisig are signing
Bitarray *types1.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"`
Bitarray *types.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"`
// signatures is the signatures of the multi-signature
Signatures []*SignatureDescriptor_Data `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"`
}
@@ -394,7 +394,7 @@ func (m *SignatureDescriptor_Data_Multi) XXX_DiscardUnknown() {
var xxx_messageInfo_SignatureDescriptor_Data_Multi proto.InternalMessageInfo
func (m *SignatureDescriptor_Data_Multi) GetBitarray() *types1.CompactBitArray {
func (m *SignatureDescriptor_Data_Multi) GetBitarray() *types.CompactBitArray {
if m != nil {
return m.Bitarray
}
@@ -974,7 +974,7 @@ func (m *SignatureDescriptor) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.PublicKey == nil {
m.PublicKey = &types.Any{}
m.PublicKey = &any.Any{}
}
if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -1338,7 +1338,7 @@ func (m *SignatureDescriptor_Data_Multi) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Bitarray == nil {
m.Bitarray = &types1.CompactBitArray{}
m.Bitarray = &types.CompactBitArray{}
}
if err := m.Bitarray.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
+23 -23
View File
@@ -6,15 +6,15 @@ package tx
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
types "github.com/cosmos/cosmos-sdk/codec/types"
types1 "github.com/cosmos/cosmos-sdk/crypto/types"
types "github.com/cosmos/cosmos-sdk/crypto/types"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types2 "github.com/cosmos/cosmos-sdk/types"
types1 "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
signing "github.com/cosmos/cosmos-sdk/types/tx/signing"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types"
any "github.com/cosmos/gogoproto/types/any"
_ "google.golang.org/protobuf/types/known/timestamppb"
io "io"
math "math"
@@ -257,7 +257,7 @@ type SignDocDirectAux struct {
// representation in TxRaw.
BodyBytes []byte `protobuf:"bytes,1,opt,name=body_bytes,json=bodyBytes,proto3" json:"body_bytes,omitempty"`
// public_key is the public key of the signing account.
PublicKey *types.Any `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
PublicKey *any.Any `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
// chain_id is the identifier of the chain this transaction targets.
// It prevents signed transactions from being used on another chain by an
// attacker.
@@ -310,7 +310,7 @@ func (m *SignDocDirectAux) GetBodyBytes() []byte {
return nil
}
func (m *SignDocDirectAux) GetPublicKey() *types.Any {
func (m *SignDocDirectAux) GetPublicKey() *any.Any {
if m != nil {
return m.PublicKey
}
@@ -355,7 +355,7 @@ type TxBody struct {
// By convention, the first required signer (usually from the first message)
// is referred to as the primary signer and pays the fee for the whole
// transaction.
Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
Messages []*any.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
// memo is any arbitrary note/comment to be added to the transaction.
// WARNING: in clients, any publicly exposed text should not be called memo,
// but should be called `note` instead (see
@@ -384,11 +384,11 @@ type TxBody struct {
// extension_options are arbitrary options that can be added by chains
// when the default options are not sufficient. If any of these are present
// and can't be handled, the transaction will be rejected
ExtensionOptions []*types.Any `protobuf:"bytes,1023,rep,name=extension_options,json=extensionOptions,proto3" json:"extension_options,omitempty"`
ExtensionOptions []*any.Any `protobuf:"bytes,1023,rep,name=extension_options,json=extensionOptions,proto3" json:"extension_options,omitempty"`
// extension_options are arbitrary options that can be added by chains
// when the default options are not sufficient. If any of these are present
// and can't be handled, they will be ignored
NonCriticalExtensionOptions []*types.Any `protobuf:"bytes,2047,rep,name=non_critical_extension_options,json=nonCriticalExtensionOptions,proto3" json:"non_critical_extension_options,omitempty"`
NonCriticalExtensionOptions []*any.Any `protobuf:"bytes,2047,rep,name=non_critical_extension_options,json=nonCriticalExtensionOptions,proto3" json:"non_critical_extension_options,omitempty"`
}
func (m *TxBody) Reset() { *m = TxBody{} }
@@ -424,7 +424,7 @@ func (m *TxBody) XXX_DiscardUnknown() {
var xxx_messageInfo_TxBody proto.InternalMessageInfo
func (m *TxBody) GetMessages() []*types.Any {
func (m *TxBody) GetMessages() []*any.Any {
if m != nil {
return m.Messages
}
@@ -459,14 +459,14 @@ func (m *TxBody) GetTimeoutTimestamp() *time.Time {
return nil
}
func (m *TxBody) GetExtensionOptions() []*types.Any {
func (m *TxBody) GetExtensionOptions() []*any.Any {
if m != nil {
return m.ExtensionOptions
}
return nil
}
func (m *TxBody) GetNonCriticalExtensionOptions() []*types.Any {
func (m *TxBody) GetNonCriticalExtensionOptions() []*any.Any {
if m != nil {
return m.NonCriticalExtensionOptions
}
@@ -554,7 +554,7 @@ type SignerInfo struct {
// public_key is the public key of the signer. It is optional for accounts
// that already exist in state. If unset, the verifier can use the required \
// signer address for this position and lookup the public key.
PublicKey *types.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
PublicKey *any.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
// mode_info describes the signing mode of the signer and is a nested
// structure to support nested multisig pubkey's
ModeInfo *ModeInfo `protobuf:"bytes,2,opt,name=mode_info,json=modeInfo,proto3" json:"mode_info,omitempty"`
@@ -597,7 +597,7 @@ func (m *SignerInfo) XXX_DiscardUnknown() {
var xxx_messageInfo_SignerInfo proto.InternalMessageInfo
func (m *SignerInfo) GetPublicKey() *types.Any {
func (m *SignerInfo) GetPublicKey() *any.Any {
if m != nil {
return m.PublicKey
}
@@ -759,7 +759,7 @@ func (m *ModeInfo_Single) GetMode() signing.SignMode {
// Multi is the mode info for a multisig public key
type ModeInfo_Multi struct {
// bitarray specifies which keys within the multisig are signing
Bitarray *types1.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"`
Bitarray *types.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"`
// mode_infos is the corresponding modes of the signers of the multisig
// which could include nested multisig public keys
ModeInfos []*ModeInfo `protobuf:"bytes,2,rep,name=mode_infos,json=modeInfos,proto3" json:"mode_infos,omitempty"`
@@ -798,7 +798,7 @@ func (m *ModeInfo_Multi) XXX_DiscardUnknown() {
var xxx_messageInfo_ModeInfo_Multi proto.InternalMessageInfo
func (m *ModeInfo_Multi) GetBitarray() *types1.CompactBitArray {
func (m *ModeInfo_Multi) GetBitarray() *types.CompactBitArray {
if m != nil {
return m.Bitarray
}
@@ -2771,7 +2771,7 @@ func (m *SignDocDirectAux) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.PublicKey == nil {
m.PublicKey = &types.Any{}
m.PublicKey = &any.Any{}
}
if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -2962,7 +2962,7 @@ func (m *TxBody) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Messages = append(m.Messages, &types.Any{})
m.Messages = append(m.Messages, &any.Any{})
if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -3103,7 +3103,7 @@ func (m *TxBody) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ExtensionOptions = append(m.ExtensionOptions, &types.Any{})
m.ExtensionOptions = append(m.ExtensionOptions, &any.Any{})
if err := m.ExtensionOptions[len(m.ExtensionOptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -3137,7 +3137,7 @@ func (m *TxBody) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NonCriticalExtensionOptions = append(m.NonCriticalExtensionOptions, &types.Any{})
m.NonCriticalExtensionOptions = append(m.NonCriticalExtensionOptions, &any.Any{})
if err := m.NonCriticalExtensionOptions[len(m.NonCriticalExtensionOptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -3378,7 +3378,7 @@ func (m *SignerInfo) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.PublicKey == nil {
m.PublicKey = &types.Any{}
m.PublicKey = &any.Any{}
}
if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -3708,7 +3708,7 @@ func (m *ModeInfo_Multi) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Bitarray == nil {
m.Bitarray = &types1.CompactBitArray{}
m.Bitarray = &types.CompactBitArray{}
}
if err := m.Bitarray.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -3827,7 +3827,7 @@ func (m *Fee) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Amount = append(m.Amount, types2.Coin{})
m.Amount = append(m.Amount, types1.Coin{})
if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -3994,7 +3994,7 @@ func (m *Tip) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Amount = append(m.Amount, types2.Coin{})
m.Amount = append(m.Amount, types1.Coin{})
if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}