Add TxsByEvent gRPC endpoint (#7842)
* add service definition for TxsByEvents * add TxsByEvent gRPC endpoint * fix lint * fix test * review changes * review changes * fix proto descriptions * review changes * fix lint * review changes * Update proto/cosmos/tx/v1beta1/service.proto * review changes Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
c8afb2cbe7
commit
f3e4964f2f
|
@ -4,6 +4,7 @@ package cosmos.tx.v1beta1;
|
||||||
import "google/api/annotations.proto";
|
import "google/api/annotations.proto";
|
||||||
import "cosmos/base/abci/v1beta1/abci.proto";
|
import "cosmos/base/abci/v1beta1/abci.proto";
|
||||||
import "cosmos/tx/v1beta1/tx.proto";
|
import "cosmos/tx/v1beta1/tx.proto";
|
||||||
|
import "cosmos/base/query/v1beta1/pagination.proto";
|
||||||
|
|
||||||
option go_package = "github.com/cosmos/cosmos-sdk/types/tx";
|
option go_package = "github.com/cosmos/cosmos-sdk/types/tx";
|
||||||
|
|
||||||
|
@ -17,6 +18,31 @@ service Service {
|
||||||
rpc GetTx(GetTxRequest) returns (GetTxResponse) {
|
rpc GetTx(GetTxRequest) returns (GetTxResponse) {
|
||||||
option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}";
|
option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTxsEvent fetches txs by event.
|
||||||
|
rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) {
|
||||||
|
option (google.api.http).get = "/cosmos/tx/v1beta1/txs";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxsEventRequest is the request type for the Service.TxsByEvents
|
||||||
|
// RPC method.
|
||||||
|
message GetTxsEventRequest {
|
||||||
|
// event is the transaction event type.
|
||||||
|
string event = 1;
|
||||||
|
// pagination defines an pagination for the request.
|
||||||
|
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxsEventResponse is the response type for the Service.TxsByEvents
|
||||||
|
// RPC method.
|
||||||
|
message GetTxsEventResponse {
|
||||||
|
// txs is the list of queried transactions.
|
||||||
|
repeated cosmos.tx.v1beta1.Tx txs = 1;
|
||||||
|
// tx_responses is the list of queried TxResponses.
|
||||||
|
repeated cosmos.base.abci.v1beta1.TxResponse tx_responses = 2;
|
||||||
|
// pagination defines an pagination for the response.
|
||||||
|
cosmos.base.query.v1beta1.PageResponse pagination = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SimulateRequest is the request type for the Service.Simulate
|
// SimulateRequest is the request type for the Service.Simulate
|
||||||
|
@ -35,15 +61,17 @@ message SimulateResponse {
|
||||||
cosmos.base.abci.v1beta1.Result result = 2;
|
cosmos.base.abci.v1beta1.Result result = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTx is the request type for the Service.GetTx
|
// GetTxRequest is the request type for the Service.GetTx
|
||||||
// RPC method.
|
// RPC method.
|
||||||
message GetTxRequest {
|
message GetTxRequest {
|
||||||
// hash is the tx hash to query, encoded as a hex string.
|
// hash is the tx hash to query, encoded as a hex string.
|
||||||
string hash = 1;
|
string hash = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTxResponse is the response type for the Service.GetTx method.
|
// GetTxResponse is the response type for the Service.GetTx method.
|
||||||
message GetTxResponse {
|
message GetTxResponse {
|
||||||
// tx is the queried transaction.
|
// tx is the queried transaction.
|
||||||
cosmos.tx.v1beta1.Tx tx = 1;
|
cosmos.tx.v1beta1.Tx tx = 1;
|
||||||
}
|
// tx_response is the queried TxResponses.
|
||||||
|
cosmos.base.abci.v1beta1.TxResponse tx_response = 2;
|
||||||
|
}
|
|
@ -35,7 +35,7 @@ func FilteredPaginate(
|
||||||
}
|
}
|
||||||
|
|
||||||
if limit == 0 {
|
if limit == 0 {
|
||||||
limit = defaultLimit
|
limit = DefaultLimit
|
||||||
|
|
||||||
// count total results when the limit is zero/not supplied
|
// count total results when the limit is zero/not supplied
|
||||||
countTotal = true
|
countTotal = true
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/store/types"
|
"github.com/cosmos/cosmos-sdk/store/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// defaultLimit is the default `limit` for queries
|
// DefaultLimit is the default `limit` for queries
|
||||||
// if the `limit` is not supplied, paginate will use `defaultLimit`
|
// if the `limit` is not supplied, paginate will use `DefaultLimit`
|
||||||
const defaultLimit = 100
|
const DefaultLimit = 100
|
||||||
|
|
||||||
// Paginate does pagination of all the results in the PrefixStore based on the
|
// Paginate does pagination of all the results in the PrefixStore based on the
|
||||||
// provided PageRequest. onResult should be used to do actual unmarshaling.
|
// provided PageRequest. onResult should be used to do actual unmarshaling.
|
||||||
|
@ -33,7 +33,7 @@ func Paginate(
|
||||||
}
|
}
|
||||||
|
|
||||||
if limit == 0 {
|
if limit == 0 {
|
||||||
limit = defaultLimit
|
limit = DefaultLimit
|
||||||
|
|
||||||
// count total results when the limit is zero/not supplied
|
// count total results when the limit is zero/not supplied
|
||||||
countTotal = true
|
countTotal = true
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
context "context"
|
context "context"
|
||||||
fmt "fmt"
|
fmt "fmt"
|
||||||
types "github.com/cosmos/cosmos-sdk/types"
|
types "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
query "github.com/cosmos/cosmos-sdk/types/query"
|
||||||
grpc1 "github.com/gogo/protobuf/grpc"
|
grpc1 "github.com/gogo/protobuf/grpc"
|
||||||
proto "github.com/gogo/protobuf/proto"
|
proto "github.com/gogo/protobuf/proto"
|
||||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||||
|
@ -29,6 +30,127 @@ var _ = math.Inf
|
||||||
// proto package needs to be updated.
|
// proto package needs to be updated.
|
||||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
// GetTxsEventRequest is the request type for the Service.TxsByEvents
|
||||||
|
// RPC method.
|
||||||
|
type GetTxsEventRequest struct {
|
||||||
|
// event is the transaction event type.
|
||||||
|
Event string `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"`
|
||||||
|
// pagination defines an pagination for the request.
|
||||||
|
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventRequest) Reset() { *m = GetTxsEventRequest{} }
|
||||||
|
func (m *GetTxsEventRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetTxsEventRequest) ProtoMessage() {}
|
||||||
|
func (*GetTxsEventRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_e0b00a618705eca7, []int{0}
|
||||||
|
}
|
||||||
|
func (m *GetTxsEventRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *GetTxsEventRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_GetTxsEventRequest.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 *GetTxsEventRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetTxsEventRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *GetTxsEventRequest) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *GetTxsEventRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetTxsEventRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetTxsEventRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetTxsEventRequest) GetEvent() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Event
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventRequest) GetPagination() *query.PageRequest {
|
||||||
|
if m != nil {
|
||||||
|
return m.Pagination
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxsEventResponse is the response type for the Service.TxsByEvents
|
||||||
|
// RPC method.
|
||||||
|
type GetTxsEventResponse struct {
|
||||||
|
// txs is the list of queried transactions.
|
||||||
|
Txs []*Tx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"`
|
||||||
|
// tx_responses is the list of queried TxResponses.
|
||||||
|
TxResponses []*types.TxResponse `protobuf:"bytes,2,rep,name=tx_responses,json=txResponses,proto3" json:"tx_responses,omitempty"`
|
||||||
|
// pagination defines an pagination for the response.
|
||||||
|
Pagination *query.PageResponse `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventResponse) Reset() { *m = GetTxsEventResponse{} }
|
||||||
|
func (m *GetTxsEventResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetTxsEventResponse) ProtoMessage() {}
|
||||||
|
func (*GetTxsEventResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_e0b00a618705eca7, []int{1}
|
||||||
|
}
|
||||||
|
func (m *GetTxsEventResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *GetTxsEventResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_GetTxsEventResponse.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 *GetTxsEventResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetTxsEventResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *GetTxsEventResponse) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *GetTxsEventResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetTxsEventResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetTxsEventResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetTxsEventResponse) GetTxs() []*Tx {
|
||||||
|
if m != nil {
|
||||||
|
return m.Txs
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventResponse) GetTxResponses() []*types.TxResponse {
|
||||||
|
if m != nil {
|
||||||
|
return m.TxResponses
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventResponse) GetPagination() *query.PageResponse {
|
||||||
|
if m != nil {
|
||||||
|
return m.Pagination
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// SimulateRequest is the request type for the Service.Simulate
|
// SimulateRequest is the request type for the Service.Simulate
|
||||||
// RPC method.
|
// RPC method.
|
||||||
type SimulateRequest struct {
|
type SimulateRequest struct {
|
||||||
|
@ -40,7 +162,7 @@ func (m *SimulateRequest) Reset() { *m = SimulateRequest{} }
|
||||||
func (m *SimulateRequest) String() string { return proto.CompactTextString(m) }
|
func (m *SimulateRequest) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SimulateRequest) ProtoMessage() {}
|
func (*SimulateRequest) ProtoMessage() {}
|
||||||
func (*SimulateRequest) Descriptor() ([]byte, []int) {
|
func (*SimulateRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_e0b00a618705eca7, []int{0}
|
return fileDescriptor_e0b00a618705eca7, []int{2}
|
||||||
}
|
}
|
||||||
func (m *SimulateRequest) XXX_Unmarshal(b []byte) error {
|
func (m *SimulateRequest) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -89,7 +211,7 @@ func (m *SimulateResponse) Reset() { *m = SimulateResponse{} }
|
||||||
func (m *SimulateResponse) String() string { return proto.CompactTextString(m) }
|
func (m *SimulateResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SimulateResponse) ProtoMessage() {}
|
func (*SimulateResponse) ProtoMessage() {}
|
||||||
func (*SimulateResponse) Descriptor() ([]byte, []int) {
|
func (*SimulateResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_e0b00a618705eca7, []int{1}
|
return fileDescriptor_e0b00a618705eca7, []int{3}
|
||||||
}
|
}
|
||||||
func (m *SimulateResponse) XXX_Unmarshal(b []byte) error {
|
func (m *SimulateResponse) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -132,7 +254,7 @@ func (m *SimulateResponse) GetResult() *types.Result {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTx is the request type for the Service.GetTx
|
// GetTxRequest is the request type for the Service.GetTx
|
||||||
// RPC method.
|
// RPC method.
|
||||||
type GetTxRequest struct {
|
type GetTxRequest struct {
|
||||||
// hash is the tx hash to query, encoded as a hex string.
|
// hash is the tx hash to query, encoded as a hex string.
|
||||||
|
@ -143,7 +265,7 @@ func (m *GetTxRequest) Reset() { *m = GetTxRequest{} }
|
||||||
func (m *GetTxRequest) String() string { return proto.CompactTextString(m) }
|
func (m *GetTxRequest) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetTxRequest) ProtoMessage() {}
|
func (*GetTxRequest) ProtoMessage() {}
|
||||||
func (*GetTxRequest) Descriptor() ([]byte, []int) {
|
func (*GetTxRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_e0b00a618705eca7, []int{2}
|
return fileDescriptor_e0b00a618705eca7, []int{4}
|
||||||
}
|
}
|
||||||
func (m *GetTxRequest) XXX_Unmarshal(b []byte) error {
|
func (m *GetTxRequest) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -183,13 +305,15 @@ func (m *GetTxRequest) GetHash() string {
|
||||||
type GetTxResponse struct {
|
type GetTxResponse struct {
|
||||||
// tx is the queried transaction.
|
// tx is the queried transaction.
|
||||||
Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
|
Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
|
||||||
|
// tx_response is the queried TxResponses.
|
||||||
|
TxResponse *types.TxResponse `protobuf:"bytes,2,opt,name=tx_response,json=txResponse,proto3" json:"tx_response,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GetTxResponse) Reset() { *m = GetTxResponse{} }
|
func (m *GetTxResponse) Reset() { *m = GetTxResponse{} }
|
||||||
func (m *GetTxResponse) String() string { return proto.CompactTextString(m) }
|
func (m *GetTxResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetTxResponse) ProtoMessage() {}
|
func (*GetTxResponse) ProtoMessage() {}
|
||||||
func (*GetTxResponse) Descriptor() ([]byte, []int) {
|
func (*GetTxResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_e0b00a618705eca7, []int{3}
|
return fileDescriptor_e0b00a618705eca7, []int{5}
|
||||||
}
|
}
|
||||||
func (m *GetTxResponse) XXX_Unmarshal(b []byte) error {
|
func (m *GetTxResponse) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -225,7 +349,16 @@ func (m *GetTxResponse) GetTx() *Tx {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *GetTxResponse) GetTxResponse() *types.TxResponse {
|
||||||
|
if m != nil {
|
||||||
|
return m.TxResponse
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
proto.RegisterType((*GetTxsEventRequest)(nil), "cosmos.tx.v1beta1.GetTxsEventRequest")
|
||||||
|
proto.RegisterType((*GetTxsEventResponse)(nil), "cosmos.tx.v1beta1.GetTxsEventResponse")
|
||||||
proto.RegisterType((*SimulateRequest)(nil), "cosmos.tx.v1beta1.SimulateRequest")
|
proto.RegisterType((*SimulateRequest)(nil), "cosmos.tx.v1beta1.SimulateRequest")
|
||||||
proto.RegisterType((*SimulateResponse)(nil), "cosmos.tx.v1beta1.SimulateResponse")
|
proto.RegisterType((*SimulateResponse)(nil), "cosmos.tx.v1beta1.SimulateResponse")
|
||||||
proto.RegisterType((*GetTxRequest)(nil), "cosmos.tx.v1beta1.GetTxRequest")
|
proto.RegisterType((*GetTxRequest)(nil), "cosmos.tx.v1beta1.GetTxRequest")
|
||||||
|
@ -235,33 +368,43 @@ func init() {
|
||||||
func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) }
|
func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) }
|
||||||
|
|
||||||
var fileDescriptor_e0b00a618705eca7 = []byte{
|
var fileDescriptor_e0b00a618705eca7 = []byte{
|
||||||
// 404 bytes of a gzipped FileDescriptorProto
|
// 563 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x31, 0x6b, 0xdb, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x40,
|
||||||
0x1c, 0xc5, 0x2d, 0xd1, 0xda, 0xee, 0xb5, 0xa5, 0xed, 0x41, 0xc1, 0xa8, 0xae, 0xec, 0x9e, 0x6b,
|
0x10, 0xae, 0x1d, 0xfa, 0xc3, 0xa4, 0x08, 0x58, 0x7e, 0x14, 0x99, 0xe2, 0x06, 0xa7, 0x69, 0x23,
|
||||||
0xe8, 0x52, 0x1d, 0x76, 0xa1, 0x78, 0x08, 0x04, 0xb2, 0x98, 0xac, 0xb2, 0xa7, 0x2c, 0xe1, 0xa4,
|
0x24, 0xbc, 0x6a, 0xb8, 0xf4, 0x80, 0x84, 0x84, 0x54, 0x22, 0x6e, 0xc8, 0xed, 0x89, 0x4b, 0xb5,
|
||||||
0x9c, 0x65, 0x11, 0x5b, 0xa7, 0xf8, 0x4e, 0xe6, 0x42, 0xc8, 0x92, 0x31, 0x53, 0x20, 0x5f, 0x2a,
|
0x09, 0x5b, 0xc7, 0x22, 0xf1, 0xba, 0xde, 0x4d, 0xb4, 0x15, 0xf4, 0xc2, 0x91, 0x13, 0x12, 0x2f,
|
||||||
0xa3, 0x21, 0x4b, 0xc6, 0x60, 0xe7, 0x2b, 0x64, 0x0f, 0x3a, 0x9d, 0x92, 0x10, 0xcb, 0x21, 0x93,
|
0xc5, 0x31, 0x12, 0x17, 0x8e, 0x28, 0xe1, 0x0d, 0x78, 0x01, 0xe4, 0xf5, 0x3a, 0x71, 0xa8, 0x4d,
|
||||||
0x4e, 0xe8, 0xbd, 0xdf, 0xff, 0xbd, 0xd3, 0x1f, 0x34, 0x7c, 0xc6, 0xa7, 0x8c, 0x63, 0x21, 0xf1,
|
0x7b, 0xf2, 0xae, 0xfc, 0xfd, 0xcc, 0x37, 0xe3, 0x31, 0x6c, 0xf7, 0x18, 0x1f, 0x32, 0x8e, 0x85,
|
||||||
0xbc, 0xe3, 0x51, 0x41, 0x3a, 0x98, 0xd3, 0xd9, 0x3c, 0xf4, 0xa9, 0x13, 0xcf, 0x98, 0x60, 0xf0,
|
0xc4, 0xe3, 0xfd, 0x2e, 0x15, 0x64, 0x1f, 0x73, 0x1a, 0x8f, 0x83, 0x1e, 0x75, 0xa3, 0x98, 0x09,
|
||||||
0x5b, 0x26, 0x70, 0x84, 0x74, 0xb4, 0xc0, 0xaa, 0x07, 0x8c, 0x05, 0x13, 0x8a, 0x49, 0x1c, 0x62,
|
0x86, 0xee, 0xa6, 0x00, 0x57, 0x48, 0x57, 0x03, 0xac, 0x2d, 0x9f, 0x31, 0x7f, 0x40, 0x31, 0x89,
|
||||||
0x12, 0x45, 0x4c, 0x10, 0x11, 0xb2, 0x88, 0x67, 0x06, 0xab, 0xa5, 0x89, 0x1e, 0xe1, 0x14, 0x13,
|
0x02, 0x4c, 0xc2, 0x90, 0x09, 0x22, 0x02, 0x16, 0xf2, 0x94, 0x60, 0x35, 0xb4, 0x62, 0x97, 0x70,
|
||||||
0xcf, 0x0f, 0x1f, 0xc1, 0xe9, 0x8b, 0x16, 0x59, 0xeb, 0x63, 0x85, 0xcc, 0xbe, 0xa1, 0x1e, 0xf8,
|
0x8a, 0x49, 0xb7, 0x17, 0xcc, 0x85, 0x93, 0x8b, 0x06, 0x59, 0x97, 0x6d, 0x85, 0xd4, 0xef, 0x9e,
|
||||||
0x32, 0x08, 0xa7, 0xc9, 0x84, 0x08, 0xea, 0xd2, 0xa3, 0x84, 0x72, 0x01, 0xdb, 0xc0, 0x14, 0xb2,
|
0xe6, 0x05, 0xce, 0x46, 0x34, 0x3e, 0x9f, 0x63, 0x22, 0xe2, 0x07, 0xa1, 0x72, 0x4b, 0xb1, 0x4e,
|
||||||
0x66, 0x34, 0x8d, 0x3f, 0x1f, 0xbb, 0xdf, 0x9d, 0xb5, 0x44, 0xce, 0x50, 0xba, 0xa6, 0x90, 0xe8,
|
0x0c, 0xa8, 0x43, 0xc5, 0xb1, 0xe4, 0x87, 0x63, 0x1a, 0x0a, 0x8f, 0x9e, 0x8d, 0x28, 0x17, 0xe8,
|
||||||
0xdc, 0x00, 0x5f, 0x9f, 0xac, 0x3c, 0x66, 0x11, 0xa7, 0x70, 0x0b, 0x54, 0x03, 0xc2, 0xf7, 0xc3,
|
0x3e, 0xac, 0xd2, 0xe4, 0x5e, 0x33, 0xea, 0x46, 0xeb, 0xa6, 0x97, 0x5e, 0xd0, 0x6b, 0x80, 0x05,
|
||||||
0x68, 0xc4, 0x34, 0xe1, 0x57, 0x4e, 0x48, 0x23, 0x3a, 0x2a, 0x55, 0x0e, 0xea, 0x13, 0xbe, 0x1b,
|
0xbf, 0x66, 0xd6, 0x8d, 0x56, 0xb5, 0xbd, 0xeb, 0xea, 0x78, 0x89, 0x99, 0xab, 0xcc, 0xb2, 0x98,
|
||||||
0x8d, 0x98, 0x5b, 0x09, 0xb2, 0x03, 0xec, 0x81, 0xf2, 0x8c, 0xf2, 0x64, 0x22, 0x6a, 0xa6, 0xf2,
|
0xee, 0x5b, 0xe2, 0x53, 0xad, 0xe8, 0xe5, 0x98, 0xce, 0xc4, 0x80, 0x7b, 0x4b, 0xa6, 0x3c, 0x62,
|
||||||
0x36, 0x37, 0x7b, 0x5d, 0xa5, 0x73, 0xb5, 0x1e, 0x21, 0xf0, 0xa9, 0x4f, 0xc5, 0x50, 0xe6, 0x1d,
|
0x21, 0xa7, 0x68, 0x0f, 0x2a, 0x42, 0xf2, 0x9a, 0x51, 0xaf, 0xb4, 0xaa, 0xed, 0x07, 0xee, 0xa5,
|
||||||
0x20, 0x78, 0x37, 0x26, 0x7c, 0xac, 0x32, 0x7c, 0x70, 0xd5, 0x19, 0xfd, 0x07, 0x9f, 0xb5, 0x46,
|
0xbe, 0xb9, 0xc7, 0xd2, 0x4b, 0x10, 0xa8, 0x03, 0x9b, 0x42, 0x9e, 0xc4, 0x9a, 0xc7, 0x6b, 0xa6,
|
||||||
0x87, 0x7d, 0x5b, 0xd1, 0xee, 0xbd, 0x01, 0x2a, 0x83, 0xec, 0x37, 0x41, 0x09, 0xaa, 0x79, 0x67,
|
0x62, 0xec, 0x2c, 0x95, 0xa2, 0x7a, 0x95, 0x23, 0x6a, 0xb0, 0x57, 0x15, 0xf3, 0x73, 0x22, 0x94,
|
||||||
0x88, 0x0a, 0x2c, 0x2f, 0xee, 0xd2, 0x6a, 0xbd, 0xaa, 0xc9, 0x72, 0xa0, 0xd6, 0xd9, 0xf5, 0xdd,
|
0x4f, 0x54, 0x51, 0x89, 0xf6, 0xae, 0x4c, 0xa4, 0x95, 0xf2, 0x91, 0x0e, 0xe0, 0xf6, 0x51, 0x30,
|
||||||
0xa5, 0xf9, 0x13, 0xfd, 0xc0, 0x05, 0xfb, 0x91, 0x4f, 0x8b, 0xc1, 0x7b, 0x95, 0x1e, 0x36, 0x0a,
|
0x1c, 0x0d, 0x88, 0xc8, 0x12, 0xa3, 0x26, 0x98, 0x42, 0xaa, 0x06, 0x96, 0x86, 0x31, 0x85, 0x74,
|
||||||
0x90, 0xcf, 0xbb, 0x5b, 0xcd, 0xcd, 0x02, 0x3d, 0xf0, 0xb7, 0x1a, 0x68, 0xc3, 0x3a, 0x2e, 0xda,
|
0xbe, 0x18, 0x70, 0x67, 0x41, 0xd5, 0x9d, 0x78, 0x01, 0x1b, 0x3e, 0xe1, 0x27, 0x41, 0x78, 0xca,
|
||||||
0x0c, 0x7c, 0x92, 0x5e, 0xd7, 0xe9, 0xce, 0xf6, 0xd5, 0xd2, 0x36, 0x16, 0x4b, 0xdb, 0xb8, 0x5d,
|
0xb4, 0xc2, 0x93, 0xf2, 0x70, 0x1d, 0xc2, 0xdf, 0x84, 0xa7, 0xcc, 0x5b, 0xf7, 0xd3, 0x03, 0x3a,
|
||||||
0xda, 0xc6, 0xc5, 0xca, 0x2e, 0x2d, 0x56, 0x76, 0xe9, 0x66, 0x65, 0x97, 0xf6, 0xda, 0x41, 0x28,
|
0x80, 0xb5, 0x98, 0xf2, 0xd1, 0x40, 0xe8, 0x19, 0xd5, 0xcb, 0xb9, 0x9e, 0xc2, 0x79, 0x1a, 0xef,
|
||||||
0xc6, 0x89, 0xe7, 0xf8, 0x6c, 0x9a, 0x13, 0xb2, 0xc7, 0x5f, 0x7e, 0x70, 0x88, 0xc5, 0x71, 0x4c,
|
0x38, 0xb0, 0xa9, 0x06, 0x93, 0x65, 0x40, 0x70, 0xa3, 0x4f, 0x78, 0x5f, 0x7f, 0x06, 0xea, 0xec,
|
||||||
0x53, 0xa4, 0x57, 0x56, 0x2b, 0xf6, 0xef, 0x21, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x4c, 0x40, 0xff,
|
0x5c, 0xc0, 0x2d, 0x8d, 0xd1, 0xc5, 0x5e, 0x2f, 0x28, 0x3a, 0x84, 0x6a, 0x6e, 0x68, 0xba, 0xb4,
|
||||||
0xf7, 0x02, 0x00, 0x00,
|
0xeb, 0xcd, 0x0c, 0x16, 0x33, 0x6b, 0xff, 0x31, 0x61, 0xfd, 0x28, 0x5d, 0x30, 0x24, 0x61, 0x23,
|
||||||
|
0x6b, 0x1d, 0x72, 0x0a, 0x9c, 0xff, 0x19, 0x89, 0xd5, 0xf8, 0x2f, 0x26, 0x35, 0x70, 0x1a, 0x9f,
|
||||||
|
0x7f, 0xfc, 0xfe, 0x66, 0x3e, 0x76, 0x1e, 0xe1, 0x82, 0xcd, 0xce, 0xdc, 0x22, 0x58, 0x55, 0x4d,
|
||||||
|
0x40, 0xdb, 0x05, 0x92, 0xf9, 0x16, 0x5a, 0xf5, 0x72, 0x80, 0x36, 0xdc, 0x51, 0x86, 0x36, 0xda,
|
||||||
|
0xc2, 0x45, 0x3b, 0x8d, 0x3f, 0x26, 0x5d, 0xbf, 0x40, 0x9f, 0xa0, 0x9a, 0xdb, 0x19, 0xd4, 0x2c,
|
||||||
|
0x93, 0x5d, 0x5a, 0x64, 0x6b, 0xf7, 0x2a, 0x98, 0xae, 0xc1, 0x56, 0x35, 0xd4, 0xd0, 0xc3, 0xc2,
|
||||||
|
0x1a, 0xf8, 0xab, 0x97, 0xdf, 0xa7, 0xb6, 0x31, 0x99, 0xda, 0xc6, 0xaf, 0xa9, 0x6d, 0x7c, 0x9d,
|
||||||
|
0xd9, 0x2b, 0x93, 0x99, 0xbd, 0xf2, 0x73, 0x66, 0xaf, 0xbc, 0x6b, 0xfa, 0x81, 0xe8, 0x8f, 0xba,
|
||||||
|
0x6e, 0x8f, 0x0d, 0x33, 0x6e, 0xfa, 0x78, 0xc6, 0xdf, 0x7f, 0xc0, 0xe2, 0x3c, 0xa2, 0x89, 0x58,
|
||||||
|
0x77, 0x4d, 0xfd, 0x6e, 0x9e, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xae, 0x63, 0xf9, 0x38, 0x2f,
|
||||||
|
0x05, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
@ -280,6 +423,8 @@ type ServiceClient interface {
|
||||||
Simulate(ctx context.Context, in *SimulateRequest, opts ...grpc.CallOption) (*SimulateResponse, error)
|
Simulate(ctx context.Context, in *SimulateRequest, opts ...grpc.CallOption) (*SimulateResponse, error)
|
||||||
// GetTx fetches a tx by hash.
|
// GetTx fetches a tx by hash.
|
||||||
GetTx(ctx context.Context, in *GetTxRequest, opts ...grpc.CallOption) (*GetTxResponse, error)
|
GetTx(ctx context.Context, in *GetTxRequest, opts ...grpc.CallOption) (*GetTxResponse, error)
|
||||||
|
// GetTxsEvent fetches txs by event.
|
||||||
|
GetTxsEvent(ctx context.Context, in *GetTxsEventRequest, opts ...grpc.CallOption) (*GetTxsEventResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type serviceClient struct {
|
type serviceClient struct {
|
||||||
|
@ -308,12 +453,23 @@ func (c *serviceClient) GetTx(ctx context.Context, in *GetTxRequest, opts ...grp
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *serviceClient) GetTxsEvent(ctx context.Context, in *GetTxsEventRequest, opts ...grpc.CallOption) (*GetTxsEventResponse, error) {
|
||||||
|
out := new(GetTxsEventResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/GetTxsEvent", 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.
|
||||||
Simulate(context.Context, *SimulateRequest) (*SimulateResponse, error)
|
Simulate(context.Context, *SimulateRequest) (*SimulateResponse, error)
|
||||||
// GetTx fetches a tx by hash.
|
// GetTx fetches a tx by hash.
|
||||||
GetTx(context.Context, *GetTxRequest) (*GetTxResponse, error)
|
GetTx(context.Context, *GetTxRequest) (*GetTxResponse, error)
|
||||||
|
// GetTxsEvent fetches txs by event.
|
||||||
|
GetTxsEvent(context.Context, *GetTxsEventRequest) (*GetTxsEventResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
|
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
|
||||||
|
@ -326,6 +482,9 @@ func (*UnimplementedServiceServer) Simulate(ctx context.Context, req *SimulateRe
|
||||||
func (*UnimplementedServiceServer) GetTx(ctx context.Context, req *GetTxRequest) (*GetTxResponse, error) {
|
func (*UnimplementedServiceServer) GetTx(ctx context.Context, req *GetTxRequest) (*GetTxResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetTx not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetTx not implemented")
|
||||||
}
|
}
|
||||||
|
func (*UnimplementedServiceServer) GetTxsEvent(ctx context.Context, req *GetTxsEventRequest) (*GetTxsEventResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetTxsEvent 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)
|
||||||
|
@ -367,6 +526,24 @@ func _Service_GetTx_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Service_GetTxsEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetTxsEventRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(ServiceServer).GetTxsEvent(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/cosmos.tx.v1beta1.Service/GetTxsEvent",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(ServiceServer).GetTxsEvent(ctx, req.(*GetTxsEventRequest))
|
||||||
|
}
|
||||||
|
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),
|
||||||
|
@ -379,11 +556,120 @@ var _Service_serviceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "GetTx",
|
MethodName: "GetTx",
|
||||||
Handler: _Service_GetTx_Handler,
|
Handler: _Service_GetTx_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetTxsEvent",
|
||||||
|
Handler: _Service_GetTxsEvent_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "cosmos/tx/v1beta1/service.proto",
|
Metadata: "cosmos/tx/v1beta1/service.proto",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventRequest) 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 *GetTxsEventRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if m.Pagination != nil {
|
||||||
|
{
|
||||||
|
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i -= size
|
||||||
|
i = encodeVarintService(dAtA, i, uint64(size))
|
||||||
|
}
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
if len(m.Event) > 0 {
|
||||||
|
i -= len(m.Event)
|
||||||
|
copy(dAtA[i:], m.Event)
|
||||||
|
i = encodeVarintService(dAtA, i, uint64(len(m.Event)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventResponse) 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 *GetTxsEventResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if m.Pagination != nil {
|
||||||
|
{
|
||||||
|
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i -= size
|
||||||
|
i = encodeVarintService(dAtA, i, uint64(size))
|
||||||
|
}
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x1a
|
||||||
|
}
|
||||||
|
if len(m.TxResponses) > 0 {
|
||||||
|
for iNdEx := len(m.TxResponses) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
|
{
|
||||||
|
size, err := m.TxResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i -= size
|
||||||
|
i = encodeVarintService(dAtA, i, uint64(size))
|
||||||
|
}
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(m.Txs) > 0 {
|
||||||
|
for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
|
{
|
||||||
|
size, err := m.Txs[iNdEx].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 *SimulateRequest) Marshal() (dAtA []byte, err error) {
|
func (m *SimulateRequest) Marshal() (dAtA []byte, err error) {
|
||||||
size := m.Size()
|
size := m.Size()
|
||||||
dAtA = make([]byte, size)
|
dAtA = make([]byte, size)
|
||||||
|
@ -516,6 +802,18 @@ func (m *GetTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
|
if m.TxResponse != nil {
|
||||||
|
{
|
||||||
|
size, err := m.TxResponse.MarshalToSizedBuffer(dAtA[:i])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i -= size
|
||||||
|
i = encodeVarintService(dAtA, i, uint64(size))
|
||||||
|
}
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
if m.Tx != nil {
|
if m.Tx != nil {
|
||||||
{
|
{
|
||||||
size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i])
|
size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i])
|
||||||
|
@ -542,6 +840,48 @@ func encodeVarintService(dAtA []byte, offset int, v uint64) int {
|
||||||
dAtA[offset] = uint8(v)
|
dAtA[offset] = uint8(v)
|
||||||
return base
|
return base
|
||||||
}
|
}
|
||||||
|
func (m *GetTxsEventRequest) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.Event)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
|
if m.Pagination != nil {
|
||||||
|
l = m.Pagination.Size()
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetTxsEventResponse) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Txs) > 0 {
|
||||||
|
for _, e := range m.Txs {
|
||||||
|
l = e.Size()
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(m.TxResponses) > 0 {
|
||||||
|
for _, e := range m.TxResponses {
|
||||||
|
l = e.Size()
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if m.Pagination != nil {
|
||||||
|
l = m.Pagination.Size()
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
func (m *SimulateRequest) Size() (n int) {
|
func (m *SimulateRequest) Size() (n int) {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -595,6 +935,10 @@ func (m *GetTxResponse) Size() (n int) {
|
||||||
l = m.Tx.Size()
|
l = m.Tx.Size()
|
||||||
n += 1 + l + sovService(uint64(l))
|
n += 1 + l + sovService(uint64(l))
|
||||||
}
|
}
|
||||||
|
if m.TxResponse != nil {
|
||||||
|
l = m.TxResponse.Size()
|
||||||
|
n += 1 + l + sovService(uint64(l))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,6 +948,284 @@ func sovService(x uint64) (n int) {
|
||||||
func sozService(x uint64) (n int) {
|
func sozService(x uint64) (n int) {
|
||||||
return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||||
}
|
}
|
||||||
|
func (m *GetTxsEventRequest) 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: GetTxsEventRequest: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: GetTxsEventRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Event", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowService
|
||||||
|
}
|
||||||
|
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 ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Event = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil {
|
||||||
|
m.Pagination = &query.PageRequest{}
|
||||||
|
}
|
||||||
|
if err := m.Pagination.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 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *GetTxsEventResponse) 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: GetTxsEventResponse: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: GetTxsEventResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Txs", 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
|
||||||
|
}
|
||||||
|
m.Txs = append(m.Txs, &Tx{})
|
||||||
|
if err := m.Txs[len(m.Txs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field TxResponses", 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
|
||||||
|
}
|
||||||
|
m.TxResponses = append(m.TxResponses, &types.TxResponse{})
|
||||||
|
if err := m.TxResponses[len(m.TxResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 3:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil {
|
||||||
|
m.Pagination = &query.PageResponse{}
|
||||||
|
}
|
||||||
|
if err := m.Pagination.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 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) < 0 {
|
||||||
|
return ErrInvalidLengthService
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func (m *SimulateRequest) Unmarshal(dAtA []byte) error {
|
func (m *SimulateRequest) Unmarshal(dAtA []byte) error {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
@ -968,6 +1590,42 @@ func (m *GetTxResponse) Unmarshal(dAtA []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field TxResponse", 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.TxResponse == nil {
|
||||||
|
m.TxResponse = &types.TxResponse{}
|
||||||
|
}
|
||||||
|
if err := m.TxResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipService(dAtA[iNdEx:])
|
skippy, err := skipService(dAtA[iNdEx:])
|
||||||
|
|
|
@ -121,6 +121,42 @@ func local_request_Service_GetTx_0(ctx context.Context, marshaler runtime.Marsha
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
filter_Service_GetTxsEvent_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||||
|
)
|
||||||
|
|
||||||
|
func request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq GetTxsEventRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
if err := req.ParseForm(); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Service_GetTxsEvent_0); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := client.GetTxsEvent(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq GetTxsEventRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
if err := req.ParseForm(); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Service_GetTxsEvent_0); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := server.GetTxsEvent(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.
|
||||||
|
@ -167,6 +203,26 @@ func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, se
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_Service_GetTxsEvent_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.AnnotateIncomingContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_Service_GetTxsEvent_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_Service_GetTxsEvent_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +304,26 @@ func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_Service_GetTxsEvent_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_GetTxsEvent_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_GetTxsEvent_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,10 +331,14 @@ var (
|
||||||
pattern_Service_Simulate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "simulate"}, "", runtime.AssumeColonVerbOpt(true)))
|
pattern_Service_Simulate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "simulate"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
|
|
||||||
pattern_Service_GetTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"cosmos", "tx", "v1beta1", "hash"}, "", runtime.AssumeColonVerbOpt(true)))
|
pattern_Service_GetTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"cosmos", "tx", "v1beta1", "hash"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
|
|
||||||
|
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(true)))
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
forward_Service_Simulate_0 = runtime.ForwardResponseMessage
|
forward_Service_Simulate_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
forward_Service_GetTx_0 = runtime.ForwardResponseMessage
|
forward_Service_GetTx_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
|
forward_Service_GetTxsEvent_0 = runtime.ForwardResponseMessage
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,16 +3,22 @@ package tx
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
gogogrpc "github.com/gogo/protobuf/grpc"
|
gogogrpc "github.com/gogo/protobuf/grpc"
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
|
|
||||||
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
pagination "github.com/cosmos/cosmos-sdk/types/query"
|
||||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,6 +43,89 @@ func NewTxServer(clientCtx client.Context, simulate baseAppSimulateFn, interface
|
||||||
|
|
||||||
var _ txtypes.ServiceServer = txServer{}
|
var _ txtypes.ServiceServer = txServer{}
|
||||||
|
|
||||||
|
const (
|
||||||
|
eventFormat = "{eventType}.{eventAttribute}={value}"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TxsByEvents implements the ServiceServer.TxsByEvents RPC method.
|
||||||
|
func (s txServer) GetTxsEvent(ctx context.Context, req *txtypes.GetTxsEventRequest) (*txtypes.GetTxsEventResponse, error) {
|
||||||
|
offset := int(req.Pagination.Offset)
|
||||||
|
limit := int(req.Pagination.Limit)
|
||||||
|
if offset < 0 {
|
||||||
|
return nil, status.Error(codes.InvalidArgument, "offset must greater than 0")
|
||||||
|
}
|
||||||
|
if len(req.Event) == 0 {
|
||||||
|
return nil, status.Error(codes.InvalidArgument, "must declare at least one event to search")
|
||||||
|
}
|
||||||
|
|
||||||
|
if limit < 0 {
|
||||||
|
return nil, status.Error(codes.InvalidArgument, "limit must greater than 0")
|
||||||
|
} else if limit == 0 {
|
||||||
|
limit = pagination.DefaultLimit
|
||||||
|
}
|
||||||
|
|
||||||
|
page := offset/limit + 1
|
||||||
|
|
||||||
|
var events []string
|
||||||
|
|
||||||
|
if strings.Contains(req.Event, "&") {
|
||||||
|
events = strings.Split(req.Event, "&")
|
||||||
|
} else {
|
||||||
|
events = append(events, req.Event)
|
||||||
|
}
|
||||||
|
tmEvents := make([]string, len(events))
|
||||||
|
for i, event := range events {
|
||||||
|
if !strings.Contains(event, "=") {
|
||||||
|
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid event; event %s should be of the format: %s", event, eventFormat))
|
||||||
|
} else if strings.Count(event, "=") > 1 {
|
||||||
|
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid event; event %s should be of the format: %s", event, eventFormat))
|
||||||
|
}
|
||||||
|
|
||||||
|
tokens := strings.Split(event, "=")
|
||||||
|
if tokens[0] == tmtypes.TxHeightKey {
|
||||||
|
event = fmt.Sprintf("%s=%s", tokens[0], tokens[1])
|
||||||
|
} else {
|
||||||
|
event = fmt.Sprintf("%s='%s'", tokens[0], tokens[1])
|
||||||
|
}
|
||||||
|
|
||||||
|
tmEvents[i] = event
|
||||||
|
}
|
||||||
|
|
||||||
|
query := strings.Join(tmEvents, " AND ")
|
||||||
|
|
||||||
|
result, err := s.clientCtx.Client.TxSearch(ctx, query, false, &page, &limit, "")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a proto codec, we need it to unmarshal the tx bytes.
|
||||||
|
cdc := codec.NewProtoCodec(s.clientCtx.InterfaceRegistry)
|
||||||
|
txRespList := make([]*sdk.TxResponse, len(result.Txs))
|
||||||
|
txsList := make([]*txtypes.Tx, len(result.Txs))
|
||||||
|
|
||||||
|
for i, tx := range result.Txs {
|
||||||
|
txResp := txResultToTxResponse(&tx.TxResult)
|
||||||
|
txResp.Height = tx.Height
|
||||||
|
txResp.TxHash = tx.Hash.String()
|
||||||
|
txRespList[i] = txResp
|
||||||
|
|
||||||
|
var protoTx txtypes.Tx
|
||||||
|
if err := cdc.UnmarshalBinaryBare(tx.Tx, &protoTx); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
txsList[i] = &protoTx
|
||||||
|
}
|
||||||
|
|
||||||
|
return &txtypes.GetTxsEventResponse{
|
||||||
|
Txs: txsList,
|
||||||
|
TxResponses: txRespList,
|
||||||
|
Pagination: &pagination.PageResponse{
|
||||||
|
Total: uint64(result.TotalCount),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Simulate implements the ServiceServer.Simulate RPC method.
|
// Simulate implements the ServiceServer.Simulate RPC method.
|
||||||
func (s txServer) Simulate(ctx context.Context, req *txtypes.SimulateRequest) (*txtypes.SimulateResponse, error) {
|
func (s txServer) Simulate(ctx context.Context, req *txtypes.SimulateRequest) (*txtypes.SimulateResponse, error) {
|
||||||
if req.Tx == nil {
|
if req.Tx == nil {
|
||||||
|
@ -80,14 +169,19 @@ func (s txServer) GetTx(ctx context.Context, req *txtypes.GetTxRequest) (*txtype
|
||||||
|
|
||||||
// Create a proto codec, we need it to unmarshal the tx bytes.
|
// Create a proto codec, we need it to unmarshal the tx bytes.
|
||||||
cdc := codec.NewProtoCodec(s.clientCtx.InterfaceRegistry)
|
cdc := codec.NewProtoCodec(s.clientCtx.InterfaceRegistry)
|
||||||
var protoTx txtypes.Tx
|
|
||||||
|
|
||||||
|
var protoTx txtypes.Tx
|
||||||
if err := cdc.UnmarshalBinaryBare(result.Tx, &protoTx); err != nil {
|
if err := cdc.UnmarshalBinaryBare(result.Tx, &protoTx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txResp := txResultToTxResponse(&result.TxResult)
|
||||||
|
txResp.Height = result.Height
|
||||||
|
txResp.TxHash = result.Hash.String()
|
||||||
|
|
||||||
return &txtypes.GetTxResponse{
|
return &txtypes.GetTxResponse{
|
||||||
Tx: &protoTx,
|
Tx: &protoTx,
|
||||||
|
TxResponse: txResp,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,3 +203,15 @@ func RegisterTxService(
|
||||||
func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.ServeMux) {
|
func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.ServeMux) {
|
||||||
txtypes.RegisterServiceHandlerClient(context.Background(), mux, txtypes.NewServiceClient(clientConn))
|
txtypes.RegisterServiceHandlerClient(context.Background(), mux, txtypes.NewServiceClient(clientConn))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func txResultToTxResponse(respTx *abci.ResponseDeliverTx) *sdk.TxResponse {
|
||||||
|
logs, _ := sdk.ParseABCILogs(respTx.Log)
|
||||||
|
return &sdk.TxResponse{
|
||||||
|
Code: respTx.Code,
|
||||||
|
Codespace: respTx.Codespace,
|
||||||
|
GasUsed: respTx.GasUsed,
|
||||||
|
GasWanted: respTx.GasWanted,
|
||||||
|
Info: respTx.Info,
|
||||||
|
Logs: logs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
|
query "github.com/cosmos/cosmos-sdk/types/query"
|
||||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||||
"github.com/cosmos/cosmos-sdk/types/tx"
|
"github.com/cosmos/cosmos-sdk/types/tx"
|
||||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||||
|
@ -99,6 +100,55 @@ func (s IntegrationTestSuite) TestSimulate() {
|
||||||
s.Require().True(res.GetGasInfo().GetGasUsed() > 0) // Gas used sometimes change, just check it's not empty.
|
s.Require().True(res.GetGasInfo().GetGasUsed() > 0) // Gas used sometimes change, just check it's not empty.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s IntegrationTestSuite) TestGetTxEvents() {
|
||||||
|
val := s.network.Validators[0]
|
||||||
|
|
||||||
|
// Create a new MsgSend tx from val to itself.
|
||||||
|
out, err := bankcli.MsgSendExec(
|
||||||
|
val.ClientCtx,
|
||||||
|
val.Address,
|
||||||
|
val.Address,
|
||||||
|
sdk.NewCoins(
|
||||||
|
sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)),
|
||||||
|
),
|
||||||
|
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||||
|
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||||
|
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
|
||||||
|
fmt.Sprintf("--gas=%d", flags.DefaultGasLimit),
|
||||||
|
fmt.Sprintf("--%s=foobar", flags.FlagMemo),
|
||||||
|
)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
var txRes sdk.TxResponse
|
||||||
|
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), &txRes))
|
||||||
|
s.Require().Equal(uint32(0), txRes.Code)
|
||||||
|
|
||||||
|
s.Require().NoError(s.network.WaitForNextBlock())
|
||||||
|
|
||||||
|
// Query the tx via gRPC.
|
||||||
|
grpcRes, err := s.queryClient.GetTxsEvent(
|
||||||
|
context.Background(),
|
||||||
|
&tx.GetTxsEventRequest{Event: "message.action=send",
|
||||||
|
Pagination: &query.PageRequest{
|
||||||
|
CountTotal: false,
|
||||||
|
Offset: 0,
|
||||||
|
Limit: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
s.Require().Equal(len(grpcRes.Txs), 1)
|
||||||
|
s.Require().Equal("foobar", grpcRes.Txs[0].Body.Memo)
|
||||||
|
|
||||||
|
// Query the tx via grpc-gateway.
|
||||||
|
restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?event=%s&pagination.offset=%d&pagination.limit=%d", val.APIAddress, "message.action=send", 0, 1))
|
||||||
|
s.Require().NoError(err)
|
||||||
|
var getTxRes tx.GetTxsEventResponse
|
||||||
|
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(restRes, &getTxRes))
|
||||||
|
s.Require().Equal(len(grpcRes.Txs), 1)
|
||||||
|
s.Require().Equal("foobar", getTxRes.Txs[0].Body.Memo)
|
||||||
|
s.Require().NotZero(grpcRes.TxResponses[0].Height)
|
||||||
|
}
|
||||||
|
|
||||||
func (s IntegrationTestSuite) TestGetTx() {
|
func (s IntegrationTestSuite) TestGetTx() {
|
||||||
val := s.network.Validators[0]
|
val := s.network.Validators[0]
|
||||||
|
|
||||||
|
@ -130,13 +180,15 @@ func (s IntegrationTestSuite) TestGetTx() {
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Equal("foobar", grpcRes.Tx.Body.Memo)
|
s.Require().Equal("foobar", grpcRes.Tx.Body.Memo)
|
||||||
|
s.Require().NotZero(grpcRes.TxResponse.Height)
|
||||||
|
|
||||||
// Query the tx via grpc-gateway.
|
// Query the tx via grpc-gateway.
|
||||||
restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, txRes.TxHash))
|
restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, txRes.TxHash))
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
var getTxRes tx.GetTxResponse
|
var getTxRes tx.GetTxResponse
|
||||||
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(restRes, &getTxRes))
|
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(restRes, &getTxRes))
|
||||||
s.Require().Equal("foobar", getTxRes.Tx.Body.Memo)
|
s.Require().Equal("foobar", grpcRes.Tx.Body.Memo)
|
||||||
|
s.Require().NotZero(grpcRes.TxResponse.Height)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIntegrationTestSuite(t *testing.T) {
|
func TestIntegrationTestSuite(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue