feat(accounts): Add Query to simulate a UserOperation (#18979)

Co-authored-by: unknown unknown <unknown@unknown>
This commit is contained in:
testinginprod
2024-01-09 14:02:43 +00:00
committed by GitHub
co-authored by unknown unknown
parent 7ecdbd0814
commit f431a5039c
6 changed files with 1797 additions and 130 deletions
File diff suppressed because it is too large Load Diff
+42 -3
View File
@@ -19,9 +19,10 @@ import (
const _ = grpc.SupportPackageIsVersion7
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_AccountQuery_FullMethodName = "/cosmos.accounts.v1.Query/AccountQuery"
Query_Schema_FullMethodName = "/cosmos.accounts.v1.Query/Schema"
Query_AccountType_FullMethodName = "/cosmos.accounts.v1.Query/AccountType"
Query_SimulateUserOperation_FullMethodName = "/cosmos.accounts.v1.Query/SimulateUserOperation"
)
// QueryClient is the client API for Query service.
@@ -34,6 +35,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)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(ctx context.Context, in *SimulateUserOperationRequest, opts ...grpc.CallOption) (*SimulateUserOperationResponse, error)
}
type queryClient struct {
@@ -71,6 +74,15 @@ func (c *queryClient) AccountType(ctx context.Context, in *AccountTypeRequest, o
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...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
@@ -81,6 +93,8 @@ type QueryServer interface {
Schema(context.Context, *SchemaRequest) (*SchemaResponse, error)
// AccountType returns the account type for an address.
AccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(context.Context, *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error)
mustEmbedUnimplementedQueryServer()
}
@@ -97,6 +111,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) SimulateUserOperation(context.Context, *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SimulateUserOperation not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
@@ -164,6 +181,24 @@ func _Query_AccountType_Handler(srv interface{}, ctx context.Context, dec func(i
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 {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).SimulateUserOperation(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_SimulateUserOperation_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).SimulateUserOperation(ctx, req.(*SimulateUserOperationRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -183,6 +218,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "AccountType",
Handler: _Query_AccountType_Handler,
},
{
MethodName: "SimulateUserOperation",
Handler: _Query_SimulateUserOperation_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/accounts/v1/query.proto",