From 3b90c9db5ee5ae56710eb67307f36164019e4fa1 Mon Sep 17 00:00:00 2001 From: Jay Yu <103467857+jayy04@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:33:23 -0400 Subject: [PATCH 1/6] [CT-1160] add relevant protos to dydxprotocol --- proto/dydxprotocol/accountplus/genesis.proto | 22 + proto/dydxprotocol/accountplus/models.proto | 23 + proto/dydxprotocol/accountplus/query.proto | 43 + proto/dydxprotocol/accountplus/tx.proto | 52 + protocol/x/accountplus/types/genesis.pb.go | 368 ++++- protocol/x/accountplus/types/models.pb.go | 418 ++++++ protocol/x/accountplus/types/query.pb.go | 1026 ++++++++++++++ protocol/x/accountplus/types/query.pb.gw.go | 312 +++++ protocol/x/accountplus/types/tx.pb.go | 1325 ++++++++++++++++++ 9 files changed, 3578 insertions(+), 11 deletions(-) create mode 100644 proto/dydxprotocol/accountplus/models.proto create mode 100644 proto/dydxprotocol/accountplus/query.proto create mode 100644 proto/dydxprotocol/accountplus/tx.proto create mode 100644 protocol/x/accountplus/types/models.pb.go create mode 100644 protocol/x/accountplus/types/query.pb.go create mode 100644 protocol/x/accountplus/types/query.pb.gw.go create mode 100644 protocol/x/accountplus/types/tx.pb.go diff --git a/proto/dydxprotocol/accountplus/genesis.proto b/proto/dydxprotocol/accountplus/genesis.proto index 9358dca161..ad91ab478e 100644 --- a/proto/dydxprotocol/accountplus/genesis.proto +++ b/proto/dydxprotocol/accountplus/genesis.proto @@ -3,10 +3,32 @@ package dydxprotocol.accountplus; import "gogoproto/gogo.proto"; import "dydxprotocol/accountplus/accountplus.proto"; +import "dydxprotocol/accountplus/models.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; +// AuthenticatorData represents a genesis exported account with Authenticators. +// The address is used as the key, and the account authenticators are stored in +// the authenticators field. +message AuthenticatorData { + // address is an account address, one address can have many authenticators + string address = 1; + + // authenticators are the account's authenticators, these can be multiple + // types including SignatureVerification, AllOfs, CosmWasmAuthenticators, etc + repeated AccountAuthenticator authenticators = 2 + [ (gogoproto.nullable) = false ]; +} + // Module genesis state message GenesisState { repeated AccountState accounts = 1 [ (gogoproto.nullable) = false ]; + + // next_authenticator_id is the next available authenticator ID. + uint64 next_authenticator_id = 2; + + // authenticator_data contains the data for multiple accounts, each with their + // authenticators. + repeated AuthenticatorData authenticator_data = 3 + [ (gogoproto.nullable) = false ]; } diff --git a/proto/dydxprotocol/accountplus/models.proto b/proto/dydxprotocol/accountplus/models.proto new file mode 100644 index 0000000000..bf026d2680 --- /dev/null +++ b/proto/dydxprotocol/accountplus/models.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package dydxprotocol.accountplus; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; + +// AccountAuthenticator represents a foundational model for all authenticators. +// It provides extensibility by allowing concrete types to interpret and +// validate transactions based on the encapsulated data. +message AccountAuthenticator { + // ID uniquely identifies the authenticator instance. + uint64 id = 1; + + // Type specifies the category of the AccountAuthenticator. + // This type information is essential for differentiating authenticators + // and ensuring precise data retrieval from the storage layer. + string type = 2; + + // Config is a versatile field used in conjunction with the specific type of + // account authenticator to facilitate complex authentication processes. + // The interpretation of this field is overloaded, enabling multiple + // authenticators to utilize it for their respective purposes. + bytes config = 3; +} \ No newline at end of file diff --git a/proto/dydxprotocol/accountplus/query.proto b/proto/dydxprotocol/accountplus/query.proto new file mode 100644 index 0000000000..73e60669a7 --- /dev/null +++ b/proto/dydxprotocol/accountplus/query.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package dydxprotocol.accountplus; + +import "google/api/annotations.proto"; +import "dydxprotocol/accountplus/models.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; + +// Query defines the gRPC querier service. +service Query { + // Queries a single authenticator by account and authenticator ID. + rpc GetAuthenticator(GetAuthenticatorRequest) + returns (GetAuthenticatorResponse) { + option (google.api.http).get = + "/dydxprotocol/accountplus/authenticator/{account}/{authenticator_id}"; + } + + // Queries all authenticators for a given account. + rpc GetAuthenticators(GetAuthenticatorsRequest) + returns (GetAuthenticatorsResponse) { + option (google.api.http).get = + "/dydxprotocol/accountplus/authenticators/{account}"; + } +} + +// MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. +message GetAuthenticatorsRequest { string account = 1; } + +// MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. +message GetAuthenticatorsResponse { + repeated AccountAuthenticator account_authenticators = 1; +} + +// MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. +message GetAuthenticatorRequest { + string account = 1; + uint64 authenticator_id = 2; +} + +// MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. +message GetAuthenticatorResponse { + AccountAuthenticator account_authenticator = 1; +} \ No newline at end of file diff --git a/proto/dydxprotocol/accountplus/tx.proto b/proto/dydxprotocol/accountplus/tx.proto new file mode 100644 index 0000000000..726beeebea --- /dev/null +++ b/proto/dydxprotocol/accountplus/tx.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; +package dydxprotocol.accountplus; + +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; + +// Msg defines the Msg service. +service Msg { + // AddAuthenticator adds an authenticator to an account. + rpc AddAuthenticator(MsgAddAuthenticator) + returns (MsgAddAuthenticatorResponse); + // RemoveAuthenticator removes an authenticator from an account. + rpc RemoveAuthenticator(MsgRemoveAuthenticator) + returns (MsgRemoveAuthenticatorResponse); +} + +// MsgAddAuthenticatorRequest defines the Msg/AddAuthenticator request type. +message MsgAddAuthenticator { + option (amino.name) = "dydxprotocol/accountplus/add-authenticator"; + option (cosmos.msg.v1.signer) = "sender"; + + string sender = 1; + string authenticator_type = 2; + bytes data = 3; +} + +// MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. +message MsgAddAuthenticatorResponse { bool success = 1; } + +// MsgRemoveAuthenticatorRequest defines the Msg/RemoveAuthenticator request +// type. +message MsgRemoveAuthenticator { + option (amino.name) = "dydxprotocol/accountplus/remove-authenticator"; + option (cosmos.msg.v1.signer) = "sender"; + + string sender = 1; + uint64 id = 2; +} + +// MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response +// type. +message MsgRemoveAuthenticatorResponse { bool success = 1; } + +// TxExtension allows for additional authenticator-specific data in +// transactions. +message TxExtension { + // selected_authenticators holds the authenticator_id for the chosen + // authenticator per message. + repeated uint64 selected_authenticators = 1; +} \ No newline at end of file diff --git a/protocol/x/accountplus/types/genesis.pb.go b/protocol/x/accountplus/types/genesis.pb.go index 13a13d224e..212c5d826f 100644 --- a/protocol/x/accountplus/types/genesis.pb.go +++ b/protocol/x/accountplus/types/genesis.pb.go @@ -23,16 +23,79 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// AuthenticatorData represents a genesis exported account with Authenticators. +// The address is used as the key, and the account authenticators are stored in +// the authenticators field. +type AuthenticatorData struct { + // address is an account address, one address can have many authenticators + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // authenticators are the account's authenticators, these can be multiple + // types including SignatureVerification, AllOfs, CosmWasmAuthenticators, etc + Authenticators []AccountAuthenticator `protobuf:"bytes,2,rep,name=authenticators,proto3" json:"authenticators"` +} + +func (m *AuthenticatorData) Reset() { *m = AuthenticatorData{} } +func (m *AuthenticatorData) String() string { return proto.CompactTextString(m) } +func (*AuthenticatorData) ProtoMessage() {} +func (*AuthenticatorData) Descriptor() ([]byte, []int) { + return fileDescriptor_03516b8fa43b3a59, []int{0} +} +func (m *AuthenticatorData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthenticatorData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthenticatorData.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 *AuthenticatorData) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthenticatorData.Merge(m, src) +} +func (m *AuthenticatorData) XXX_Size() int { + return m.Size() +} +func (m *AuthenticatorData) XXX_DiscardUnknown() { + xxx_messageInfo_AuthenticatorData.DiscardUnknown(m) +} + +var xxx_messageInfo_AuthenticatorData proto.InternalMessageInfo + +func (m *AuthenticatorData) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *AuthenticatorData) GetAuthenticators() []AccountAuthenticator { + if m != nil { + return m.Authenticators + } + return nil +} + // Module genesis state type GenesisState struct { Accounts []AccountState `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` + // next_authenticator_id is the next available authenticator ID. + NextAuthenticatorId uint64 `protobuf:"varint,2,opt,name=next_authenticator_id,json=nextAuthenticatorId,proto3" json:"next_authenticator_id,omitempty"` + // authenticator_data contains the data for multiple accounts, each with their + // authenticators. + AuthenticatorData []AuthenticatorData `protobuf:"bytes,3,rep,name=authenticator_data,json=authenticatorData,proto3" json:"authenticator_data"` } func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_03516b8fa43b3a59, []int{0} + return fileDescriptor_03516b8fa43b3a59, []int{1} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -68,7 +131,22 @@ func (m *GenesisState) GetAccounts() []AccountState { return nil } +func (m *GenesisState) GetNextAuthenticatorId() uint64 { + if m != nil { + return m.NextAuthenticatorId + } + return 0 +} + +func (m *GenesisState) GetAuthenticatorData() []AuthenticatorData { + if m != nil { + return m.AuthenticatorData + } + return nil +} + func init() { + proto.RegisterType((*AuthenticatorData)(nil), "dydxprotocol.accountplus.AuthenticatorData") proto.RegisterType((*GenesisState)(nil), "dydxprotocol.accountplus.GenesisState") } @@ -77,20 +155,72 @@ func init() { } var fileDescriptor_03516b8fa43b3a59 = []byte{ - // 202 bytes of a gzipped FileDescriptorProto + // 331 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0xa9, 0x4c, 0xa9, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xc8, 0x29, 0x2d, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x03, 0x4b, 0x0a, 0x49, 0x20, 0xab, 0xd3, 0x43, 0x52, 0x27, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, 0xd1, 0x07, - 0xb1, 0x20, 0xea, 0xa5, 0xb4, 0x70, 0x9a, 0x8b, 0xc4, 0x86, 0xa8, 0x55, 0x8a, 0xe0, 0xe2, 0x71, - 0x87, 0x58, 0x16, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0xe4, 0xc1, 0xc5, 0x01, 0x55, 0x54, 0x2c, 0xc1, - 0xa8, 0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0xa6, 0x87, 0xcb, 0x7a, 0x3d, 0x47, 0x08, 0x1b, 0xac, 0xd3, - 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xb8, 0x6e, 0xa7, 0xf0, 0x13, 0x8f, 0xe4, 0x18, 0x2f, - 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, - 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xb2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, - 0xd5, 0x47, 0x71, 0x6a, 0x99, 0x89, 0x6e, 0x72, 0x46, 0x62, 0x66, 0x9e, 0x3e, 0x5c, 0xa4, 0x02, - 0xc5, 0xf9, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x59, 0x63, 0x40, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xfa, 0x84, 0x6b, 0x24, 0x3f, 0x01, 0x00, 0x00, + 0xb1, 0x20, 0xea, 0xa5, 0xb4, 0x70, 0x9a, 0x8b, 0xc4, 0x86, 0xaa, 0x55, 0xc5, 0xa9, 0x36, 0x37, + 0x3f, 0x25, 0x35, 0x07, 0xaa, 0x4c, 0xa9, 0x9b, 0x91, 0x4b, 0xd0, 0xb1, 0xb4, 0x24, 0x23, 0x35, + 0xaf, 0x24, 0x33, 0x39, 0xb1, 0x24, 0xbf, 0xc8, 0x25, 0xb1, 0x24, 0x51, 0x48, 0x82, 0x8b, 0x3d, + 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc6, 0x15, + 0x8a, 0xe1, 0xe2, 0x4b, 0x44, 0x56, 0x5e, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0xa7, + 0x87, 0xcb, 0x2f, 0x7a, 0x8e, 0x10, 0x36, 0x8a, 0x2d, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, + 0xa1, 0x99, 0xa5, 0xf4, 0x8e, 0x91, 0x8b, 0xc7, 0x1d, 0x12, 0x44, 0xc1, 0x25, 0x89, 0x25, 0xa9, + 0x42, 0x1e, 0x5c, 0x1c, 0x50, 0xa3, 0x40, 0x2e, 0x01, 0x59, 0xa4, 0x46, 0xd0, 0x22, 0xb0, 0x4e, + 0xa8, 0x05, 0x70, 0xdd, 0x42, 0x46, 0x5c, 0xa2, 0x79, 0xa9, 0x15, 0x25, 0xf1, 0x28, 0x36, 0xc6, + 0x67, 0xa6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x04, 0x09, 0x83, 0x24, 0x51, 0x9c, 0xe8, 0x99, + 0x22, 0x94, 0xc0, 0x25, 0x84, 0xaa, 0x3c, 0x25, 0xb1, 0x24, 0x51, 0x82, 0x19, 0xec, 0x0e, 0x6d, + 0x3c, 0xee, 0x40, 0x0f, 0x4f, 0xa8, 0x63, 0x04, 0x13, 0x31, 0x24, 0xc2, 0x4f, 0x3c, 0x92, 0x63, + 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, + 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x36, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, + 0x3f, 0x57, 0x1f, 0x25, 0x2a, 0xcb, 0x4c, 0x74, 0x93, 0x33, 0x12, 0x33, 0xf3, 0xf4, 0xe1, 0x22, + 0x15, 0x28, 0xd1, 0x5b, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x96, 0x35, 0x06, 0x04, 0x00, + 0x00, 0xff, 0xff, 0xe3, 0xf2, 0x0f, 0x79, 0x8b, 0x02, 0x00, 0x00, +} + +func (m *AuthenticatorData) 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 *AuthenticatorData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthenticatorData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authenticators) > 0 { + for iNdEx := len(m.Authenticators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Authenticators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -113,6 +243,25 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AuthenticatorData) > 0 { + for iNdEx := len(m.AuthenticatorData) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AuthenticatorData[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.NextAuthenticatorId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.NextAuthenticatorId)) + i-- + dAtA[i] = 0x10 + } if len(m.Accounts) > 0 { for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { { @@ -141,6 +290,25 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *AuthenticatorData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if len(m.Authenticators) > 0 { + for _, e := range m.Authenticators { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -153,6 +321,15 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if m.NextAuthenticatorId != 0 { + n += 1 + sovGenesis(uint64(m.NextAuthenticatorId)) + } + if len(m.AuthenticatorData) > 0 { + for _, e := range m.AuthenticatorData { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -162,6 +339,122 @@ func sovGenesis(x uint64) (n int) { func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *AuthenticatorData) 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 ErrIntOverflowGenesis + } + 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: AuthenticatorData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuthenticatorData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authenticators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authenticators = append(m.Authenticators, AccountAuthenticator{}) + if err := m.Authenticators[len(m.Authenticators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -225,6 +518,59 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NextAuthenticatorId", wireType) + } + m.NextAuthenticatorId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NextAuthenticatorId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthenticatorData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthenticatorData = append(m.AuthenticatorData, AuthenticatorData{}) + if err := m.AuthenticatorData[len(m.AuthenticatorData)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/protocol/x/accountplus/types/models.pb.go b/protocol/x/accountplus/types/models.pb.go new file mode 100644 index 0000000000..86a51934d9 --- /dev/null +++ b/protocol/x/accountplus/types/models.pb.go @@ -0,0 +1,418 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/accountplus/models.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/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 + +// AccountAuthenticator represents a foundational model for all authenticators. +// It provides extensibility by allowing concrete types to interpret and +// validate transactions based on the encapsulated data. +type AccountAuthenticator struct { + // ID uniquely identifies the authenticator instance. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Type specifies the category of the AccountAuthenticator. + // This type information is essential for differentiating authenticators + // and ensuring precise data retrieval from the storage layer. + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + // Config is a versatile field used in conjunction with the specific type of + // account authenticator to facilitate complex authentication processes. + // The interpretation of this field is overloaded, enabling multiple + // authenticators to utilize it for their respective purposes. + Config []byte `protobuf:"bytes,3,opt,name=config,proto3" json:"config,omitempty"` +} + +func (m *AccountAuthenticator) Reset() { *m = AccountAuthenticator{} } +func (m *AccountAuthenticator) String() string { return proto.CompactTextString(m) } +func (*AccountAuthenticator) ProtoMessage() {} +func (*AccountAuthenticator) Descriptor() ([]byte, []int) { + return fileDescriptor_14404dbe8eb22d3f, []int{0} +} +func (m *AccountAuthenticator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccountAuthenticator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccountAuthenticator.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 *AccountAuthenticator) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountAuthenticator.Merge(m, src) +} +func (m *AccountAuthenticator) XXX_Size() int { + return m.Size() +} +func (m *AccountAuthenticator) XXX_DiscardUnknown() { + xxx_messageInfo_AccountAuthenticator.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountAuthenticator proto.InternalMessageInfo + +func (m *AccountAuthenticator) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *AccountAuthenticator) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *AccountAuthenticator) GetConfig() []byte { + if m != nil { + return m.Config + } + return nil +} + +func init() { + proto.RegisterType((*AccountAuthenticator)(nil), "dydxprotocol.accountplus.AccountAuthenticator") +} + +func init() { + proto.RegisterFile("dydxprotocol/accountplus/models.proto", fileDescriptor_14404dbe8eb22d3f) +} + +var fileDescriptor_14404dbe8eb22d3f = []byte{ + // 204 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, + 0x29, 0xc8, 0x29, 0x2d, 0xd6, 0xcf, 0xcd, 0x4f, 0x49, 0xcd, 0x29, 0xd6, 0x03, 0xcb, 0x09, 0x49, + 0x20, 0x2b, 0xd3, 0x43, 0x52, 0xa6, 0x14, 0xc4, 0x25, 0xe2, 0x08, 0xe1, 0x3a, 0x96, 0x96, 0x64, + 0xa4, 0xe6, 0x95, 0x64, 0x26, 0x27, 0x96, 0xe4, 0x17, 0x09, 0xf1, 0x71, 0x31, 0x65, 0xa6, 0x48, + 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x04, 0x31, 0x65, 0xa6, 0x08, 0x09, 0x71, 0xb1, 0x94, 0x54, 0x16, + 0xa4, 0x4a, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x42, 0x62, 0x5c, 0x6c, 0xc9, 0xf9, + 0x79, 0x69, 0x99, 0xe9, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x50, 0x9e, 0x53, 0xf8, 0x89, + 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, + 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xd9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, + 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa3, 0xb8, 0xbc, 0xcc, 0x44, 0x37, 0x39, 0x23, 0x31, 0x33, 0x4f, + 0x1f, 0x2e, 0x52, 0x81, 0xe2, 0x1b, 0x90, 0x7d, 0xc5, 0x49, 0x6c, 0x60, 0x59, 0x63, 0x40, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xa0, 0x32, 0xd3, 0x28, 0xf6, 0x00, 0x00, 0x00, +} + +func (m *AccountAuthenticator) 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 *AccountAuthenticator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountAuthenticator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Config) > 0 { + i -= len(m.Config) + copy(dAtA[i:], m.Config) + i = encodeVarintModels(dAtA, i, uint64(len(m.Config))) + i-- + dAtA[i] = 0x1a + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintModels(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintModels(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintModels(dAtA []byte, offset int, v uint64) int { + offset -= sovModels(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AccountAuthenticator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovModels(uint64(m.Id)) + } + l = len(m.Type) + if l > 0 { + n += 1 + l + sovModels(uint64(l)) + } + l = len(m.Config) + if l > 0 { + n += 1 + l + sovModels(uint64(l)) + } + return n +} + +func sovModels(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozModels(x uint64) (n int) { + return sovModels(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AccountAuthenticator) 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 ErrIntOverflowModels + } + 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: AccountAuthenticator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccountAuthenticator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthModels + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthModels + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = append(m.Config[:0], dAtA[iNdEx:postIndex]...) + if m.Config == nil { + m.Config = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModels(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModels + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipModels(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, ErrIntOverflowModels + } + 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, ErrIntOverflowModels + } + 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, ErrIntOverflowModels + } + 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, ErrInvalidLengthModels + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupModels + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthModels + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthModels = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowModels = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupModels = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/accountplus/types/query.pb.go b/protocol/x/accountplus/types/query.pb.go new file mode 100644 index 0000000000..a7f8432a29 --- /dev/null +++ b/protocol/x/accountplus/types/query.pb.go @@ -0,0 +1,1026 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/accountplus/query.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. +type GetAuthenticatorsRequest struct { + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` +} + +func (m *GetAuthenticatorsRequest) Reset() { *m = GetAuthenticatorsRequest{} } +func (m *GetAuthenticatorsRequest) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorsRequest) ProtoMessage() {} +func (*GetAuthenticatorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{0} +} +func (m *GetAuthenticatorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorsRequest.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 *GetAuthenticatorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorsRequest.Merge(m, src) +} +func (m *GetAuthenticatorsRequest) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorsRequest proto.InternalMessageInfo + +func (m *GetAuthenticatorsRequest) GetAccount() string { + if m != nil { + return m.Account + } + return "" +} + +// MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. +type GetAuthenticatorsResponse struct { + AccountAuthenticators []*AccountAuthenticator `protobuf:"bytes,1,rep,name=account_authenticators,json=accountAuthenticators,proto3" json:"account_authenticators,omitempty"` +} + +func (m *GetAuthenticatorsResponse) Reset() { *m = GetAuthenticatorsResponse{} } +func (m *GetAuthenticatorsResponse) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorsResponse) ProtoMessage() {} +func (*GetAuthenticatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{1} +} +func (m *GetAuthenticatorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorsResponse.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 *GetAuthenticatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorsResponse.Merge(m, src) +} +func (m *GetAuthenticatorsResponse) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorsResponse proto.InternalMessageInfo + +func (m *GetAuthenticatorsResponse) GetAccountAuthenticators() []*AccountAuthenticator { + if m != nil { + return m.AccountAuthenticators + } + return nil +} + +// MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. +type GetAuthenticatorRequest struct { + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` + AuthenticatorId uint64 `protobuf:"varint,2,opt,name=authenticator_id,json=authenticatorId,proto3" json:"authenticator_id,omitempty"` +} + +func (m *GetAuthenticatorRequest) Reset() { *m = GetAuthenticatorRequest{} } +func (m *GetAuthenticatorRequest) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorRequest) ProtoMessage() {} +func (*GetAuthenticatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{2} +} +func (m *GetAuthenticatorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorRequest.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 *GetAuthenticatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorRequest.Merge(m, src) +} +func (m *GetAuthenticatorRequest) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorRequest proto.InternalMessageInfo + +func (m *GetAuthenticatorRequest) GetAccount() string { + if m != nil { + return m.Account + } + return "" +} + +func (m *GetAuthenticatorRequest) GetAuthenticatorId() uint64 { + if m != nil { + return m.AuthenticatorId + } + return 0 +} + +// MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. +type GetAuthenticatorResponse struct { + AccountAuthenticator *AccountAuthenticator `protobuf:"bytes,1,opt,name=account_authenticator,json=accountAuthenticator,proto3" json:"account_authenticator,omitempty"` +} + +func (m *GetAuthenticatorResponse) Reset() { *m = GetAuthenticatorResponse{} } +func (m *GetAuthenticatorResponse) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorResponse) ProtoMessage() {} +func (*GetAuthenticatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{3} +} +func (m *GetAuthenticatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorResponse.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 *GetAuthenticatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorResponse.Merge(m, src) +} +func (m *GetAuthenticatorResponse) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorResponse proto.InternalMessageInfo + +func (m *GetAuthenticatorResponse) GetAccountAuthenticator() *AccountAuthenticator { + if m != nil { + return m.AccountAuthenticator + } + return nil +} + +func init() { + proto.RegisterType((*GetAuthenticatorsRequest)(nil), "dydxprotocol.accountplus.GetAuthenticatorsRequest") + proto.RegisterType((*GetAuthenticatorsResponse)(nil), "dydxprotocol.accountplus.GetAuthenticatorsResponse") + proto.RegisterType((*GetAuthenticatorRequest)(nil), "dydxprotocol.accountplus.GetAuthenticatorRequest") + proto.RegisterType((*GetAuthenticatorResponse)(nil), "dydxprotocol.accountplus.GetAuthenticatorResponse") +} + +func init() { + proto.RegisterFile("dydxprotocol/accountplus/query.proto", fileDescriptor_3beaace7ec4b0b78) +} + +var fileDescriptor_3beaace7ec4b0b78 = []byte{ + // 399 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, + 0x29, 0xc8, 0x29, 0x2d, 0xd6, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x03, 0x4b, 0x09, 0x49, 0x20, + 0xab, 0xd2, 0x43, 0x52, 0x25, 0x25, 0x93, 0x9e, 0x9f, 0x9f, 0x9e, 0x93, 0xaa, 0x9f, 0x58, 0x90, + 0xa9, 0x9f, 0x98, 0x97, 0x97, 0x5f, 0x92, 0x58, 0x92, 0x99, 0x9f, 0x57, 0x0c, 0xd1, 0x27, 0xa5, + 0x8a, 0xd3, 0xf4, 0xdc, 0xfc, 0x94, 0xd4, 0x1c, 0xa8, 0x32, 0x25, 0x13, 0x2e, 0x09, 0xf7, 0xd4, + 0x12, 0xc7, 0xd2, 0x92, 0x8c, 0xd4, 0xbc, 0x92, 0xcc, 0xe4, 0xc4, 0x92, 0xfc, 0xa2, 0xe2, 0xa0, + 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0x21, 0x09, 0x2e, 0x76, 0xa8, 0x3e, 0x09, 0x46, 0x05, 0x46, + 0x0d, 0xce, 0x20, 0x18, 0x57, 0xa9, 0x89, 0x91, 0x4b, 0x12, 0x8b, 0xb6, 0xe2, 0x82, 0xfc, 0xbc, + 0xe2, 0x54, 0xa1, 0x54, 0x2e, 0x31, 0xa8, 0xc2, 0xf8, 0x44, 0x14, 0x15, 0x12, 0x8c, 0x0a, 0xcc, + 0x1a, 0xdc, 0x46, 0x7a, 0x7a, 0xb8, 0xfc, 0xa4, 0xe7, 0x08, 0x61, 0xa3, 0x18, 0x1c, 0x24, 0x9a, + 0x88, 0x45, 0xb4, 0x58, 0x29, 0x8e, 0x4b, 0x1c, 0xdd, 0x0d, 0x04, 0x5d, 0x2e, 0xa4, 0xc9, 0x25, + 0x80, 0xe2, 0xa6, 0xf8, 0xcc, 0x14, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x96, 0x20, 0x7e, 0x14, 0x71, + 0xcf, 0x14, 0xa5, 0x7a, 0xcc, 0xa0, 0x81, 0x7b, 0x31, 0x99, 0x4b, 0x14, 0xab, 0x17, 0xc1, 0xd6, + 0x91, 0xee, 0x43, 0x11, 0x6c, 0x3e, 0x34, 0xea, 0x61, 0xe6, 0x62, 0x0d, 0x04, 0x25, 0x05, 0xa1, + 0xe3, 0x8c, 0x5c, 0x02, 0xe8, 0x6e, 0x11, 0x32, 0xc4, 0x6d, 0x09, 0x8e, 0x70, 0x91, 0x32, 0x22, + 0x45, 0x0b, 0xc4, 0xab, 0x4a, 0x3e, 0x4d, 0x97, 0x9f, 0x4c, 0x66, 0x72, 0x13, 0x72, 0xd1, 0xc7, + 0x99, 0xa2, 0x50, 0x82, 0x40, 0xbf, 0x1a, 0x2a, 0x55, 0xab, 0x5f, 0x8d, 0x1e, 0xd4, 0xb5, 0x42, + 0x3b, 0x18, 0xb9, 0x04, 0x31, 0x52, 0x8e, 0x10, 0x09, 0xee, 0x82, 0xa5, 0x4e, 0x29, 0x63, 0x92, + 0xf4, 0x40, 0x3d, 0x63, 0x05, 0xf6, 0x8c, 0x89, 0x90, 0x11, 0x91, 0x9e, 0x29, 0x46, 0xf8, 0xc6, + 0x29, 0xfc, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, + 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x6c, 0xd3, 0x33, 0x4b, + 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0x51, 0xcd, 0x2d, 0x33, 0xd1, 0x4d, 0xce, 0x48, 0xcc, + 0xcc, 0xd3, 0x87, 0x8b, 0x54, 0xa0, 0xd8, 0x55, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x96, + 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x56, 0xb6, 0xc4, 0x11, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Queries a single authenticator by account and authenticator ID. + GetAuthenticator(ctx context.Context, in *GetAuthenticatorRequest, opts ...grpc.CallOption) (*GetAuthenticatorResponse, error) + // Queries all authenticators for a given account. + GetAuthenticators(ctx context.Context, in *GetAuthenticatorsRequest, opts ...grpc.CallOption) (*GetAuthenticatorsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) GetAuthenticator(ctx context.Context, in *GetAuthenticatorRequest, opts ...grpc.CallOption) (*GetAuthenticatorResponse, error) { + out := new(GetAuthenticatorResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Query/GetAuthenticator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetAuthenticators(ctx context.Context, in *GetAuthenticatorsRequest, opts ...grpc.CallOption) (*GetAuthenticatorsResponse, error) { + out := new(GetAuthenticatorsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Query/GetAuthenticators", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Queries a single authenticator by account and authenticator ID. + GetAuthenticator(context.Context, *GetAuthenticatorRequest) (*GetAuthenticatorResponse, error) + // Queries all authenticators for a given account. + GetAuthenticators(context.Context, *GetAuthenticatorsRequest) (*GetAuthenticatorsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) GetAuthenticator(ctx context.Context, req *GetAuthenticatorRequest) (*GetAuthenticatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAuthenticator not implemented") +} +func (*UnimplementedQueryServer) GetAuthenticators(ctx context.Context, req *GetAuthenticatorsRequest) (*GetAuthenticatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAuthenticators not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_GetAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAuthenticatorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAuthenticator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Query/GetAuthenticator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAuthenticator(ctx, req.(*GetAuthenticatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetAuthenticators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAuthenticatorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAuthenticators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Query/GetAuthenticators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAuthenticators(ctx, req.(*GetAuthenticatorsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dydxprotocol.accountplus.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAuthenticator", + Handler: _Query_GetAuthenticator_Handler, + }, + { + MethodName: "GetAuthenticators", + Handler: _Query_GetAuthenticators_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/accountplus/query.proto", +} + +func (m *GetAuthenticatorsRequest) 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 *GetAuthenticatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetAuthenticatorsResponse) 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 *GetAuthenticatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AccountAuthenticators) > 0 { + for iNdEx := len(m.AccountAuthenticators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AccountAuthenticators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *GetAuthenticatorRequest) 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 *GetAuthenticatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AuthenticatorId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.AuthenticatorId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetAuthenticatorResponse) 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 *GetAuthenticatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AccountAuthenticator != nil { + { + size, err := m.AccountAuthenticator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GetAuthenticatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Account) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *GetAuthenticatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AccountAuthenticators) > 0 { + for _, e := range m.AccountAuthenticators { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *GetAuthenticatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Account) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.AuthenticatorId != 0 { + n += 1 + sovQuery(uint64(m.AuthenticatorId)) + } + return n +} + +func (m *GetAuthenticatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AccountAuthenticator != nil { + l = m.AccountAuthenticator.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GetAuthenticatorsRequest) 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 ErrIntOverflowQuery + } + 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: GetAuthenticatorsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetAuthenticatorsResponse) 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 ErrIntOverflowQuery + } + 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: GetAuthenticatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountAuthenticators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AccountAuthenticators = append(m.AccountAuthenticators, &AccountAuthenticator{}) + if err := m.AccountAuthenticators[len(m.AccountAuthenticators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetAuthenticatorRequest) 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 ErrIntOverflowQuery + } + 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: GetAuthenticatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthenticatorId", wireType) + } + m.AuthenticatorId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuthenticatorId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetAuthenticatorResponse) 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 ErrIntOverflowQuery + } + 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: GetAuthenticatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountAuthenticator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AccountAuthenticator == nil { + m.AccountAuthenticator = &AccountAuthenticator{} + } + if err := m.AccountAuthenticator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/accountplus/types/query.pb.gw.go b/protocol/x/accountplus/types/query.pb.gw.go new file mode 100644 index 0000000000..ce6a0b4972 --- /dev/null +++ b/protocol/x/accountplus/types/query.pb.gw.go @@ -0,0 +1,312 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: dydxprotocol/accountplus/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_GetAuthenticator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + val, ok = pathParams["authenticator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "authenticator_id") + } + + protoReq.AuthenticatorId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "authenticator_id", err) + } + + msg, err := client.GetAuthenticator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAuthenticator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + val, ok = pathParams["authenticator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "authenticator_id") + } + + protoReq.AuthenticatorId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "authenticator_id", err) + } + + msg, err := server.GetAuthenticator(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetAuthenticators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + msg, err := client.GetAuthenticators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAuthenticators_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + msg, err := server.GetAuthenticators(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_GetAuthenticator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetAuthenticator_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuthenticator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuthenticators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetAuthenticators_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuthenticators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_GetAuthenticator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetAuthenticator_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuthenticator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuthenticators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetAuthenticators_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuthenticators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_GetAuthenticator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dydxprotocol", "accountplus", "authenticator", "account", "authenticator_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetAuthenticators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dydxprotocol", "accountplus", "authenticators", "account"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_GetAuthenticator_0 = runtime.ForwardResponseMessage + + forward_Query_GetAuthenticators_0 = runtime.ForwardResponseMessage +) diff --git a/protocol/x/accountplus/types/tx.pb.go b/protocol/x/accountplus/types/tx.pb.go new file mode 100644 index 0000000000..7213db3b30 --- /dev/null +++ b/protocol/x/accountplus/types/tx.pb.go @@ -0,0 +1,1325 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/accountplus/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// MsgAddAuthenticatorRequest defines the Msg/AddAuthenticator request type. +type MsgAddAuthenticator struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + AuthenticatorType string `protobuf:"bytes,2,opt,name=authenticator_type,json=authenticatorType,proto3" json:"authenticator_type,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *MsgAddAuthenticator) Reset() { *m = MsgAddAuthenticator{} } +func (m *MsgAddAuthenticator) String() string { return proto.CompactTextString(m) } +func (*MsgAddAuthenticator) ProtoMessage() {} +func (*MsgAddAuthenticator) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{0} +} +func (m *MsgAddAuthenticator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAuthenticator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAuthenticator.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 *MsgAddAuthenticator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAuthenticator.Merge(m, src) +} +func (m *MsgAddAuthenticator) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAuthenticator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAuthenticator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAuthenticator proto.InternalMessageInfo + +func (m *MsgAddAuthenticator) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgAddAuthenticator) GetAuthenticatorType() string { + if m != nil { + return m.AuthenticatorType + } + return "" +} + +func (m *MsgAddAuthenticator) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +// MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. +type MsgAddAuthenticatorResponse struct { + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` +} + +func (m *MsgAddAuthenticatorResponse) Reset() { *m = MsgAddAuthenticatorResponse{} } +func (m *MsgAddAuthenticatorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddAuthenticatorResponse) ProtoMessage() {} +func (*MsgAddAuthenticatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{1} +} +func (m *MsgAddAuthenticatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAuthenticatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAuthenticatorResponse.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 *MsgAddAuthenticatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAuthenticatorResponse.Merge(m, src) +} +func (m *MsgAddAuthenticatorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAuthenticatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAuthenticatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAuthenticatorResponse proto.InternalMessageInfo + +func (m *MsgAddAuthenticatorResponse) GetSuccess() bool { + if m != nil { + return m.Success + } + return false +} + +// MsgRemoveAuthenticatorRequest defines the Msg/RemoveAuthenticator request +// type. +type MsgRemoveAuthenticator struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *MsgRemoveAuthenticator) Reset() { *m = MsgRemoveAuthenticator{} } +func (m *MsgRemoveAuthenticator) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveAuthenticator) ProtoMessage() {} +func (*MsgRemoveAuthenticator) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{2} +} +func (m *MsgRemoveAuthenticator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveAuthenticator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveAuthenticator.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 *MsgRemoveAuthenticator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveAuthenticator.Merge(m, src) +} +func (m *MsgRemoveAuthenticator) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveAuthenticator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveAuthenticator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveAuthenticator proto.InternalMessageInfo + +func (m *MsgRemoveAuthenticator) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgRemoveAuthenticator) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +// MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response +// type. +type MsgRemoveAuthenticatorResponse struct { + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` +} + +func (m *MsgRemoveAuthenticatorResponse) Reset() { *m = MsgRemoveAuthenticatorResponse{} } +func (m *MsgRemoveAuthenticatorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveAuthenticatorResponse) ProtoMessage() {} +func (*MsgRemoveAuthenticatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{3} +} +func (m *MsgRemoveAuthenticatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveAuthenticatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveAuthenticatorResponse.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 *MsgRemoveAuthenticatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveAuthenticatorResponse.Merge(m, src) +} +func (m *MsgRemoveAuthenticatorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveAuthenticatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveAuthenticatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveAuthenticatorResponse proto.InternalMessageInfo + +func (m *MsgRemoveAuthenticatorResponse) GetSuccess() bool { + if m != nil { + return m.Success + } + return false +} + +// TxExtension allows for additional authenticator-specific data in +// transactions. +type TxExtension struct { + // selected_authenticators holds the authenticator_id for the chosen + // authenticator per message. + SelectedAuthenticators []uint64 `protobuf:"varint,1,rep,packed,name=selected_authenticators,json=selectedAuthenticators,proto3" json:"selected_authenticators,omitempty"` +} + +func (m *TxExtension) Reset() { *m = TxExtension{} } +func (m *TxExtension) String() string { return proto.CompactTextString(m) } +func (*TxExtension) ProtoMessage() {} +func (*TxExtension) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{4} +} +func (m *TxExtension) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxExtension.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 *TxExtension) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxExtension.Merge(m, src) +} +func (m *TxExtension) XXX_Size() int { + return m.Size() +} +func (m *TxExtension) XXX_DiscardUnknown() { + xxx_messageInfo_TxExtension.DiscardUnknown(m) +} + +var xxx_messageInfo_TxExtension proto.InternalMessageInfo + +func (m *TxExtension) GetSelectedAuthenticators() []uint64 { + if m != nil { + return m.SelectedAuthenticators + } + return nil +} + +func init() { + proto.RegisterType((*MsgAddAuthenticator)(nil), "dydxprotocol.accountplus.MsgAddAuthenticator") + proto.RegisterType((*MsgAddAuthenticatorResponse)(nil), "dydxprotocol.accountplus.MsgAddAuthenticatorResponse") + proto.RegisterType((*MsgRemoveAuthenticator)(nil), "dydxprotocol.accountplus.MsgRemoveAuthenticator") + proto.RegisterType((*MsgRemoveAuthenticatorResponse)(nil), "dydxprotocol.accountplus.MsgRemoveAuthenticatorResponse") + proto.RegisterType((*TxExtension)(nil), "dydxprotocol.accountplus.TxExtension") +} + +func init() { proto.RegisterFile("dydxprotocol/accountplus/tx.proto", fileDescriptor_2d1c240983fd17d6) } + +var fileDescriptor_2d1c240983fd17d6 = []byte{ + // 432 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcd, 0x6a, 0xdb, 0x40, + 0x10, 0xc7, 0xbd, 0xb2, 0x49, 0xdb, 0x6d, 0x29, 0xcd, 0x06, 0x1c, 0xa1, 0x82, 0x48, 0x7d, 0x32, + 0x06, 0x49, 0xfd, 0x24, 0x45, 0x90, 0x43, 0x0a, 0xed, 0xcd, 0x17, 0x11, 0x28, 0xf4, 0x12, 0x36, + 0xbb, 0x8b, 0x2c, 0xb0, 0x76, 0x85, 0x66, 0x65, 0xa4, 0x53, 0x69, 0x7b, 0xeb, 0xa9, 0x0f, 0xd2, + 0x43, 0x1e, 0xa3, 0xc7, 0x1c, 0x7b, 0x2c, 0xf6, 0x21, 0xaf, 0x51, 0xb2, 0xfe, 0xc0, 0x72, 0xe5, + 0x62, 0x5f, 0x24, 0xed, 0xcc, 0x7f, 0x66, 0x7e, 0x7f, 0x8d, 0x84, 0x9f, 0xf1, 0x8a, 0x97, 0x59, + 0xae, 0xb4, 0x62, 0x6a, 0x1c, 0x50, 0xc6, 0x54, 0x21, 0x75, 0x36, 0x2e, 0x20, 0xd0, 0xa5, 0x6f, + 0xe2, 0xc4, 0x5e, 0x97, 0xf8, 0x6b, 0x12, 0xe7, 0x98, 0x29, 0x48, 0x15, 0x04, 0x29, 0xc4, 0xc1, + 0xe4, 0xc5, 0xdd, 0x6d, 0x5e, 0xe2, 0x1c, 0xd2, 0x34, 0x91, 0x2a, 0x30, 0xd7, 0x79, 0xa8, 0xf7, + 0x13, 0xe1, 0xa3, 0x21, 0xc4, 0xe7, 0x9c, 0x9f, 0x17, 0x7a, 0x24, 0xa4, 0x4e, 0x18, 0xd5, 0x2a, + 0x27, 0x5d, 0x7c, 0x00, 0x42, 0x72, 0x91, 0xdb, 0xe8, 0x04, 0xf5, 0x1f, 0x44, 0x8b, 0x13, 0xf1, + 0x30, 0xa1, 0xeb, 0xc2, 0x4b, 0x5d, 0x65, 0xc2, 0xb6, 0x8c, 0xe6, 0xb0, 0x96, 0xb9, 0xa8, 0x32, + 0x41, 0x08, 0xee, 0x70, 0xaa, 0xa9, 0xdd, 0x3e, 0x41, 0xfd, 0x47, 0x91, 0x79, 0x0e, 0xc3, 0xaf, + 0xb7, 0xd7, 0x83, 0x45, 0xbf, 0xef, 0xb7, 0xd7, 0x83, 0xc1, 0x56, 0xaf, 0x94, 0x73, 0xaf, 0xd6, + 0xb3, 0x77, 0x8a, 0x9f, 0x36, 0xd0, 0x46, 0x02, 0x32, 0x25, 0x41, 0x10, 0x1b, 0xdf, 0x83, 0x82, + 0x31, 0x01, 0x60, 0xb0, 0xef, 0x47, 0xcb, 0x63, 0xef, 0x33, 0xee, 0x0e, 0x21, 0x8e, 0x44, 0xaa, + 0x26, 0x62, 0x37, 0xa7, 0x8f, 0xb1, 0x95, 0x70, 0xe3, 0xac, 0x13, 0x59, 0x09, 0x0f, 0xcf, 0x36, + 0xb0, 0xbd, 0xad, 0xd8, 0xb9, 0x99, 0xb2, 0x41, 0x1e, 0x62, 0xb7, 0x19, 0x60, 0x07, 0xf8, 0x0f, + 0xf8, 0xe1, 0x45, 0xf9, 0xbe, 0xd4, 0x42, 0x42, 0xa2, 0x24, 0x39, 0xc5, 0xc7, 0x20, 0xc6, 0x82, + 0x69, 0xc1, 0x2f, 0x6b, 0x43, 0xee, 0x0a, 0xdb, 0xfd, 0x4e, 0xd4, 0x5d, 0xa6, 0x6b, 0x83, 0xe0, + 0xe5, 0x37, 0x0b, 0xb7, 0x87, 0x10, 0x93, 0x12, 0x3f, 0xf9, 0x67, 0xe1, 0x9e, 0xbf, 0xed, 0x7b, + 0xf2, 0x1b, 0xde, 0xb8, 0xf3, 0x66, 0x2f, 0xf9, 0xca, 0xe3, 0x17, 0x84, 0x8f, 0x9a, 0x96, 0xf0, + 0xfc, 0xbf, 0xed, 0x1a, 0x2a, 0x9c, 0xb7, 0xfb, 0x56, 0x2c, 0x19, 0xde, 0x7d, 0xfc, 0x35, 0x75, + 0xd1, 0xcd, 0xd4, 0x45, 0x7f, 0xa6, 0x2e, 0xfa, 0x31, 0x73, 0x5b, 0x37, 0x33, 0xb7, 0xf5, 0x7b, + 0xe6, 0xb6, 0x3e, 0x9d, 0xc5, 0x89, 0x1e, 0x15, 0x57, 0x3e, 0x53, 0x69, 0x50, 0xdb, 0xee, 0xe4, + 0xb5, 0xc7, 0x46, 0x34, 0x91, 0xc1, 0x2a, 0x52, 0xd6, 0x7f, 0xca, 0x2a, 0x13, 0x70, 0x75, 0x60, + 0xb2, 0xaf, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x90, 0xba, 0xf1, 0x80, 0xbd, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // AddAuthenticator adds an authenticator to an account. + AddAuthenticator(ctx context.Context, in *MsgAddAuthenticator, opts ...grpc.CallOption) (*MsgAddAuthenticatorResponse, error) + // RemoveAuthenticator removes an authenticator from an account. + RemoveAuthenticator(ctx context.Context, in *MsgRemoveAuthenticator, opts ...grpc.CallOption) (*MsgRemoveAuthenticatorResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) AddAuthenticator(ctx context.Context, in *MsgAddAuthenticator, opts ...grpc.CallOption) (*MsgAddAuthenticatorResponse, error) { + out := new(MsgAddAuthenticatorResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Msg/AddAuthenticator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveAuthenticator(ctx context.Context, in *MsgRemoveAuthenticator, opts ...grpc.CallOption) (*MsgRemoveAuthenticatorResponse, error) { + out := new(MsgRemoveAuthenticatorResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Msg/RemoveAuthenticator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // AddAuthenticator adds an authenticator to an account. + AddAuthenticator(context.Context, *MsgAddAuthenticator) (*MsgAddAuthenticatorResponse, error) + // RemoveAuthenticator removes an authenticator from an account. + RemoveAuthenticator(context.Context, *MsgRemoveAuthenticator) (*MsgRemoveAuthenticatorResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) AddAuthenticator(ctx context.Context, req *MsgAddAuthenticator) (*MsgAddAuthenticatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddAuthenticator not implemented") +} +func (*UnimplementedMsgServer) RemoveAuthenticator(ctx context.Context, req *MsgRemoveAuthenticator) (*MsgRemoveAuthenticatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveAuthenticator not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_AddAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddAuthenticator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddAuthenticator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Msg/AddAuthenticator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddAuthenticator(ctx, req.(*MsgAddAuthenticator)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveAuthenticator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveAuthenticator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Msg/RemoveAuthenticator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveAuthenticator(ctx, req.(*MsgRemoveAuthenticator)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dydxprotocol.accountplus.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddAuthenticator", + Handler: _Msg_AddAuthenticator_Handler, + }, + { + MethodName: "RemoveAuthenticator", + Handler: _Msg_RemoveAuthenticator_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/accountplus/tx.proto", +} + +func (m *MsgAddAuthenticator) 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 *MsgAddAuthenticator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAuthenticator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if len(m.AuthenticatorType) > 0 { + i -= len(m.AuthenticatorType) + copy(dAtA[i:], m.AuthenticatorType) + i = encodeVarintTx(dAtA, i, uint64(len(m.AuthenticatorType))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddAuthenticatorResponse) 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 *MsgAddAuthenticatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAuthenticatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Success { + i-- + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveAuthenticator) 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 *MsgRemoveAuthenticator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveAuthenticator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveAuthenticatorResponse) 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 *MsgRemoveAuthenticatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveAuthenticatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Success { + i-- + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TxExtension) 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 *TxExtension) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SelectedAuthenticators) > 0 { + dAtA2 := make([]byte, len(m.SelectedAuthenticators)*10) + var j1 int + for _, num := range m.SelectedAuthenticators { + for num >= 1<<7 { + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA2[j1] = uint8(num) + j1++ + } + i -= j1 + copy(dAtA[i:], dAtA2[:j1]) + i = encodeVarintTx(dAtA, i, uint64(j1)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgAddAuthenticator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.AuthenticatorType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAddAuthenticatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + return n +} + +func (m *MsgRemoveAuthenticator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } + return n +} + +func (m *MsgRemoveAuthenticatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + return n +} + +func (m *TxExtension) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.SelectedAuthenticators) > 0 { + l = 0 + for _, e := range m.SelectedAuthenticators { + l += sovTx(uint64(e)) + } + n += 1 + sovTx(uint64(l)) + l + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgAddAuthenticator) 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 ErrIntOverflowTx + } + 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: MsgAddAuthenticator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddAuthenticator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthenticatorType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthenticatorType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddAuthenticatorResponse) 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 ErrIntOverflowTx + } + 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: MsgAddAuthenticatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddAuthenticatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveAuthenticator) 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 ErrIntOverflowTx + } + 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: MsgRemoveAuthenticator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveAuthenticator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveAuthenticatorResponse) 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 ErrIntOverflowTx + } + 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: MsgRemoveAuthenticatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveAuthenticatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxExtension) 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 ErrIntOverflowTx + } + 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: TxExtension: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxExtension: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SelectedAuthenticators = append(m.SelectedAuthenticators, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.SelectedAuthenticators) == 0 { + m.SelectedAuthenticators = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SelectedAuthenticators = append(m.SelectedAuthenticators, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field SelectedAuthenticators", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From 0c4f80ae82bc4d9ee37963849040d7723bbd6bcf Mon Sep 17 00:00:00 2001 From: Jay Yu <103467857+jayy04@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:50:34 -0400 Subject: [PATCH 2/6] fix genesis --- protocol/app/testdata/default_genesis_state.json | 4 +++- protocol/scripts/genesis/sample_pregenesis.json | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index 215e9e8e58..4c07e1ee74 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -129,7 +129,9 @@ "validator_slash_events": [] }, "dydxaccountplus": { - "accounts": [] + "accounts": [], + "next_authenticator_id": "0", + "authenticator_data": [] }, "epochs": { "epoch_info_list": [ diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index 7e633c91ac..4d507d7187 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -638,7 +638,9 @@ "validator_slash_events": [] }, "dydxaccountplus": { - "accounts": [] + "accounts": [], + "authenticator_data": [], + "next_authenticator_id": "0" }, "epochs": { "epoch_info_list": [ From fe869a324adfa67076864ab5b728b8c39dd190f8 Mon Sep 17 00:00:00 2001 From: Jay Yu <103467857+jayy04@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:58:13 -0400 Subject: [PATCH 3/6] indexer gen --- .../dydxprotocol/accountplus/genesis.ts | 130 +++- .../dydxprotocol/accountplus/models.ts | 117 ++++ .../dydxprotocol/accountplus/query.lcd.ts | 30 + .../accountplus/query.rpc.Query.ts | 49 ++ .../codegen/dydxprotocol/accountplus/query.ts | 237 +++++++ .../dydxprotocol/accountplus/tx.rpc.msg.ts | 34 + .../codegen/dydxprotocol/accountplus/tx.ts | 361 +++++++++++ .../src/codegen/dydxprotocol/bundle.ts | 606 +++++++++--------- .../v4-protos/src/codegen/dydxprotocol/lcd.ts | 3 + .../src/codegen/dydxprotocol/rpc.query.ts | 1 + .../src/codegen/dydxprotocol/rpc.tx.ts | 1 + .../v4-protos/src/codegen/gogoproto/bundle.ts | 4 +- .../v4-protos/src/codegen/google/bundle.ts | 24 +- 13 files changed, 1284 insertions(+), 313 deletions(-) create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/models.ts create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts index 00311a9921..0757871328 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts @@ -1,20 +1,128 @@ +import { AccountAuthenticator, AccountAuthenticatorSDKType } from "./models"; import { AccountState, AccountStateSDKType } from "./accountplus"; import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../helpers"; +import { DeepPartial, Long } from "../../helpers"; +/** + * AuthenticatorData represents a genesis exported account with Authenticators. + * The address is used as the key, and the account authenticators are stored in + * the authenticators field. + */ + +export interface AuthenticatorData { + /** address is an account address, one address can have many authenticators */ + address: string; + /** + * authenticators are the account's authenticators, these can be multiple + * types including SignatureVerification, AllOfs, CosmWasmAuthenticators, etc + */ + + authenticators: AccountAuthenticator[]; +} +/** + * AuthenticatorData represents a genesis exported account with Authenticators. + * The address is used as the key, and the account authenticators are stored in + * the authenticators field. + */ + +export interface AuthenticatorDataSDKType { + /** address is an account address, one address can have many authenticators */ + address: string; + /** + * authenticators are the account's authenticators, these can be multiple + * types including SignatureVerification, AllOfs, CosmWasmAuthenticators, etc + */ + + authenticators: AccountAuthenticatorSDKType[]; +} /** Module genesis state */ export interface GenesisState { accounts: AccountState[]; + /** next_authenticator_id is the next available authenticator ID. */ + + nextAuthenticatorId: Long; + /** + * authenticator_data contains the data for multiple accounts, each with their + * authenticators. + */ + + authenticatorData: AuthenticatorData[]; } /** Module genesis state */ export interface GenesisStateSDKType { accounts: AccountStateSDKType[]; + /** next_authenticator_id is the next available authenticator ID. */ + + next_authenticator_id: Long; + /** + * authenticator_data contains the data for multiple accounts, each with their + * authenticators. + */ + + authenticator_data: AuthenticatorDataSDKType[]; +} + +function createBaseAuthenticatorData(): AuthenticatorData { + return { + address: "", + authenticators: [] + }; } +export const AuthenticatorData = { + encode(message: AuthenticatorData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + + for (const v of message.authenticators) { + AccountAuthenticator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AuthenticatorData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthenticatorData(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + + case 2: + message.authenticators.push(AccountAuthenticator.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): AuthenticatorData { + const message = createBaseAuthenticatorData(); + message.address = object.address ?? ""; + message.authenticators = object.authenticators?.map(e => AccountAuthenticator.fromPartial(e)) || []; + return message; + } + +}; + function createBaseGenesisState(): GenesisState { return { - accounts: [] + accounts: [], + nextAuthenticatorId: Long.UZERO, + authenticatorData: [] }; } @@ -24,6 +132,14 @@ export const GenesisState = { AccountState.encode(v!, writer.uint32(10).fork()).ldelim(); } + if (!message.nextAuthenticatorId.isZero()) { + writer.uint32(16).uint64(message.nextAuthenticatorId); + } + + for (const v of message.authenticatorData) { + AuthenticatorData.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; }, @@ -40,6 +156,14 @@ export const GenesisState = { message.accounts.push(AccountState.decode(reader, reader.uint32())); break; + case 2: + message.nextAuthenticatorId = (reader.uint64() as Long); + break; + + case 3: + message.authenticatorData.push(AuthenticatorData.decode(reader, reader.uint32())); + break; + default: reader.skipType(tag & 7); break; @@ -52,6 +176,8 @@ export const GenesisState = { fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); message.accounts = object.accounts?.map(e => AccountState.fromPartial(e)) || []; + message.nextAuthenticatorId = object.nextAuthenticatorId !== undefined && object.nextAuthenticatorId !== null ? Long.fromValue(object.nextAuthenticatorId) : Long.UZERO; + message.authenticatorData = object.authenticatorData?.map(e => AuthenticatorData.fromPartial(e)) || []; return message; } diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/models.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/models.ts new file mode 100644 index 0000000000..2e7ce339aa --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/models.ts @@ -0,0 +1,117 @@ +import * as _m0 from "protobufjs/minimal"; +import { Long, DeepPartial } from "../../helpers"; +/** + * AccountAuthenticator represents a foundational model for all authenticators. + * It provides extensibility by allowing concrete types to interpret and + * validate transactions based on the encapsulated data. + */ + +export interface AccountAuthenticator { + /** ID uniquely identifies the authenticator instance. */ + id: Long; + /** + * Type specifies the category of the AccountAuthenticator. + * This type information is essential for differentiating authenticators + * and ensuring precise data retrieval from the storage layer. + */ + + type: string; + /** + * Config is a versatile field used in conjunction with the specific type of + * account authenticator to facilitate complex authentication processes. + * The interpretation of this field is overloaded, enabling multiple + * authenticators to utilize it for their respective purposes. + */ + + config: Uint8Array; +} +/** + * AccountAuthenticator represents a foundational model for all authenticators. + * It provides extensibility by allowing concrete types to interpret and + * validate transactions based on the encapsulated data. + */ + +export interface AccountAuthenticatorSDKType { + /** ID uniquely identifies the authenticator instance. */ + id: Long; + /** + * Type specifies the category of the AccountAuthenticator. + * This type information is essential for differentiating authenticators + * and ensuring precise data retrieval from the storage layer. + */ + + type: string; + /** + * Config is a versatile field used in conjunction with the specific type of + * account authenticator to facilitate complex authentication processes. + * The interpretation of this field is overloaded, enabling multiple + * authenticators to utilize it for their respective purposes. + */ + + config: Uint8Array; +} + +function createBaseAccountAuthenticator(): AccountAuthenticator { + return { + id: Long.UZERO, + type: "", + config: new Uint8Array() + }; +} + +export const AccountAuthenticator = { + encode(message: AccountAuthenticator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.id.isZero()) { + writer.uint32(8).uint64(message.id); + } + + if (message.type !== "") { + writer.uint32(18).string(message.type); + } + + if (message.config.length !== 0) { + writer.uint32(26).bytes(message.config); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AccountAuthenticator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountAuthenticator(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.id = (reader.uint64() as Long); + break; + + case 2: + message.type = reader.string(); + break; + + case 3: + message.config = reader.bytes(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): AccountAuthenticator { + const message = createBaseAccountAuthenticator(); + message.id = object.id !== undefined && object.id !== null ? Long.fromValue(object.id) : Long.UZERO; + message.type = object.type ?? ""; + message.config = object.config ?? new Uint8Array(); + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts new file mode 100644 index 0000000000..f63258df1e --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts @@ -0,0 +1,30 @@ +import { LCDClient } from "@osmonauts/lcd"; +import { GetAuthenticatorRequest, GetAuthenticatorResponseSDKType, GetAuthenticatorsRequest, GetAuthenticatorsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.getAuthenticator = this.getAuthenticator.bind(this); + this.getAuthenticators = this.getAuthenticators.bind(this); + } + /* Queries a single authenticator by account and authenticator ID. */ + + + async getAuthenticator(params: GetAuthenticatorRequest): Promise { + const endpoint = `dydxprotocol/accountplus/authenticator/${params.account}/${params.authenticatorId}`; + return await this.req.get(endpoint); + } + /* Queries all authenticators for a given account. */ + + + async getAuthenticators(params: GetAuthenticatorsRequest): Promise { + const endpoint = `dydxprotocol/accountplus/authenticators/${params.account}`; + return await this.req.get(endpoint); + } + +} \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts new file mode 100644 index 0000000000..e68868199e --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts @@ -0,0 +1,49 @@ +import { Rpc } from "../../helpers"; +import * as _m0 from "protobufjs/minimal"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { GetAuthenticatorRequest, GetAuthenticatorResponse, GetAuthenticatorsRequest, GetAuthenticatorsResponse } from "./query"; +/** Query defines the gRPC querier service. */ + +export interface Query { + /** Queries a single authenticator by account and authenticator ID. */ + getAuthenticator(request: GetAuthenticatorRequest): Promise; + /** Queries all authenticators for a given account. */ + + getAuthenticators(request: GetAuthenticatorsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + + constructor(rpc: Rpc) { + this.rpc = rpc; + this.getAuthenticator = this.getAuthenticator.bind(this); + this.getAuthenticators = this.getAuthenticators.bind(this); + } + + getAuthenticator(request: GetAuthenticatorRequest): Promise { + const data = GetAuthenticatorRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Query", "GetAuthenticator", data); + return promise.then(data => GetAuthenticatorResponse.decode(new _m0.Reader(data))); + } + + getAuthenticators(request: GetAuthenticatorsRequest): Promise { + const data = GetAuthenticatorsRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Query", "GetAuthenticators", data); + return promise.then(data => GetAuthenticatorsResponse.decode(new _m0.Reader(data))); + } + +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + getAuthenticator(request: GetAuthenticatorRequest): Promise { + return queryService.getAuthenticator(request); + }, + + getAuthenticators(request: GetAuthenticatorsRequest): Promise { + return queryService.getAuthenticators(request); + } + + }; +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts new file mode 100644 index 0000000000..9087cad421 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts @@ -0,0 +1,237 @@ +import { AccountAuthenticator, AccountAuthenticatorSDKType } from "./models"; +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial, Long } from "../../helpers"; +/** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */ + +export interface GetAuthenticatorsRequest { + /** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */ + account: string; +} +/** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */ + +export interface GetAuthenticatorsRequestSDKType { + /** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */ + account: string; +} +/** MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. */ + +export interface GetAuthenticatorsResponse { + accountAuthenticators: AccountAuthenticator[]; +} +/** MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. */ + +export interface GetAuthenticatorsResponseSDKType { + account_authenticators: AccountAuthenticatorSDKType[]; +} +/** MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. */ + +export interface GetAuthenticatorRequest { + account: string; + authenticatorId: Long; +} +/** MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. */ + +export interface GetAuthenticatorRequestSDKType { + account: string; + authenticator_id: Long; +} +/** MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. */ + +export interface GetAuthenticatorResponse { + accountAuthenticator?: AccountAuthenticator; +} +/** MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. */ + +export interface GetAuthenticatorResponseSDKType { + account_authenticator?: AccountAuthenticatorSDKType; +} + +function createBaseGetAuthenticatorsRequest(): GetAuthenticatorsRequest { + return { + account: "" + }; +} + +export const GetAuthenticatorsRequest = { + encode(message: GetAuthenticatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthenticatorsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthenticatorsRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): GetAuthenticatorsRequest { + const message = createBaseGetAuthenticatorsRequest(); + message.account = object.account ?? ""; + return message; + } + +}; + +function createBaseGetAuthenticatorsResponse(): GetAuthenticatorsResponse { + return { + accountAuthenticators: [] + }; +} + +export const GetAuthenticatorsResponse = { + encode(message: GetAuthenticatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.accountAuthenticators) { + AccountAuthenticator.encode(v!, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthenticatorsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthenticatorsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.accountAuthenticators.push(AccountAuthenticator.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): GetAuthenticatorsResponse { + const message = createBaseGetAuthenticatorsResponse(); + message.accountAuthenticators = object.accountAuthenticators?.map(e => AccountAuthenticator.fromPartial(e)) || []; + return message; + } + +}; + +function createBaseGetAuthenticatorRequest(): GetAuthenticatorRequest { + return { + account: "", + authenticatorId: Long.UZERO + }; +} + +export const GetAuthenticatorRequest = { + encode(message: GetAuthenticatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + + if (!message.authenticatorId.isZero()) { + writer.uint32(16).uint64(message.authenticatorId); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthenticatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthenticatorRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + + case 2: + message.authenticatorId = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): GetAuthenticatorRequest { + const message = createBaseGetAuthenticatorRequest(); + message.account = object.account ?? ""; + message.authenticatorId = object.authenticatorId !== undefined && object.authenticatorId !== null ? Long.fromValue(object.authenticatorId) : Long.UZERO; + return message; + } + +}; + +function createBaseGetAuthenticatorResponse(): GetAuthenticatorResponse { + return { + accountAuthenticator: undefined + }; +} + +export const GetAuthenticatorResponse = { + encode(message: GetAuthenticatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accountAuthenticator !== undefined) { + AccountAuthenticator.encode(message.accountAuthenticator, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthenticatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthenticatorResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.accountAuthenticator = AccountAuthenticator.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): GetAuthenticatorResponse { + const message = createBaseGetAuthenticatorResponse(); + message.accountAuthenticator = object.accountAuthenticator !== undefined && object.accountAuthenticator !== null ? AccountAuthenticator.fromPartial(object.accountAuthenticator) : undefined; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts new file mode 100644 index 0000000000..863458ced6 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts @@ -0,0 +1,34 @@ +import { Rpc } from "../../helpers"; +import * as _m0 from "protobufjs/minimal"; +import { MsgAddAuthenticator, MsgAddAuthenticatorResponse, MsgRemoveAuthenticator, MsgRemoveAuthenticatorResponse } from "./tx"; +/** Msg defines the Msg service. */ + +export interface Msg { + /** AddAuthenticator adds an authenticator to an account. */ + addAuthenticator(request: MsgAddAuthenticator): Promise; + /** RemoveAuthenticator removes an authenticator from an account. */ + + removeAuthenticator(request: MsgRemoveAuthenticator): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + + constructor(rpc: Rpc) { + this.rpc = rpc; + this.addAuthenticator = this.addAuthenticator.bind(this); + this.removeAuthenticator = this.removeAuthenticator.bind(this); + } + + addAuthenticator(request: MsgAddAuthenticator): Promise { + const data = MsgAddAuthenticator.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Msg", "AddAuthenticator", data); + return promise.then(data => MsgAddAuthenticatorResponse.decode(new _m0.Reader(data))); + } + + removeAuthenticator(request: MsgRemoveAuthenticator): Promise { + const data = MsgRemoveAuthenticator.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Msg", "RemoveAuthenticator", data); + return promise.then(data => MsgRemoveAuthenticatorResponse.decode(new _m0.Reader(data))); + } + +} \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts new file mode 100644 index 0000000000..8561898d75 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts @@ -0,0 +1,361 @@ +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial, Long } from "../../helpers"; +/** MsgAddAuthenticatorRequest defines the Msg/AddAuthenticator request type. */ + +export interface MsgAddAuthenticator { + sender: string; + authenticatorType: string; + data: Uint8Array; +} +/** MsgAddAuthenticatorRequest defines the Msg/AddAuthenticator request type. */ + +export interface MsgAddAuthenticatorSDKType { + sender: string; + authenticator_type: string; + data: Uint8Array; +} +/** MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. */ + +export interface MsgAddAuthenticatorResponse { + /** MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. */ + success: boolean; +} +/** MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. */ + +export interface MsgAddAuthenticatorResponseSDKType { + /** MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. */ + success: boolean; +} +/** + * MsgRemoveAuthenticatorRequest defines the Msg/RemoveAuthenticator request + * type. + */ + +export interface MsgRemoveAuthenticator { + sender: string; + id: Long; +} +/** + * MsgRemoveAuthenticatorRequest defines the Msg/RemoveAuthenticator request + * type. + */ + +export interface MsgRemoveAuthenticatorSDKType { + sender: string; + id: Long; +} +/** + * MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response + * type. + */ + +export interface MsgRemoveAuthenticatorResponse { + /** + * MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response + * type. + */ + success: boolean; +} +/** + * MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response + * type. + */ + +export interface MsgRemoveAuthenticatorResponseSDKType { + /** + * MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response + * type. + */ + success: boolean; +} +/** + * TxExtension allows for additional authenticator-specific data in + * transactions. + */ + +export interface TxExtension { + /** + * selected_authenticators holds the authenticator_id for the chosen + * authenticator per message. + */ + selectedAuthenticators: Long[]; +} +/** + * TxExtension allows for additional authenticator-specific data in + * transactions. + */ + +export interface TxExtensionSDKType { + /** + * selected_authenticators holds the authenticator_id for the chosen + * authenticator per message. + */ + selected_authenticators: Long[]; +} + +function createBaseMsgAddAuthenticator(): MsgAddAuthenticator { + return { + sender: "", + authenticatorType: "", + data: new Uint8Array() + }; +} + +export const MsgAddAuthenticator = { + encode(message: MsgAddAuthenticator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + + if (message.authenticatorType !== "") { + writer.uint32(18).string(message.authenticatorType); + } + + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgAddAuthenticator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddAuthenticator(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + + case 2: + message.authenticatorType = reader.string(); + break; + + case 3: + message.data = reader.bytes(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgAddAuthenticator { + const message = createBaseMsgAddAuthenticator(); + message.sender = object.sender ?? ""; + message.authenticatorType = object.authenticatorType ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + } + +}; + +function createBaseMsgAddAuthenticatorResponse(): MsgAddAuthenticatorResponse { + return { + success: false + }; +} + +export const MsgAddAuthenticatorResponse = { + encode(message: MsgAddAuthenticatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.success === true) { + writer.uint32(8).bool(message.success); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgAddAuthenticatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddAuthenticatorResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.success = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgAddAuthenticatorResponse { + const message = createBaseMsgAddAuthenticatorResponse(); + message.success = object.success ?? false; + return message; + } + +}; + +function createBaseMsgRemoveAuthenticator(): MsgRemoveAuthenticator { + return { + sender: "", + id: Long.UZERO + }; +} + +export const MsgRemoveAuthenticator = { + encode(message: MsgRemoveAuthenticator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + + if (!message.id.isZero()) { + writer.uint32(16).uint64(message.id); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRemoveAuthenticator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveAuthenticator(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + + case 2: + message.id = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgRemoveAuthenticator { + const message = createBaseMsgRemoveAuthenticator(); + message.sender = object.sender ?? ""; + message.id = object.id !== undefined && object.id !== null ? Long.fromValue(object.id) : Long.UZERO; + return message; + } + +}; + +function createBaseMsgRemoveAuthenticatorResponse(): MsgRemoveAuthenticatorResponse { + return { + success: false + }; +} + +export const MsgRemoveAuthenticatorResponse = { + encode(message: MsgRemoveAuthenticatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.success === true) { + writer.uint32(8).bool(message.success); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRemoveAuthenticatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveAuthenticatorResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.success = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgRemoveAuthenticatorResponse { + const message = createBaseMsgRemoveAuthenticatorResponse(); + message.success = object.success ?? false; + return message; + } + +}; + +function createBaseTxExtension(): TxExtension { + return { + selectedAuthenticators: [] + }; +} + +export const TxExtension = { + encode(message: TxExtension, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + writer.uint32(10).fork(); + + for (const v of message.selectedAuthenticators) { + writer.uint64(v); + } + + writer.ldelim(); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxExtension { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxExtension(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + + while (reader.pos < end2) { + message.selectedAuthenticators.push((reader.uint64() as Long)); + } + } else { + message.selectedAuthenticators.push((reader.uint64() as Long)); + } + + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): TxExtension { + const message = createBaseTxExtension(); + message.selectedAuthenticators = object.selectedAuthenticators?.map(e => Long.fromValue(e)) || []; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index 8357d1849d..b56e28de7c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -1,218 +1,227 @@ import * as _5 from "./accountplus/accountplus"; import * as _6 from "./accountplus/genesis"; -import * as _7 from "./affiliates/affiliates"; -import * as _8 from "./affiliates/genesis"; -import * as _9 from "./affiliates/query"; -import * as _10 from "./affiliates/tx"; -import * as _11 from "./assets/asset"; -import * as _12 from "./assets/genesis"; -import * as _13 from "./assets/query"; -import * as _14 from "./assets/tx"; -import * as _15 from "./blocktime/blocktime"; -import * as _16 from "./blocktime/genesis"; -import * as _17 from "./blocktime/params"; -import * as _18 from "./blocktime/query"; -import * as _19 from "./blocktime/tx"; -import * as _20 from "./bridge/bridge_event_info"; -import * as _21 from "./bridge/bridge_event"; -import * as _22 from "./bridge/genesis"; -import * as _23 from "./bridge/params"; -import * as _24 from "./bridge/query"; -import * as _25 from "./bridge/tx"; -import * as _26 from "./clob/block_rate_limit_config"; -import * as _27 from "./clob/clob_pair"; -import * as _28 from "./clob/equity_tier_limit_config"; -import * as _29 from "./clob/genesis"; -import * as _30 from "./clob/liquidations_config"; -import * as _31 from "./clob/liquidations"; -import * as _32 from "./clob/matches"; -import * as _33 from "./clob/mev"; -import * as _34 from "./clob/operation"; -import * as _35 from "./clob/order_removals"; -import * as _36 from "./clob/order"; -import * as _37 from "./clob/process_proposer_matches_events"; -import * as _38 from "./clob/query"; -import * as _39 from "./clob/tx"; -import * as _40 from "./daemons/bridge/bridge"; -import * as _41 from "./daemons/liquidation/liquidation"; -import * as _42 from "./daemons/pricefeed/price_feed"; -import * as _43 from "./delaymsg/block_message_ids"; -import * as _44 from "./delaymsg/delayed_message"; -import * as _45 from "./delaymsg/genesis"; -import * as _46 from "./delaymsg/query"; -import * as _47 from "./delaymsg/tx"; -import * as _48 from "./epochs/epoch_info"; -import * as _49 from "./epochs/genesis"; -import * as _50 from "./epochs/query"; -import * as _51 from "./feetiers/genesis"; -import * as _52 from "./feetiers/params"; -import * as _53 from "./feetiers/query"; -import * as _54 from "./feetiers/tx"; -import * as _55 from "./govplus/genesis"; -import * as _56 from "./govplus/query"; -import * as _57 from "./govplus/tx"; -import * as _58 from "./indexer/events/events"; -import * as _59 from "./indexer/indexer_manager/event"; -import * as _60 from "./indexer/off_chain_updates/off_chain_updates"; -import * as _61 from "./indexer/protocol/v1/clob"; -import * as _62 from "./indexer/protocol/v1/perpetual"; -import * as _63 from "./indexer/protocol/v1/subaccount"; -import * as _64 from "./indexer/redis/redis_order"; -import * as _65 from "./indexer/shared/removal_reason"; -import * as _66 from "./indexer/socks/messages"; -import * as _67 from "./listing/genesis"; -import * as _68 from "./listing/params"; -import * as _69 from "./listing/query"; -import * as _70 from "./listing/tx"; -import * as _71 from "./perpetuals/genesis"; -import * as _72 from "./perpetuals/params"; -import * as _73 from "./perpetuals/perpetual"; -import * as _74 from "./perpetuals/query"; -import * as _75 from "./perpetuals/tx"; -import * as _76 from "./prices/genesis"; -import * as _77 from "./prices/market_param"; -import * as _78 from "./prices/market_price"; -import * as _79 from "./prices/query"; -import * as _80 from "./prices/tx"; -import * as _81 from "./ratelimit/capacity"; -import * as _82 from "./ratelimit/genesis"; -import * as _83 from "./ratelimit/limit_params"; -import * as _84 from "./ratelimit/pending_send_packet"; -import * as _85 from "./ratelimit/query"; -import * as _86 from "./ratelimit/tx"; -import * as _87 from "./revshare/genesis"; -import * as _88 from "./revshare/params"; -import * as _89 from "./revshare/query"; -import * as _90 from "./revshare/revshare"; -import * as _91 from "./revshare/tx"; -import * as _92 from "./rewards/genesis"; -import * as _93 from "./rewards/params"; -import * as _94 from "./rewards/query"; -import * as _95 from "./rewards/reward_share"; -import * as _96 from "./rewards/tx"; -import * as _97 from "./sending/genesis"; -import * as _98 from "./sending/query"; -import * as _99 from "./sending/transfer"; -import * as _100 from "./sending/tx"; -import * as _101 from "./stats/genesis"; -import * as _102 from "./stats/params"; -import * as _103 from "./stats/query"; -import * as _104 from "./stats/stats"; -import * as _105 from "./stats/tx"; -import * as _106 from "./subaccounts/asset_position"; -import * as _107 from "./subaccounts/genesis"; -import * as _108 from "./subaccounts/perpetual_position"; -import * as _109 from "./subaccounts/query"; -import * as _110 from "./subaccounts/streaming"; -import * as _111 from "./subaccounts/subaccount"; -import * as _112 from "./vault/genesis"; -import * as _113 from "./vault/params"; -import * as _114 from "./vault/query"; -import * as _115 from "./vault/share"; -import * as _116 from "./vault/tx"; -import * as _117 from "./vault/vault"; -import * as _118 from "./vest/genesis"; -import * as _119 from "./vest/query"; -import * as _120 from "./vest/tx"; -import * as _121 from "./vest/vest_entry"; -import * as _129 from "./assets/query.lcd"; -import * as _130 from "./blocktime/query.lcd"; -import * as _131 from "./bridge/query.lcd"; -import * as _132 from "./clob/query.lcd"; -import * as _133 from "./delaymsg/query.lcd"; -import * as _134 from "./epochs/query.lcd"; -import * as _135 from "./feetiers/query.lcd"; -import * as _136 from "./listing/query.lcd"; -import * as _137 from "./perpetuals/query.lcd"; -import * as _138 from "./prices/query.lcd"; -import * as _139 from "./ratelimit/query.lcd"; -import * as _140 from "./revshare/query.lcd"; -import * as _141 from "./rewards/query.lcd"; -import * as _142 from "./stats/query.lcd"; -import * as _143 from "./subaccounts/query.lcd"; -import * as _144 from "./vault/query.lcd"; -import * as _145 from "./vest/query.lcd"; -import * as _146 from "./affiliates/query.rpc.Query"; -import * as _147 from "./assets/query.rpc.Query"; -import * as _148 from "./blocktime/query.rpc.Query"; -import * as _149 from "./bridge/query.rpc.Query"; -import * as _150 from "./clob/query.rpc.Query"; -import * as _151 from "./delaymsg/query.rpc.Query"; -import * as _152 from "./epochs/query.rpc.Query"; -import * as _153 from "./feetiers/query.rpc.Query"; -import * as _154 from "./govplus/query.rpc.Query"; -import * as _155 from "./listing/query.rpc.Query"; -import * as _156 from "./perpetuals/query.rpc.Query"; -import * as _157 from "./prices/query.rpc.Query"; -import * as _158 from "./ratelimit/query.rpc.Query"; -import * as _159 from "./revshare/query.rpc.Query"; -import * as _160 from "./rewards/query.rpc.Query"; -import * as _161 from "./sending/query.rpc.Query"; -import * as _162 from "./stats/query.rpc.Query"; -import * as _163 from "./subaccounts/query.rpc.Query"; -import * as _164 from "./vault/query.rpc.Query"; -import * as _165 from "./vest/query.rpc.Query"; -import * as _166 from "./affiliates/tx.rpc.msg"; -import * as _167 from "./blocktime/tx.rpc.msg"; -import * as _168 from "./bridge/tx.rpc.msg"; -import * as _169 from "./clob/tx.rpc.msg"; -import * as _170 from "./delaymsg/tx.rpc.msg"; -import * as _171 from "./feetiers/tx.rpc.msg"; -import * as _172 from "./govplus/tx.rpc.msg"; -import * as _173 from "./listing/tx.rpc.msg"; -import * as _174 from "./perpetuals/tx.rpc.msg"; -import * as _175 from "./prices/tx.rpc.msg"; -import * as _176 from "./ratelimit/tx.rpc.msg"; -import * as _177 from "./revshare/tx.rpc.msg"; -import * as _178 from "./rewards/tx.rpc.msg"; -import * as _179 from "./sending/tx.rpc.msg"; -import * as _180 from "./stats/tx.rpc.msg"; -import * as _181 from "./vault/tx.rpc.msg"; -import * as _182 from "./vest/tx.rpc.msg"; -import * as _183 from "./lcd"; -import * as _184 from "./rpc.query"; -import * as _185 from "./rpc.tx"; +import * as _7 from "./accountplus/models"; +import * as _8 from "./accountplus/query"; +import * as _9 from "./accountplus/tx"; +import * as _10 from "./affiliates/affiliates"; +import * as _11 from "./affiliates/genesis"; +import * as _12 from "./affiliates/query"; +import * as _13 from "./affiliates/tx"; +import * as _14 from "./assets/asset"; +import * as _15 from "./assets/genesis"; +import * as _16 from "./assets/query"; +import * as _17 from "./assets/tx"; +import * as _18 from "./blocktime/blocktime"; +import * as _19 from "./blocktime/genesis"; +import * as _20 from "./blocktime/params"; +import * as _21 from "./blocktime/query"; +import * as _22 from "./blocktime/tx"; +import * as _23 from "./bridge/bridge_event_info"; +import * as _24 from "./bridge/bridge_event"; +import * as _25 from "./bridge/genesis"; +import * as _26 from "./bridge/params"; +import * as _27 from "./bridge/query"; +import * as _28 from "./bridge/tx"; +import * as _29 from "./clob/block_rate_limit_config"; +import * as _30 from "./clob/clob_pair"; +import * as _31 from "./clob/equity_tier_limit_config"; +import * as _32 from "./clob/genesis"; +import * as _33 from "./clob/liquidations_config"; +import * as _34 from "./clob/liquidations"; +import * as _35 from "./clob/matches"; +import * as _36 from "./clob/mev"; +import * as _37 from "./clob/operation"; +import * as _38 from "./clob/order_removals"; +import * as _39 from "./clob/order"; +import * as _40 from "./clob/process_proposer_matches_events"; +import * as _41 from "./clob/query"; +import * as _42 from "./clob/tx"; +import * as _43 from "./daemons/bridge/bridge"; +import * as _44 from "./daemons/liquidation/liquidation"; +import * as _45 from "./daemons/pricefeed/price_feed"; +import * as _46 from "./delaymsg/block_message_ids"; +import * as _47 from "./delaymsg/delayed_message"; +import * as _48 from "./delaymsg/genesis"; +import * as _49 from "./delaymsg/query"; +import * as _50 from "./delaymsg/tx"; +import * as _51 from "./epochs/epoch_info"; +import * as _52 from "./epochs/genesis"; +import * as _53 from "./epochs/query"; +import * as _54 from "./feetiers/genesis"; +import * as _55 from "./feetiers/params"; +import * as _56 from "./feetiers/query"; +import * as _57 from "./feetiers/tx"; +import * as _58 from "./govplus/genesis"; +import * as _59 from "./govplus/query"; +import * as _60 from "./govplus/tx"; +import * as _61 from "./indexer/events/events"; +import * as _62 from "./indexer/indexer_manager/event"; +import * as _63 from "./indexer/off_chain_updates/off_chain_updates"; +import * as _64 from "./indexer/protocol/v1/clob"; +import * as _65 from "./indexer/protocol/v1/perpetual"; +import * as _66 from "./indexer/protocol/v1/subaccount"; +import * as _67 from "./indexer/redis/redis_order"; +import * as _68 from "./indexer/shared/removal_reason"; +import * as _69 from "./indexer/socks/messages"; +import * as _70 from "./listing/genesis"; +import * as _71 from "./listing/params"; +import * as _72 from "./listing/query"; +import * as _73 from "./listing/tx"; +import * as _74 from "./perpetuals/genesis"; +import * as _75 from "./perpetuals/params"; +import * as _76 from "./perpetuals/perpetual"; +import * as _77 from "./perpetuals/query"; +import * as _78 from "./perpetuals/tx"; +import * as _79 from "./prices/genesis"; +import * as _80 from "./prices/market_param"; +import * as _81 from "./prices/market_price"; +import * as _82 from "./prices/query"; +import * as _83 from "./prices/tx"; +import * as _84 from "./ratelimit/capacity"; +import * as _85 from "./ratelimit/genesis"; +import * as _86 from "./ratelimit/limit_params"; +import * as _87 from "./ratelimit/pending_send_packet"; +import * as _88 from "./ratelimit/query"; +import * as _89 from "./ratelimit/tx"; +import * as _90 from "./revshare/genesis"; +import * as _91 from "./revshare/params"; +import * as _92 from "./revshare/query"; +import * as _93 from "./revshare/revshare"; +import * as _94 from "./revshare/tx"; +import * as _95 from "./rewards/genesis"; +import * as _96 from "./rewards/params"; +import * as _97 from "./rewards/query"; +import * as _98 from "./rewards/reward_share"; +import * as _99 from "./rewards/tx"; +import * as _100 from "./sending/genesis"; +import * as _101 from "./sending/query"; +import * as _102 from "./sending/transfer"; +import * as _103 from "./sending/tx"; +import * as _104 from "./stats/genesis"; +import * as _105 from "./stats/params"; +import * as _106 from "./stats/query"; +import * as _107 from "./stats/stats"; +import * as _108 from "./stats/tx"; +import * as _109 from "./subaccounts/asset_position"; +import * as _110 from "./subaccounts/genesis"; +import * as _111 from "./subaccounts/perpetual_position"; +import * as _112 from "./subaccounts/query"; +import * as _113 from "./subaccounts/streaming"; +import * as _114 from "./subaccounts/subaccount"; +import * as _115 from "./vault/genesis"; +import * as _116 from "./vault/params"; +import * as _117 from "./vault/query"; +import * as _118 from "./vault/share"; +import * as _119 from "./vault/tx"; +import * as _120 from "./vault/vault"; +import * as _121 from "./vest/genesis"; +import * as _122 from "./vest/query"; +import * as _123 from "./vest/tx"; +import * as _124 from "./vest/vest_entry"; +import * as _132 from "./accountplus/query.lcd"; +import * as _133 from "./assets/query.lcd"; +import * as _134 from "./blocktime/query.lcd"; +import * as _135 from "./bridge/query.lcd"; +import * as _136 from "./clob/query.lcd"; +import * as _137 from "./delaymsg/query.lcd"; +import * as _138 from "./epochs/query.lcd"; +import * as _139 from "./feetiers/query.lcd"; +import * as _140 from "./listing/query.lcd"; +import * as _141 from "./perpetuals/query.lcd"; +import * as _142 from "./prices/query.lcd"; +import * as _143 from "./ratelimit/query.lcd"; +import * as _144 from "./revshare/query.lcd"; +import * as _145 from "./rewards/query.lcd"; +import * as _146 from "./stats/query.lcd"; +import * as _147 from "./subaccounts/query.lcd"; +import * as _148 from "./vault/query.lcd"; +import * as _149 from "./vest/query.lcd"; +import * as _150 from "./accountplus/query.rpc.Query"; +import * as _151 from "./affiliates/query.rpc.Query"; +import * as _152 from "./assets/query.rpc.Query"; +import * as _153 from "./blocktime/query.rpc.Query"; +import * as _154 from "./bridge/query.rpc.Query"; +import * as _155 from "./clob/query.rpc.Query"; +import * as _156 from "./delaymsg/query.rpc.Query"; +import * as _157 from "./epochs/query.rpc.Query"; +import * as _158 from "./feetiers/query.rpc.Query"; +import * as _159 from "./govplus/query.rpc.Query"; +import * as _160 from "./listing/query.rpc.Query"; +import * as _161 from "./perpetuals/query.rpc.Query"; +import * as _162 from "./prices/query.rpc.Query"; +import * as _163 from "./ratelimit/query.rpc.Query"; +import * as _164 from "./revshare/query.rpc.Query"; +import * as _165 from "./rewards/query.rpc.Query"; +import * as _166 from "./sending/query.rpc.Query"; +import * as _167 from "./stats/query.rpc.Query"; +import * as _168 from "./subaccounts/query.rpc.Query"; +import * as _169 from "./vault/query.rpc.Query"; +import * as _170 from "./vest/query.rpc.Query"; +import * as _171 from "./accountplus/tx.rpc.msg"; +import * as _172 from "./affiliates/tx.rpc.msg"; +import * as _173 from "./blocktime/tx.rpc.msg"; +import * as _174 from "./bridge/tx.rpc.msg"; +import * as _175 from "./clob/tx.rpc.msg"; +import * as _176 from "./delaymsg/tx.rpc.msg"; +import * as _177 from "./feetiers/tx.rpc.msg"; +import * as _178 from "./govplus/tx.rpc.msg"; +import * as _179 from "./listing/tx.rpc.msg"; +import * as _180 from "./perpetuals/tx.rpc.msg"; +import * as _181 from "./prices/tx.rpc.msg"; +import * as _182 from "./ratelimit/tx.rpc.msg"; +import * as _183 from "./revshare/tx.rpc.msg"; +import * as _184 from "./rewards/tx.rpc.msg"; +import * as _185 from "./sending/tx.rpc.msg"; +import * as _186 from "./stats/tx.rpc.msg"; +import * as _187 from "./vault/tx.rpc.msg"; +import * as _188 from "./vest/tx.rpc.msg"; +import * as _189 from "./lcd"; +import * as _190 from "./rpc.query"; +import * as _191 from "./rpc.tx"; export namespace dydxprotocol { export const accountplus = { ..._5, - ..._6 - }; - export const affiliates = { ..._7, + ..._6, + ..._7, ..._8, ..._9, - ..._10, - ..._146, - ..._166 + ..._132, + ..._150, + ..._171 }; - export const assets = { ..._11, + export const affiliates = { ..._10, + ..._11, ..._12, ..._13, - ..._14, - ..._129, - ..._147 + ..._151, + ..._172 }; - export const blocktime = { ..._15, + export const assets = { ..._14, + ..._15, ..._16, ..._17, - ..._18, - ..._19, - ..._130, - ..._148, - ..._167 + ..._133, + ..._152 }; - export const bridge = { ..._20, + export const blocktime = { ..._18, + ..._19, + ..._20, ..._21, ..._22, - ..._23, + ..._134, + ..._153, + ..._173 + }; + export const bridge = { ..._23, ..._24, ..._25, - ..._131, - ..._149, - ..._168 - }; - export const clob = { ..._26, + ..._26, ..._27, ..._28, - ..._29, + ..._135, + ..._154, + ..._174 + }; + export const clob = { ..._29, ..._30, ..._31, ..._32, @@ -223,166 +232,169 @@ export namespace dydxprotocol { ..._37, ..._38, ..._39, - ..._132, - ..._150, - ..._169 + ..._40, + ..._41, + ..._42, + ..._136, + ..._155, + ..._175 }; export namespace daemons { - export const bridge = { ..._40 + export const bridge = { ..._43 }; - export const liquidation = { ..._41 + export const liquidation = { ..._44 }; - export const pricefeed = { ..._42 + export const pricefeed = { ..._45 }; } - export const delaymsg = { ..._43, - ..._44, - ..._45, - ..._46, + export const delaymsg = { ..._46, ..._47, - ..._133, - ..._151, - ..._170 - }; - export const epochs = { ..._48, + ..._48, ..._49, ..._50, - ..._134, - ..._152 + ..._137, + ..._156, + ..._176 }; - export const feetiers = { ..._51, + export const epochs = { ..._51, ..._52, ..._53, - ..._54, - ..._135, - ..._153, - ..._171 + ..._138, + ..._157 }; - export const govplus = { ..._55, + export const feetiers = { ..._54, + ..._55, ..._56, ..._57, - ..._154, - ..._172 + ..._139, + ..._158, + ..._177 + }; + export const govplus = { ..._58, + ..._59, + ..._60, + ..._159, + ..._178 }; export namespace indexer { - export const events = { ..._58 + export const events = { ..._61 }; - export const indexer_manager = { ..._59 + export const indexer_manager = { ..._62 }; - export const off_chain_updates = { ..._60 + export const off_chain_updates = { ..._63 }; export namespace protocol { - export const v1 = { ..._61, - ..._62, - ..._63 + export const v1 = { ..._64, + ..._65, + ..._66 }; } - export const redis = { ..._64 + export const redis = { ..._67 }; - export const shared = { ..._65 + export const shared = { ..._68 }; - export const socks = { ..._66 + export const socks = { ..._69 }; } - export const listing = { ..._67, - ..._68, - ..._69, - ..._70, - ..._136, - ..._155, - ..._173 - }; - export const perpetuals = { ..._71, + export const listing = { ..._70, + ..._71, ..._72, ..._73, - ..._74, - ..._75, - ..._137, - ..._156, - ..._174 + ..._140, + ..._160, + ..._179 }; - export const prices = { ..._76, + export const perpetuals = { ..._74, + ..._75, + ..._76, ..._77, ..._78, - ..._79, - ..._80, - ..._138, - ..._157, - ..._175 + ..._141, + ..._161, + ..._180 }; - export const ratelimit = { ..._81, + export const prices = { ..._79, + ..._80, + ..._81, ..._82, ..._83, - ..._84, + ..._142, + ..._162, + ..._181 + }; + export const ratelimit = { ..._84, ..._85, ..._86, - ..._139, - ..._158, - ..._176 - }; - export const revshare = { ..._87, + ..._87, ..._88, ..._89, - ..._90, - ..._91, - ..._140, - ..._159, - ..._177 + ..._143, + ..._163, + ..._182 }; - export const rewards = { ..._92, + export const revshare = { ..._90, + ..._91, + ..._92, ..._93, ..._94, - ..._95, - ..._96, - ..._141, - ..._160, - ..._178 + ..._144, + ..._164, + ..._183 }; - export const sending = { ..._97, + export const rewards = { ..._95, + ..._96, + ..._97, ..._98, ..._99, - ..._100, - ..._161, - ..._179 + ..._145, + ..._165, + ..._184 }; - export const stats = { ..._101, + export const sending = { ..._100, + ..._101, ..._102, ..._103, - ..._104, - ..._105, - ..._142, - ..._162, - ..._180 + ..._166, + ..._185 }; - export const subaccounts = { ..._106, + export const stats = { ..._104, + ..._105, + ..._106, ..._107, ..._108, - ..._109, + ..._146, + ..._167, + ..._186 + }; + export const subaccounts = { ..._109, ..._110, ..._111, - ..._143, - ..._163 - }; - export const vault = { ..._112, + ..._112, ..._113, ..._114, - ..._115, + ..._147, + ..._168 + }; + export const vault = { ..._115, ..._116, ..._117, - ..._144, - ..._164, - ..._181 - }; - export const vest = { ..._118, + ..._118, ..._119, ..._120, - ..._121, - ..._145, - ..._165, - ..._182 + ..._148, + ..._169, + ..._187 }; - export const ClientFactory = { ..._183, - ..._184, - ..._185 + export const vest = { ..._121, + ..._122, + ..._123, + ..._124, + ..._149, + ..._170, + ..._188 + }; + export const ClientFactory = { ..._189, + ..._190, + ..._191 }; } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts index 790d937a2e..dd77cee074 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts @@ -9,6 +9,9 @@ export const createLCDClient = async ({ }); return { dydxprotocol: { + accountplus: new (await import("./accountplus/query.lcd")).LCDQueryClient({ + requestClient + }), assets: new (await import("./assets/query.lcd")).LCDQueryClient({ requestClient }), diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts index 73541397db..dd9037fad1 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts @@ -9,6 +9,7 @@ export const createRPCQueryClient = async ({ const client = new QueryClient(tmClient); return { dydxprotocol: { + accountplus: (await import("./accountplus/query.rpc.Query")).createRpcQueryExtension(client), affiliates: (await import("./affiliates/query.rpc.Query")).createRpcQueryExtension(client), assets: (await import("./assets/query.rpc.Query")).createRpcQueryExtension(client), blocktime: (await import("./blocktime/query.rpc.Query")).createRpcQueryExtension(client), diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts index 1c3eedfabc..cfddfb350c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts @@ -5,6 +5,7 @@ export const createRPCMsgClient = async ({ rpc: Rpc; }) => ({ dydxprotocol: { + accountplus: new (await import("./accountplus/tx.rpc.msg")).MsgClientImpl(rpc), affiliates: new (await import("./affiliates/tx.rpc.msg")).MsgClientImpl(rpc), blocktime: new (await import("./blocktime/tx.rpc.msg")).MsgClientImpl(rpc), bridge: new (await import("./bridge/tx.rpc.msg")).MsgClientImpl(rpc), diff --git a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts index 790ad9003a..486d799253 100644 --- a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts @@ -1,3 +1,3 @@ -import * as _122 from "./gogo"; -export const gogoproto = { ..._122 +import * as _125 from "./gogo"; +export const gogoproto = { ..._125 }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/google/bundle.ts b/indexer/packages/v4-protos/src/codegen/google/bundle.ts index 1ed0c78141..5c2c5120ea 100644 --- a/indexer/packages/v4-protos/src/codegen/google/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/google/bundle.ts @@ -1,16 +1,16 @@ -import * as _123 from "./api/annotations"; -import * as _124 from "./api/http"; -import * as _125 from "./protobuf/descriptor"; -import * as _126 from "./protobuf/duration"; -import * as _127 from "./protobuf/timestamp"; -import * as _128 from "./protobuf/any"; +import * as _126 from "./api/annotations"; +import * as _127 from "./api/http"; +import * as _128 from "./protobuf/descriptor"; +import * as _129 from "./protobuf/duration"; +import * as _130 from "./protobuf/timestamp"; +import * as _131 from "./protobuf/any"; export namespace google { - export const api = { ..._123, - ..._124 + export const api = { ..._126, + ..._127 }; - export const protobuf = { ..._125, - ..._126, - ..._127, - ..._128 + export const protobuf = { ..._128, + ..._129, + ..._130, + ..._131 }; } \ No newline at end of file From a1a3263a1c29e49f0d7664001b8597a66893a389 Mon Sep 17 00:00:00 2001 From: Jay Yu <103467857+jayy04@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:24:09 +0900 Subject: [PATCH 4/6] add params --- .../dydxprotocol/accountplus/genesis.ts | 23 +- .../dydxprotocol/accountplus/params.ts | 67 ++ .../dydxprotocol/accountplus/query.lcd.ts | 10 +- .../accountplus/query.rpc.Query.ts | 16 +- .../codegen/dydxprotocol/accountplus/query.ts | 98 +++ .../dydxprotocol/accountplus/tx.rpc.msg.ts | 15 +- .../codegen/dydxprotocol/accountplus/tx.ts | 107 ++++ .../src/codegen/dydxprotocol/bundle.ts | 580 +++++++++--------- .../v4-protos/src/codegen/gogoproto/bundle.ts | 4 +- .../v4-protos/src/codegen/google/bundle.ts | 22 +- proto/dydxprotocol/accountplus/genesis.proto | 8 +- proto/dydxprotocol/accountplus/models.proto | 2 +- proto/dydxprotocol/accountplus/params.proto | 15 + proto/dydxprotocol/accountplus/query.proto | 18 +- proto/dydxprotocol/accountplus/tx.proto | 18 +- .../app/testdata/default_genesis_state.json | 3 + .../scripts/genesis/sample_pregenesis.json | 5 +- protocol/x/accountplus/types/genesis.pb.go | 110 +++- protocol/x/accountplus/types/params.pb.go | 315 ++++++++++ protocol/x/accountplus/types/query.pb.go | 399 +++++++++++- protocol/x/accountplus/types/query.pb.gw.go | 65 ++ protocol/x/accountplus/types/tx.pb.go | 435 ++++++++++++- 22 files changed, 1935 insertions(+), 400 deletions(-) create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/params.ts create mode 100644 proto/dydxprotocol/accountplus/params.proto create mode 100644 protocol/x/accountplus/types/params.pb.go diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts index 0757871328..5ffc5a7edf 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts @@ -1,5 +1,6 @@ import { AccountAuthenticator, AccountAuthenticatorSDKType } from "./models"; import { AccountState, AccountStateSDKType } from "./accountplus"; +import { Params, ParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial, Long } from "../../helpers"; /** @@ -38,6 +39,9 @@ export interface AuthenticatorDataSDKType { export interface GenesisState { accounts: AccountState[]; + /** params define the parameters for the authenticator module. */ + + params?: Params; /** next_authenticator_id is the next available authenticator ID. */ nextAuthenticatorId: Long; @@ -52,6 +56,9 @@ export interface GenesisState { export interface GenesisStateSDKType { accounts: AccountStateSDKType[]; + /** params define the parameters for the authenticator module. */ + + params?: ParamsSDKType; /** next_authenticator_id is the next available authenticator ID. */ next_authenticator_id: Long; @@ -121,6 +128,7 @@ export const AuthenticatorData = { function createBaseGenesisState(): GenesisState { return { accounts: [], + params: undefined, nextAuthenticatorId: Long.UZERO, authenticatorData: [] }; @@ -132,12 +140,16 @@ export const GenesisState = { AccountState.encode(v!, writer.uint32(10).fork()).ldelim(); } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + if (!message.nextAuthenticatorId.isZero()) { - writer.uint32(16).uint64(message.nextAuthenticatorId); + writer.uint32(24).uint64(message.nextAuthenticatorId); } for (const v of message.authenticatorData) { - AuthenticatorData.encode(v!, writer.uint32(26).fork()).ldelim(); + AuthenticatorData.encode(v!, writer.uint32(34).fork()).ldelim(); } return writer; @@ -157,10 +169,14 @@ export const GenesisState = { break; case 2: - message.nextAuthenticatorId = (reader.uint64() as Long); + message.params = Params.decode(reader, reader.uint32()); break; case 3: + message.nextAuthenticatorId = (reader.uint64() as Long); + break; + + case 4: message.authenticatorData.push(AuthenticatorData.decode(reader, reader.uint32())); break; @@ -176,6 +192,7 @@ export const GenesisState = { fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); message.accounts = object.accounts?.map(e => AccountState.fromPartial(e)) || []; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.nextAuthenticatorId = object.nextAuthenticatorId !== undefined && object.nextAuthenticatorId !== null ? Long.fromValue(object.nextAuthenticatorId) : Long.UZERO; message.authenticatorData = object.authenticatorData?.map(e => AuthenticatorData.fromPartial(e)) || []; return message; diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/params.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/params.ts new file mode 100644 index 0000000000..e0c5fb5adb --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/params.ts @@ -0,0 +1,67 @@ +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** Params defines the parameters for the module. */ + +export interface Params { + /** + * IsSmartAccountActive defines the state of the authenticator. + * If set to false, the authenticator module will not be used + * and the classic cosmos sdk authentication will be used instead. + */ + isSmartAccountActive: boolean; +} +/** Params defines the parameters for the module. */ + +export interface ParamsSDKType { + /** + * IsSmartAccountActive defines the state of the authenticator. + * If set to false, the authenticator module will not be used + * and the classic cosmos sdk authentication will be used instead. + */ + is_smart_account_active: boolean; +} + +function createBaseParams(): Params { + return { + isSmartAccountActive: false + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.isSmartAccountActive === true) { + writer.uint32(8).bool(message.isSmartAccountActive); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.isSmartAccountActive = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.isSmartAccountActive = object.isSmartAccountActive ?? false; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts index f63258df1e..6331bc8560 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts @@ -1,5 +1,5 @@ import { LCDClient } from "@osmonauts/lcd"; -import { GetAuthenticatorRequest, GetAuthenticatorResponseSDKType, GetAuthenticatorsRequest, GetAuthenticatorsResponseSDKType } from "./query"; +import { QueryParamsRequest, QueryParamsResponseSDKType, GetAuthenticatorRequest, GetAuthenticatorResponseSDKType, GetAuthenticatorsRequest, GetAuthenticatorsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; @@ -9,9 +9,17 @@ export class LCDQueryClient { requestClient: LCDClient; }) { this.req = requestClient; + this.params = this.params.bind(this); this.getAuthenticator = this.getAuthenticator.bind(this); this.getAuthenticators = this.getAuthenticators.bind(this); } + /* Parameters queries the parameters of the module. */ + + + async params(_params: QueryParamsRequest = {}): Promise { + const endpoint = `dydxprotocol/accountplus/params`; + return await this.req.get(endpoint); + } /* Queries a single authenticator by account and authenticator ID. */ diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts index e68868199e..ab66285450 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts @@ -1,11 +1,14 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { GetAuthenticatorRequest, GetAuthenticatorResponse, GetAuthenticatorsRequest, GetAuthenticatorsResponse } from "./query"; +import { QueryParamsRequest, QueryParamsResponse, GetAuthenticatorRequest, GetAuthenticatorResponse, GetAuthenticatorsRequest, GetAuthenticatorsResponse } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { + /** Parameters queries the parameters of the module. */ + params(request?: QueryParamsRequest): Promise; /** Queries a single authenticator by account and authenticator ID. */ + getAuthenticator(request: GetAuthenticatorRequest): Promise; /** Queries all authenticators for a given account. */ @@ -16,10 +19,17 @@ export class QueryClientImpl implements Query { constructor(rpc: Rpc) { this.rpc = rpc; + this.params = this.params.bind(this); this.getAuthenticator = this.getAuthenticator.bind(this); this.getAuthenticators = this.getAuthenticators.bind(this); } + params(request: QueryParamsRequest = {}): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data))); + } + getAuthenticator(request: GetAuthenticatorRequest): Promise { const data = GetAuthenticatorRequest.encode(request).finish(); const promise = this.rpc.request("dydxprotocol.accountplus.Query", "GetAuthenticator", data); @@ -37,6 +47,10 @@ export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); const queryService = new QueryClientImpl(rpc); return { + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + }, + getAuthenticator(request: GetAuthenticatorRequest): Promise { return queryService.getAuthenticator(request); }, diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts index 9087cad421..432a383d59 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts @@ -1,6 +1,25 @@ +import { Params, ParamsSDKType } from "./params"; import { AccountAuthenticator, AccountAuthenticatorSDKType } from "./models"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial, Long } from "../../helpers"; +/** QueryParamsRequest is request type for the Query/Params RPC method. */ + +export interface QueryParamsRequest {} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ + +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ + +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ + +export interface QueryParamsResponseSDKType { + /** params holds all the parameters of this module. */ + params?: ParamsSDKType; +} /** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */ export interface GetAuthenticatorsRequest { @@ -46,6 +65,85 @@ export interface GetAuthenticatorResponseSDKType { account_authenticator?: AccountAuthenticatorSDKType; } +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + } + +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined + }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + } + +}; + function createBaseGetAuthenticatorsRequest(): GetAuthenticatorsRequest { return { account: "" diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts index 863458ced6..9582fd403d 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; -import { MsgAddAuthenticator, MsgAddAuthenticatorResponse, MsgRemoveAuthenticator, MsgRemoveAuthenticatorResponse } from "./tx"; +import { MsgAddAuthenticator, MsgAddAuthenticatorResponse, MsgRemoveAuthenticator, MsgRemoveAuthenticatorResponse, MsgSetActiveState, MsgSetActiveStateResponse } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { @@ -9,6 +9,12 @@ export interface Msg { /** RemoveAuthenticator removes an authenticator from an account. */ removeAuthenticator(request: MsgRemoveAuthenticator): Promise; + /** + * SetActiveState sets the active state of the authenticator. + * Primarily used for circuit breaking. + */ + + setActiveState(request: MsgSetActiveState): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -17,6 +23,7 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; this.addAuthenticator = this.addAuthenticator.bind(this); this.removeAuthenticator = this.removeAuthenticator.bind(this); + this.setActiveState = this.setActiveState.bind(this); } addAuthenticator(request: MsgAddAuthenticator): Promise { @@ -31,4 +38,10 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgRemoveAuthenticatorResponse.decode(new _m0.Reader(data))); } + setActiveState(request: MsgSetActiveState): Promise { + const data = MsgSetActiveState.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Msg", "SetActiveState", data); + return promise.then(data => MsgSetActiveStateResponse.decode(new _m0.Reader(data))); + } + } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts index 8561898d75..bf7b78452a 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts @@ -68,6 +68,24 @@ export interface MsgRemoveAuthenticatorResponseSDKType { */ success: boolean; } +/** MsgSetActiveState sets the active state of the module. */ + +export interface MsgSetActiveState { + sender: string; + active: boolean; +} +/** MsgSetActiveState sets the active state of the module. */ + +export interface MsgSetActiveStateSDKType { + sender: string; + active: boolean; +} +/** MsgSetActiveStateResponse defines the Msg/SetActiveState response type. */ + +export interface MsgSetActiveStateResponse {} +/** MsgSetActiveStateResponse defines the Msg/SetActiveState response type. */ + +export interface MsgSetActiveStateResponseSDKType {} /** * TxExtension allows for additional authenticator-specific data in * transactions. @@ -303,6 +321,95 @@ export const MsgRemoveAuthenticatorResponse = { }; +function createBaseMsgSetActiveState(): MsgSetActiveState { + return { + sender: "", + active: false + }; +} + +export const MsgSetActiveState = { + encode(message: MsgSetActiveState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + + if (message.active === true) { + writer.uint32(16).bool(message.active); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetActiveState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetActiveState(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + + case 2: + message.active = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgSetActiveState { + const message = createBaseMsgSetActiveState(); + message.sender = object.sender ?? ""; + message.active = object.active ?? false; + return message; + } + +}; + +function createBaseMsgSetActiveStateResponse(): MsgSetActiveStateResponse { + return {}; +} + +export const MsgSetActiveStateResponse = { + encode(_: MsgSetActiveStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetActiveStateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetActiveStateResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): MsgSetActiveStateResponse { + const message = createBaseMsgSetActiveStateResponse(); + return message; + } + +}; + function createBaseTxExtension(): TxExtension { return { selectedAuthenticators: [] diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index b56e28de7c..ea45d3f68c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -1,228 +1,229 @@ import * as _5 from "./accountplus/accountplus"; import * as _6 from "./accountplus/genesis"; import * as _7 from "./accountplus/models"; -import * as _8 from "./accountplus/query"; -import * as _9 from "./accountplus/tx"; -import * as _10 from "./affiliates/affiliates"; -import * as _11 from "./affiliates/genesis"; -import * as _12 from "./affiliates/query"; -import * as _13 from "./affiliates/tx"; -import * as _14 from "./assets/asset"; -import * as _15 from "./assets/genesis"; -import * as _16 from "./assets/query"; -import * as _17 from "./assets/tx"; -import * as _18 from "./blocktime/blocktime"; -import * as _19 from "./blocktime/genesis"; -import * as _20 from "./blocktime/params"; -import * as _21 from "./blocktime/query"; -import * as _22 from "./blocktime/tx"; -import * as _23 from "./bridge/bridge_event_info"; -import * as _24 from "./bridge/bridge_event"; -import * as _25 from "./bridge/genesis"; -import * as _26 from "./bridge/params"; -import * as _27 from "./bridge/query"; -import * as _28 from "./bridge/tx"; -import * as _29 from "./clob/block_rate_limit_config"; -import * as _30 from "./clob/clob_pair"; -import * as _31 from "./clob/equity_tier_limit_config"; -import * as _32 from "./clob/genesis"; -import * as _33 from "./clob/liquidations_config"; -import * as _34 from "./clob/liquidations"; -import * as _35 from "./clob/matches"; -import * as _36 from "./clob/mev"; -import * as _37 from "./clob/operation"; -import * as _38 from "./clob/order_removals"; -import * as _39 from "./clob/order"; -import * as _40 from "./clob/process_proposer_matches_events"; -import * as _41 from "./clob/query"; -import * as _42 from "./clob/tx"; -import * as _43 from "./daemons/bridge/bridge"; -import * as _44 from "./daemons/liquidation/liquidation"; -import * as _45 from "./daemons/pricefeed/price_feed"; -import * as _46 from "./delaymsg/block_message_ids"; -import * as _47 from "./delaymsg/delayed_message"; -import * as _48 from "./delaymsg/genesis"; -import * as _49 from "./delaymsg/query"; -import * as _50 from "./delaymsg/tx"; -import * as _51 from "./epochs/epoch_info"; -import * as _52 from "./epochs/genesis"; -import * as _53 from "./epochs/query"; -import * as _54 from "./feetiers/genesis"; -import * as _55 from "./feetiers/params"; -import * as _56 from "./feetiers/query"; -import * as _57 from "./feetiers/tx"; -import * as _58 from "./govplus/genesis"; -import * as _59 from "./govplus/query"; -import * as _60 from "./govplus/tx"; -import * as _61 from "./indexer/events/events"; -import * as _62 from "./indexer/indexer_manager/event"; -import * as _63 from "./indexer/off_chain_updates/off_chain_updates"; -import * as _64 from "./indexer/protocol/v1/clob"; -import * as _65 from "./indexer/protocol/v1/perpetual"; -import * as _66 from "./indexer/protocol/v1/subaccount"; -import * as _67 from "./indexer/redis/redis_order"; -import * as _68 from "./indexer/shared/removal_reason"; -import * as _69 from "./indexer/socks/messages"; -import * as _70 from "./listing/genesis"; -import * as _71 from "./listing/params"; -import * as _72 from "./listing/query"; -import * as _73 from "./listing/tx"; -import * as _74 from "./perpetuals/genesis"; -import * as _75 from "./perpetuals/params"; -import * as _76 from "./perpetuals/perpetual"; -import * as _77 from "./perpetuals/query"; -import * as _78 from "./perpetuals/tx"; -import * as _79 from "./prices/genesis"; -import * as _80 from "./prices/market_param"; -import * as _81 from "./prices/market_price"; -import * as _82 from "./prices/query"; -import * as _83 from "./prices/tx"; -import * as _84 from "./ratelimit/capacity"; -import * as _85 from "./ratelimit/genesis"; -import * as _86 from "./ratelimit/limit_params"; -import * as _87 from "./ratelimit/pending_send_packet"; -import * as _88 from "./ratelimit/query"; -import * as _89 from "./ratelimit/tx"; -import * as _90 from "./revshare/genesis"; -import * as _91 from "./revshare/params"; -import * as _92 from "./revshare/query"; -import * as _93 from "./revshare/revshare"; -import * as _94 from "./revshare/tx"; -import * as _95 from "./rewards/genesis"; -import * as _96 from "./rewards/params"; -import * as _97 from "./rewards/query"; -import * as _98 from "./rewards/reward_share"; -import * as _99 from "./rewards/tx"; -import * as _100 from "./sending/genesis"; -import * as _101 from "./sending/query"; -import * as _102 from "./sending/transfer"; -import * as _103 from "./sending/tx"; -import * as _104 from "./stats/genesis"; -import * as _105 from "./stats/params"; -import * as _106 from "./stats/query"; -import * as _107 from "./stats/stats"; -import * as _108 from "./stats/tx"; -import * as _109 from "./subaccounts/asset_position"; -import * as _110 from "./subaccounts/genesis"; -import * as _111 from "./subaccounts/perpetual_position"; -import * as _112 from "./subaccounts/query"; -import * as _113 from "./subaccounts/streaming"; -import * as _114 from "./subaccounts/subaccount"; -import * as _115 from "./vault/genesis"; -import * as _116 from "./vault/params"; -import * as _117 from "./vault/query"; -import * as _118 from "./vault/share"; -import * as _119 from "./vault/tx"; -import * as _120 from "./vault/vault"; -import * as _121 from "./vest/genesis"; -import * as _122 from "./vest/query"; -import * as _123 from "./vest/tx"; -import * as _124 from "./vest/vest_entry"; -import * as _132 from "./accountplus/query.lcd"; -import * as _133 from "./assets/query.lcd"; -import * as _134 from "./blocktime/query.lcd"; -import * as _135 from "./bridge/query.lcd"; -import * as _136 from "./clob/query.lcd"; -import * as _137 from "./delaymsg/query.lcd"; -import * as _138 from "./epochs/query.lcd"; -import * as _139 from "./feetiers/query.lcd"; -import * as _140 from "./listing/query.lcd"; -import * as _141 from "./perpetuals/query.lcd"; -import * as _142 from "./prices/query.lcd"; -import * as _143 from "./ratelimit/query.lcd"; -import * as _144 from "./revshare/query.lcd"; -import * as _145 from "./rewards/query.lcd"; -import * as _146 from "./stats/query.lcd"; -import * as _147 from "./subaccounts/query.lcd"; -import * as _148 from "./vault/query.lcd"; -import * as _149 from "./vest/query.lcd"; -import * as _150 from "./accountplus/query.rpc.Query"; -import * as _151 from "./affiliates/query.rpc.Query"; -import * as _152 from "./assets/query.rpc.Query"; -import * as _153 from "./blocktime/query.rpc.Query"; -import * as _154 from "./bridge/query.rpc.Query"; -import * as _155 from "./clob/query.rpc.Query"; -import * as _156 from "./delaymsg/query.rpc.Query"; -import * as _157 from "./epochs/query.rpc.Query"; -import * as _158 from "./feetiers/query.rpc.Query"; -import * as _159 from "./govplus/query.rpc.Query"; -import * as _160 from "./listing/query.rpc.Query"; -import * as _161 from "./perpetuals/query.rpc.Query"; -import * as _162 from "./prices/query.rpc.Query"; -import * as _163 from "./ratelimit/query.rpc.Query"; -import * as _164 from "./revshare/query.rpc.Query"; -import * as _165 from "./rewards/query.rpc.Query"; -import * as _166 from "./sending/query.rpc.Query"; -import * as _167 from "./stats/query.rpc.Query"; -import * as _168 from "./subaccounts/query.rpc.Query"; -import * as _169 from "./vault/query.rpc.Query"; -import * as _170 from "./vest/query.rpc.Query"; -import * as _171 from "./accountplus/tx.rpc.msg"; -import * as _172 from "./affiliates/tx.rpc.msg"; -import * as _173 from "./blocktime/tx.rpc.msg"; -import * as _174 from "./bridge/tx.rpc.msg"; -import * as _175 from "./clob/tx.rpc.msg"; -import * as _176 from "./delaymsg/tx.rpc.msg"; -import * as _177 from "./feetiers/tx.rpc.msg"; -import * as _178 from "./govplus/tx.rpc.msg"; -import * as _179 from "./listing/tx.rpc.msg"; -import * as _180 from "./perpetuals/tx.rpc.msg"; -import * as _181 from "./prices/tx.rpc.msg"; -import * as _182 from "./ratelimit/tx.rpc.msg"; -import * as _183 from "./revshare/tx.rpc.msg"; -import * as _184 from "./rewards/tx.rpc.msg"; -import * as _185 from "./sending/tx.rpc.msg"; -import * as _186 from "./stats/tx.rpc.msg"; -import * as _187 from "./vault/tx.rpc.msg"; -import * as _188 from "./vest/tx.rpc.msg"; -import * as _189 from "./lcd"; -import * as _190 from "./rpc.query"; -import * as _191 from "./rpc.tx"; +import * as _8 from "./accountplus/params"; +import * as _9 from "./accountplus/query"; +import * as _10 from "./accountplus/tx"; +import * as _11 from "./affiliates/affiliates"; +import * as _12 from "./affiliates/genesis"; +import * as _13 from "./affiliates/query"; +import * as _14 from "./affiliates/tx"; +import * as _15 from "./assets/asset"; +import * as _16 from "./assets/genesis"; +import * as _17 from "./assets/query"; +import * as _18 from "./assets/tx"; +import * as _19 from "./blocktime/blocktime"; +import * as _20 from "./blocktime/genesis"; +import * as _21 from "./blocktime/params"; +import * as _22 from "./blocktime/query"; +import * as _23 from "./blocktime/tx"; +import * as _24 from "./bridge/bridge_event_info"; +import * as _25 from "./bridge/bridge_event"; +import * as _26 from "./bridge/genesis"; +import * as _27 from "./bridge/params"; +import * as _28 from "./bridge/query"; +import * as _29 from "./bridge/tx"; +import * as _30 from "./clob/block_rate_limit_config"; +import * as _31 from "./clob/clob_pair"; +import * as _32 from "./clob/equity_tier_limit_config"; +import * as _33 from "./clob/genesis"; +import * as _34 from "./clob/liquidations_config"; +import * as _35 from "./clob/liquidations"; +import * as _36 from "./clob/matches"; +import * as _37 from "./clob/mev"; +import * as _38 from "./clob/operation"; +import * as _39 from "./clob/order_removals"; +import * as _40 from "./clob/order"; +import * as _41 from "./clob/process_proposer_matches_events"; +import * as _42 from "./clob/query"; +import * as _43 from "./clob/tx"; +import * as _44 from "./daemons/bridge/bridge"; +import * as _45 from "./daemons/liquidation/liquidation"; +import * as _46 from "./daemons/pricefeed/price_feed"; +import * as _47 from "./delaymsg/block_message_ids"; +import * as _48 from "./delaymsg/delayed_message"; +import * as _49 from "./delaymsg/genesis"; +import * as _50 from "./delaymsg/query"; +import * as _51 from "./delaymsg/tx"; +import * as _52 from "./epochs/epoch_info"; +import * as _53 from "./epochs/genesis"; +import * as _54 from "./epochs/query"; +import * as _55 from "./feetiers/genesis"; +import * as _56 from "./feetiers/params"; +import * as _57 from "./feetiers/query"; +import * as _58 from "./feetiers/tx"; +import * as _59 from "./govplus/genesis"; +import * as _60 from "./govplus/query"; +import * as _61 from "./govplus/tx"; +import * as _62 from "./indexer/events/events"; +import * as _63 from "./indexer/indexer_manager/event"; +import * as _64 from "./indexer/off_chain_updates/off_chain_updates"; +import * as _65 from "./indexer/protocol/v1/clob"; +import * as _66 from "./indexer/protocol/v1/perpetual"; +import * as _67 from "./indexer/protocol/v1/subaccount"; +import * as _68 from "./indexer/redis/redis_order"; +import * as _69 from "./indexer/shared/removal_reason"; +import * as _70 from "./indexer/socks/messages"; +import * as _71 from "./listing/genesis"; +import * as _72 from "./listing/params"; +import * as _73 from "./listing/query"; +import * as _74 from "./listing/tx"; +import * as _75 from "./perpetuals/genesis"; +import * as _76 from "./perpetuals/params"; +import * as _77 from "./perpetuals/perpetual"; +import * as _78 from "./perpetuals/query"; +import * as _79 from "./perpetuals/tx"; +import * as _80 from "./prices/genesis"; +import * as _81 from "./prices/market_param"; +import * as _82 from "./prices/market_price"; +import * as _83 from "./prices/query"; +import * as _84 from "./prices/tx"; +import * as _85 from "./ratelimit/capacity"; +import * as _86 from "./ratelimit/genesis"; +import * as _87 from "./ratelimit/limit_params"; +import * as _88 from "./ratelimit/pending_send_packet"; +import * as _89 from "./ratelimit/query"; +import * as _90 from "./ratelimit/tx"; +import * as _91 from "./revshare/genesis"; +import * as _92 from "./revshare/params"; +import * as _93 from "./revshare/query"; +import * as _94 from "./revshare/revshare"; +import * as _95 from "./revshare/tx"; +import * as _96 from "./rewards/genesis"; +import * as _97 from "./rewards/params"; +import * as _98 from "./rewards/query"; +import * as _99 from "./rewards/reward_share"; +import * as _100 from "./rewards/tx"; +import * as _101 from "./sending/genesis"; +import * as _102 from "./sending/query"; +import * as _103 from "./sending/transfer"; +import * as _104 from "./sending/tx"; +import * as _105 from "./stats/genesis"; +import * as _106 from "./stats/params"; +import * as _107 from "./stats/query"; +import * as _108 from "./stats/stats"; +import * as _109 from "./stats/tx"; +import * as _110 from "./subaccounts/asset_position"; +import * as _111 from "./subaccounts/genesis"; +import * as _112 from "./subaccounts/perpetual_position"; +import * as _113 from "./subaccounts/query"; +import * as _114 from "./subaccounts/streaming"; +import * as _115 from "./subaccounts/subaccount"; +import * as _116 from "./vault/genesis"; +import * as _117 from "./vault/params"; +import * as _118 from "./vault/query"; +import * as _119 from "./vault/share"; +import * as _120 from "./vault/tx"; +import * as _121 from "./vault/vault"; +import * as _122 from "./vest/genesis"; +import * as _123 from "./vest/query"; +import * as _124 from "./vest/tx"; +import * as _125 from "./vest/vest_entry"; +import * as _133 from "./accountplus/query.lcd"; +import * as _134 from "./assets/query.lcd"; +import * as _135 from "./blocktime/query.lcd"; +import * as _136 from "./bridge/query.lcd"; +import * as _137 from "./clob/query.lcd"; +import * as _138 from "./delaymsg/query.lcd"; +import * as _139 from "./epochs/query.lcd"; +import * as _140 from "./feetiers/query.lcd"; +import * as _141 from "./listing/query.lcd"; +import * as _142 from "./perpetuals/query.lcd"; +import * as _143 from "./prices/query.lcd"; +import * as _144 from "./ratelimit/query.lcd"; +import * as _145 from "./revshare/query.lcd"; +import * as _146 from "./rewards/query.lcd"; +import * as _147 from "./stats/query.lcd"; +import * as _148 from "./subaccounts/query.lcd"; +import * as _149 from "./vault/query.lcd"; +import * as _150 from "./vest/query.lcd"; +import * as _151 from "./accountplus/query.rpc.Query"; +import * as _152 from "./affiliates/query.rpc.Query"; +import * as _153 from "./assets/query.rpc.Query"; +import * as _154 from "./blocktime/query.rpc.Query"; +import * as _155 from "./bridge/query.rpc.Query"; +import * as _156 from "./clob/query.rpc.Query"; +import * as _157 from "./delaymsg/query.rpc.Query"; +import * as _158 from "./epochs/query.rpc.Query"; +import * as _159 from "./feetiers/query.rpc.Query"; +import * as _160 from "./govplus/query.rpc.Query"; +import * as _161 from "./listing/query.rpc.Query"; +import * as _162 from "./perpetuals/query.rpc.Query"; +import * as _163 from "./prices/query.rpc.Query"; +import * as _164 from "./ratelimit/query.rpc.Query"; +import * as _165 from "./revshare/query.rpc.Query"; +import * as _166 from "./rewards/query.rpc.Query"; +import * as _167 from "./sending/query.rpc.Query"; +import * as _168 from "./stats/query.rpc.Query"; +import * as _169 from "./subaccounts/query.rpc.Query"; +import * as _170 from "./vault/query.rpc.Query"; +import * as _171 from "./vest/query.rpc.Query"; +import * as _172 from "./accountplus/tx.rpc.msg"; +import * as _173 from "./affiliates/tx.rpc.msg"; +import * as _174 from "./blocktime/tx.rpc.msg"; +import * as _175 from "./bridge/tx.rpc.msg"; +import * as _176 from "./clob/tx.rpc.msg"; +import * as _177 from "./delaymsg/tx.rpc.msg"; +import * as _178 from "./feetiers/tx.rpc.msg"; +import * as _179 from "./govplus/tx.rpc.msg"; +import * as _180 from "./listing/tx.rpc.msg"; +import * as _181 from "./perpetuals/tx.rpc.msg"; +import * as _182 from "./prices/tx.rpc.msg"; +import * as _183 from "./ratelimit/tx.rpc.msg"; +import * as _184 from "./revshare/tx.rpc.msg"; +import * as _185 from "./rewards/tx.rpc.msg"; +import * as _186 from "./sending/tx.rpc.msg"; +import * as _187 from "./stats/tx.rpc.msg"; +import * as _188 from "./vault/tx.rpc.msg"; +import * as _189 from "./vest/tx.rpc.msg"; +import * as _190 from "./lcd"; +import * as _191 from "./rpc.query"; +import * as _192 from "./rpc.tx"; export namespace dydxprotocol { export const accountplus = { ..._5, ..._6, ..._7, ..._8, ..._9, - ..._132, - ..._150, - ..._171 + ..._10, + ..._133, + ..._151, + ..._172 }; - export const affiliates = { ..._10, - ..._11, + export const affiliates = { ..._11, ..._12, ..._13, - ..._151, - ..._172 + ..._14, + ..._152, + ..._173 }; - export const assets = { ..._14, - ..._15, + export const assets = { ..._15, ..._16, ..._17, - ..._133, - ..._152 + ..._18, + ..._134, + ..._153 }; - export const blocktime = { ..._18, - ..._19, + export const blocktime = { ..._19, ..._20, ..._21, ..._22, - ..._134, - ..._153, - ..._173 + ..._23, + ..._135, + ..._154, + ..._174 }; - export const bridge = { ..._23, - ..._24, + export const bridge = { ..._24, ..._25, ..._26, ..._27, ..._28, - ..._135, - ..._154, - ..._174 + ..._29, + ..._136, + ..._155, + ..._175 }; - export const clob = { ..._29, - ..._30, + export const clob = { ..._30, ..._31, ..._32, ..._33, @@ -235,166 +236,167 @@ export namespace dydxprotocol { ..._40, ..._41, ..._42, - ..._136, - ..._155, - ..._175 + ..._43, + ..._137, + ..._156, + ..._176 }; export namespace daemons { - export const bridge = { ..._43 + export const bridge = { ..._44 }; - export const liquidation = { ..._44 + export const liquidation = { ..._45 }; - export const pricefeed = { ..._45 + export const pricefeed = { ..._46 }; } - export const delaymsg = { ..._46, - ..._47, + export const delaymsg = { ..._47, ..._48, ..._49, ..._50, - ..._137, - ..._156, - ..._176 + ..._51, + ..._138, + ..._157, + ..._177 }; - export const epochs = { ..._51, - ..._52, + export const epochs = { ..._52, ..._53, - ..._138, - ..._157 + ..._54, + ..._139, + ..._158 }; - export const feetiers = { ..._54, - ..._55, + export const feetiers = { ..._55, ..._56, ..._57, - ..._139, - ..._158, - ..._177 - }; - export const govplus = { ..._58, - ..._59, - ..._60, + ..._58, + ..._140, ..._159, ..._178 }; + export const govplus = { ..._59, + ..._60, + ..._61, + ..._160, + ..._179 + }; export namespace indexer { - export const events = { ..._61 + export const events = { ..._62 }; - export const indexer_manager = { ..._62 + export const indexer_manager = { ..._63 }; - export const off_chain_updates = { ..._63 + export const off_chain_updates = { ..._64 }; export namespace protocol { - export const v1 = { ..._64, - ..._65, - ..._66 + export const v1 = { ..._65, + ..._66, + ..._67 }; } - export const redis = { ..._67 + export const redis = { ..._68 }; - export const shared = { ..._68 + export const shared = { ..._69 }; - export const socks = { ..._69 + export const socks = { ..._70 }; } - export const listing = { ..._70, - ..._71, + export const listing = { ..._71, ..._72, ..._73, - ..._140, - ..._160, - ..._179 + ..._74, + ..._141, + ..._161, + ..._180 }; - export const perpetuals = { ..._74, - ..._75, + export const perpetuals = { ..._75, ..._76, ..._77, ..._78, - ..._141, - ..._161, - ..._180 + ..._79, + ..._142, + ..._162, + ..._181 }; - export const prices = { ..._79, - ..._80, + export const prices = { ..._80, ..._81, ..._82, ..._83, - ..._142, - ..._162, - ..._181 + ..._84, + ..._143, + ..._163, + ..._182 }; - export const ratelimit = { ..._84, - ..._85, + export const ratelimit = { ..._85, ..._86, ..._87, ..._88, ..._89, - ..._143, - ..._163, - ..._182 + ..._90, + ..._144, + ..._164, + ..._183 }; - export const revshare = { ..._90, - ..._91, + export const revshare = { ..._91, ..._92, ..._93, ..._94, - ..._144, - ..._164, - ..._183 + ..._95, + ..._145, + ..._165, + ..._184 }; - export const rewards = { ..._95, - ..._96, + export const rewards = { ..._96, ..._97, ..._98, ..._99, - ..._145, - ..._165, - ..._184 + ..._100, + ..._146, + ..._166, + ..._185 }; - export const sending = { ..._100, - ..._101, + export const sending = { ..._101, ..._102, ..._103, - ..._166, - ..._185 + ..._104, + ..._167, + ..._186 }; - export const stats = { ..._104, - ..._105, + export const stats = { ..._105, ..._106, ..._107, ..._108, - ..._146, - ..._167, - ..._186 + ..._109, + ..._147, + ..._168, + ..._187 }; - export const subaccounts = { ..._109, - ..._110, + export const subaccounts = { ..._110, ..._111, ..._112, ..._113, ..._114, - ..._147, - ..._168 + ..._115, + ..._148, + ..._169 }; - export const vault = { ..._115, - ..._116, + export const vault = { ..._116, ..._117, ..._118, ..._119, ..._120, - ..._148, - ..._169, - ..._187 - }; - export const vest = { ..._121, - ..._122, - ..._123, - ..._124, + ..._121, ..._149, ..._170, ..._188 }; - export const ClientFactory = { ..._189, - ..._190, - ..._191 + export const vest = { ..._122, + ..._123, + ..._124, + ..._125, + ..._150, + ..._171, + ..._189 + }; + export const ClientFactory = { ..._190, + ..._191, + ..._192 }; } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts index 486d799253..795d06bc47 100644 --- a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts @@ -1,3 +1,3 @@ -import * as _125 from "./gogo"; -export const gogoproto = { ..._125 +import * as _126 from "./gogo"; +export const gogoproto = { ..._126 }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/google/bundle.ts b/indexer/packages/v4-protos/src/codegen/google/bundle.ts index 5c2c5120ea..6c02be50fc 100644 --- a/indexer/packages/v4-protos/src/codegen/google/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/google/bundle.ts @@ -1,16 +1,16 @@ -import * as _126 from "./api/annotations"; -import * as _127 from "./api/http"; -import * as _128 from "./protobuf/descriptor"; -import * as _129 from "./protobuf/duration"; -import * as _130 from "./protobuf/timestamp"; -import * as _131 from "./protobuf/any"; +import * as _127 from "./api/annotations"; +import * as _128 from "./api/http"; +import * as _129 from "./protobuf/descriptor"; +import * as _130 from "./protobuf/duration"; +import * as _131 from "./protobuf/timestamp"; +import * as _132 from "./protobuf/any"; export namespace google { - export const api = { ..._126, - ..._127 + export const api = { ..._127, + ..._128 }; - export const protobuf = { ..._128, - ..._129, + export const protobuf = { ..._129, ..._130, - ..._131 + ..._131, + ..._132 }; } \ No newline at end of file diff --git a/proto/dydxprotocol/accountplus/genesis.proto b/proto/dydxprotocol/accountplus/genesis.proto index ad91ab478e..723893b855 100644 --- a/proto/dydxprotocol/accountplus/genesis.proto +++ b/proto/dydxprotocol/accountplus/genesis.proto @@ -4,6 +4,7 @@ package dydxprotocol.accountplus; import "gogoproto/gogo.proto"; import "dydxprotocol/accountplus/accountplus.proto"; import "dydxprotocol/accountplus/models.proto"; +import "dydxprotocol/accountplus/params.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; @@ -24,11 +25,14 @@ message AuthenticatorData { message GenesisState { repeated AccountState accounts = 1 [ (gogoproto.nullable) = false ]; + // params define the parameters for the authenticator module. + Params params = 2 [ (gogoproto.nullable) = false ]; + // next_authenticator_id is the next available authenticator ID. - uint64 next_authenticator_id = 2; + uint64 next_authenticator_id = 3; // authenticator_data contains the data for multiple accounts, each with their // authenticators. - repeated AuthenticatorData authenticator_data = 3 + repeated AuthenticatorData authenticator_data = 4 [ (gogoproto.nullable) = false ]; } diff --git a/proto/dydxprotocol/accountplus/models.proto b/proto/dydxprotocol/accountplus/models.proto index bf026d2680..50ff3732b7 100644 --- a/proto/dydxprotocol/accountplus/models.proto +++ b/proto/dydxprotocol/accountplus/models.proto @@ -20,4 +20,4 @@ message AccountAuthenticator { // The interpretation of this field is overloaded, enabling multiple // authenticators to utilize it for their respective purposes. bytes config = 3; -} \ No newline at end of file +} diff --git a/proto/dydxprotocol/accountplus/params.proto b/proto/dydxprotocol/accountplus/params.proto new file mode 100644 index 0000000000..673b71d6fd --- /dev/null +++ b/proto/dydxprotocol/accountplus/params.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package dydxprotocol.accountplus; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; + +// Params defines the parameters for the module. +message Params { + // IsSmartAccountActive defines the state of the authenticator. + // If set to false, the authenticator module will not be used + // and the classic cosmos sdk authentication will be used instead. + bool is_smart_account_active = 1 + [ (gogoproto.moretags) = "yaml:\"is_smart_account_active\"" ]; +} diff --git a/proto/dydxprotocol/accountplus/query.proto b/proto/dydxprotocol/accountplus/query.proto index 73e60669a7..5314055957 100644 --- a/proto/dydxprotocol/accountplus/query.proto +++ b/proto/dydxprotocol/accountplus/query.proto @@ -1,13 +1,20 @@ syntax = "proto3"; package dydxprotocol.accountplus; +import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "dydxprotocol/accountplus/models.proto"; +import "dydxprotocol/accountplus/params.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; // Query defines the gRPC querier service. service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/dydxprotocol/accountplus/params"; + } + // Queries a single authenticator by account and authenticator ID. rpc GetAuthenticator(GetAuthenticatorRequest) returns (GetAuthenticatorResponse) { @@ -23,6 +30,15 @@ service Query { } } +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + // MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. message GetAuthenticatorsRequest { string account = 1; } @@ -40,4 +56,4 @@ message GetAuthenticatorRequest { // MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. message GetAuthenticatorResponse { AccountAuthenticator account_authenticator = 1; -} \ No newline at end of file +} diff --git a/proto/dydxprotocol/accountplus/tx.proto b/proto/dydxprotocol/accountplus/tx.proto index 726beeebea..9f901688d2 100644 --- a/proto/dydxprotocol/accountplus/tx.proto +++ b/proto/dydxprotocol/accountplus/tx.proto @@ -14,6 +14,10 @@ service Msg { // RemoveAuthenticator removes an authenticator from an account. rpc RemoveAuthenticator(MsgRemoveAuthenticator) returns (MsgRemoveAuthenticatorResponse); + + // SetActiveState sets the active state of the authenticator. + // Primarily used for circuit breaking. + rpc SetActiveState(MsgSetActiveState) returns (MsgSetActiveStateResponse); } // MsgAddAuthenticatorRequest defines the Msg/AddAuthenticator request type. @@ -43,10 +47,22 @@ message MsgRemoveAuthenticator { // type. message MsgRemoveAuthenticatorResponse { bool success = 1; } +// MsgSetActiveState sets the active state of the module. +message MsgSetActiveState { + option (amino.name) = "osmosis/smartaccount/set-active-state"; + option (cosmos.msg.v1.signer) = "sender"; + + string sender = 1; + bool active = 2; +} + +// MsgSetActiveStateResponse defines the Msg/SetActiveState response type. +message MsgSetActiveStateResponse {} + // TxExtension allows for additional authenticator-specific data in // transactions. message TxExtension { // selected_authenticators holds the authenticator_id for the chosen // authenticator per message. repeated uint64 selected_authenticators = 1; -} \ No newline at end of file +} diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index 7213a7522d..970ae13312 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -130,6 +130,9 @@ }, "dydxaccountplus": { "accounts": [], + "params": { + "is_smart_account_active": false + }, "next_authenticator_id": "0", "authenticator_data": [] }, diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index 7d5c681291..5925ef792a 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -640,7 +640,10 @@ "dydxaccountplus": { "accounts": [], "authenticator_data": [], - "next_authenticator_id": "0" + "next_authenticator_id": "0", + "params": { + "is_smart_account_active": false + } }, "epochs": { "epoch_info_list": [ diff --git a/protocol/x/accountplus/types/genesis.pb.go b/protocol/x/accountplus/types/genesis.pb.go index 212c5d826f..476dd31f5e 100644 --- a/protocol/x/accountplus/types/genesis.pb.go +++ b/protocol/x/accountplus/types/genesis.pb.go @@ -84,11 +84,13 @@ func (m *AuthenticatorData) GetAuthenticators() []AccountAuthenticator { // Module genesis state type GenesisState struct { Accounts []AccountState `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` + // params define the parameters for the authenticator module. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` // next_authenticator_id is the next available authenticator ID. - NextAuthenticatorId uint64 `protobuf:"varint,2,opt,name=next_authenticator_id,json=nextAuthenticatorId,proto3" json:"next_authenticator_id,omitempty"` + NextAuthenticatorId uint64 `protobuf:"varint,3,opt,name=next_authenticator_id,json=nextAuthenticatorId,proto3" json:"next_authenticator_id,omitempty"` // authenticator_data contains the data for multiple accounts, each with their // authenticators. - AuthenticatorData []AuthenticatorData `protobuf:"bytes,3,rep,name=authenticator_data,json=authenticatorData,proto3" json:"authenticator_data"` + AuthenticatorData []AuthenticatorData `protobuf:"bytes,4,rep,name=authenticator_data,json=authenticatorData,proto3" json:"authenticator_data"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -131,6 +133,13 @@ func (m *GenesisState) GetAccounts() []AccountState { return nil } +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + func (m *GenesisState) GetNextAuthenticatorId() uint64 { if m != nil { return m.NextAuthenticatorId @@ -155,28 +164,30 @@ func init() { } var fileDescriptor_03516b8fa43b3a59 = []byte{ - // 331 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0xa9, 0x4c, 0xa9, - 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, - 0x29, 0xc8, 0x29, 0x2d, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x03, 0x4b, 0x0a, - 0x49, 0x20, 0xab, 0xd3, 0x43, 0x52, 0x27, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, 0xd1, 0x07, - 0xb1, 0x20, 0xea, 0xa5, 0xb4, 0x70, 0x9a, 0x8b, 0xc4, 0x86, 0xaa, 0x55, 0xc5, 0xa9, 0x36, 0x37, - 0x3f, 0x25, 0x35, 0x07, 0xaa, 0x4c, 0xa9, 0x9b, 0x91, 0x4b, 0xd0, 0xb1, 0xb4, 0x24, 0x23, 0x35, - 0xaf, 0x24, 0x33, 0x39, 0xb1, 0x24, 0xbf, 0xc8, 0x25, 0xb1, 0x24, 0x51, 0x48, 0x82, 0x8b, 0x3d, - 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc6, 0x15, - 0x8a, 0xe1, 0xe2, 0x4b, 0x44, 0x56, 0x5e, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0xa7, - 0x87, 0xcb, 0x2f, 0x7a, 0x8e, 0x10, 0x36, 0x8a, 0x2d, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, - 0xa1, 0x99, 0xa5, 0xf4, 0x8e, 0x91, 0x8b, 0xc7, 0x1d, 0x12, 0x44, 0xc1, 0x25, 0x89, 0x25, 0xa9, - 0x42, 0x1e, 0x5c, 0x1c, 0x50, 0xa3, 0x40, 0x2e, 0x01, 0x59, 0xa4, 0x46, 0xd0, 0x22, 0xb0, 0x4e, - 0xa8, 0x05, 0x70, 0xdd, 0x42, 0x46, 0x5c, 0xa2, 0x79, 0xa9, 0x15, 0x25, 0xf1, 0x28, 0x36, 0xc6, - 0x67, 0xa6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x04, 0x09, 0x83, 0x24, 0x51, 0x9c, 0xe8, 0x99, - 0x22, 0x94, 0xc0, 0x25, 0x84, 0xaa, 0x3c, 0x25, 0xb1, 0x24, 0x51, 0x82, 0x19, 0xec, 0x0e, 0x6d, - 0x3c, 0xee, 0x40, 0x0f, 0x4f, 0xa8, 0x63, 0x04, 0x13, 0x31, 0x24, 0xc2, 0x4f, 0x3c, 0x92, 0x63, - 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, - 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x36, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, - 0x3f, 0x57, 0x1f, 0x25, 0x2a, 0xcb, 0x4c, 0x74, 0x93, 0x33, 0x12, 0x33, 0xf3, 0xf4, 0xe1, 0x22, - 0x15, 0x28, 0xd1, 0x5b, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x96, 0x35, 0x06, 0x04, 0x00, - 0x00, 0xff, 0xff, 0xe3, 0xf2, 0x0f, 0x79, 0x8b, 0x02, 0x00, 0x00, + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x4a, 0xf3, 0x40, + 0x14, 0x85, 0x33, 0x6d, 0xe9, 0xff, 0x3b, 0x15, 0xa1, 0xa3, 0xc2, 0xd0, 0x45, 0x0c, 0x05, 0x4b, + 0x50, 0x4c, 0xa0, 0xba, 0x55, 0xa8, 0x08, 0xea, 0x4e, 0xea, 0x42, 0x10, 0xa1, 0x4e, 0x33, 0x43, + 0x1a, 0x68, 0x33, 0x21, 0x33, 0x91, 0xf6, 0x19, 0xdc, 0xf8, 0x24, 0x3e, 0x47, 0x97, 0x5d, 0xba, + 0x12, 0x69, 0x5e, 0x44, 0x92, 0x8c, 0x25, 0xa9, 0xc4, 0xee, 0x6e, 0x72, 0xbe, 0x7b, 0xee, 0x3d, + 0xc9, 0x85, 0x1d, 0x3a, 0xa3, 0xd3, 0x20, 0xe4, 0x92, 0x3b, 0x7c, 0x6c, 0x13, 0xc7, 0xe1, 0x91, + 0x2f, 0x83, 0x71, 0x24, 0x6c, 0x97, 0xf9, 0x4c, 0x78, 0xc2, 0x4a, 0x45, 0x84, 0xf3, 0x9c, 0x95, + 0xe3, 0x5a, 0x7b, 0x2e, 0x77, 0x79, 0xaa, 0xd8, 0x49, 0x95, 0xf1, 0xad, 0xa3, 0x52, 0xdf, 0x5c, + 0xad, 0xd8, 0xc3, 0x52, 0x76, 0xc2, 0x29, 0x1b, 0x6f, 0xc6, 0x02, 0x12, 0x92, 0x89, 0xc2, 0xda, + 0xaf, 0x00, 0x36, 0x7b, 0x91, 0x1c, 0x31, 0x5f, 0x7a, 0x0e, 0x91, 0x3c, 0xbc, 0x22, 0x92, 0x20, + 0x0c, 0xff, 0x11, 0x4a, 0x43, 0x26, 0x04, 0x06, 0x06, 0x30, 0xb7, 0xfa, 0x3f, 0x8f, 0xe8, 0x09, + 0xee, 0x90, 0x3c, 0x2e, 0x70, 0xc5, 0xa8, 0x9a, 0x8d, 0xae, 0x65, 0x95, 0x45, 0xb6, 0x7a, 0x59, + 0x5d, 0x98, 0x72, 0x59, 0x9b, 0x7f, 0x1e, 0x68, 0xfd, 0x35, 0xaf, 0xf6, 0x7b, 0x05, 0x6e, 0x5f, + 0x67, 0x5f, 0xf2, 0x5e, 0x12, 0xc9, 0xd0, 0x0d, 0xfc, 0xaf, 0xac, 0x92, 0x4d, 0x92, 0x41, 0x9d, + 0x8d, 0x83, 0xd2, 0x4e, 0x35, 0x60, 0xd5, 0x8d, 0x2e, 0x60, 0x3d, 0x0b, 0x8e, 0x2b, 0x06, 0x30, + 0x1b, 0x5d, 0xa3, 0xdc, 0xe7, 0x2e, 0xe5, 0x94, 0x83, 0xea, 0x42, 0x5d, 0xb8, 0xef, 0xb3, 0xa9, + 0x1c, 0x14, 0x36, 0x1e, 0x78, 0x14, 0x57, 0x0d, 0x60, 0xd6, 0xfa, 0xbb, 0x89, 0x58, 0x88, 0x78, + 0x4b, 0xd1, 0x33, 0x44, 0x45, 0x9c, 0x12, 0x49, 0x70, 0x2d, 0xcd, 0x71, 0xfc, 0x47, 0x8e, 0xf5, + 0xff, 0xa1, 0x56, 0x69, 0x92, 0x5f, 0xc2, 0xc3, 0x7c, 0xa9, 0x83, 0xc5, 0x52, 0x07, 0x5f, 0x4b, + 0x1d, 0xbc, 0xc5, 0xba, 0xb6, 0x88, 0x75, 0xed, 0x23, 0xd6, 0xb5, 0xc7, 0x73, 0xd7, 0x93, 0xa3, + 0x68, 0x68, 0x39, 0x7c, 0x62, 0x17, 0x4e, 0xe1, 0xe5, 0xec, 0xc4, 0x19, 0x11, 0xcf, 0xb7, 0x57, + 0x6f, 0xa6, 0x85, 0xf3, 0x90, 0xb3, 0x80, 0x89, 0x61, 0x3d, 0x55, 0x4f, 0xbf, 0x03, 0x00, 0x00, + 0xff, 0xff, 0xda, 0x60, 0x35, 0x04, 0xf2, 0x02, 0x00, 0x00, } func (m *AuthenticatorData) Marshal() (dAtA []byte, err error) { @@ -254,14 +265,24 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } } if m.NextAuthenticatorId != 0 { i = encodeVarintGenesis(dAtA, i, uint64(m.NextAuthenticatorId)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.Accounts) > 0 { for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { { @@ -321,6 +342,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) if m.NextAuthenticatorId != 0 { n += 1 + sovGenesis(uint64(m.NextAuthenticatorId)) } @@ -519,6 +542,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NextAuthenticatorId", wireType) } @@ -537,7 +593,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AuthenticatorData", wireType) } diff --git a/protocol/x/accountplus/types/params.pb.go b/protocol/x/accountplus/types/params.pb.go new file mode 100644 index 0000000000..18da286443 --- /dev/null +++ b/protocol/x/accountplus/types/params.pb.go @@ -0,0 +1,315 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/accountplus/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +// Params defines the parameters for the module. +type Params struct { + // IsSmartAccountActive defines the state of the authenticator. + // If set to false, the authenticator module will not be used + // and the classic cosmos sdk authentication will be used instead. + IsSmartAccountActive bool `protobuf:"varint,1,opt,name=is_smart_account_active,json=isSmartAccountActive,proto3" json:"is_smart_account_active,omitempty" yaml:"is_smart_account_active"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_7db9dd150a39c6af, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetIsSmartAccountActive() bool { + if m != nil { + return m.IsSmartAccountActive + } + return false +} + +func init() { + proto.RegisterType((*Params)(nil), "dydxprotocol.accountplus.Params") +} + +func init() { + proto.RegisterFile("dydxprotocol/accountplus/params.proto", fileDescriptor_7db9dd150a39c6af) +} + +var fileDescriptor_7db9dd150a39c6af = []byte{ + // 210 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, + 0x29, 0xc8, 0x29, 0x2d, 0xd6, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x03, 0xcb, 0x09, 0x49, + 0x20, 0x2b, 0xd3, 0x43, 0x52, 0x26, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, 0xd1, 0x07, 0xb1, + 0x20, 0xea, 0x95, 0x92, 0xb9, 0xd8, 0x02, 0xc0, 0xfa, 0x85, 0x22, 0xb9, 0xc4, 0x33, 0x8b, 0xe3, + 0x8b, 0x73, 0x13, 0x8b, 0x4a, 0xe2, 0xa1, 0xfa, 0xe2, 0x13, 0x93, 0x4b, 0x32, 0xcb, 0x52, 0x25, + 0x18, 0x15, 0x18, 0x35, 0x38, 0x9c, 0x94, 0x3e, 0xdd, 0x93, 0x97, 0xab, 0x4c, 0xcc, 0xcd, 0xb1, + 0x52, 0xc2, 0xa1, 0x50, 0x29, 0x48, 0x24, 0xb3, 0x38, 0x18, 0x24, 0xe1, 0x08, 0x11, 0x77, 0x04, + 0x0b, 0x3b, 0x85, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, + 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x6d, 0x7a, + 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x8a, 0x07, 0xcb, 0x4c, 0x74, 0x93, + 0x33, 0x12, 0x33, 0xf3, 0xf4, 0xe1, 0x22, 0x15, 0x28, 0x9e, 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, + 0x62, 0x03, 0xcb, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x37, 0xad, 0x40, 0x1a, 0x1d, 0x01, + 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsSmartAccountActive { + i-- + if m.IsSmartAccountActive { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsSmartAccountActive { + n += 2 + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsSmartAccountActive", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsSmartAccountActive = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/accountplus/types/query.pb.go b/protocol/x/accountplus/types/query.pb.go index a7f8432a29..f850e057f1 100644 --- a/protocol/x/accountplus/types/query.pb.go +++ b/protocol/x/accountplus/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -28,6 +29,89 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + // MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. type GetAuthenticatorsRequest struct { Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` @@ -37,7 +121,7 @@ func (m *GetAuthenticatorsRequest) Reset() { *m = GetAuthenticatorsReque func (m *GetAuthenticatorsRequest) String() string { return proto.CompactTextString(m) } func (*GetAuthenticatorsRequest) ProtoMessage() {} func (*GetAuthenticatorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3beaace7ec4b0b78, []int{0} + return fileDescriptor_3beaace7ec4b0b78, []int{2} } func (m *GetAuthenticatorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -82,7 +166,7 @@ func (m *GetAuthenticatorsResponse) Reset() { *m = GetAuthenticatorsResp func (m *GetAuthenticatorsResponse) String() string { return proto.CompactTextString(m) } func (*GetAuthenticatorsResponse) ProtoMessage() {} func (*GetAuthenticatorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3beaace7ec4b0b78, []int{1} + return fileDescriptor_3beaace7ec4b0b78, []int{3} } func (m *GetAuthenticatorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -128,7 +212,7 @@ func (m *GetAuthenticatorRequest) Reset() { *m = GetAuthenticatorRequest func (m *GetAuthenticatorRequest) String() string { return proto.CompactTextString(m) } func (*GetAuthenticatorRequest) ProtoMessage() {} func (*GetAuthenticatorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3beaace7ec4b0b78, []int{2} + return fileDescriptor_3beaace7ec4b0b78, []int{4} } func (m *GetAuthenticatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -180,7 +264,7 @@ func (m *GetAuthenticatorResponse) Reset() { *m = GetAuthenticatorRespon func (m *GetAuthenticatorResponse) String() string { return proto.CompactTextString(m) } func (*GetAuthenticatorResponse) ProtoMessage() {} func (*GetAuthenticatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3beaace7ec4b0b78, []int{3} + return fileDescriptor_3beaace7ec4b0b78, []int{5} } func (m *GetAuthenticatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -217,6 +301,8 @@ func (m *GetAuthenticatorResponse) GetAccountAuthenticator() *AccountAuthenticat } func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "dydxprotocol.accountplus.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "dydxprotocol.accountplus.QueryParamsResponse") proto.RegisterType((*GetAuthenticatorsRequest)(nil), "dydxprotocol.accountplus.GetAuthenticatorsRequest") proto.RegisterType((*GetAuthenticatorsResponse)(nil), "dydxprotocol.accountplus.GetAuthenticatorsResponse") proto.RegisterType((*GetAuthenticatorRequest)(nil), "dydxprotocol.accountplus.GetAuthenticatorRequest") @@ -228,32 +314,38 @@ func init() { } var fileDescriptor_3beaace7ec4b0b78 = []byte{ - // 399 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xa9, 0x4c, 0xa9, - 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, - 0x29, 0xc8, 0x29, 0x2d, 0xd6, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x03, 0x4b, 0x09, 0x49, 0x20, - 0xab, 0xd2, 0x43, 0x52, 0x25, 0x25, 0x93, 0x9e, 0x9f, 0x9f, 0x9e, 0x93, 0xaa, 0x9f, 0x58, 0x90, - 0xa9, 0x9f, 0x98, 0x97, 0x97, 0x5f, 0x92, 0x58, 0x92, 0x99, 0x9f, 0x57, 0x0c, 0xd1, 0x27, 0xa5, - 0x8a, 0xd3, 0xf4, 0xdc, 0xfc, 0x94, 0xd4, 0x1c, 0xa8, 0x32, 0x25, 0x13, 0x2e, 0x09, 0xf7, 0xd4, - 0x12, 0xc7, 0xd2, 0x92, 0x8c, 0xd4, 0xbc, 0x92, 0xcc, 0xe4, 0xc4, 0x92, 0xfc, 0xa2, 0xe2, 0xa0, - 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0x21, 0x09, 0x2e, 0x76, 0xa8, 0x3e, 0x09, 0x46, 0x05, 0x46, - 0x0d, 0xce, 0x20, 0x18, 0x57, 0xa9, 0x89, 0x91, 0x4b, 0x12, 0x8b, 0xb6, 0xe2, 0x82, 0xfc, 0xbc, - 0xe2, 0x54, 0xa1, 0x54, 0x2e, 0x31, 0xa8, 0xc2, 0xf8, 0x44, 0x14, 0x15, 0x12, 0x8c, 0x0a, 0xcc, - 0x1a, 0xdc, 0x46, 0x7a, 0x7a, 0xb8, 0xfc, 0xa4, 0xe7, 0x08, 0x61, 0xa3, 0x18, 0x1c, 0x24, 0x9a, - 0x88, 0x45, 0xb4, 0x58, 0x29, 0x8e, 0x4b, 0x1c, 0xdd, 0x0d, 0x04, 0x5d, 0x2e, 0xa4, 0xc9, 0x25, - 0x80, 0xe2, 0xa6, 0xf8, 0xcc, 0x14, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x96, 0x20, 0x7e, 0x14, 0x71, - 0xcf, 0x14, 0xa5, 0x7a, 0xcc, 0xa0, 0x81, 0x7b, 0x31, 0x99, 0x4b, 0x14, 0xab, 0x17, 0xc1, 0xd6, - 0x91, 0xee, 0x43, 0x11, 0x6c, 0x3e, 0x34, 0xea, 0x61, 0xe6, 0x62, 0x0d, 0x04, 0x25, 0x05, 0xa1, - 0xe3, 0x8c, 0x5c, 0x02, 0xe8, 0x6e, 0x11, 0x32, 0xc4, 0x6d, 0x09, 0x8e, 0x70, 0x91, 0x32, 0x22, - 0x45, 0x0b, 0xc4, 0xab, 0x4a, 0x3e, 0x4d, 0x97, 0x9f, 0x4c, 0x66, 0x72, 0x13, 0x72, 0xd1, 0xc7, - 0x99, 0xa2, 0x50, 0x82, 0x40, 0xbf, 0x1a, 0x2a, 0x55, 0xab, 0x5f, 0x8d, 0x1e, 0xd4, 0xb5, 0x42, - 0x3b, 0x18, 0xb9, 0x04, 0x31, 0x52, 0x8e, 0x10, 0x09, 0xee, 0x82, 0xa5, 0x4e, 0x29, 0x63, 0x92, - 0xf4, 0x40, 0x3d, 0x63, 0x05, 0xf6, 0x8c, 0x89, 0x90, 0x11, 0x91, 0x9e, 0x29, 0x46, 0xf8, 0xc6, - 0x29, 0xfc, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, - 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x6c, 0xd3, 0x33, 0x4b, - 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0x51, 0xcd, 0x2d, 0x33, 0xd1, 0x4d, 0xce, 0x48, 0xcc, - 0xcc, 0xd3, 0x87, 0x8b, 0x54, 0xa0, 0xd8, 0x55, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x96, - 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x56, 0xb6, 0xc4, 0x11, 0x04, 0x00, 0x00, + // 486 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xde, 0xa9, 0xeb, 0x8a, 0xd3, 0x83, 0x75, 0xdc, 0x6a, 0x5c, 0x24, 0x86, 0x41, 0x61, 0x05, + 0x9b, 0xc1, 0x74, 0x4f, 0x82, 0x42, 0x8b, 0x28, 0x82, 0x07, 0x0d, 0x88, 0xe0, 0xc1, 0x32, 0x4d, + 0x86, 0x6c, 0x20, 0x9b, 0x49, 0x33, 0x13, 0xe9, 0x52, 0x8a, 0xd0, 0x3f, 0xa0, 0xe0, 0xdd, 0xdf, + 0xe1, 0x3f, 0xb0, 0xc7, 0x82, 0x17, 0x4f, 0x22, 0xbb, 0xfe, 0x10, 0xe9, 0x64, 0xba, 0x76, 0x76, + 0x13, 0xb6, 0xb9, 0x25, 0xef, 0x7d, 0xdf, 0x7b, 0xdf, 0x37, 0xdf, 0x83, 0xf7, 0xc2, 0x71, 0xb8, + 0x9f, 0xe5, 0x5c, 0xf2, 0x80, 0x27, 0x84, 0x06, 0x01, 0x2f, 0x52, 0x99, 0x25, 0x85, 0x20, 0x7b, + 0x05, 0xcb, 0xc7, 0xae, 0x6a, 0x21, 0xeb, 0x3c, 0xca, 0x3d, 0x87, 0xea, 0x75, 0x23, 0x1e, 0x71, + 0xd5, 0x21, 0xa7, 0x5f, 0x25, 0xbe, 0x77, 0x27, 0xe2, 0x3c, 0x4a, 0x18, 0xa1, 0x59, 0x4c, 0x68, + 0x9a, 0x72, 0x49, 0x65, 0xcc, 0x53, 0xa1, 0xbb, 0xf7, 0x6b, 0x77, 0x8e, 0x78, 0xc8, 0x92, 0xe5, + 0xb0, 0x8c, 0xe6, 0x74, 0xa4, 0x61, 0xb8, 0x0b, 0xd1, 0x9b, 0x53, 0xa9, 0xaf, 0x55, 0xd1, 0x67, + 0x7b, 0x05, 0x13, 0x12, 0xbf, 0x85, 0x37, 0x8c, 0xaa, 0xc8, 0x78, 0x2a, 0x18, 0x7a, 0x0a, 0x3b, + 0x25, 0xd9, 0x02, 0x0e, 0xe8, 0xaf, 0x7a, 0x8e, 0x5b, 0xe7, 0xcc, 0x2d, 0x99, 0xdb, 0xed, 0xe3, + 0xdf, 0x77, 0x5b, 0xbe, 0x66, 0xe1, 0x01, 0xb4, 0x5e, 0x30, 0xb9, 0x55, 0xc8, 0x21, 0x4b, 0x65, + 0x1c, 0x50, 0xc9, 0xf3, 0xb3, 0x95, 0xc8, 0x82, 0x57, 0x34, 0x5f, 0x0d, 0xbf, 0xea, 0x9f, 0xfd, + 0xe2, 0x23, 0x00, 0x6f, 0x57, 0xd0, 0xb4, 0x26, 0x06, 0x6f, 0x6a, 0xe0, 0x0e, 0x35, 0x10, 0x16, + 0x70, 0x2e, 0xf5, 0x57, 0x3d, 0xb7, 0x5e, 0xe3, 0x56, 0xf9, 0x6d, 0x0c, 0xf6, 0xd7, 0x69, 0x45, + 0x55, 0xe0, 0x0f, 0xf0, 0xd6, 0xbc, 0x86, 0xa5, 0xca, 0xd1, 0x03, 0xb8, 0x66, 0x68, 0xda, 0x89, + 0x43, 0x6b, 0xc5, 0x01, 0xfd, 0xb6, 0x7f, 0xcd, 0xa8, 0xbf, 0x0c, 0xf1, 0xa7, 0xc5, 0xa7, 0x99, + 0x59, 0x0c, 0xe0, 0x7a, 0xa5, 0x45, 0x9d, 0x42, 0x53, 0x87, 0xdd, 0x2a, 0x87, 0xde, 0xb7, 0x36, + 0xbc, 0xac, 0x32, 0x47, 0x9f, 0x01, 0xec, 0x94, 0xf1, 0xa1, 0x87, 0xf5, 0xa3, 0x17, 0xaf, 0xa6, + 0xb7, 0x71, 0x41, 0x74, 0x69, 0x0b, 0xf7, 0x8f, 0x7e, 0xfe, 0xfd, 0xba, 0x82, 0x91, 0x43, 0x96, + 0x9c, 0x2a, 0xfa, 0x01, 0xe0, 0xda, 0xfc, 0xeb, 0xa0, 0x47, 0xf5, 0xdb, 0x6a, 0x92, 0xea, 0x79, + 0x4d, 0x28, 0x5a, 0xe5, 0x2b, 0xa5, 0xf2, 0x39, 0x7a, 0x56, 0xaf, 0xd2, 0x08, 0x85, 0x1c, 0xe8, + 0xd6, 0x21, 0x39, 0x98, 0x0f, 0xff, 0x10, 0x7d, 0x07, 0xf0, 0xfa, 0xc2, 0x2d, 0xa3, 0x06, 0xba, + 0x66, 0x8f, 0xbd, 0xd9, 0x88, 0xa3, 0xcd, 0x3c, 0x56, 0x66, 0x06, 0xc8, 0xbb, 0xa0, 0x19, 0xf1, + 0xdf, 0xcd, 0xf6, 0xbb, 0xe3, 0x89, 0x0d, 0x4e, 0x26, 0x36, 0xf8, 0x33, 0xb1, 0xc1, 0x97, 0xa9, + 0xdd, 0x3a, 0x99, 0xda, 0xad, 0x5f, 0x53, 0xbb, 0xf5, 0xfe, 0x49, 0x14, 0xcb, 0x61, 0xb1, 0xeb, + 0x06, 0x7c, 0x64, 0xce, 0xfd, 0x38, 0xd8, 0x08, 0x86, 0x34, 0x4e, 0xc9, 0xac, 0xb2, 0x6f, 0xec, + 0x92, 0xe3, 0x8c, 0x89, 0xdd, 0x8e, 0xea, 0x6e, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x3e, + 0x4f, 0x88, 0x4d, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -268,6 +360,8 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Queries a single authenticator by account and authenticator ID. GetAuthenticator(ctx context.Context, in *GetAuthenticatorRequest, opts ...grpc.CallOption) (*GetAuthenticatorResponse, error) // Queries all authenticators for a given account. @@ -282,6 +376,15 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) GetAuthenticator(ctx context.Context, in *GetAuthenticatorRequest, opts ...grpc.CallOption) (*GetAuthenticatorResponse, error) { out := new(GetAuthenticatorResponse) err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Query/GetAuthenticator", in, out, opts...) @@ -302,6 +405,8 @@ func (c *queryClient) GetAuthenticators(ctx context.Context, in *GetAuthenticato // QueryServer is the server API for Query service. type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Queries a single authenticator by account and authenticator ID. GetAuthenticator(context.Context, *GetAuthenticatorRequest) (*GetAuthenticatorResponse, error) // Queries all authenticators for a given account. @@ -312,6 +417,9 @@ type QueryServer interface { type UnimplementedQueryServer struct { } +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} func (*UnimplementedQueryServer) GetAuthenticator(ctx context.Context, req *GetAuthenticatorRequest) (*GetAuthenticatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAuthenticator not implemented") } @@ -323,6 +431,24 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_GetAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetAuthenticatorRequest) if err := dec(in); err != nil { @@ -363,6 +489,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "dydxprotocol.accountplus.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, { MethodName: "GetAuthenticator", Handler: _Query_GetAuthenticator_Handler, @@ -376,6 +506,62 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "dydxprotocol/accountplus/query.proto", } +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *GetAuthenticatorsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -524,6 +710,26 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func (m *GetAuthenticatorsRequest) Size() (n int) { if m == nil { return 0 @@ -587,6 +793,139 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *QueryParamsRequest) 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 ErrIntOverflowQuery + } + 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) 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 ErrIntOverflowQuery + } + 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *GetAuthenticatorsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/protocol/x/accountplus/types/query.pb.gw.go b/protocol/x/accountplus/types/query.pb.gw.go index ce6a0b4972..490d4e2343 100644 --- a/protocol/x/accountplus/types/query.pb.gw.go +++ b/protocol/x/accountplus/types/query.pb.gw.go @@ -33,6 +33,24 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_GetAuthenticator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetAuthenticatorRequest var metadata runtime.ServerMetadata @@ -169,6 +187,29 @@ func local_request_Query_GetAuthenticators_0(ctx context.Context, marshaler runt // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_GetAuthenticator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -256,6 +297,26 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_GetAuthenticator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -300,12 +361,16 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dydxprotocol", "accountplus", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_GetAuthenticator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dydxprotocol", "accountplus", "authenticator", "account", "authenticator_id"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_GetAuthenticators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dydxprotocol", "accountplus", "authenticators", "account"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + forward_Query_GetAuthenticator_0 = runtime.ForwardResponseMessage forward_Query_GetAuthenticators_0 = runtime.ForwardResponseMessage diff --git a/protocol/x/accountplus/types/tx.pb.go b/protocol/x/accountplus/types/tx.pb.go index 7213db3b30..7f908acf0f 100644 --- a/protocol/x/accountplus/types/tx.pb.go +++ b/protocol/x/accountplus/types/tx.pb.go @@ -235,6 +235,96 @@ func (m *MsgRemoveAuthenticatorResponse) GetSuccess() bool { return false } +// MsgSetActiveState sets the active state of the module. +type MsgSetActiveState struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Active bool `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"` +} + +func (m *MsgSetActiveState) Reset() { *m = MsgSetActiveState{} } +func (m *MsgSetActiveState) String() string { return proto.CompactTextString(m) } +func (*MsgSetActiveState) ProtoMessage() {} +func (*MsgSetActiveState) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{4} +} +func (m *MsgSetActiveState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetActiveState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetActiveState.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 *MsgSetActiveState) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetActiveState.Merge(m, src) +} +func (m *MsgSetActiveState) XXX_Size() int { + return m.Size() +} +func (m *MsgSetActiveState) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetActiveState.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetActiveState proto.InternalMessageInfo + +func (m *MsgSetActiveState) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgSetActiveState) GetActive() bool { + if m != nil { + return m.Active + } + return false +} + +// MsgSetActiveStateResponse defines the Msg/SetActiveState response type. +type MsgSetActiveStateResponse struct { +} + +func (m *MsgSetActiveStateResponse) Reset() { *m = MsgSetActiveStateResponse{} } +func (m *MsgSetActiveStateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetActiveStateResponse) ProtoMessage() {} +func (*MsgSetActiveStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{5} +} +func (m *MsgSetActiveStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetActiveStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetActiveStateResponse.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 *MsgSetActiveStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetActiveStateResponse.Merge(m, src) +} +func (m *MsgSetActiveStateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetActiveStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetActiveStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetActiveStateResponse proto.InternalMessageInfo + // TxExtension allows for additional authenticator-specific data in // transactions. type TxExtension struct { @@ -247,7 +337,7 @@ func (m *TxExtension) Reset() { *m = TxExtension{} } func (m *TxExtension) String() string { return proto.CompactTextString(m) } func (*TxExtension) ProtoMessage() {} func (*TxExtension) Descriptor() ([]byte, []int) { - return fileDescriptor_2d1c240983fd17d6, []int{4} + return fileDescriptor_2d1c240983fd17d6, []int{6} } func (m *TxExtension) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -288,40 +378,47 @@ func init() { proto.RegisterType((*MsgAddAuthenticatorResponse)(nil), "dydxprotocol.accountplus.MsgAddAuthenticatorResponse") proto.RegisterType((*MsgRemoveAuthenticator)(nil), "dydxprotocol.accountplus.MsgRemoveAuthenticator") proto.RegisterType((*MsgRemoveAuthenticatorResponse)(nil), "dydxprotocol.accountplus.MsgRemoveAuthenticatorResponse") + proto.RegisterType((*MsgSetActiveState)(nil), "dydxprotocol.accountplus.MsgSetActiveState") + proto.RegisterType((*MsgSetActiveStateResponse)(nil), "dydxprotocol.accountplus.MsgSetActiveStateResponse") proto.RegisterType((*TxExtension)(nil), "dydxprotocol.accountplus.TxExtension") } func init() { proto.RegisterFile("dydxprotocol/accountplus/tx.proto", fileDescriptor_2d1c240983fd17d6) } var fileDescriptor_2d1c240983fd17d6 = []byte{ - // 432 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcd, 0x6a, 0xdb, 0x40, - 0x10, 0xc7, 0xbd, 0xb2, 0x49, 0xdb, 0x6d, 0x29, 0xcd, 0x06, 0x1c, 0xa1, 0x82, 0x48, 0x7d, 0x32, - 0x06, 0x49, 0xfd, 0x24, 0x45, 0x90, 0x43, 0x0a, 0xed, 0xcd, 0x17, 0x11, 0x28, 0xf4, 0x12, 0x36, - 0xbb, 0x8b, 0x2c, 0xb0, 0x76, 0x85, 0x66, 0x65, 0xa4, 0x53, 0x69, 0x7b, 0xeb, 0xa9, 0x0f, 0xd2, - 0x43, 0x1e, 0xa3, 0xc7, 0x1c, 0x7b, 0x2c, 0xf6, 0x21, 0xaf, 0x51, 0xb2, 0xfe, 0xc0, 0x72, 0xe5, - 0x62, 0x5f, 0x24, 0xed, 0xcc, 0x7f, 0x66, 0x7e, 0x7f, 0x8d, 0x84, 0x9f, 0xf1, 0x8a, 0x97, 0x59, - 0xae, 0xb4, 0x62, 0x6a, 0x1c, 0x50, 0xc6, 0x54, 0x21, 0x75, 0x36, 0x2e, 0x20, 0xd0, 0xa5, 0x6f, - 0xe2, 0xc4, 0x5e, 0x97, 0xf8, 0x6b, 0x12, 0xe7, 0x98, 0x29, 0x48, 0x15, 0x04, 0x29, 0xc4, 0xc1, - 0xe4, 0xc5, 0xdd, 0x6d, 0x5e, 0xe2, 0x1c, 0xd2, 0x34, 0x91, 0x2a, 0x30, 0xd7, 0x79, 0xa8, 0xf7, - 0x13, 0xe1, 0xa3, 0x21, 0xc4, 0xe7, 0x9c, 0x9f, 0x17, 0x7a, 0x24, 0xa4, 0x4e, 0x18, 0xd5, 0x2a, - 0x27, 0x5d, 0x7c, 0x00, 0x42, 0x72, 0x91, 0xdb, 0xe8, 0x04, 0xf5, 0x1f, 0x44, 0x8b, 0x13, 0xf1, - 0x30, 0xa1, 0xeb, 0xc2, 0x4b, 0x5d, 0x65, 0xc2, 0xb6, 0x8c, 0xe6, 0xb0, 0x96, 0xb9, 0xa8, 0x32, - 0x41, 0x08, 0xee, 0x70, 0xaa, 0xa9, 0xdd, 0x3e, 0x41, 0xfd, 0x47, 0x91, 0x79, 0x0e, 0xc3, 0xaf, - 0xb7, 0xd7, 0x83, 0x45, 0xbf, 0xef, 0xb7, 0xd7, 0x83, 0xc1, 0x56, 0xaf, 0x94, 0x73, 0xaf, 0xd6, - 0xb3, 0x77, 0x8a, 0x9f, 0x36, 0xd0, 0x46, 0x02, 0x32, 0x25, 0x41, 0x10, 0x1b, 0xdf, 0x83, 0x82, - 0x31, 0x01, 0x60, 0xb0, 0xef, 0x47, 0xcb, 0x63, 0xef, 0x33, 0xee, 0x0e, 0x21, 0x8e, 0x44, 0xaa, - 0x26, 0x62, 0x37, 0xa7, 0x8f, 0xb1, 0x95, 0x70, 0xe3, 0xac, 0x13, 0x59, 0x09, 0x0f, 0xcf, 0x36, - 0xb0, 0xbd, 0xad, 0xd8, 0xb9, 0x99, 0xb2, 0x41, 0x1e, 0x62, 0xb7, 0x19, 0x60, 0x07, 0xf8, 0x0f, - 0xf8, 0xe1, 0x45, 0xf9, 0xbe, 0xd4, 0x42, 0x42, 0xa2, 0x24, 0x39, 0xc5, 0xc7, 0x20, 0xc6, 0x82, - 0x69, 0xc1, 0x2f, 0x6b, 0x43, 0xee, 0x0a, 0xdb, 0xfd, 0x4e, 0xd4, 0x5d, 0xa6, 0x6b, 0x83, 0xe0, - 0xe5, 0x37, 0x0b, 0xb7, 0x87, 0x10, 0x93, 0x12, 0x3f, 0xf9, 0x67, 0xe1, 0x9e, 0xbf, 0xed, 0x7b, - 0xf2, 0x1b, 0xde, 0xb8, 0xf3, 0x66, 0x2f, 0xf9, 0xca, 0xe3, 0x17, 0x84, 0x8f, 0x9a, 0x96, 0xf0, - 0xfc, 0xbf, 0xed, 0x1a, 0x2a, 0x9c, 0xb7, 0xfb, 0x56, 0x2c, 0x19, 0xde, 0x7d, 0xfc, 0x35, 0x75, - 0xd1, 0xcd, 0xd4, 0x45, 0x7f, 0xa6, 0x2e, 0xfa, 0x31, 0x73, 0x5b, 0x37, 0x33, 0xb7, 0xf5, 0x7b, - 0xe6, 0xb6, 0x3e, 0x9d, 0xc5, 0x89, 0x1e, 0x15, 0x57, 0x3e, 0x53, 0x69, 0x50, 0xdb, 0xee, 0xe4, - 0xb5, 0xc7, 0x46, 0x34, 0x91, 0xc1, 0x2a, 0x52, 0xd6, 0x7f, 0xca, 0x2a, 0x13, 0x70, 0x75, 0x60, - 0xb2, 0xaf, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x90, 0xba, 0xf1, 0x80, 0xbd, 0x03, 0x00, 0x00, + // 511 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6a, 0xdb, 0x40, + 0x10, 0xc6, 0x2d, 0xdb, 0xb8, 0xe9, 0xb6, 0x84, 0x5a, 0x01, 0xc7, 0x75, 0x40, 0xa4, 0x82, 0x82, + 0x71, 0x91, 0xd4, 0x36, 0x0d, 0x29, 0x82, 0x1c, 0x5c, 0x68, 0x6f, 0xbe, 0x28, 0x81, 0x42, 0x2f, + 0x61, 0xb3, 0x3b, 0xc8, 0x02, 0x4b, 0x2b, 0x34, 0x2b, 0x23, 0xf7, 0x52, 0xda, 0x63, 0x4f, 0x7d, + 0x90, 0x1e, 0xf2, 0x18, 0x3d, 0xe6, 0xd8, 0x63, 0xb1, 0x0f, 0x79, 0x84, 0x5e, 0x83, 0xd7, 0x7f, + 0xb0, 0x1c, 0x39, 0xc4, 0x17, 0x5b, 0x3b, 0xf3, 0xcd, 0xcc, 0x6f, 0x56, 0x1f, 0x22, 0x2f, 0xf8, + 0x88, 0x67, 0x71, 0x22, 0xa4, 0x60, 0x62, 0xe0, 0x50, 0xc6, 0x44, 0x1a, 0xc9, 0x78, 0x90, 0xa2, + 0x23, 0x33, 0x5b, 0xc5, 0xf5, 0xe6, 0xaa, 0xc4, 0x5e, 0x91, 0xb4, 0xf6, 0x99, 0xc0, 0x50, 0xa0, + 0x13, 0xa2, 0xef, 0x0c, 0xdf, 0x4c, 0xff, 0x66, 0x25, 0xad, 0x3a, 0x0d, 0x83, 0x48, 0x38, 0xea, + 0x77, 0x16, 0x32, 0x7f, 0x6b, 0x64, 0xaf, 0x87, 0x7e, 0x97, 0xf3, 0x6e, 0x2a, 0xfb, 0x10, 0xc9, + 0x80, 0x51, 0x29, 0x12, 0xbd, 0x41, 0x6a, 0x08, 0x11, 0x87, 0xa4, 0xa9, 0x1d, 0x6a, 0xed, 0xc7, + 0xde, 0xfc, 0xa4, 0x5b, 0x44, 0xa7, 0xab, 0xc2, 0x0b, 0x39, 0x8a, 0xa1, 0x59, 0x56, 0x9a, 0x7a, + 0x2e, 0x73, 0x3e, 0x8a, 0x41, 0xd7, 0x49, 0x95, 0x53, 0x49, 0x9b, 0x95, 0x43, 0xad, 0xfd, 0xd4, + 0x53, 0xcf, 0xae, 0xfb, 0xe3, 0xe6, 0xaa, 0x33, 0xef, 0xf7, 0xf3, 0xe6, 0xaa, 0xd3, 0xd9, 0xb8, + 0x2b, 0xe5, 0xdc, 0xca, 0xf5, 0x34, 0x4f, 0xc8, 0x41, 0x01, 0xad, 0x07, 0x18, 0x8b, 0x08, 0x41, + 0x6f, 0x92, 0x47, 0x98, 0x32, 0x06, 0x88, 0x0a, 0x7b, 0xc7, 0x5b, 0x1c, 0xcd, 0x6f, 0xa4, 0xd1, + 0x43, 0xdf, 0x83, 0x50, 0x0c, 0xe1, 0x61, 0x9b, 0xee, 0x92, 0x72, 0xc0, 0xd5, 0x66, 0x55, 0xaf, + 0x1c, 0x70, 0xf7, 0x74, 0x0d, 0xdb, 0xda, 0x88, 0x9d, 0xa8, 0x29, 0x6b, 0xe4, 0x2e, 0x31, 0x8a, + 0x01, 0x1e, 0x00, 0xff, 0x95, 0xd4, 0x7b, 0xe8, 0x9f, 0x81, 0xec, 0x32, 0x19, 0x0c, 0xe1, 0x4c, + 0x52, 0x09, 0x1b, 0xb9, 0x1b, 0xa4, 0x46, 0x95, 0x4c, 0xb1, 0xef, 0x78, 0xf3, 0x93, 0x7b, 0xbc, + 0xc6, 0xff, 0x52, 0x99, 0x24, 0x40, 0x07, 0x43, 0x9a, 0xc8, 0x39, 0xbf, 0x83, 0x20, 0xad, 0x59, + 0x81, 0x85, 0xd3, 0x31, 0xe6, 0x01, 0x79, 0x7e, 0x67, 0xf6, 0x02, 0xd9, 0xfc, 0x44, 0x9e, 0x9c, + 0x67, 0x1f, 0x33, 0x09, 0x11, 0x06, 0x22, 0xd2, 0x4f, 0xc8, 0x3e, 0xc2, 0x00, 0x98, 0x04, 0x7e, + 0x91, 0xdb, 0x7e, 0xba, 0x51, 0xa5, 0x5d, 0xf5, 0x1a, 0x8b, 0x74, 0xee, 0x06, 0xf0, 0xed, 0xff, + 0x32, 0xa9, 0xf4, 0xd0, 0xd7, 0x33, 0xf2, 0xec, 0x8e, 0x13, 0x2d, 0x7b, 0x93, 0xd1, 0xed, 0x02, + 0x2b, 0xb4, 0x8e, 0xb7, 0x92, 0x2f, 0x2f, 0xff, 0xbb, 0x46, 0xf6, 0x8a, 0xdc, 0xf1, 0xfa, 0xde, + 0x76, 0x05, 0x15, 0xad, 0xf7, 0xdb, 0x56, 0x2c, 0x19, 0x12, 0xb2, 0xbb, 0xf6, 0x8e, 0x5f, 0xdd, + 0xdb, 0x2b, 0x2f, 0x6e, 0x1d, 0x6d, 0x21, 0x5e, 0xcc, 0xfc, 0xf0, 0xf9, 0xcf, 0xd8, 0xd0, 0xae, + 0xc7, 0x86, 0xf6, 0x6f, 0x6c, 0x68, 0xbf, 0x26, 0x46, 0xe9, 0x7a, 0x62, 0x94, 0xfe, 0x4e, 0x8c, + 0xd2, 0x97, 0x53, 0x3f, 0x90, 0xfd, 0xf4, 0xd2, 0x66, 0x22, 0x74, 0x72, 0x56, 0x1f, 0xbe, 0xb3, + 0x58, 0x9f, 0x06, 0x91, 0xb3, 0x8c, 0x64, 0xf9, 0x2f, 0xd4, 0x28, 0x06, 0xbc, 0xac, 0xa9, 0xec, + 0xd1, 0x6d, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6f, 0xd1, 0xf0, 0xf4, 0xca, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -340,6 +437,9 @@ type MsgClient interface { AddAuthenticator(ctx context.Context, in *MsgAddAuthenticator, opts ...grpc.CallOption) (*MsgAddAuthenticatorResponse, error) // RemoveAuthenticator removes an authenticator from an account. RemoveAuthenticator(ctx context.Context, in *MsgRemoveAuthenticator, opts ...grpc.CallOption) (*MsgRemoveAuthenticatorResponse, error) + // SetActiveState sets the active state of the authenticator. + // Primarily used for circuit breaking. + SetActiveState(ctx context.Context, in *MsgSetActiveState, opts ...grpc.CallOption) (*MsgSetActiveStateResponse, error) } type msgClient struct { @@ -368,12 +468,24 @@ func (c *msgClient) RemoveAuthenticator(ctx context.Context, in *MsgRemoveAuthen return out, nil } +func (c *msgClient) SetActiveState(ctx context.Context, in *MsgSetActiveState, opts ...grpc.CallOption) (*MsgSetActiveStateResponse, error) { + out := new(MsgSetActiveStateResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Msg/SetActiveState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // AddAuthenticator adds an authenticator to an account. AddAuthenticator(context.Context, *MsgAddAuthenticator) (*MsgAddAuthenticatorResponse, error) // RemoveAuthenticator removes an authenticator from an account. RemoveAuthenticator(context.Context, *MsgRemoveAuthenticator) (*MsgRemoveAuthenticatorResponse, error) + // SetActiveState sets the active state of the authenticator. + // Primarily used for circuit breaking. + SetActiveState(context.Context, *MsgSetActiveState) (*MsgSetActiveStateResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -386,6 +498,9 @@ func (*UnimplementedMsgServer) AddAuthenticator(ctx context.Context, req *MsgAdd func (*UnimplementedMsgServer) RemoveAuthenticator(ctx context.Context, req *MsgRemoveAuthenticator) (*MsgRemoveAuthenticatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveAuthenticator not implemented") } +func (*UnimplementedMsgServer) SetActiveState(ctx context.Context, req *MsgSetActiveState) (*MsgSetActiveStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetActiveState not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -427,6 +542,24 @@ func _Msg_RemoveAuthenticator_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Msg_SetActiveState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetActiveState) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetActiveState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Msg/SetActiveState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetActiveState(ctx, req.(*MsgSetActiveState)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "dydxprotocol.accountplus.Msg", HandlerType: (*MsgServer)(nil), @@ -439,6 +572,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RemoveAuthenticator", Handler: _Msg_RemoveAuthenticator_Handler, }, + { + MethodName: "SetActiveState", + Handler: _Msg_SetActiveState_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "dydxprotocol/accountplus/tx.proto", @@ -589,6 +726,69 @@ func (m *MsgRemoveAuthenticatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *MsgSetActiveState) 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 *MsgSetActiveState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetActiveState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Active { + i-- + if m.Active { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetActiveStateResponse) 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 *MsgSetActiveStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetActiveStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *TxExtension) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -702,6 +902,31 @@ func (m *MsgRemoveAuthenticatorResponse) Size() (n int) { return n } +func (m *MsgSetActiveState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Active { + n += 2 + } + return n +} + +func (m *MsgSetActiveStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *TxExtension) Size() (n int) { if m == nil { return 0 @@ -1113,6 +1338,158 @@ func (m *MsgRemoveAuthenticatorResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgSetActiveState) 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 ErrIntOverflowTx + } + 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: MsgSetActiveState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetActiveState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Active = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSetActiveStateResponse) 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 ErrIntOverflowTx + } + 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: MsgSetActiveStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetActiveStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *TxExtension) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 65fc453b7e4069d7523a208ebfb917823b22eca5 Mon Sep 17 00:00:00 2001 From: Jay Yu <103467857+jayy04@users.noreply.github.com> Date: Sat, 31 Aug 2024 12:08:14 -0400 Subject: [PATCH 5/6] [CT-1161] add signature verification authenticator --- .../authenticator/authentication_request.go | 284 ++++++++++++ .../x/accountplus/authenticator/base_test.go | 180 ++++++++ protocol/x/accountplus/authenticator/iface.go | 51 ++ .../x/accountplus/authenticator/requests.go | 49 ++ .../authenticator/signature_authenticator.go | 114 +++++ .../signature_authenticator_test.go | 436 ++++++++++++++++++ 6 files changed, 1114 insertions(+) create mode 100644 protocol/x/accountplus/authenticator/authentication_request.go create mode 100644 protocol/x/accountplus/authenticator/base_test.go create mode 100644 protocol/x/accountplus/authenticator/iface.go create mode 100644 protocol/x/accountplus/authenticator/requests.go create mode 100644 protocol/x/accountplus/authenticator/signature_authenticator.go create mode 100644 protocol/x/accountplus/authenticator/signature_authenticator_test.go diff --git a/protocol/x/accountplus/authenticator/authentication_request.go b/protocol/x/accountplus/authenticator/authentication_request.go new file mode 100644 index 0000000000..d7ff749812 --- /dev/null +++ b/protocol/x/accountplus/authenticator/authentication_request.go @@ -0,0 +1,284 @@ +package authenticator + +import ( + "fmt" + + txsigning "cosmossdk.io/x/tx/signing" + + authante "github.com/cosmos/cosmos-sdk/x/auth/ante" + + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// +// These structs define the data structure for authentication, used with AuthenticationRequest struct. +// + +// SignModeData represents the signing modes with direct bytes and textual representation. +type SignModeData struct { + Direct []byte `json:"sign_mode_direct"` + Textual string `json:"sign_mode_textual"` +} + +// LocalAny holds a message with its type URL and byte value. This is necessary because the type Any fails +// to serialize and deserialize properly in nested contexts. +type LocalAny struct { + TypeURL string `json:"type_url"` + Value []byte `json:"value"` +} + +// SimplifiedSignatureData contains lists of signers and their corresponding signatures. +type SimplifiedSignatureData struct { + Signers []sdk.AccAddress `json:"signers"` + Signatures [][]byte `json:"signatures"` +} + +// ExplicitTxData encapsulates key transaction data like chain ID, account info, and messages. +type ExplicitTxData struct { + ChainID string `json:"chain_id"` + AccountNumber uint64 `json:"account_number"` + AccountSequence uint64 `json:"sequence"` + TimeoutHeight uint64 `json:"timeout_height"` + Msgs []LocalAny `json:"msgs"` + Memo string `json:"memo"` +} + +// GetSignerAndSignatures gets an array of signer and an array of signatures from the transaction +// checks they're the same length and returns both. +// +// A signer can only have one signature, so if it appears in multiple messages, the signatures must be +// the same, and it will only be returned once by this function. This is to mimic the way the classic +// sdk authentication works, and we will probably want to change this in the future +func GetSignerAndSignatures(tx sdk.Tx) (signers []sdk.AccAddress, signatures []signing.SignatureV2, err error) { + // Attempt to cast the provided transaction to an authsigning.Tx. + sigTx, ok := tx.(authsigning.Tx) + if !ok { + return nil, nil, + errorsmod.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") + } + + // Retrieve signatures from the transaction. + signatures, err = sigTx.GetSignaturesV2() + if err != nil { + return nil, nil, err + } + + // Retrieve messages from the transaction. + signerBytes, err := sigTx.GetSigners() + if err != nil { + return nil, nil, err + } + + for _, signer := range signerBytes { + signers = append(signers, sdk.AccAddress(signer)) + } + + // check that signer length and signature length are the same + if len(signatures) != len(signers) { + return nil, + nil, + errorsmod.Wrap( + sdkerrors.ErrTxDecode, + fmt.Sprintf( + "invalid number of signer; expected: %d, got %d", + len(signers), + len(signatures), + ), + ) + } + + return signers, signatures, nil +} + +// getSignerData returns the signer data for a given account. This is part of the data that needs to be signed. +func getSignerData(ctx sdk.Context, ak authante.AccountKeeper, account sdk.AccAddress) authsigning.SignerData { + // Retrieve and build the signer data struct + baseAccount := ak.GetAccount(ctx, account) + genesis := ctx.BlockHeight() == 0 + chainID := ctx.ChainID() + var accNum uint64 + if !genesis { + accNum = baseAccount.GetAccountNumber() + } + var sequence uint64 + if baseAccount != nil { + sequence = baseAccount.GetSequence() + } + + return authsigning.SignerData{ + ChainID: chainID, + AccountNumber: accNum, + Sequence: sequence, + } +} + +// extractExplicitTxData makes the transaction data concrete for the authentication request. This is necessary to +// pass the parsed data to the cosmwasm authenticator. +func extractExplicitTxData(tx sdk.Tx, signerData authsigning.SignerData) (ExplicitTxData, error) { + timeoutTx, ok := tx.(sdk.TxWithTimeoutHeight) + if !ok { + return ExplicitTxData{}, errorsmod.Wrap(sdkerrors.ErrInvalidType, "failed to cast tx to TxWithTimeoutHeight") + } + memoTx, ok := tx.(sdk.TxWithMemo) + if !ok { + return ExplicitTxData{}, errorsmod.Wrap(sdkerrors.ErrInvalidType, "failed to cast tx to TxWithMemo") + } + + // Encode messages as Anys and manually convert them to a struct we can serialize to json for cosmwasm. + txMsgs := tx.GetMsgs() + msgs := make([]LocalAny, len(txMsgs)) + for i, txMsg := range txMsgs { + encodedMsg, err := types.NewAnyWithValue(txMsg) + if err != nil { + return ExplicitTxData{}, errorsmod.Wrap(err, "failed to encode msg") + } + msgs[i] = LocalAny{ + TypeURL: encodedMsg.TypeUrl, + Value: encodedMsg.Value, + } + } + + return ExplicitTxData{ + ChainID: signerData.ChainID, + AccountNumber: signerData.AccountNumber, + AccountSequence: signerData.Sequence, + TimeoutHeight: timeoutTx.GetTimeoutHeight(), + Msgs: msgs, + Memo: memoTx.GetMemo(), + }, nil +} + +// extractSignatures returns the signature data for each signature in the transaction and +// the one for the current signer. +// +// This function also checks for replay attacks. The replay protection needs to be able to match the signature to the +// corresponding signer, which involves iterating over the signatures. To avoid iterating over the signatures twice, +// we do replay protection here instead of in a separate replay protection function. +// +// Only SingleSignatureData is supported. Multisigs can be implemented by using partitioned compound authenticators +func extractSignatures( + txSigners []sdk.AccAddress, + txSignatures []signing.SignatureV2, + account sdk.AccAddress, +) (signatures [][]byte, msgSignature []byte, err error) { + for i, signature := range txSignatures { + single, ok := signature.Data.(*signing.SingleSignatureData) + if !ok { + return nil, + nil, + errorsmod.Wrap( + sdkerrors.ErrInvalidType, + "failed to cast signature to SingleSignatureData", + ) + } + + signatures = append(signatures, single.Signature) + + if txSigners[i].Equals(account) { + msgSignature = single.Signature + } + } + return signatures, msgSignature, nil +} + +// GenerateAuthenticationRequest creates an AuthenticationRequest for the transaction. +func GenerateAuthenticationRequest( + ctx sdk.Context, + cdc codec.Codec, + ak authante.AccountKeeper, + sigModeHandler *txsigning.HandlerMap, + account sdk.AccAddress, + feePayer sdk.AccAddress, + feeGranter sdk.AccAddress, + fee sdk.Coins, + msg sdk.Msg, + tx sdk.Tx, + msgIndex int, + simulate bool, +) (AuthenticationRequest, error) { + // Only supporting one signer per message. This will be enforced in sdk v0.50 + signers, _, err := cdc.GetMsgV1Signers(msg) + if err != nil { + return AuthenticationRequest{}, err + } + signer := sdk.AccAddress(signers[0]) + if !signer.Equals(account) { + return AuthenticationRequest{}, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid signer") + } + + // Get the signers and signatures from the transaction. A signer can only have one signature, so if it + // appears in multiple messages, the signatures must be the same, and it will only be returned once by + // this function. This is to mimic the way the classic sdk authentication works, and we will probably want + // to change this in the future + txSigners, txSignatures, err := GetSignerAndSignatures(tx) + if err != nil { + return AuthenticationRequest{}, errorsmod.Wrap(err, "failed to get signers and signatures") + } + + // Get the signer data for the account. This is needed in the SignDoc + signerData := getSignerData(ctx, ak, account) + + // Get the concrete transaction data to be passed to the authenticators + txData, err := extractExplicitTxData(tx, signerData) + if err != nil { + return AuthenticationRequest{}, errorsmod.Wrap(err, "failed to get explicit tx data") + } + + // Get the signatures for the transaction and execute replay protection + signatures, msgSignature, err := extractSignatures(txSigners, txSignatures, account) + if err != nil { + return AuthenticationRequest{}, errorsmod.Wrap(err, "failed to get signatures") + } + + // Build the authentication request + authRequest := AuthenticationRequest{ + Account: account, + FeePayer: feePayer, + FeeGranter: feeGranter, + Fee: fee, + Msg: txData.Msgs[msgIndex], + MsgIndex: uint64(msgIndex), + Signature: msgSignature, + TxData: txData, + SignModeTxData: SignModeData{ + Direct: []byte("signBytes"), + }, + SignatureData: SimplifiedSignatureData{ + Signers: txSigners, + Signatures: signatures, + }, + Simulate: simulate, + AuthenticatorParams: nil, + } + + // We do not generate the sign bytes if simulate is true + if simulate { + return authRequest, nil + } + + // Get the sign bytes for the transaction + signBytes, err := authsigning.GetSignBytesAdapter( + ctx, + sigModeHandler, + signing.SignMode_SIGN_MODE_DIRECT, + signerData, + tx, + ) + if err != nil { + return AuthenticationRequest{}, errorsmod.Wrap(err, "failed to get signBytes") + } + + // TODO: Add other sign modes. Specifically json when it becomes available + authRequest.SignModeTxData = SignModeData{ + Direct: signBytes, + } + + return authRequest, nil +} diff --git a/protocol/x/accountplus/authenticator/base_test.go b/protocol/x/accountplus/authenticator/base_test.go new file mode 100644 index 0000000000..dbc6a89f0a --- /dev/null +++ b/protocol/x/accountplus/authenticator/base_test.go @@ -0,0 +1,180 @@ +package authenticator_test + +import ( + "encoding/hex" + "fmt" + "math/rand" + + storetypes "cosmossdk.io/store/types" + "github.com/cometbft/cometbft/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/bank/testutil" + "github.com/dydxprotocol/v4-chain/protocol/app" + testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" + "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" + "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/authenticator" + smartaccounttypes "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types" + "github.com/stretchr/testify/suite" +) + +type BaseAuthenticatorSuite struct { + suite.Suite + tApp *testapp.TestApp + Ctx sdk.Context + EncodingConfig app.EncodingConfig + SigVerificationAuthenticator authenticator.SignatureVerification + TestKeys []string + TestAccAddress []sdk.AccAddress + TestPrivKeys []*secp256k1.PrivKey + HomeDir string +} + +func (s *BaseAuthenticatorSuite) SetupKeys() { + // Test data for authenticator signature verification + TestKeys := []string{ + "6cf5103c60c939a5f38e383b52239c5296c968579eec1c68a47d70fbf1d19159", + "0dd4d1506e18a5712080708c338eb51ecf2afdceae01e8162e890b126ac190fe", + "49006a359803f0602a7ec521df88bf5527579da79112bb71f285dd3e7d438033", + } + accounts := make([]sdk.AccountI, 0) + // Set up test accounts + for _, key := range TestKeys { + bz, _ := hex.DecodeString(key) + priv := &secp256k1.PrivKey{Key: bz} + + // add the test private keys to array for later use + s.TestPrivKeys = append(s.TestPrivKeys, priv) + + accAddress := sdk.AccAddress(priv.PubKey().Address()) + accounts = append( + accounts, + authtypes.NewBaseAccount(accAddress, priv.PubKey(), 0, 0), + ) + + // add the test accounts to array for later use + s.TestAccAddress = append(s.TestAccAddress, accAddress) + } + + s.HomeDir = fmt.Sprintf("%d", rand.Int()) + s.tApp = testapp.NewTestAppBuilder(s.T()).WithGenesisDocFn(func() (genesis types.GenesisDoc) { + genesis = testapp.DefaultGenesis() + testapp.UpdateGenesisDocWithAppStateForModule( + &genesis, + func(genesisState *authtypes.GenesisState) { + for _, acct := range accounts { + genesisState.Accounts = append(genesisState.Accounts, codectypes.UnsafePackAny(acct)) + } + }, + ) + return genesis + }).Build() + s.Ctx = s.tApp.InitChain() + s.Ctx = s.Ctx.WithGasMeter(storetypes.NewGasMeter(1_000_000)) + + s.EncodingConfig = app.GetEncodingConfig() +} + +func (s *BaseAuthenticatorSuite) GenSimpleTx(msgs []sdk.Msg, signers []cryptotypes.PrivKey) (sdk.Tx, error) { + txconfig := app.GetEncodingConfig().TxConfig + feeCoins := constants.TestFeeCoins_5Cents + var accNums []uint64 + var accSeqs []uint64 + + ak := s.tApp.App.AccountKeeper + + for _, signer := range signers { + var account sdk.AccountI + if ak.HasAccount(s.Ctx, sdk.AccAddress(signer.PubKey().Address())) { + account = ak.GetAccount(s.Ctx, sdk.AccAddress(signer.PubKey().Address())) + } else { + account = authtypes.NewBaseAccount( + sdk.AccAddress(signer.PubKey().Address()), + signer.PubKey(), + ak.NextAccountNumber(s.Ctx), + 0, + ) + } + accNums = append(accNums, account.GetAccountNumber()) + accSeqs = append(accSeqs, account.GetSequence()) + } + + tx, err := GenTx( + s.Ctx, + txconfig, + msgs, + feeCoins, + 300000, + "", + accNums, + accSeqs, + signers, + signers, + ) + if err != nil { + return nil, err + } + return tx, nil +} + +func (s *BaseAuthenticatorSuite) GenSimpleTxWithSelectedAuthenticators( + msgs []sdk.Msg, + signers []cryptotypes.PrivKey, + selectedAuthenticators []uint64, +) (sdk.Tx, error) { + txconfig := app.GetEncodingConfig().TxConfig + feeCoins := constants.TestFeeCoins_5Cents + var accNums []uint64 + var accSeqs []uint64 + + ak := s.tApp.App.AccountKeeper + + for _, signer := range signers { + account := ak.GetAccount(s.Ctx, sdk.AccAddress(signer.PubKey().Address())) + accNums = append(accNums, account.GetAccountNumber()) + accSeqs = append(accSeqs, account.GetSequence()) + } + + baseTxBuilder, err := MakeTxBuilder( + s.Ctx, + txconfig, + msgs, + feeCoins, + 300000, + "", + accNums, + accSeqs, + signers, + signers, + ) + if err != nil { + return nil, err + } + + txBuilder, ok := baseTxBuilder.(authtx.ExtensionOptionsTxBuilder) + if !ok { + return nil, fmt.Errorf("expected authtx.ExtensionOptionsTxBuilder, got %T", baseTxBuilder) + } + if len(selectedAuthenticators) > 0 { + value, err := codectypes.NewAnyWithValue(&smartaccounttypes.TxExtension{ + SelectedAuthenticators: selectedAuthenticators, + }) + if err != nil { + return nil, err + } + txBuilder.SetNonCriticalExtensionOptions(value) + } + + tx := txBuilder.GetTx() + return tx, nil +} + +// FundAcc funds target address with specified amount. +func (s *BaseAuthenticatorSuite) FundAcc(acc sdk.AccAddress, amounts sdk.Coins) { + err := testutil.FundAccount(s.Ctx, s.tApp.App.BankKeeper, acc, amounts) + s.Require().NoError(err) +} diff --git a/protocol/x/accountplus/authenticator/iface.go b/protocol/x/accountplus/authenticator/iface.go new file mode 100644 index 0000000000..556d6d0367 --- /dev/null +++ b/protocol/x/accountplus/authenticator/iface.go @@ -0,0 +1,51 @@ +package authenticator + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitializedAuthenticator denotes an authenticator fetched from the store and prepared for use. +type InitializedAuthenticator struct { + Id uint64 + Authenticator Authenticator +} + +// Authenticator is an interface that encapsulates all authentication functionalities essential for +// verifying transactions, paying transaction fees, and managing gas consumption during verification. +type Authenticator interface { + // Type returns the specific type of the authenticator, such as SignatureVerification. + // This type is used for registering and identifying the authenticator within the AuthenticatorManager. + Type() string + + // StaticGas provides the fixed gas amount consumed for each invocation of this authenticator. + // This is used for managing gas consumption during transaction verification. + StaticGas() uint64 + + // Initialize prepares the authenticator with necessary data from storage, specific to an account-authenticator pair. + // This method is used for setting up the authenticator with data like a PublicKey for signature verification. + Initialize(config []byte) (Authenticator, error) + + // Authenticate confirms the validity of a message using the provided authentication data. + // NOTE: Any state changes made by this function will be discarded. + // It's a core function within an ante handler to ensure message authenticity and enforce gas consumption. + Authenticate(ctx sdk.Context, request AuthenticationRequest) error + + // Track allows the authenticator to record information, regardless of the transaction's authentication method. + // NOTE: Any state changes made by this function will be written to the store as long as Authenticate succeeds + // and will not be reverted if the message execution fails. + // This function is used for the authenticator to acknowledge the execution of specific messages by an account. + Track(ctx sdk.Context, request AuthenticationRequest) error + + // ConfirmExecution enforces transaction rules post-transaction, like spending and transaction limits. + // It is used to verify execution-specific state and values, to allow authentication to be dependent on the + // effects of a transaction. + ConfirmExecution(ctx sdk.Context, request AuthenticationRequest) error + + // OnAuthenticatorAdded handles the addition of an authenticator to an account. + // It checks the data format and compatibility, to maintain account security and authenticator integrity. + OnAuthenticatorAdded(ctx sdk.Context, account sdk.AccAddress, config []byte, authenticatorId string) error + + // OnAuthenticatorRemoved manages the removal of an authenticator from an account. + // This function is used for updating global data or preventing removal when necessary to maintain system stability. + OnAuthenticatorRemoved(ctx sdk.Context, account sdk.AccAddress, config []byte, authenticatorId string) error +} diff --git a/protocol/x/accountplus/authenticator/requests.go b/protocol/x/accountplus/authenticator/requests.go new file mode 100644 index 0000000000..f1629f862e --- /dev/null +++ b/protocol/x/accountplus/authenticator/requests.go @@ -0,0 +1,49 @@ +package authenticator + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type TrackRequest struct { + AuthenticatorId string `json:"authenticator_id"` + Account sdk.AccAddress `json:"account"` + FeePayer sdk.AccAddress `json:"fee_payer"` + FeeGranter sdk.AccAddress `json:"fee_granter,omitempty"` + Fee sdk.Coins `json:"fee"` + Msg LocalAny `json:"msg"` + MsgIndex uint64 `json:"msg_index"` + AuthenticatorParams []byte `json:"authenticator_params,omitempty"` +} + +type ConfirmExecutionRequest struct { + AuthenticatorId string `json:"authenticator_id"` + Account sdk.AccAddress `json:"account"` + FeePayer sdk.AccAddress `json:"fee_payer"` + FeeGranter sdk.AccAddress `json:"fee_granter,omitempty"` + Fee sdk.Coins `json:"fee"` + Msg LocalAny `json:"msg"` + MsgIndex uint64 `json:"msg_index"` + AuthenticatorParams []byte `json:"authenticator_params,omitempty"` +} + +type AuthenticationRequest struct { + AuthenticatorId string `json:"authenticator_id"` + Account sdk.AccAddress `json:"account"` + FeePayer sdk.AccAddress `json:"fee_payer"` + FeeGranter sdk.AccAddress `json:"fee_granter,omitempty"` + Fee sdk.Coins `json:"fee"` + Msg LocalAny `json:"msg"` + + // Since array size is int, and size depends on the system architecture, + // we use uint64 to cover all available architectures. + // It is unsigned, so at this point, it can't be negative. + MsgIndex uint64 `json:"msg_index"` + + // Only allowing messages with a single signer, so the signature can be a single byte array. + Signature []byte `json:"signature"` + SignModeTxData SignModeData `json:"sign_mode_tx_data"` + TxData ExplicitTxData `json:"tx_data"` + SignatureData SimplifiedSignatureData `json:"signature_data"` + Simulate bool `json:"simulate"` + AuthenticatorParams []byte `json:"authenticator_params,omitempty"` +} diff --git a/protocol/x/accountplus/authenticator/signature_authenticator.go b/protocol/x/accountplus/authenticator/signature_authenticator.go new file mode 100644 index 0000000000..de051ad2b9 --- /dev/null +++ b/protocol/x/accountplus/authenticator/signature_authenticator.go @@ -0,0 +1,114 @@ +package authenticator + +import ( + "fmt" + + authante "github.com/cosmos/cosmos-sdk/x/auth/ante" + + errorsmod "cosmossdk.io/errors" + + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// Compile time type assertion for the SignatureData using the +// SignatureVerification struct +var _ Authenticator = &SignatureVerification{} + +const ( + // SignatureVerificationType represents a type of authenticator specifically designed for + // secp256k1 signature verification. + SignatureVerificationType = "SignatureVerification" +) + +// signature authenticator +type SignatureVerification struct { + ak authante.AccountKeeper + PubKey cryptotypes.PubKey +} + +func (sva SignatureVerification) Type() string { + return SignatureVerificationType +} + +func (sva SignatureVerification) StaticGas() uint64 { + // using 0 gas here. The gas is consumed based on the pubkey type in Authenticate() + return 0 +} + +// NewSignatureVerification creates a new SignatureVerification +func NewSignatureVerification(ak authante.AccountKeeper) SignatureVerification { + return SignatureVerification{ak: ak} +} + +// Initialize sets up the public key to the data supplied from the account-authenticator configuration +func (sva SignatureVerification) Initialize(config []byte) (Authenticator, error) { + if len(config) != secp256k1.PubKeySize { + sva.PubKey = nil + } + sva.PubKey = &secp256k1.PubKey{Key: config} + return sva, nil +} + +// Authenticate takes a SignaturesVerificationData struct and validates +// each signer and signature using signature verification +func (sva SignatureVerification) Authenticate(ctx sdk.Context, request AuthenticationRequest) error { + // First consume gas for verifying the signature + params := sva.ak.GetParams(ctx) + ctx.GasMeter().ConsumeGas(params.SigVerifyCostSecp256k1, "secp256k1 signature verification") + // after gas consumption continue to verify signatures + + if request.Simulate || ctx.IsReCheckTx() { + return nil + } + if sva.PubKey == nil { + return errorsmod.Wrap(sdkerrors.ErrInvalidPubKey, "pubkey on not set on account or authenticator") + } + + if !sva.PubKey.VerifySignature(request.SignModeTxData.Direct, request.Signature) { + return errorsmod.Wrapf( + sdkerrors.ErrUnauthorized, + "signature verification failed; please verify account number (%d), sequence (%d) and chain-id (%s)", + request.TxData.AccountNumber, + request.TxData.AccountSequence, + request.TxData.ChainID, + ) + } + return nil +} + +func (sva SignatureVerification) Track(ctx sdk.Context, request AuthenticationRequest) error { + return nil +} + +func (sva SignatureVerification) ConfirmExecution(ctx sdk.Context, request AuthenticationRequest) error { + return nil +} + +func (sva SignatureVerification) OnAuthenticatorAdded( + ctx sdk.Context, + account sdk.AccAddress, + config []byte, + authenticatorId string, +) error { + // We allow users to pass no data or a valid public key for signature verification. + if len(config) != secp256k1.PubKeySize { + return fmt.Errorf( + "invalid secp256k1 public key size, expected %d, got %d", + secp256k1.PubKeySize, + len(config), + ) + } + return nil +} + +func (sva SignatureVerification) OnAuthenticatorRemoved( + ctx sdk.Context, + account sdk.AccAddress, + config []byte, + authenticatorId string, +) error { + return nil +} diff --git a/protocol/x/accountplus/authenticator/signature_authenticator_test.go b/protocol/x/accountplus/authenticator/signature_authenticator_test.go new file mode 100644 index 0000000000..6f1ceebd45 --- /dev/null +++ b/protocol/x/accountplus/authenticator/signature_authenticator_test.go @@ -0,0 +1,436 @@ +package authenticator_test + +import ( + "math/rand" + "os" + "testing" + "time" + + "github.com/cosmos/cosmos-sdk/client" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + + "github.com/stretchr/testify/suite" + + "github.com/dydxprotocol/v4-chain/protocol/app" + "github.com/dydxprotocol/v4-chain/protocol/app/config" + "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" + "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/authenticator" +) + +type SigVerifyAuthenticationSuite struct { + BaseAuthenticatorSuite + + SigVerificationAuthenticator authenticator.SignatureVerification +} + +func TestSigVerifyAuthenticationSuite(t *testing.T) { + suite.Run(t, new(SigVerifyAuthenticationSuite)) +} + +func (s *SigVerifyAuthenticationSuite) SetupTest() { + s.SetupKeys() + + s.EncodingConfig = app.GetEncodingConfig() + ak := s.tApp.App.AccountKeeper + + // Create a new Secp256k1SignatureAuthenticator for testing + s.SigVerificationAuthenticator = authenticator.NewSignatureVerification( + ak, + ) +} + +func (s *SigVerifyAuthenticationSuite) TearDownTest() { + os.RemoveAll(s.HomeDir) +} + +type SignatureVerificationTestData struct { + Msgs []sdk.Msg + AccNums []uint64 + AccSeqs []uint64 + Signers []cryptotypes.PrivKey + Signatures []cryptotypes.PrivKey + NumberOfExpectedSigners int + NumberOfExpectedSignatures int + ShouldSucceedGettingData bool + ShouldSucceedSignatureVerification bool +} + +type SignatureVerificationTest struct { + Description string + TestData SignatureVerificationTestData +} + +// TestSignatureAuthenticator test a non-smart account signature verification +func (s *SigVerifyAuthenticationSuite) TestSignatureAuthenticator() { + bech32Prefix := config.Bech32PrefixAccAddr + coins := sdk.Coins{sdk.NewInt64Coin(constants.TestNativeTokenDenom, 2500)} + + // Create a test messages for signing + testMsg1 := &banktypes.MsgSend{ + FromAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[0]), + ToAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[1]), + Amount: coins, + } + testMsg2 := &banktypes.MsgSend{ + FromAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[1]), + ToAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[1]), + Amount: coins, + } + testMsg3 := &banktypes.MsgSend{ + FromAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[2]), + ToAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[1]), + Amount: coins, + } + //testMsg4 := &banktypes.MsgSend{ + // FromAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[0]), + // ToAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[1]), + // Amount: coins, + //} + feeCoins := constants.TestFeeCoins_5Cents + + tests := []SignatureVerificationTest{ + { + Description: "Test: successfully verified authenticator with one signer: base case: PASS", + TestData: SignatureVerificationTestData{ + []sdk.Msg{ + testMsg1, + }, + []uint64{5}, + []uint64{0}, + []cryptotypes.PrivKey{ + s.TestPrivKeys[0], + }, + []cryptotypes.PrivKey{ + s.TestPrivKeys[0], + }, + 1, + 1, + true, + true, + }, + }, + + { + Description: "Test: successfully verified authenticator: multiple signers: PASS", + TestData: SignatureVerificationTestData{ + []sdk.Msg{ + testMsg1, + testMsg2, + testMsg3, + }, + []uint64{5, 5, 5, 5}, + []uint64{0, 0, 0, 0}, + []cryptotypes.PrivKey{ + s.TestPrivKeys[0], + s.TestPrivKeys[1], + s.TestPrivKeys[2], + }, + []cryptotypes.PrivKey{ + s.TestPrivKeys[0], + s.TestPrivKeys[1], + s.TestPrivKeys[2], + }, + 3, + 3, + true, + true, + }, + }, + + { + // This test case tests if there are two messages with the same signer + // with two successful signatures. + Description: "Test: verified authenticator with 2 messages signed correctly with the same address: PASS", + TestData: SignatureVerificationTestData{ + []sdk.Msg{ + testMsg1, + testMsg2, + testMsg2, + }, + []uint64{5, 5}, + []uint64{0, 0}, + []cryptotypes.PrivKey{ + s.TestPrivKeys[0], + s.TestPrivKeys[1], + }, + []cryptotypes.PrivKey{ + s.TestPrivKeys[0], + s.TestPrivKeys[1], + }, + 2, + 2, + true, + true, + }, + }, + + { + // This test case tests if there are two messages with the same signer + // with two successful signatures. + Description: "Test: verified authenticator with 2 messages but only first signed signed correctly: Fail", + TestData: SignatureVerificationTestData{ + []sdk.Msg{ + testMsg1, + testMsg2, + testMsg2, + }, + []uint64{5, 5}, + []uint64{0, 0}, + []cryptotypes.PrivKey{ + s.TestPrivKeys[0], + s.TestPrivKeys[1], + }, + []cryptotypes.PrivKey{ + s.TestPrivKeys[0], + s.TestPrivKeys[0], + }, + 2, + 2, + true, + false, + }, + }, + + { + // This test case tests if there are two messages with the same signer + // with two successful signatures. + Description: "Test: verified authenticator with 2 messages but only second signed signed correctly: Fail", + TestData: SignatureVerificationTestData{ + []sdk.Msg{ + testMsg1, + testMsg2, + testMsg2, + }, + []uint64{5, 5}, + []uint64{0, 0}, + []cryptotypes.PrivKey{ + s.TestPrivKeys[0], + s.TestPrivKeys[1], + }, + []cryptotypes.PrivKey{ + s.TestPrivKeys[1], + s.TestPrivKeys[1], + }, + 2, + 2, + true, + false, + }, + }, + + { + Description: "Test: unsuccessful signature authentication invalid signatures: FAIL", + TestData: SignatureVerificationTestData{ + []sdk.Msg{ + testMsg1, + testMsg2, + }, + []uint64{5, 5}, + []uint64{0, 0}, + []cryptotypes.PrivKey{ + s.TestPrivKeys[1], + s.TestPrivKeys[0], + }, + []cryptotypes.PrivKey{ + s.TestPrivKeys[2], + s.TestPrivKeys[0], + }, + 2, + 2, + false, + false, + }, + }, + } + + for _, tc := range tests { + s.Run(tc.Description, func() { + // Generate a transaction based on the test cases + tx, _ := GenTx( + s.Ctx, + s.EncodingConfig.TxConfig, + tc.TestData.Msgs, + feeCoins, + 300000, + s.Ctx.ChainID(), + tc.TestData.AccNums, + tc.TestData.AccSeqs, + tc.TestData.Signers, + tc.TestData.Signatures, + ) + ak := s.tApp.App.AccountKeeper + sigModeHandler := s.EncodingConfig.TxConfig.SignModeHandler() + + // Only the first message is tested for authenticate + addr := sdk.AccAddress(tc.TestData.Signers[0].PubKey().Address()) + + if tc.TestData.ShouldSucceedGettingData { + // request for the first message + request, err := authenticator.GenerateAuthenticationRequest( + s.Ctx, + s.tApp.App.AppCodec(), + ak, + sigModeHandler, + addr, + addr, + nil, + sdk.NewCoins(), + tc.TestData.Msgs[0], + tx, + 0, + false, + ) + s.Require().NoError(err) + + // Test Authenticate method + if tc.TestData.ShouldSucceedSignatureVerification { + initialized, err := s.SigVerificationAuthenticator.Initialize(tc.TestData.Signers[0].PubKey().Bytes()) + s.Require().NoError(err) + err = initialized.Authenticate(s.Ctx, request) + s.Require().NoError(err) + } else { + err = s.SigVerificationAuthenticator.Authenticate(s.Ctx, request) + s.Require().Error(err) + } + } else { + _, err := authenticator.GenerateAuthenticationRequest( + s.Ctx, + s.tApp.App.AppCodec(), + ak, + sigModeHandler, + addr, + addr, + nil, + sdk.NewCoins(), + tc.TestData.Msgs[0], + tx, + 0, + false, + ) + s.Require().Error(err) + } + }) + } +} + +func MakeTxBuilder(ctx sdk.Context, + gen client.TxConfig, + msgs []sdk.Msg, + feeAmt sdk.Coins, + gas uint64, + chainID string, + accNums, + accSeqs []uint64, + signers []cryptotypes.PrivKey, + signatures []cryptotypes.PrivKey, +) (client.TxBuilder, error) { + sigs := make([]signing.SignatureV2, len(signatures)) + + // create a random length memo + r := rand.New(rand.NewSource(time.Now().UnixNano())) + memo := simulation.RandStringOfLength(r, simulation.RandIntBetween(r, 0, 100)) + signMode, err := authsigning.APISignModeToInternal(gen.SignModeHandler().DefaultMode()) + if err != nil { + return nil, err + } + + // 1st round: set SignatureV2 with empty signatures, to set correct + // signer infos. + for i, p := range signers { + sigs[i] = signing.SignatureV2{ + PubKey: p.PubKey(), + Data: &signing.SingleSignatureData{ + SignMode: signMode, + }, + Sequence: accSeqs[i], + } + } + + tx := gen.NewTxBuilder() + err = tx.SetMsgs(msgs...) + if err != nil { + return nil, err + } + err = tx.SetSignatures(sigs...) + if err != nil { + return nil, err + } + tx.SetMemo(memo) + tx.SetFeeAmount(feeAmt) + tx.SetGasLimit(gas) + + // 2nd round: once all signer infos are set, every signer can sign. + for i, p := range signatures { + signerData := authsigning.SignerData{ + ChainID: chainID, + AccountNumber: accNums[i], + Sequence: accSeqs[i], + } + signBytes, err := authsigning.GetSignBytesAdapter( + ctx, gen.SignModeHandler(), signMode, signerData, tx.GetTx()) + if err != nil { + panic(err) + } + sig, err := p.Sign(signBytes) + if err != nil { + panic(err) + } + sigs[i].Data.(*signing.SingleSignatureData).Signature = sig + } + + err = tx.SetSignatures(sigs...) + if err != nil { + panic(err) + } + return tx, nil +} + +// GenTx generates a signed mock transaction. +func GenTx( + ctx sdk.Context, + gen client.TxConfig, + msgs []sdk.Msg, + feeAmt sdk.Coins, + gas uint64, + chainID string, + accNums, + accSeqs []uint64, + signers []cryptotypes.PrivKey, + signatures []cryptotypes.PrivKey, +) (sdk.Tx, error) { + tx, err := MakeTxBuilder(ctx, gen, msgs, feeAmt, gas, chainID, accNums, accSeqs, signers, signatures) + if err != nil { + return nil, err + } + return tx.GetTx(), nil +} + +// func generatePubKeysForMultiSig( +// priv ...cryptotypes.PrivKey, +// ) (pubkeys []cryptotypes.PubKey) { +// pubkeys = make([]cryptotypes.PubKey, len(priv)) +// for i, p := range priv { +// pubkeys[i] = p.PubKey() +// } +// return +// } + +// func generateSignaturesForMultiSig( +// msg []byte, +// priv ...cryptotypes.PrivKey, +// ) (signatures [][]byte) { +// signatures = make([][]byte, len(priv)) +// for i, p := range priv { +// var err error +// signatures[i], err = p.Sign(msg) +// if err != nil { +// panic(err) +// } +// } +// return +// } From 52da410e256fd33bb2e56849fe1d824edc16c91e Mon Sep 17 00:00:00 2001 From: Jay Yu <103467857+jayy04@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:56:21 +0900 Subject: [PATCH 6/6] update tests --- .../signature_authenticator_test.go | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/protocol/x/accountplus/authenticator/signature_authenticator_test.go b/protocol/x/accountplus/authenticator/signature_authenticator_test.go index 6f1ceebd45..081e52345c 100644 --- a/protocol/x/accountplus/authenticator/signature_authenticator_test.go +++ b/protocol/x/accountplus/authenticator/signature_authenticator_test.go @@ -86,11 +86,6 @@ func (s *SigVerifyAuthenticationSuite) TestSignatureAuthenticator() { ToAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[1]), Amount: coins, } - //testMsg4 := &banktypes.MsgSend{ - // FromAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[0]), - // ToAddress: sdk.MustBech32ifyAddressBytes(bech32Prefix, s.TestAccAddress[1]), - // Amount: coins, - //} feeCoins := constants.TestFeeCoins_5Cents tests := []SignatureVerificationTest{ @@ -409,28 +404,3 @@ func GenTx( } return tx.GetTx(), nil } - -// func generatePubKeysForMultiSig( -// priv ...cryptotypes.PrivKey, -// ) (pubkeys []cryptotypes.PubKey) { -// pubkeys = make([]cryptotypes.PubKey, len(priv)) -// for i, p := range priv { -// pubkeys[i] = p.PubKey() -// } -// return -// } - -// func generateSignaturesForMultiSig( -// msg []byte, -// priv ...cryptotypes.PrivKey, -// ) (signatures [][]byte) { -// signatures = make([][]byte, len(priv)) -// for i, p := range priv { -// var err error -// signatures[i], err = p.Sign(msg) -// if err != nil { -// panic(err) -// } -// } -// return -// }