feat(accounts): implement Account Number query (#18989)

Co-authored-by: unknown unknown <unknown@unknown>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
This commit is contained in:
testinginprod 2024-01-09 19:23:41 +01:00 committed by GitHub
parent 6ffc209043
commit e1f478da41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1527 additions and 138 deletions

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,7 @@ const (
Query_AccountQuery_FullMethodName = "/cosmos.accounts.v1.Query/AccountQuery"
Query_Schema_FullMethodName = "/cosmos.accounts.v1.Query/Schema"
Query_AccountType_FullMethodName = "/cosmos.accounts.v1.Query/AccountType"
Query_AccountNumber_FullMethodName = "/cosmos.accounts.v1.Query/AccountNumber"
Query_SimulateUserOperation_FullMethodName = "/cosmos.accounts.v1.Query/SimulateUserOperation"
)
@ -35,6 +36,8 @@ type QueryClient interface {
Schema(ctx context.Context, in *SchemaRequest, opts ...grpc.CallOption) (*SchemaResponse, error)
// AccountType returns the account type for an address.
AccountType(ctx context.Context, in *AccountTypeRequest, opts ...grpc.CallOption) (*AccountTypeResponse, error)
// AccountNumber returns the account number given the account address.
AccountNumber(ctx context.Context, in *AccountNumberRequest, opts ...grpc.CallOption) (*AccountNumberResponse, error)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(ctx context.Context, in *SimulateUserOperationRequest, opts ...grpc.CallOption) (*SimulateUserOperationResponse, error)
}
@ -74,6 +77,15 @@ func (c *queryClient) AccountType(ctx context.Context, in *AccountTypeRequest, o
return out, nil
}
func (c *queryClient) AccountNumber(ctx context.Context, in *AccountNumberRequest, opts ...grpc.CallOption) (*AccountNumberResponse, error) {
out := new(AccountNumberResponse)
err := c.cc.Invoke(ctx, Query_AccountNumber_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) SimulateUserOperation(ctx context.Context, in *SimulateUserOperationRequest, opts ...grpc.CallOption) (*SimulateUserOperationResponse, error) {
out := new(SimulateUserOperationResponse)
err := c.cc.Invoke(ctx, Query_SimulateUserOperation_FullMethodName, in, out, opts...)
@ -93,6 +105,8 @@ type QueryServer interface {
Schema(context.Context, *SchemaRequest) (*SchemaResponse, error)
// AccountType returns the account type for an address.
AccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error)
// AccountNumber returns the account number given the account address.
AccountNumber(context.Context, *AccountNumberRequest) (*AccountNumberResponse, error)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(context.Context, *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error)
mustEmbedUnimplementedQueryServer()
@ -111,6 +125,9 @@ func (UnimplementedQueryServer) Schema(context.Context, *SchemaRequest) (*Schema
func (UnimplementedQueryServer) AccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AccountType not implemented")
}
func (UnimplementedQueryServer) AccountNumber(context.Context, *AccountNumberRequest) (*AccountNumberResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AccountNumber not implemented")
}
func (UnimplementedQueryServer) SimulateUserOperation(context.Context, *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SimulateUserOperation not implemented")
}
@ -181,6 +198,24 @@ func _Query_AccountType_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _Query_AccountNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AccountNumberRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).AccountNumber(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_AccountNumber_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).AccountNumber(ctx, req.(*AccountNumberRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_SimulateUserOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SimulateUserOperationRequest)
if err := dec(in); err != nil {
@ -218,6 +253,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "AccountType",
Handler: _Query_AccountType_Handler,
},
{
MethodName: "AccountNumber",
Handler: _Query_AccountNumber_Handler,
},
{
MethodName: "SimulateUserOperation",
Handler: _Query_SimulateUserOperation_Handler,

View File

@ -15,6 +15,8 @@ service Query {
rpc Schema(SchemaRequest) returns (SchemaResponse) {};
// AccountType returns the account type for an address.
rpc AccountType(AccountTypeRequest) returns (AccountTypeResponse) {};
// AccountNumber returns the account number given the account address.
rpc AccountNumber(AccountNumberRequest) returns (AccountNumberResponse) {};
// SimulateUserOperation simulates a user operation.
rpc SimulateUserOperation(SimulateUserOperationRequest) returns (SimulateUserOperationResponse) {};
}
@ -70,6 +72,19 @@ message AccountTypeResponse {
string account_type = 1;
}
// AccountNumberRequest returns the account number given the address.
message AccountNumberRequest {
// address is the address of the account we want to know the number of.
string address = 1;
}
// AccountNumberResponse is the response returned when querying the
// account number by address.
message AccountNumberResponse {
// number is the account number of the provided address.
uint64 number = 1;
}
// SimulateUserOperationRequest is the query request used to simulate a
// UserOperation.
message SimulateUserOperationRequest {

View File

@ -72,7 +72,20 @@ func (q queryServer) AccountType(ctx context.Context, request *v1.AccountTypeReq
}, nil
}
func (q queryServer) AccountNumber(ctx context.Context, request *v1.AccountNumberRequest) (*v1.AccountNumberResponse, error) {
addr, err := q.k.addressCodec.StringToBytes(request.Address)
if err != nil {
return nil, err
}
number, err := q.k.AccountByNumber.Get(ctx, addr)
if err != nil {
return nil, err
}
return &v1.AccountNumberResponse{Number: number}, nil
}
const (
// TODO(tip): evaluate if the following numbers should be parametrised over state, or over the node.
SimulateAuthenticateGasLimit = 1_000_000
SimulateBundlerPaymentGasLimit = SimulateAuthenticateGasLimit
ExecuteGasLimit = SimulateAuthenticateGasLimit

View File

@ -23,7 +23,7 @@ func TestQueryServer(t *testing.T) {
ms := NewMsgServer(k)
qs := NewQueryServer(k)
// create
// create account
initMsg, err := implementation.PackAny(&emptypb.Empty{})
require.NoError(t, err)
@ -34,19 +34,32 @@ func TestQueryServer(t *testing.T) {
})
require.NoError(t, err)
// query
req := &wrapperspb.UInt64Value{Value: 10}
anypbReq, err := implementation.PackAny(req)
require.NoError(t, err)
t.Run("account query", func(t *testing.T) {
// query
req := &wrapperspb.UInt64Value{Value: 10}
anypbReq, err := implementation.PackAny(req)
require.NoError(t, err)
queryResp, err := qs.AccountQuery(ctx, &v1.AccountQueryRequest{
Target: initResp.AccountAddress,
Request: anypbReq,
queryResp, err := qs.AccountQuery(ctx, &v1.AccountQueryRequest{
Target: initResp.AccountAddress,
Request: anypbReq,
})
require.NoError(t, err)
resp, err := implementation.UnpackAnyRaw(queryResp.Response)
require.NoError(t, err)
require.Equal(t, "10", resp.(*types.StringValue).Value)
})
require.NoError(t, err)
resp, err := implementation.UnpackAnyRaw(queryResp.Response)
require.NoError(t, err)
t.Run("account number", func(t *testing.T) {
numResp, err := qs.AccountNumber(ctx, &v1.AccountNumberRequest{Address: initResp.AccountAddress})
require.NoError(t, err)
require.Equal(t, 0, int(numResp.Number))
})
require.Equal(t, "10", resp.(*types.StringValue).Value)
t.Run("account type", func(t *testing.T) {
typ, err := qs.AccountType(ctx, &v1.AccountTypeRequest{Address: initResp.AccountAddress})
require.NoError(t, err)
require.Equal(t, "test", typ.AccountType)
})
}

View File

@ -388,6 +388,99 @@ func (m *AccountTypeResponse) GetAccountType() string {
return ""
}
// AccountNumberRequest returns the account number given the address.
type AccountNumberRequest struct {
// address is the address of the account we want to know the number of.
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
}
func (m *AccountNumberRequest) Reset() { *m = AccountNumberRequest{} }
func (m *AccountNumberRequest) String() string { return proto.CompactTextString(m) }
func (*AccountNumberRequest) ProtoMessage() {}
func (*AccountNumberRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_16ad14c22e3080d2, []int{6}
}
func (m *AccountNumberRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AccountNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_AccountNumberRequest.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 *AccountNumberRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_AccountNumberRequest.Merge(m, src)
}
func (m *AccountNumberRequest) XXX_Size() int {
return m.Size()
}
func (m *AccountNumberRequest) XXX_DiscardUnknown() {
xxx_messageInfo_AccountNumberRequest.DiscardUnknown(m)
}
var xxx_messageInfo_AccountNumberRequest proto.InternalMessageInfo
func (m *AccountNumberRequest) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
// AccountNumberResponse is the response returned when querying the
// account number by address.
type AccountNumberResponse struct {
// number is the account number of the provided address.
Number uint64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
}
func (m *AccountNumberResponse) Reset() { *m = AccountNumberResponse{} }
func (m *AccountNumberResponse) String() string { return proto.CompactTextString(m) }
func (*AccountNumberResponse) ProtoMessage() {}
func (*AccountNumberResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_16ad14c22e3080d2, []int{7}
}
func (m *AccountNumberResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AccountNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_AccountNumberResponse.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 *AccountNumberResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_AccountNumberResponse.Merge(m, src)
}
func (m *AccountNumberResponse) XXX_Size() int {
return m.Size()
}
func (m *AccountNumberResponse) XXX_DiscardUnknown() {
xxx_messageInfo_AccountNumberResponse.DiscardUnknown(m)
}
var xxx_messageInfo_AccountNumberResponse proto.InternalMessageInfo
func (m *AccountNumberResponse) GetNumber() uint64 {
if m != nil {
return m.Number
}
return 0
}
// SimulateUserOperationRequest is the query request used to simulate a
// UserOperation.
type SimulateUserOperationRequest struct {
@ -402,7 +495,7 @@ func (m *SimulateUserOperationRequest) Reset() { *m = SimulateUserOperat
func (m *SimulateUserOperationRequest) String() string { return proto.CompactTextString(m) }
func (*SimulateUserOperationRequest) ProtoMessage() {}
func (*SimulateUserOperationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_16ad14c22e3080d2, []int{6}
return fileDescriptor_16ad14c22e3080d2, []int{8}
}
func (m *SimulateUserOperationRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -456,7 +549,7 @@ func (m *SimulateUserOperationResponse) Reset() { *m = SimulateUserOpera
func (m *SimulateUserOperationResponse) String() string { return proto.CompactTextString(m) }
func (*SimulateUserOperationResponse) ProtoMessage() {}
func (*SimulateUserOperationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_16ad14c22e3080d2, []int{7}
return fileDescriptor_16ad14c22e3080d2, []int{9}
}
func (m *SimulateUserOperationResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -500,6 +593,8 @@ func init() {
proto.RegisterType((*SchemaResponse_Handler)(nil), "cosmos.accounts.v1.SchemaResponse.Handler")
proto.RegisterType((*AccountTypeRequest)(nil), "cosmos.accounts.v1.AccountTypeRequest")
proto.RegisterType((*AccountTypeResponse)(nil), "cosmos.accounts.v1.AccountTypeResponse")
proto.RegisterType((*AccountNumberRequest)(nil), "cosmos.accounts.v1.AccountNumberRequest")
proto.RegisterType((*AccountNumberResponse)(nil), "cosmos.accounts.v1.AccountNumberResponse")
proto.RegisterType((*SimulateUserOperationRequest)(nil), "cosmos.accounts.v1.SimulateUserOperationRequest")
proto.RegisterType((*SimulateUserOperationResponse)(nil), "cosmos.accounts.v1.SimulateUserOperationResponse")
}
@ -507,43 +602,45 @@ func init() {
func init() { proto.RegisterFile("cosmos/accounts/v1/query.proto", fileDescriptor_16ad14c22e3080d2) }
var fileDescriptor_16ad14c22e3080d2 = []byte{
// 563 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x8e, 0x12, 0x41,
0x10, 0x66, 0xd8, 0x08, 0x5a, 0x2c, 0x68, 0xda, 0x5d, 0xc5, 0x89, 0x4e, 0x60, 0x0e, 0x2e, 0x1a,
0xd3, 0xb3, 0xa0, 0x07, 0x6f, 0x06, 0x4f, 0x24, 0x1e, 0x0c, 0xac, 0x7b, 0x31, 0x31, 0xd8, 0x0c,
0x2d, 0x4b, 0x84, 0x69, 0xb6, 0x7f, 0x36, 0xcb, 0xc5, 0x83, 0x4f, 0xe0, 0x2b, 0xf8, 0x36, 0x7b,
0xdc, 0xa3, 0x47, 0x03, 0x2f, 0x62, 0x98, 0xee, 0x86, 0x41, 0x67, 0x41, 0x6e, 0x53, 0x5d, 0x5f,
0x7d, 0x5f, 0x75, 0xd5, 0xd7, 0x03, 0x5e, 0xc8, 0xc4, 0x98, 0x89, 0x80, 0x84, 0x21, 0x53, 0x91,
0x14, 0xc1, 0x45, 0x3d, 0x38, 0x57, 0x94, 0x4f, 0xf1, 0x84, 0x33, 0xc9, 0x10, 0xd2, 0x79, 0x6c,
0xf3, 0xf8, 0xa2, 0xee, 0x3e, 0x1a, 0x30, 0x36, 0x18, 0xd1, 0x20, 0x46, 0xf4, 0xd4, 0x97, 0x80,
0x44, 0x06, 0xee, 0xbe, 0x48, 0xa1, 0x33, 0xdf, 0x5d, 0xd2, 0x13, 0x92, 0x93, 0x50, 0x0e, 0x59,
0xa4, 0xd1, 0xfe, 0x27, 0xb8, 0xdf, 0xd4, 0xc9, 0xf6, 0x42, 0xb2, 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x2f, 0x73, 0x3d, 0xf7, 0x32, 0xbf,
0xe6, 0x5e, 0xe6, 0xa3, 0xab, 0xd9, 0x44, 0xff, 0x2b, 0x1e, 0xb2, 0xe0, 0x32, 0xf9, 0x3f, 0xee,
0xe5, 0xe2, 0x9f, 0xdc, 0xcb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x77, 0xb6, 0x2c, 0xc3, 0xfb,
0x05, 0x00, 0x00,
// 608 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcf, 0x6f, 0x12, 0x41,
0x14, 0x66, 0x69, 0xa5, 0xfa, 0x28, 0xd5, 0x8c, 0xa5, 0xe2, 0x46, 0x37, 0xb0, 0x07, 0x4b, 0x8d,
0x99, 0x05, 0xf4, 0xe0, 0xcd, 0xe0, 0x89, 0xc4, 0x44, 0xc3, 0xd6, 0x5e, 0x4c, 0x0c, 0x2e, 0xcb,
0x94, 0x12, 0x61, 0x97, 0xce, 0xec, 0x34, 0xe5, 0xe2, 0xc1, 0x9b, 0x37, 0xff, 0xac, 0x1e, 0x7b,
0xf4, 0x68, 0xe0, 0x1f, 0x31, 0xcc, 0x0f, 0xd8, 0xad, 0x5b, 0x28, 0xb7, 0x79, 0xf3, 0xde, 0xfb,
0xbe, 0xb7, 0xef, 0x7d, 0x6f, 0x16, 0x2c, 0x3f, 0x64, 0xa3, 0x90, 0x39, 0x9e, 0xef, 0x87, 0x3c,
0x88, 0x98, 0x73, 0x51, 0x77, 0xce, 0x39, 0xa1, 0x13, 0x3c, 0xa6, 0x61, 0x14, 0x22, 0x24, 0xfd,
0x58, 0xfb, 0xf1, 0x45, 0xdd, 0x7c, 0xda, 0x0f, 0xc3, 0xfe, 0x90, 0x38, 0x22, 0xa2, 0xcb, 0x4f,
0x1d, 0x2f, 0x50, 0xe1, 0xe6, 0xab, 0x14, 0x38, 0x75, 0xee, 0x78, 0x5d, 0x16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 0xa8, 0x26,
0xa6, 0x5c, 0xf3, 0x70, 0x6d, 0xdc, 0x82, 0xe1, 0x14, 0x0a, 0x09, 0x79, 0xa1, 0x55, 0x5f, 0x9c,
0xd0, 0xac, 0x79, 0x74, 0x87, 0xc8, 0x05, 0xcf, 0x0f, 0x28, 0xa6, 0xea, 0x01, 0xd5, 0x52, 0x1b,
0xb1, 0x42, 0xbf, 0x66, 0x7d, 0x83, 0x0c, 0xcd, 0xff, 0xfe, 0xcd, 0xd5, 0xd4, 0x32, 0xae, 0xa7,
0x96, 0xf1, 0x77, 0x6a, 0x19, 0xbf, 0x67, 0x56, 0xe6, 0x7a, 0x66, 0x65, 0xfe, 0xcc, 0xac, 0xcc,
0x17, 0x53, 0xa2, 0xb1, 0xde, 0x77, 0x3c, 0x08, 0x9d, 0xcb, 0xf8, 0xaf, 0xa5, 0x9b, 0x13, 0xef,
0xf5, 0xeb, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcd, 0xc0, 0xe6, 0x63, 0xc6, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -564,6 +661,8 @@ type QueryClient interface {
Schema(ctx context.Context, in *SchemaRequest, opts ...grpc.CallOption) (*SchemaResponse, error)
// AccountType returns the account type for an address.
AccountType(ctx context.Context, in *AccountTypeRequest, opts ...grpc.CallOption) (*AccountTypeResponse, error)
// AccountNumber returns the account number given the account address.
AccountNumber(ctx context.Context, in *AccountNumberRequest, opts ...grpc.CallOption) (*AccountNumberResponse, error)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(ctx context.Context, in *SimulateUserOperationRequest, opts ...grpc.CallOption) (*SimulateUserOperationResponse, error)
}
@ -603,6 +702,15 @@ func (c *queryClient) AccountType(ctx context.Context, in *AccountTypeRequest, o
return out, nil
}
func (c *queryClient) AccountNumber(ctx context.Context, in *AccountNumberRequest, opts ...grpc.CallOption) (*AccountNumberResponse, error) {
out := new(AccountNumberResponse)
err := c.cc.Invoke(ctx, "/cosmos.accounts.v1.Query/AccountNumber", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) SimulateUserOperation(ctx context.Context, in *SimulateUserOperationRequest, opts ...grpc.CallOption) (*SimulateUserOperationResponse, error) {
out := new(SimulateUserOperationResponse)
err := c.cc.Invoke(ctx, "/cosmos.accounts.v1.Query/SimulateUserOperation", in, out, opts...)
@ -620,6 +728,8 @@ type QueryServer interface {
Schema(context.Context, *SchemaRequest) (*SchemaResponse, error)
// AccountType returns the account type for an address.
AccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error)
// AccountNumber returns the account number given the account address.
AccountNumber(context.Context, *AccountNumberRequest) (*AccountNumberResponse, error)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(context.Context, *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error)
}
@ -637,6 +747,9 @@ func (*UnimplementedQueryServer) Schema(ctx context.Context, req *SchemaRequest)
func (*UnimplementedQueryServer) AccountType(ctx context.Context, req *AccountTypeRequest) (*AccountTypeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AccountType not implemented")
}
func (*UnimplementedQueryServer) AccountNumber(ctx context.Context, req *AccountNumberRequest) (*AccountNumberResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AccountNumber not implemented")
}
func (*UnimplementedQueryServer) SimulateUserOperation(ctx context.Context, req *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SimulateUserOperation not implemented")
}
@ -699,6 +812,24 @@ func _Query_AccountType_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _Query_AccountNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AccountNumberRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).AccountNumber(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.accounts.v1.Query/AccountNumber",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).AccountNumber(ctx, req.(*AccountNumberRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_SimulateUserOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SimulateUserOperationRequest)
if err := dec(in); err != nil {
@ -733,6 +864,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "AccountType",
Handler: _Query_AccountType_Handler,
},
{
MethodName: "AccountNumber",
Handler: _Query_AccountNumber_Handler,
},
{
MethodName: "SimulateUserOperation",
Handler: _Query_SimulateUserOperation_Handler,
@ -1009,6 +1144,64 @@ func (m *AccountTypeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *AccountNumberRequest) 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 *AccountNumberRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AccountNumberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *AccountNumberResponse) 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 *AccountNumberResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AccountNumberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Number != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Number))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *SimulateUserOperationRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -1208,6 +1401,31 @@ func (m *AccountTypeResponse) Size() (n int) {
return n
}
func (m *AccountNumberRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Address)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *AccountNumberResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Number != 0 {
n += 1 + sovQuery(uint64(m.Number))
}
return n
}
func (m *SimulateUserOperationRequest) Size() (n int) {
if m == nil {
return 0
@ -1962,6 +2180,157 @@ func (m *AccountTypeResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *AccountNumberRequest) 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: AccountNumberRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: AccountNumberRequest: 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 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.Address = 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 *AccountNumberResponse) 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: AccountNumberResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: AccountNumberResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType)
}
m.Number = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Number |= 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 *SimulateUserOperationRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0