syntax = "proto3";
package cosmos.tx.v1beta1;

import "google/api/annotations.proto";
import "cosmos/base/abci/v1beta1/abci.proto";
import "cosmos/tx/v1beta1/tx.proto";
import "cosmos/base/query/v1beta1/pagination.proto";

option go_package = "github.com/cosmos/cosmos-sdk/types/tx";

// Service defines a gRPC service for interacting with transactions.
service Service {
  // Simulate simulates executing a transaction for estimating gas usage.
  rpc Simulate(SimulateRequest) returns (SimulateResponse) {
    option (google.api.http).post = "/cosmos/tx/v1beta1/simulate";
  }
  // GetTx fetches a tx by hash.
  rpc GetTx(GetTxRequest) returns (GetTxResponse) {
    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
// RPC method.
message SimulateRequest {
  // tx is the transaction to simulate.
  cosmos.tx.v1beta1.Tx tx = 1;
}

// SimulateResponse is the response type for the
// Service.SimulateRPC method.
message SimulateResponse {
  // gas_info is the information about gas used in the simulation.
  cosmos.base.abci.v1beta1.GasInfo gas_info = 1;
  // result is the result of the simulation.
  cosmos.base.abci.v1beta1.Result result = 2;
}

// GetTxRequest is the request type for the Service.GetTx
// RPC method.
message GetTxRequest {
  // hash is the tx hash to query, encoded as a hex string.
  string hash = 1;
}

// GetTxResponse is the response type for the Service.GetTx method.
message GetTxResponse {
  // tx is the queried transaction.
  cosmos.tx.v1beta1.Tx tx = 1;
  // tx_response is the queried TxResponses.
  cosmos.base.abci.v1beta1.TxResponse tx_response = 2;
}