* add grpc endpoint for encoding proto tx's (cherry picked from commit bcff22a3767b9c5dd7d1d562aece90cf72e05e85) Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
This commit is contained in:
parent
bd6628846d
commit
e253968c6f
|
@ -58,6 +58,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
||||||
|
* [13789](https://github.com/cosmos/cosmos-sdk/pull/13789) Add tx `encode` and `decode` endpoints to tx service.
|
||||||
|
> Note: This endpoint will only encode proto messages, Amino encoding is not supported.
|
||||||
* [#13826](https://github.com/cosmos/cosmos-sdk/pull/13826) Support custom `GasConfig` configuration for applications.
|
* [#13826](https://github.com/cosmos/cosmos-sdk/pull/13826) Support custom `GasConfig` configuration for applications.
|
||||||
* [#13619](https://github.com/cosmos/cosmos-sdk/pull/13619) Add new function called LogDeferred to report errors in defers. Use the function in x/bank files.
|
* [#13619](https://github.com/cosmos/cosmos-sdk/pull/13619) Add new function called LogDeferred to report errors in defers. Use the function in x/bank files.
|
||||||
* (tools) [#13603](https://github.com/cosmos/cosmos-sdk/pull/13603) Rename cosmovisor package name to `cosmossdk.io/tools/cosmovisor`. The new tool directory contains Cosmos SDK tools.
|
* (tools) [#13603](https://github.com/cosmos/cosmos-sdk/pull/13603) Rename cosmovisor package name to `cosmossdk.io/tools/cosmovisor`. The new tool directory contains Cosmos SDK tools.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -34,6 +34,14 @@ type ServiceClient interface {
|
||||||
//
|
//
|
||||||
// Since: cosmos-sdk 0.45.2
|
// Since: cosmos-sdk 0.45.2
|
||||||
GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxsRequest, opts ...grpc.CallOption) (*GetBlockWithTxsResponse, error)
|
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 {
|
type serviceClient struct {
|
||||||
|
@ -89,6 +97,24 @@ func (c *serviceClient) GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxs
|
||||||
return out, nil
|
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.
|
// ServiceServer is the server API for Service service.
|
||||||
// All implementations must embed UnimplementedServiceServer
|
// All implementations must embed UnimplementedServiceServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
|
@ -105,6 +131,14 @@ type ServiceServer interface {
|
||||||
//
|
//
|
||||||
// Since: cosmos-sdk 0.45.2
|
// Since: cosmos-sdk 0.45.2
|
||||||
GetBlockWithTxs(context.Context, *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error)
|
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()
|
mustEmbedUnimplementedServiceServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +161,12 @@ func (UnimplementedServiceServer) GetTxsEvent(context.Context, *GetTxsEventReque
|
||||||
func (UnimplementedServiceServer) GetBlockWithTxs(context.Context, *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error) {
|
func (UnimplementedServiceServer) GetBlockWithTxs(context.Context, *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetBlockWithTxs not implemented")
|
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() {}
|
func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {}
|
||||||
|
|
||||||
// UnsafeServiceServer may be embedded to opt out of forward compatibility for this service.
|
// 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)
|
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.
|
// Service_ServiceDesc is the grpc.ServiceDesc for Service service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
@ -257,6 +333,14 @@ var Service_ServiceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "GetBlockWithTxs",
|
MethodName: "GetBlockWithTxs",
|
||||||
Handler: _Service_GetBlockWithTxs_Handler,
|
Handler: _Service_GetBlockWithTxs_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "TxDecode",
|
||||||
|
Handler: _Service_TxDecode_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "TxEncode",
|
||||||
|
Handler: _Service_TxEncode_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "cosmos/tx/v1beta1/service.proto",
|
Metadata: "cosmos/tx/v1beta1/service.proto",
|
||||||
|
|
|
@ -40,6 +40,24 @@ service Service {
|
||||||
rpc GetBlockWithTxs(GetBlockWithTxsRequest) returns (GetBlockWithTxsResponse) {
|
rpc GetBlockWithTxs(GetBlockWithTxsRequest) returns (GetBlockWithTxsResponse) {
|
||||||
option (google.api.http).get = "/cosmos/tx/v1beta1/txs/block/{height}";
|
option (google.api.http).get = "/cosmos/tx/v1beta1/txs/block/{height}";
|
||||||
}
|
}
|
||||||
|
// TxDecode decodes the transaction.
|
||||||
|
//
|
||||||
|
// Since: cosmos-sdk 0.47
|
||||||
|
rpc TxDecode(TxDecodeRequest) returns (TxDecodeResponse) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/cosmos/tx/v1beta1/decode"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// TxEncode encodes the transaction.
|
||||||
|
//
|
||||||
|
// Since: cosmos-sdk 0.47
|
||||||
|
rpc TxEncode(TxEncodeRequest) returns (TxEncodeResponse) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/cosmos/tx/v1beta1/encode"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTxsEventRequest is the request type for the Service.TxsByEvents
|
// GetTxsEventRequest is the request type for the Service.TxsByEvents
|
||||||
|
@ -170,4 +188,40 @@ message GetBlockWithTxsResponse {
|
||||||
.tendermint.types.Block block = 3;
|
.tendermint.types.Block block = 3;
|
||||||
// pagination defines a pagination for the response.
|
// pagination defines a pagination for the response.
|
||||||
cosmos.base.query.v1beta1.PageResponse pagination = 4;
|
cosmos.base.query.v1beta1.PageResponse pagination = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TxDecodeRequest is the request type for the Service.TxDecode
|
||||||
|
// RPC method.
|
||||||
|
//
|
||||||
|
// Since: cosmos-sdk 0.47
|
||||||
|
message TxDecodeRequest {
|
||||||
|
// tx_bytes is the raw transaction.
|
||||||
|
bytes tx_bytes = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TxDecodeResponse is the response type for the
|
||||||
|
// Service.TxDecode method.
|
||||||
|
//
|
||||||
|
// Since: cosmos-sdk 0.47
|
||||||
|
message TxDecodeResponse {
|
||||||
|
// tx is the decoded transaction.
|
||||||
|
cosmos.tx.v1beta1.Tx tx = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TxEncodeResponse is the request type for the Service.TxEncode
|
||||||
|
// RPC method.
|
||||||
|
//
|
||||||
|
// Since: cosmos-sdk 0.47
|
||||||
|
message TxEncodeRequest {
|
||||||
|
// tx is the transaction to encode.
|
||||||
|
cosmos.tx.v1beta1.Tx tx = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TxEncodeResponse is the response type for the
|
||||||
|
// Service.TxEncode method.
|
||||||
|
//
|
||||||
|
// Since: cosmos-sdk 0.47
|
||||||
|
message TxEncodeResponse {
|
||||||
|
// tx_bytes is the encoded transaction bytes.
|
||||||
|
bytes tx_bytes = 1;
|
||||||
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"cosmossdk.io/simapp"
|
"cosmossdk.io/simapp"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||||
clienttx "github.com/cosmos/cosmos-sdk/client/tx"
|
clienttx "github.com/cosmos/cosmos-sdk/client/tx"
|
||||||
|
@ -770,6 +771,143 @@ func (s IntegrationTestSuite) TestGetBlockWithTxs_GRPCGateway() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s IntegrationTestSuite) TestTxEncode_GRPC() {
|
||||||
|
txBuilder := s.mkTxBuilder()
|
||||||
|
protoTx, err := txBuilderToProtoTx(txBuilder)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
name string
|
||||||
|
req *tx.TxEncodeRequest
|
||||||
|
expErr bool
|
||||||
|
expErrMsg string
|
||||||
|
}{
|
||||||
|
{"nil request", nil, true, "request cannot be nil"},
|
||||||
|
{"empty request", &tx.TxEncodeRequest{}, true, "invalid empty tx"},
|
||||||
|
{"valid request with tx bytes", &tx.TxEncodeRequest{Tx: protoTx}, false, ""},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
tc := tc
|
||||||
|
s.Run(tc.name, func() {
|
||||||
|
res, err := s.queryClient.TxEncode(context.Background(), tc.req)
|
||||||
|
if tc.expErr {
|
||||||
|
s.Require().Error(err)
|
||||||
|
s.Require().Contains(err.Error(), tc.expErrMsg)
|
||||||
|
s.Require().Empty(res)
|
||||||
|
} else {
|
||||||
|
s.Require().NoError(err)
|
||||||
|
s.Require().NotEmpty(res.GetTxBytes())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *IntegrationTestSuite) TestTxEncode_GRPCGateway() {
|
||||||
|
val := s.network.Validators[0]
|
||||||
|
txBuilder := s.mkTxBuilder()
|
||||||
|
protoTx, err := txBuilderToProtoTx(txBuilder)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
name string
|
||||||
|
req *tx.TxEncodeRequest
|
||||||
|
expErr bool
|
||||||
|
expErrMsg string
|
||||||
|
}{
|
||||||
|
{"empty request", &tx.TxEncodeRequest{}, true, "invalid empty tx"},
|
||||||
|
{"valid request with tx bytes", &tx.TxEncodeRequest{Tx: protoTx}, false, ""},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
s.Run(tc.name, func() {
|
||||||
|
req, err := val.ClientCtx.Codec.MarshalJSON(tc.req)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
res, err := testutil.PostRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/encode", val.APIAddress), "application/json", req)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
if tc.expErr {
|
||||||
|
s.Require().Contains(string(res), tc.expErrMsg)
|
||||||
|
} else {
|
||||||
|
s.Require().NoError(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s IntegrationTestSuite) TestTxDecode_GRPC() {
|
||||||
|
val := s.network.Validators[0]
|
||||||
|
txBuilder := s.mkTxBuilder()
|
||||||
|
|
||||||
|
encodedTx, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx())
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
invalidTxBytes := append(encodedTx, byte(0o00))
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
name string
|
||||||
|
req *tx.TxDecodeRequest
|
||||||
|
expErr bool
|
||||||
|
expErrMsg string
|
||||||
|
}{
|
||||||
|
{"nil request", nil, true, "request cannot be nil"},
|
||||||
|
{"empty request", &tx.TxDecodeRequest{}, true, "invalid empty tx bytes"},
|
||||||
|
{"invalid tx bytes", &tx.TxDecodeRequest{TxBytes: invalidTxBytes}, true, "tx parse error"},
|
||||||
|
{"valid request with tx bytes", &tx.TxDecodeRequest{TxBytes: encodedTx}, false, ""},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
tc := tc
|
||||||
|
s.Run(tc.name, func() {
|
||||||
|
res, err := s.queryClient.TxDecode(context.Background(), tc.req)
|
||||||
|
if tc.expErr {
|
||||||
|
s.Require().Error(err)
|
||||||
|
s.Require().Contains(err.Error(), tc.expErrMsg)
|
||||||
|
s.Require().Empty(res)
|
||||||
|
} else {
|
||||||
|
s.Require().NoError(err)
|
||||||
|
s.Require().NotEmpty(res.GetTx())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s IntegrationTestSuite) TestTxDecode_GRPCGateway() {
|
||||||
|
val := s.network.Validators[0]
|
||||||
|
txBuilder := s.mkTxBuilder()
|
||||||
|
|
||||||
|
txBytes, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx())
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
invalidTxBytes := append(txBytes, byte(0o00))
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
name string
|
||||||
|
req *tx.TxDecodeRequest
|
||||||
|
expErr bool
|
||||||
|
expErrMsg string
|
||||||
|
}{
|
||||||
|
{"empty request", &tx.TxDecodeRequest{}, true, "invalid empty tx bytes"},
|
||||||
|
{"invalid tx bytes", &tx.TxDecodeRequest{TxBytes: invalidTxBytes}, true, "tx parse error"},
|
||||||
|
{"valid request with tx_bytes", &tx.TxDecodeRequest{TxBytes: txBytes}, false, ""},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
s.Run(tc.name, func() {
|
||||||
|
req, err := val.ClientCtx.Codec.MarshalJSON(tc.req)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
res, err := testutil.PostRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/decode", val.APIAddress), "application/json", req)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
if tc.expErr {
|
||||||
|
s.Require().Contains(string(res), tc.expErrMsg)
|
||||||
|
} else {
|
||||||
|
s.Require().NoError(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestIntegrationTestSuite(t *testing.T) {
|
func TestIntegrationTestSuite(t *testing.T) {
|
||||||
suite.Run(t, new(IntegrationTestSuite))
|
suite.Run(t, new(IntegrationTestSuite))
|
||||||
}
|
}
|
||||||
|
@ -816,8 +954,8 @@ type protoTxProvider interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// txBuilderToProtoTx converts a txBuilder into a proto tx.Tx.
|
// txBuilderToProtoTx converts a txBuilder into a proto tx.Tx.
|
||||||
// Deprecated: It's only used for testing the deprecated Simulate gRPC endpoint
|
// Deprecated: It's used for testing the deprecated Simulate gRPC endpoint
|
||||||
// using a proto Tx field.
|
// using a proto Tx field and for testing the TxEncode endpoint.
|
||||||
func txBuilderToProtoTx(txBuilder client.TxBuilder) (*tx.Tx, error) { // nolint
|
func txBuilderToProtoTx(txBuilder client.TxBuilder) (*tx.Tx, error) { // nolint
|
||||||
protoProvider, ok := txBuilder.(protoTxProvider)
|
protoProvider, ok := txBuilder.(protoTxProvider)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -714,6 +714,194 @@ func (m *GetBlockWithTxsResponse) GetPagination() *query.PageResponse {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TxDecodeRequest is the request type for the Service.TxDecode
|
||||||
|
// RPC method.
|
||||||
|
type TxDecodeRequest struct {
|
||||||
|
// tx_bytes is the raw transaction.
|
||||||
|
TxBytes []byte `protobuf:"bytes,1,opt,name=tx_bytes,json=txBytes,proto3" json:"tx_bytes,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxDecodeRequest) Reset() { *m = TxDecodeRequest{} }
|
||||||
|
func (m *TxDecodeRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*TxDecodeRequest) ProtoMessage() {}
|
||||||
|
func (*TxDecodeRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_e0b00a618705eca7, []int{10}
|
||||||
|
}
|
||||||
|
func (m *TxDecodeRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *TxDecodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_TxDecodeRequest.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 *TxDecodeRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_TxDecodeRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *TxDecodeRequest) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *TxDecodeRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_TxDecodeRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_TxDecodeRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *TxDecodeRequest) GetTxBytes() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.TxBytes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TxDecodeResponse is the response type for the
|
||||||
|
// Service.TxDecode method.
|
||||||
|
type TxDecodeResponse struct {
|
||||||
|
// tx is the decoded transaction.
|
||||||
|
Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxDecodeResponse) Reset() { *m = TxDecodeResponse{} }
|
||||||
|
func (m *TxDecodeResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*TxDecodeResponse) ProtoMessage() {}
|
||||||
|
func (*TxDecodeResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_e0b00a618705eca7, []int{11}
|
||||||
|
}
|
||||||
|
func (m *TxDecodeResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *TxDecodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_TxDecodeResponse.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 *TxDecodeResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_TxDecodeResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *TxDecodeResponse) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *TxDecodeResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_TxDecodeResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_TxDecodeResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *TxDecodeResponse) GetTx() *Tx {
|
||||||
|
if m != nil {
|
||||||
|
return m.Tx
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TxEncodeResponse is the request type for the Service.TxEncode
|
||||||
|
// RPC method.
|
||||||
|
type TxEncodeRequest struct {
|
||||||
|
// tx is the transaction to encode.
|
||||||
|
Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxEncodeRequest) Reset() { *m = TxEncodeRequest{} }
|
||||||
|
func (m *TxEncodeRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*TxEncodeRequest) ProtoMessage() {}
|
||||||
|
func (*TxEncodeRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_e0b00a618705eca7, []int{12}
|
||||||
|
}
|
||||||
|
func (m *TxEncodeRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *TxEncodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_TxEncodeRequest.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 *TxEncodeRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_TxEncodeRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *TxEncodeRequest) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *TxEncodeRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_TxEncodeRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_TxEncodeRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *TxEncodeRequest) GetTx() *Tx {
|
||||||
|
if m != nil {
|
||||||
|
return m.Tx
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TxEncodeResponse is the response type for the
|
||||||
|
// Service.TxEncode method.
|
||||||
|
type TxEncodeResponse struct {
|
||||||
|
// tx_bytes is the encoded transaction bytes.
|
||||||
|
TxBytes []byte `protobuf:"bytes,1,opt,name=tx_bytes,json=txBytes,proto3" json:"tx_bytes,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxEncodeResponse) Reset() { *m = TxEncodeResponse{} }
|
||||||
|
func (m *TxEncodeResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*TxEncodeResponse) ProtoMessage() {}
|
||||||
|
func (*TxEncodeResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_e0b00a618705eca7, []int{13}
|
||||||
|
}
|
||||||
|
func (m *TxEncodeResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *TxEncodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_TxEncodeResponse.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 *TxEncodeResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_TxEncodeResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *TxEncodeResponse) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *TxEncodeResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_TxEncodeResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_TxEncodeResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *TxEncodeResponse) GetTxBytes() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.TxBytes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterEnum("cosmos.tx.v1beta1.OrderBy", OrderBy_name, OrderBy_value)
|
proto.RegisterEnum("cosmos.tx.v1beta1.OrderBy", OrderBy_name, OrderBy_value)
|
||||||
proto.RegisterEnum("cosmos.tx.v1beta1.BroadcastMode", BroadcastMode_name, BroadcastMode_value)
|
proto.RegisterEnum("cosmos.tx.v1beta1.BroadcastMode", BroadcastMode_name, BroadcastMode_value)
|
||||||
|
@ -727,6 +915,10 @@ func init() {
|
||||||
proto.RegisterType((*GetTxResponse)(nil), "cosmos.tx.v1beta1.GetTxResponse")
|
proto.RegisterType((*GetTxResponse)(nil), "cosmos.tx.v1beta1.GetTxResponse")
|
||||||
proto.RegisterType((*GetBlockWithTxsRequest)(nil), "cosmos.tx.v1beta1.GetBlockWithTxsRequest")
|
proto.RegisterType((*GetBlockWithTxsRequest)(nil), "cosmos.tx.v1beta1.GetBlockWithTxsRequest")
|
||||||
proto.RegisterType((*GetBlockWithTxsResponse)(nil), "cosmos.tx.v1beta1.GetBlockWithTxsResponse")
|
proto.RegisterType((*GetBlockWithTxsResponse)(nil), "cosmos.tx.v1beta1.GetBlockWithTxsResponse")
|
||||||
|
proto.RegisterType((*TxDecodeRequest)(nil), "cosmos.tx.v1beta1.TxDecodeRequest")
|
||||||
|
proto.RegisterType((*TxDecodeResponse)(nil), "cosmos.tx.v1beta1.TxDecodeResponse")
|
||||||
|
proto.RegisterType((*TxEncodeRequest)(nil), "cosmos.tx.v1beta1.TxEncodeRequest")
|
||||||
|
proto.RegisterType((*TxEncodeResponse)(nil), "cosmos.tx.v1beta1.TxEncodeResponse")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) }
|
func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) }
|
||||||
|
@ -823,6 +1015,14 @@ type ServiceClient interface {
|
||||||
//
|
//
|
||||||
// Since: cosmos-sdk 0.45.2
|
// Since: cosmos-sdk 0.45.2
|
||||||
GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxsRequest, opts ...grpc.CallOption) (*GetBlockWithTxsResponse, error)
|
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 {
|
type serviceClient struct {
|
||||||
|
@ -878,6 +1078,24 @@ func (c *serviceClient) GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxs
|
||||||
return out, nil
|
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.
|
// ServiceServer is the server API for Service service.
|
||||||
type ServiceServer interface {
|
type ServiceServer interface {
|
||||||
// Simulate simulates executing a transaction for estimating gas usage.
|
// Simulate simulates executing a transaction for estimating gas usage.
|
||||||
|
@ -892,6 +1110,14 @@ type ServiceServer interface {
|
||||||
//
|
//
|
||||||
// Since: cosmos-sdk 0.45.2
|
// Since: cosmos-sdk 0.45.2
|
||||||
GetBlockWithTxs(context.Context, *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error)
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
|
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
|
||||||
|
@ -913,6 +1139,12 @@ func (*UnimplementedServiceServer) GetTxsEvent(ctx context.Context, req *GetTxsE
|
||||||
func (*UnimplementedServiceServer) GetBlockWithTxs(ctx context.Context, req *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error) {
|
func (*UnimplementedServiceServer) GetBlockWithTxs(ctx context.Context, req *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetBlockWithTxs not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetBlockWithTxs not implemented")
|
||||||
}
|
}
|
||||||
|
func (*UnimplementedServiceServer) TxDecode(ctx context.Context, req *TxDecodeRequest) (*TxDecodeResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method TxDecode not implemented")
|
||||||
|
}
|
||||||
|
func (*UnimplementedServiceServer) TxEncode(ctx context.Context, req *TxEncodeRequest) (*TxEncodeResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method TxEncode not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
func RegisterServiceServer(s grpc1.Server, srv ServiceServer) {
|
func RegisterServiceServer(s grpc1.Server, srv ServiceServer) {
|
||||||
s.RegisterService(&_Service_serviceDesc, srv)
|
s.RegisterService(&_Service_serviceDesc, srv)
|
||||||
|
@ -1008,6 +1240,42 @@ func _Service_GetBlockWithTxs_Handler(srv interface{}, ctx context.Context, dec
|
||||||
return interceptor(ctx, in, info, handler)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
var _Service_serviceDesc = grpc.ServiceDesc{
|
var _Service_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "cosmos.tx.v1beta1.Service",
|
ServiceName: "cosmos.tx.v1beta1.Service",
|
||||||
HandlerType: (*ServiceServer)(nil),
|
HandlerType: (*ServiceServer)(nil),
|
||||||
|
@ -1032,6 +1300,14 @@ var _Service_serviceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "GetBlockWithTxs",
|
MethodName: "GetBlockWithTxs",
|
||||||
Handler: _Service_GetBlockWithTxs_Handler,
|
Handler: _Service_GetBlockWithTxs_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "TxDecode",
|
||||||
|
Handler: _Service_TxDecode_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "TxEncode",
|
||||||
|
Handler: _Service_TxEncode_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "cosmos/tx/v1beta1/service.proto",
|
Metadata: "cosmos/tx/v1beta1/service.proto",
|
||||||
|
@ -1513,6 +1789,136 @@ func (m *GetBlockWithTxsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *TxDecodeRequest) 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 *TxDecodeRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxDecodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.TxBytes) > 0 {
|
||||||
|
i -= len(m.TxBytes)
|
||||||
|
copy(dAtA[i:], m.TxBytes)
|
||||||
|
i = encodeVarintService(dAtA, i, uint64(len(m.TxBytes)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxDecodeResponse) 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 *TxDecodeResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxDecodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if m.Tx != nil {
|
||||||
|
{
|
||||||
|
size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i -= size
|
||||||
|
i = encodeVarintService(dAtA, i, uint64(size))
|
||||||
|
}
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxEncodeRequest) 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 *TxEncodeRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxEncodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if m.Tx != nil {
|
||||||
|
{
|
||||||
|
size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i -= size
|
||||||
|
i = encodeVarintService(dAtA, i, uint64(size))
|
||||||
|
}
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxEncodeResponse) 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 *TxEncodeResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxEncodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.TxBytes) > 0 {
|
||||||
|
i -= len(m.TxBytes)
|
||||||
|
copy(dAtA[i:], m.TxBytes)
|
||||||
|
i = encodeVarintService(dAtA, i, uint64(len(m.TxBytes)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
func encodeVarintService(dAtA []byte, offset int, v uint64) int {
|
func encodeVarintService(dAtA []byte, offset int, v uint64) int {
|
||||||
offset -= sovService(v)
|
offset -= sovService(v)
|
||||||
base := offset
|
base := offset
|
||||||
|
@ -1716,6 +2122,58 @@ func (m *GetBlockWithTxsResponse) Size() (n int) {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *TxDecodeRequest) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.TxBytes)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxDecodeResponse) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if m.Tx != nil {
|
||||||
|
l = m.Tx.Size()
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxEncodeRequest) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if m.Tx != nil {
|
||||||
|
l = m.Tx.Size()
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxEncodeResponse) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.TxBytes)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
func sovService(x uint64) (n int) {
|
func sovService(x uint64) (n int) {
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
return (math_bits.Len64(x|1) + 6) / 7
|
||||||
}
|
}
|
||||||
|
@ -3002,6 +3460,346 @@ func (m *GetBlockWithTxsResponse) Unmarshal(dAtA []byte) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (m *TxDecodeRequest) 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 ErrIntOverflowService
|
||||||
|
}
|
||||||
|
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: TxDecodeRequest: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: TxDecodeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field TxBytes", wireType)
|
||||||
|
}
|
||||||
|
var byteLen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowService
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
byteLen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if byteLen < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + byteLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.TxBytes = append(m.TxBytes[:0], dAtA[iNdEx:postIndex]...)
|
||||||
|
if m.TxBytes == nil {
|
||||||
|
m.TxBytes = []byte{}
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipService(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *TxDecodeResponse) 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 ErrIntOverflowService
|
||||||
|
}
|
||||||
|
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: TxDecodeResponse: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: TxDecodeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowService
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
if m.Tx == nil {
|
||||||
|
m.Tx = &Tx{}
|
||||||
|
}
|
||||||
|
if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipService(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *TxEncodeRequest) 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 ErrIntOverflowService
|
||||||
|
}
|
||||||
|
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: TxEncodeRequest: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: TxEncodeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowService
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
if m.Tx == nil {
|
||||||
|
m.Tx = &Tx{}
|
||||||
|
}
|
||||||
|
if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipService(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *TxEncodeResponse) 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 ErrIntOverflowService
|
||||||
|
}
|
||||||
|
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: TxEncodeResponse: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: TxEncodeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field TxBytes", wireType)
|
||||||
|
}
|
||||||
|
var byteLen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowService
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
byteLen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if byteLen < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + byteLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.TxBytes = append(m.TxBytes[:0], dAtA[iNdEx:postIndex]...)
|
||||||
|
if m.TxBytes == nil {
|
||||||
|
m.TxBytes = []byte{}
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipService(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func skipService(dAtA []byte) (n int, err error) {
|
func skipService(dAtA []byte) (n int, err error) {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
|
|
@ -263,6 +263,74 @@ func local_request_Service_GetBlockWithTxs_0(ctx context.Context, marshaler runt
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func request_Service_TxDecode_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq TxDecodeRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||||
|
if berr != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||||
|
}
|
||||||
|
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := client.TxDecode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_Service_TxDecode_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq TxDecodeRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||||
|
if berr != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||||
|
}
|
||||||
|
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := server.TxDecode(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func request_Service_TxEncode_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq TxEncodeRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||||
|
if berr != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||||
|
}
|
||||||
|
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := client.TxEncode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_Service_TxEncode_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq TxEncodeRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||||
|
if berr != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||||
|
}
|
||||||
|
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := server.TxEncode(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterServiceHandlerServer registers the http handlers for service Service to "mux".
|
// RegisterServiceHandlerServer registers the http handlers for service Service to "mux".
|
||||||
// UnaryRPC :call ServiceServer directly.
|
// UnaryRPC :call ServiceServer directly.
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||||
|
@ -384,6 +452,52 @@ func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, se
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("POST", pattern_Service_TxDecode_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_Service_TxDecode_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_Service_TxDecode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
mux.Handle("POST", pattern_Service_TxEncode_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_Service_TxEncode_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_Service_TxEncode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,6 +639,46 @@ func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("POST", pattern_Service_TxDecode_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_Service_TxDecode_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_Service_TxDecode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
mux.Handle("POST", pattern_Service_TxEncode_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_Service_TxEncode_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_Service_TxEncode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,6 +692,10 @@ var (
|
||||||
pattern_Service_GetTxsEvent_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "txs"}, "", runtime.AssumeColonVerbOpt(false)))
|
pattern_Service_GetTxsEvent_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "txs"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||||
|
|
||||||
pattern_Service_GetBlockWithTxs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "tx", "v1beta1", "txs", "block", "height"}, "", runtime.AssumeColonVerbOpt(false)))
|
pattern_Service_GetBlockWithTxs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "tx", "v1beta1", "txs", "block", "height"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||||
|
|
||||||
|
pattern_Service_TxDecode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "decode"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||||
|
|
||||||
|
pattern_Service_TxEncode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "encode"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -550,4 +708,8 @@ var (
|
||||||
forward_Service_GetTxsEvent_0 = runtime.ForwardResponseMessage
|
forward_Service_GetTxsEvent_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
forward_Service_GetBlockWithTxs_0 = runtime.ForwardResponseMessage
|
forward_Service_GetBlockWithTxs_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
|
forward_Service_TxDecode_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
|
forward_Service_TxEncode_0 = runtime.ForwardResponseMessage
|
||||||
)
|
)
|
||||||
|
|
|
@ -248,10 +248,50 @@ func (s txServer) GetBlockWithTxs(ctx context.Context, req *txtypes.GetBlockWith
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BroadcastTx implements the ServiceServer.BroadcastTx RPC method.
|
||||||
func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxRequest) (*txtypes.BroadcastTxResponse, error) {
|
func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxRequest) (*txtypes.BroadcastTxResponse, error) {
|
||||||
return client.TxServiceBroadcast(ctx, s.clientCtx, req)
|
return client.TxServiceBroadcast(ctx, s.clientCtx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TxEncode implements the ServiceServer.TxEncode RPC method.
|
||||||
|
func (s txServer) TxEncode(ctx context.Context, req *txtypes.TxEncodeRequest) (*txtypes.TxEncodeResponse, error) {
|
||||||
|
if req.Tx == nil {
|
||||||
|
return nil, status.Error(codes.InvalidArgument, "invalid empty tx")
|
||||||
|
}
|
||||||
|
|
||||||
|
txBuilder := &wrapper{tx: req.Tx}
|
||||||
|
|
||||||
|
encodedBytes, err := s.clientCtx.TxConfig.TxEncoder()(txBuilder)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &txtypes.TxEncodeResponse{
|
||||||
|
TxBytes: encodedBytes,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TxDecode implements the ServiceServer.TxDecode RPC method.
|
||||||
|
func (s txServer) TxDecode(ctx context.Context, req *txtypes.TxDecodeRequest) (*txtypes.TxDecodeResponse, error) {
|
||||||
|
if req.TxBytes == nil {
|
||||||
|
return nil, status.Error(codes.InvalidArgument, "invalid empty tx bytes")
|
||||||
|
}
|
||||||
|
|
||||||
|
txb, err := s.clientCtx.TxConfig.TxDecoder()(req.TxBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
txWrapper, ok := txb.(*wrapper)
|
||||||
|
if ok {
|
||||||
|
return &txtypes.TxDecodeResponse{
|
||||||
|
Tx: txWrapper.tx,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, txb)
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterTxService registers the tx service on the gRPC router.
|
// RegisterTxService registers the tx service on the gRPC router.
|
||||||
func RegisterTxService(
|
func RegisterTxService(
|
||||||
qrt gogogrpc.Server,
|
qrt gogogrpc.Server,
|
||||||
|
|
Loading…
Reference in New Issue