feat: Add tx encode and decode endpoints (#13789)
* add grpc endpoint for encoding proto tx's
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,14 @@ type ServiceClient interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.45.2
|
||||
GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxsRequest, opts ...grpc.CallOption) (*GetBlockWithTxsResponse, error)
|
||||
// TxDecode decodes the transaction.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
TxDecode(ctx context.Context, in *TxDecodeRequest, opts ...grpc.CallOption) (*TxDecodeResponse, error)
|
||||
// TxEncode encodes the transaction.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
TxEncode(ctx context.Context, in *TxEncodeRequest, opts ...grpc.CallOption) (*TxEncodeResponse, error)
|
||||
}
|
||||
|
||||
type serviceClient struct {
|
||||
@@ -89,6 +97,24 @@ func (c *serviceClient) GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxs
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serviceClient) TxDecode(ctx context.Context, in *TxDecodeRequest, opts ...grpc.CallOption) (*TxDecodeResponse, error) {
|
||||
out := new(TxDecodeResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/TxDecode", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serviceClient) TxEncode(ctx context.Context, in *TxEncodeRequest, opts ...grpc.CallOption) (*TxEncodeResponse, error) {
|
||||
out := new(TxEncodeResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/TxEncode", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ServiceServer is the server API for Service service.
|
||||
// All implementations must embed UnimplementedServiceServer
|
||||
// for forward compatibility
|
||||
@@ -105,6 +131,14 @@ type ServiceServer interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.45.2
|
||||
GetBlockWithTxs(context.Context, *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error)
|
||||
// TxDecode decodes the transaction.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
TxDecode(context.Context, *TxDecodeRequest) (*TxDecodeResponse, error)
|
||||
// TxEncode encodes the transaction.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
TxEncode(context.Context, *TxEncodeRequest) (*TxEncodeResponse, error)
|
||||
mustEmbedUnimplementedServiceServer()
|
||||
}
|
||||
|
||||
@@ -127,6 +161,12 @@ func (UnimplementedServiceServer) GetTxsEvent(context.Context, *GetTxsEventReque
|
||||
func (UnimplementedServiceServer) GetBlockWithTxs(context.Context, *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetBlockWithTxs not implemented")
|
||||
}
|
||||
func (UnimplementedServiceServer) TxDecode(context.Context, *TxDecodeRequest) (*TxDecodeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method TxDecode not implemented")
|
||||
}
|
||||
func (UnimplementedServiceServer) TxEncode(context.Context, *TxEncodeRequest) (*TxEncodeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method TxEncode not implemented")
|
||||
}
|
||||
func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {}
|
||||
|
||||
// UnsafeServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
@@ -230,6 +270,42 @@ func _Service_GetBlockWithTxs_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Service_TxDecode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TxDecodeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ServiceServer).TxDecode(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.tx.v1beta1.Service/TxDecode",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ServiceServer).TxDecode(ctx, req.(*TxDecodeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Service_TxEncode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TxEncodeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ServiceServer).TxEncode(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.tx.v1beta1.Service/TxEncode",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ServiceServer).TxEncode(ctx, req.(*TxEncodeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Service_ServiceDesc is the grpc.ServiceDesc for Service service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -257,6 +333,14 @@ var Service_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GetBlockWithTxs",
|
||||
Handler: _Service_GetBlockWithTxs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "TxDecode",
|
||||
Handler: _Service_TxDecode_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "TxEncode",
|
||||
Handler: _Service_TxEncode_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/tx/v1beta1/service.proto",
|
||||
|
||||
Reference in New Issue
Block a user