Skip to content

Commit

Permalink
fix(api): Regenerate from v0.40.0 proto files (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Jan 14, 2021
1 parent 37b1b60 commit 0798b1c
Show file tree
Hide file tree
Showing 40 changed files with 3,009 additions and 1,802 deletions.
3 changes: 3 additions & 0 deletions packages/api/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ coverage
# os-generated files
.DS_Store

# TS source code
src

# Proto definitions
proto
scripts
2 changes: 1 addition & 1 deletion packages/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { RegenApi } from '@regen-network/api';
import { QueryClientImpl } from '@regen-network/api/lib/generated/cosmos/bank/v1beta1/query';

// Create a new instance of the RegenApi class.
const api = new RegenApi({
const api = RegenApi.connect({
// RegenApi supports multiple client connections to interact with a node:
// - via the Tendermint RPC
// - via gRPC
Expand Down
1 change: 1 addition & 0 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"scripts": {
"build": "rimraf lib && tsc",
"gen": "rimraf src/generated && mkdir src/generated && ./scripts/protocgen.sh",
"test": "jest"
},
"devDependencies": {
Expand Down
136 changes: 136 additions & 0 deletions packages/api/proto/cosmos/base/tendermint/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
syntax = "proto3";
package cosmos.base.tendermint.v1beta1;

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/api/annotations.proto";
import "tendermint/p2p/types.proto";
import "tendermint/types/block.proto";
import "tendermint/types/types.proto";
import "cosmos/base/query/v1beta1/pagination.proto";

option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice";

// Service defines the gRPC querier service for tendermint queries.
service Service {
// GetNodeInfo queries the current node info.
rpc GetNodeInfo(GetNodeInfoRequest) returns (GetNodeInfoResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/node_info";
}
// GetSyncing queries node syncing.
rpc GetSyncing(GetSyncingRequest) returns (GetSyncingResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/syncing";
}
// GetLatestBlock returns the latest block.
rpc GetLatestBlock(GetLatestBlockRequest) returns (GetLatestBlockResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/latest";
}
// GetBlockByHeight queries block for given height.
rpc GetBlockByHeight(GetBlockByHeightRequest) returns (GetBlockByHeightResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/{height}";
}

// GetLatestValidatorSet queries latest validator-set.
rpc GetLatestValidatorSet(GetLatestValidatorSetRequest) returns (GetLatestValidatorSetResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/latest";
}
// GetValidatorSetByHeight queries validator-set at a given height.
rpc GetValidatorSetByHeight(GetValidatorSetByHeightRequest) returns (GetValidatorSetByHeightResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/{height}";
}
}

// GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method.
message GetValidatorSetByHeightRequest {
int64 height = 1;
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method.
message GetValidatorSetByHeightResponse {
int64 block_height = 1;
repeated Validator validators = 2;
// pagination defines an pagination for the response.
cosmos.base.query.v1beta1.PageResponse pagination = 3;
}

// GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method.
message GetLatestValidatorSetRequest {
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method.
message GetLatestValidatorSetResponse {
int64 block_height = 1;
repeated Validator validators = 2;
// pagination defines an pagination for the response.
cosmos.base.query.v1beta1.PageResponse pagination = 3;
}

// Validator is the type for the validator-set.
message Validator {
string address = 1;
google.protobuf.Any pub_key = 2;
int64 voting_power = 3;
int64 proposer_priority = 4;
}

// GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method.
message GetBlockByHeightRequest {
int64 height = 1;
}

// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method.
message GetBlockByHeightResponse {
.tendermint.types.BlockID block_id = 1;
.tendermint.types.Block block = 2;
}

// GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method.
message GetLatestBlockRequest {}

// GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method.
message GetLatestBlockResponse {
.tendermint.types.BlockID block_id = 1;
.tendermint.types.Block block = 2;
}

// GetSyncingRequest is the request type for the Query/GetSyncing RPC method.
message GetSyncingRequest {}

// GetSyncingResponse is the response type for the Query/GetSyncing RPC method.
message GetSyncingResponse {
bool syncing = 1;
}

// GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method.
message GetNodeInfoRequest {}

// GetNodeInfoResponse is the request type for the Query/GetNodeInfo RPC method.
message GetNodeInfoResponse {
.tendermint.p2p.DefaultNodeInfo default_node_info = 1;
VersionInfo application_version = 2;
}

// VersionInfo is the type for the GetNodeInfoResponse message.
message VersionInfo {
string name = 1;
string app_name = 2;
string version = 3;
string git_commit = 4;
string build_tags = 5;
string go_version = 6;
repeated Module build_deps = 7;
}

// Module is the type for VersionInfo
message Module {
// module path
string path = 1;
// module version
string version = 2;
// checksum
string sum = 3;
}
1 change: 0 additions & 1 deletion packages/api/proto/cosmos/staking/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ message MsgEditValidator {
// We pass a reference to the new commission rate and min self delegation as
// it's not mandatory to update. If not updated, the deserialized rate will be
// zero with no way to distinguish if an update was intended.
//
// REF: #2373
string commission_rate = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
Expand Down
50 changes: 45 additions & 5 deletions packages/api/proto/cosmos/tx/v1beta1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package cosmos.tx.v1beta1;
import "google/api/annotations.proto";
import "cosmos/base/abci/v1beta1/abci.proto";
import "cosmos/tx/v1beta1/tx.proto";
import "gogoproto/gogo.proto";
import "cosmos/base/query/v1beta1/pagination.proto";

option go_package = "github.com/cosmos/cosmos-sdk/types/tx";
Expand All @@ -12,13 +13,22 @@ option go_package = "github.com/cosmos/cosmos-sdk/types/tx";
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";
option (google.api.http) = {
post: "/cosmos/tx/v1beta1/simulate"
body: "*"
};
}
// GetTx fetches a tx by hash.
rpc GetTx(GetTxRequest) returns (GetTxResponse) {
option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}";
option (google.api.http).get = "/cosmos/tx/v1beta1/txs/{hash}";
}
// BroadcastTx broadcast transaction.
rpc BroadcastTx(BroadcastTxRequest) returns (BroadcastTxResponse) {
option (google.api.http) = {
post: "/cosmos/tx/v1beta1/txs"
body: "*"
};
}

// GetTxsEvent fetches txs by event.
rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) {
option (google.api.http).get = "/cosmos/tx/v1beta1/txs";
Expand All @@ -28,8 +38,8 @@ service Service {
// GetTxsEventRequest is the request type for the Service.TxsByEvents
// RPC method.
message GetTxsEventRequest {
// event is the transaction event type.
string event = 1;
// events is the list of transaction event type.
repeated string events = 1;
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
Expand All @@ -45,6 +55,36 @@ message GetTxsEventResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 3;
}

// BroadcastTxRequest is the request type for the Service.BroadcastTxRequest
// RPC method.
message BroadcastTxRequest {
// tx_bytes is the raw transaction.
bytes tx_bytes = 1;
BroadcastMode mode = 2;
}

// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method.
enum BroadcastMode {
// zero-value for mode ordering
BROADCAST_MODE_UNSPECIFIED = 0;
// BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for
// the tx to be committed in a block.
BROADCAST_MODE_BLOCK = 1;
// BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for
// a CheckTx execution response only.
BROADCAST_MODE_SYNC = 2;
// BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns
// immediately.
BROADCAST_MODE_ASYNC = 3;
}

// BroadcastTxResponse is the response type for the
// Service.BroadcastTx method.
message BroadcastTxResponse {
// tx_response is the queried TxResponses.
cosmos.base.abci.v1beta1.TxResponse tx_response = 1;
}

// SimulateRequest is the request type for the Service.Simulate
// RPC method.
message SimulateRequest {
Expand Down
1 change: 0 additions & 1 deletion packages/api/proto/cosmos/tx/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ message TxBody {
// those messages define the number and order of elements in AuthInfo's
// signer_infos and Tx's signatures. Each required signer address is added to
// the list only the first time it occurs.
//
// By convention, the first required signer (usually from the first message)
// is referred to as the primary signer and pays the fee for the whole
// transaction.
Expand Down
23 changes: 23 additions & 0 deletions packages/api/proto/cosmos/upgrade/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";
package cosmos.upgrade.v1beta1;

import "google/protobuf/any.proto";
import "google/api/annotations.proto";
import "cosmos/upgrade/v1beta1/upgrade.proto";

Expand All @@ -17,6 +18,14 @@ service Query {
rpc AppliedPlan(QueryAppliedPlanRequest) returns (QueryAppliedPlanResponse) {
option (google.api.http).get = "/cosmos/upgrade/v1beta1/applied_plan/{name}";
}

// UpgradedConsensusState queries the consensus state that will serve
// as a trusted kernel for the next version of this chain. It will only be
// stored at the last height of this chain.
// UpgradedConsensusState RPC not supported with legacy querier
rpc UpgradedConsensusState(QueryUpgradedConsensusStateRequest) returns (QueryUpgradedConsensusStateResponse) {
option (google.api.http).get = "/cosmos/upgrade/v1beta1/upgraded_consensus_state/{last_height}";
}
}

// QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC
Expand All @@ -43,3 +52,17 @@ message QueryAppliedPlanResponse {
// height is the block height at which the plan was applied.
int64 height = 1;
}

// QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState
// RPC method.
message QueryUpgradedConsensusStateRequest {
// last height of the current chain must be sent in request
// as this is the height under which next consensus state is stored
int64 last_height = 1;
}

// QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState
// RPC method.
message QueryUpgradedConsensusStateResponse {
google.protobuf.Any upgraded_consensus_state = 1;
}
Loading

0 comments on commit 0798b1c

Please sign in to comment.