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 18:23:41 +00:00
committed by GitHub
co-authored by unknown unknown Marko Facundo Medica
parent 6ffc209043
commit e1f478da41
6 changed files with 1527 additions and 138 deletions
File diff suppressed because it is too large Load Diff
+39
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,