diff --git a/chain/evm/types/codec.go b/chain/evm/types/codec.go index 8bffd086..b811249d 100644 --- a/chain/evm/types/codec.go +++ b/chain/evm/types/codec.go @@ -8,7 +8,6 @@ import ( type ( ExtensionOptionsEthereumTxI interface{} - ExtensionOptionsWeb3TxI interface{} ) // RegisterInterfaces registers the client interfaces to protobuf Any. @@ -23,12 +22,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*ExtensionOptionsEthereumTxI)(nil), &ExtensionOptionsEthereumTx{}, ) - - registry.RegisterInterface("injective.evm.v1beta1.ExtensionOptionsWeb3Tx", (*ExtensionOptionsWeb3TxI)(nil)) - registry.RegisterImplementations( - (*ExtensionOptionsWeb3TxI)(nil), - &ExtensionOptionsWeb3Tx{}, - ) } var ( diff --git a/chain/types/codec.go b/chain/types/codec.go index 82918dc8..63ae6808 100644 --- a/chain/types/codec.go +++ b/chain/types/codec.go @@ -5,6 +5,10 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) +type ( + ExtensionOptionsWeb3TxI interface{} +) + // RegisterInterfaces registers the tendermint concrete client-related // implementations and interfaces. func RegisterInterfaces(registry codectypes.InterfaceRegistry) { @@ -19,4 +23,10 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*authtypes.GenesisAccount)(nil), &EthAccount{}, ) + + registry.RegisterInterface("injective.types.v1beta1.ExtensionOptionsWeb3Tx", (*ExtensionOptionsWeb3TxI)(nil)) + registry.RegisterImplementations( + (*ExtensionOptionsWeb3TxI)(nil), + &ExtensionOptionsWeb3Tx{}, + ) } diff --git a/chain/types/tx_ext.pb.go b/chain/types/tx_ext.pb.go new file mode 100644 index 00000000..db8b3b4b --- /dev/null +++ b/chain/types/tx_ext.pb.go @@ -0,0 +1,300 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: injective/types/v1beta1/tx_ext.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ExtensionOptionsWeb3Tx struct { + // typedDataChainID used only in EIP712 Domain and should match + // Ethereum network ID in a Web3 provider (e.g. Metamask). + TypedDataChainID uint64 `protobuf:"varint,1,opt,name=typedDataChainID,proto3" json:"typedDataChainID,omitempty"` +} + +func (m *ExtensionOptionsWeb3Tx) Reset() { *m = ExtensionOptionsWeb3Tx{} } +func (m *ExtensionOptionsWeb3Tx) String() string { return proto.CompactTextString(m) } +func (*ExtensionOptionsWeb3Tx) ProtoMessage() {} +func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int) { + return fileDescriptor_b8dd2dd0020f764b, []int{0} +} +func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExtensionOptionsWeb3Tx.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExtensionOptionsWeb3Tx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionOptionsWeb3Tx.Merge(m, src) +} +func (m *ExtensionOptionsWeb3Tx) XXX_Size() int { + return m.Size() +} +func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionOptionsWeb3Tx.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionOptionsWeb3Tx proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ExtensionOptionsWeb3Tx)(nil), "injective.types.v1beta1.ExtensionOptionsWeb3Tx") +} + +func init() { + proto.RegisterFile("injective/types/v1beta1/tx_ext.proto", fileDescriptor_b8dd2dd0020f764b) +} + +var fileDescriptor_b8dd2dd0020f764b = []byte{ + // 212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc9, 0xcc, 0xcb, 0x4a, + 0x4d, 0x2e, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, + 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0x88, 0x4f, 0xad, 0x28, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x12, 0x87, 0xab, 0xd2, 0x03, 0xab, 0xd2, 0x83, 0xaa, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, + 0x07, 0xab, 0xd1, 0x07, 0xb1, 0x20, 0xca, 0x95, 0xbc, 0xb8, 0xc4, 0x5c, 0x2b, 0x4a, 0x52, 0xf3, + 0x8a, 0x33, 0xf3, 0xf3, 0xfc, 0x0b, 0x4a, 0x32, 0xf3, 0xf3, 0x8a, 0xc3, 0x53, 0x93, 0x8c, 0x43, + 0x2a, 0x84, 0xb4, 0xb8, 0x04, 0x40, 0x06, 0xa4, 0xb8, 0x24, 0x96, 0x24, 0x3a, 0x67, 0x24, 0x66, + 0xe6, 0x79, 0xba, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x04, 0x61, 0x88, 0x5b, 0xb1, 0x74, 0x2c, + 0x90, 0x67, 0x70, 0x0a, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, + 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xdb, + 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x4f, 0x98, 0xfb, 0x7c, 0x12, + 0x93, 0x8a, 0xf5, 0xe1, 0xae, 0xd5, 0x4d, 0xce, 0x2f, 0x4a, 0x45, 0xe6, 0x82, 0x8c, 0x86, 0x78, + 0x34, 0x89, 0x0d, 0xec, 0x56, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc8, 0xdc, 0xfe, 0x30, + 0x02, 0x01, 0x00, 0x00, +} + +func (m *ExtensionOptionsWeb3Tx) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ExtensionOptionsWeb3Tx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExtensionOptionsWeb3Tx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TypedDataChainID != 0 { + i = encodeVarintTxExt(dAtA, i, uint64(m.TypedDataChainID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTxExt(dAtA []byte, offset int, v uint64) int { + offset -= sovTxExt(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ExtensionOptionsWeb3Tx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TypedDataChainID != 0 { + n += 1 + sovTxExt(uint64(m.TypedDataChainID)) + } + return n +} + +func sovTxExt(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTxExt(x uint64) (n int) { + return sovTxExt(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ExtensionOptionsWeb3Tx) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTxExt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ExtensionOptionsWeb3Tx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExtensionOptionsWeb3Tx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TypedDataChainID", wireType) + } + m.TypedDataChainID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTxExt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TypedDataChainID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTxExt(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTxExt + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTxExt(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTxExt + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTxExt + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTxExt + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTxExt + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTxExt + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTxExt + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTxExt = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTxExt = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTxExt = fmt.Errorf("proto: unexpected end of group") +)