From ce3cfbd457fab5ddcc85c4e80c650f047360b0cb Mon Sep 17 00:00:00 2001 From: prathamesh0 <42446521+prathamesh0@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:01:09 +0530 Subject: [PATCH] Update proto files and regenerate ts bindings (#1) * Update proto files * Update script to generate typescript definitions * Generate typescript definitions from protobuf files * Cleanup unnecessary proto files --------- Co-authored-by: neeraj --- package.json | 2 +- proto/amino/amino.proto | 84 + proto/cerc/auction/module/v1/module.proto | 13 + .../auction/v1/auction.proto} | 57 +- proto/cerc/auction/v1/genesis.proto | 14 + .../v1beta1 => cerc/auction/v1}/query.proto | 149 +- .../v1beta1 => cerc/auction/v1}/tx.proto | 125 +- proto/cerc/bond/module/v1/module.proto | 13 + .../bond/v1beta1 => cerc/bond/v1}/bond.proto | 14 +- .../v1beta1 => cerc/bond/v1}/genesis.proto | 11 +- .../bond/v1beta1 => cerc/bond/v1}/query.proto | 79 +- proto/cerc/bond/v1/tx.proto | 95 + proto/cerc/registry/module/v1/module.proto | 13 + proto/cerc/registry/v1/genesis.proto | 32 + proto/cerc/registry/v1/query.proto | 200 + .../registry/v1}/registry.proto | 89 +- proto/cerc/registry/v1/tx.proto | 194 + proto/cosmos/app/v1alpha1/module.proto | 91 + proto/cosmos/base/abci/v1beta1/abci.proto | 137 - proto/cosmos/base/kv/v1beta1/kv.proto | 17 - .../base/query/v1beta1/pagination.proto | 5 +- .../base/reflection/v1beta1/reflection.proto | 44 - .../base/reflection/v2alpha1/reflection.proto | 217 - .../base/snapshots/v1beta1/snapshot.proto | 20 - .../base/store/v1beta1/commit_info.proto | 29 - .../cosmos/base/store/v1beta1/listening.proto | 14 - .../cosmos/base/store/v1beta1/snapshot.proto | 28 - .../base/tendermint/v1beta1/query.proto | 136 - proto/cosmos/base/v1beta1/coin.proto | 29 +- proto/cosmos/msg/v1/msg.proto | 30 + proto/cosmos_proto/cosmos.proto | 97 + proto/google/api/httpbody.proto | 78 - proto/google/protobuf/any.proto | 161 - proto/google/protobuf/descriptor.proto | 192 +- proto/google/protobuf/duration.proto | 3 +- proto/google/protobuf/timestamp.proto | 7 +- proto/vulcanize/auction/v1beta1/genesis.proto | 15 - proto/vulcanize/bond/v1beta1/tx.proto | 77 - .../vulcanize/registry/v1beta1/genesis.proto | 21 - proto/vulcanize/registry/v1beta1/query.proto | 225 - proto/vulcanize/registry/v1beta1/tx.proto | 137 - scripts/proto-gen.sh | 31 +- src/proto2/amino/amino.ts | 2 + src/proto2/cerc/auction/module/v1/module.ts | 83 + src/proto2/cerc/auction/v1/auction.ts | 739 +++ src/proto2/cerc/auction/v1/genesis.ts | 124 + src/proto2/cerc/auction/v1/query.ts | 1236 +++++ src/proto2/cerc/auction/v1/tx.ts | 641 +++ src/proto2/cerc/bond/module/v1/module.ts | 83 + src/proto2/cerc/bond/v1/bond.ts | 194 + src/proto2/cerc/bond/v1/genesis.ts | 124 + src/proto2/cerc/bond/v1/query.ts | 834 ++++ src/proto2/cerc/bond/v1/tx.ts | 631 +++ src/proto2/cerc/registry/module/v1/module.ts | 83 + src/proto2/cerc/registry/v1/genesis.ts | 167 + src/proto2/cerc/registry/v1/query.ts | 2068 ++++++++ src/proto2/cerc/registry/v1/registry.ts | 1259 +++++ src/proto2/cerc/registry/v1/tx.ts | 1584 ++++++ src/proto2/cosmos/app/v1alpha1/module.ts | 337 ++ .../cosmos/base/query/v1beta1/pagination.ts | 322 ++ src/proto2/cosmos/base/v1beta1/coin.ts | 303 ++ src/proto2/cosmos/msg/v1/msg.ts | 2 + src/proto2/cosmos_proto/cosmos.ts | 284 ++ src/proto2/gogoproto/gogo.ts | 2 + src/proto2/google/api/annotations.ts | 2 + src/proto2/google/api/http.ts | 647 +++ src/proto2/google/protobuf/descriptor.ts | 4395 +++++++++++++++++ src/proto2/google/protobuf/duration.ts | 187 + src/proto2/google/protobuf/timestamp.ts | 220 + yarn.lock | 78 +- 70 files changed, 17932 insertions(+), 1724 deletions(-) create mode 100644 proto/amino/amino.proto create mode 100644 proto/cerc/auction/module/v1/module.proto rename proto/{vulcanize/auction/v1beta1/types.proto => cerc/auction/v1/auction.proto} (83%) create mode 100644 proto/cerc/auction/v1/genesis.proto rename proto/{vulcanize/auction/v1beta1 => cerc/auction/v1}/query.proto (53%) rename proto/{vulcanize/auction/v1beta1 => cerc/auction/v1}/tx.proto (53%) create mode 100644 proto/cerc/bond/module/v1/module.proto rename proto/{vulcanize/bond/v1beta1 => cerc/bond/v1}/bond.proto (65%) rename proto/{vulcanize/bond/v1beta1 => cerc/bond/v1}/genesis.proto (54%) rename proto/{vulcanize/bond/v1beta1 => cerc/bond/v1}/query.proto (57%) create mode 100644 proto/cerc/bond/v1/tx.proto create mode 100644 proto/cerc/registry/module/v1/module.proto create mode 100644 proto/cerc/registry/v1/genesis.proto create mode 100644 proto/cerc/registry/v1/query.proto rename proto/{vulcanize/registry/v1beta1 => cerc/registry/v1}/registry.proto (56%) create mode 100644 proto/cerc/registry/v1/tx.proto create mode 100644 proto/cosmos/app/v1alpha1/module.proto delete mode 100644 proto/cosmos/base/abci/v1beta1/abci.proto delete mode 100644 proto/cosmos/base/kv/v1beta1/kv.proto delete mode 100644 proto/cosmos/base/reflection/v1beta1/reflection.proto delete mode 100644 proto/cosmos/base/reflection/v2alpha1/reflection.proto delete mode 100644 proto/cosmos/base/snapshots/v1beta1/snapshot.proto delete mode 100644 proto/cosmos/base/store/v1beta1/commit_info.proto delete mode 100644 proto/cosmos/base/store/v1beta1/listening.proto delete mode 100644 proto/cosmos/base/store/v1beta1/snapshot.proto delete mode 100644 proto/cosmos/base/tendermint/v1beta1/query.proto create mode 100644 proto/cosmos/msg/v1/msg.proto create mode 100644 proto/cosmos_proto/cosmos.proto delete mode 100644 proto/google/api/httpbody.proto delete mode 100644 proto/google/protobuf/any.proto delete mode 100644 proto/vulcanize/auction/v1beta1/genesis.proto delete mode 100644 proto/vulcanize/bond/v1beta1/tx.proto delete mode 100644 proto/vulcanize/registry/v1beta1/genesis.proto delete mode 100644 proto/vulcanize/registry/v1beta1/query.proto delete mode 100644 proto/vulcanize/registry/v1beta1/tx.proto create mode 100644 src/proto2/amino/amino.ts create mode 100644 src/proto2/cerc/auction/module/v1/module.ts create mode 100644 src/proto2/cerc/auction/v1/auction.ts create mode 100644 src/proto2/cerc/auction/v1/genesis.ts create mode 100644 src/proto2/cerc/auction/v1/query.ts create mode 100644 src/proto2/cerc/auction/v1/tx.ts create mode 100644 src/proto2/cerc/bond/module/v1/module.ts create mode 100644 src/proto2/cerc/bond/v1/bond.ts create mode 100644 src/proto2/cerc/bond/v1/genesis.ts create mode 100644 src/proto2/cerc/bond/v1/query.ts create mode 100644 src/proto2/cerc/bond/v1/tx.ts create mode 100644 src/proto2/cerc/registry/module/v1/module.ts create mode 100644 src/proto2/cerc/registry/v1/genesis.ts create mode 100644 src/proto2/cerc/registry/v1/query.ts create mode 100644 src/proto2/cerc/registry/v1/registry.ts create mode 100644 src/proto2/cerc/registry/v1/tx.ts create mode 100644 src/proto2/cosmos/app/v1alpha1/module.ts create mode 100644 src/proto2/cosmos/base/query/v1beta1/pagination.ts create mode 100644 src/proto2/cosmos/base/v1beta1/coin.ts create mode 100644 src/proto2/cosmos/msg/v1/msg.ts create mode 100644 src/proto2/cosmos_proto/cosmos.ts create mode 100644 src/proto2/gogoproto/gogo.ts create mode 100644 src/proto2/google/api/annotations.ts create mode 100644 src/proto2/google/api/http.ts create mode 100644 src/proto2/google/protobuf/descriptor.ts create mode 100644 src/proto2/google/protobuf/duration.ts create mode 100644 src/proto2/google/protobuf/timestamp.ts diff --git a/package.json b/package.json index 0397190..df5445c 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "dotenv": "^16.0.0", "google-protobuf": "^3.21.0", "jest": "29.0.0", - "protoc-gen-ts": "^0.8.7", + "ts-proto": "1.121.6", "ts-jest": "^29.0.2", "typescript": "^4.6.2" }, diff --git a/proto/amino/amino.proto b/proto/amino/amino.proto new file mode 100644 index 0000000..fb099b8 --- /dev/null +++ b/proto/amino/amino.proto @@ -0,0 +1,84 @@ +syntax = "proto3"; + +package amino; + +import "google/protobuf/descriptor.proto"; + +// TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated. +// We need this right now because gogoproto codegen needs to import the extension. +option go_package = "github.com/cosmos/cosmos-sdk/types/tx/amino"; + +extend google.protobuf.MessageOptions { + // name is the string used when registering a concrete + // type into the Amino type registry, via the Amino codec's + // `RegisterConcrete()` method. This string MUST be at most 39 + // characters long, or else the message will be rejected by the + // Ledger hardware device. + string name = 11110001; + + // encoding describes the encoding format used by Amino for the given + // message. The field type is chosen to be a string for + // flexibility, but it should ideally be short and expected to be + // machine-readable, for example "base64" or "utf8_json". We + // highly recommend to use underscores for word separation instead of spaces. + // + // If left empty, then the Amino encoding is expected to be the same as the + // Protobuf one. + // + // This annotation should not be confused with the `encoding` + // one which operates on the field level. + string message_encoding = 11110002; +} + +extend google.protobuf.FieldOptions { + // encoding describes the encoding format used by Amino for + // the given field. The field type is chosen to be a string for + // flexibility, but it should ideally be short and expected to be + // machine-readable, for example "base64" or "utf8_json". We + // highly recommend to use underscores for word separation instead of spaces. + // + // If left empty, then the Amino encoding is expected to be the same as the + // Protobuf one. + // + // This annotation should not be confused with the + // `message_encoding` one which operates on the message level. + string encoding = 11110003; + + // field_name sets a different field name (i.e. key name) in + // the amino JSON object for the given field. + // + // Example: + // + // message Foo { + // string bar = 1 [(amino.field_name) = "baz"]; + // } + // + // Then the Amino encoding of Foo will be: + // `{"baz":"some value"}` + string field_name = 11110004; + + // dont_omitempty sets the field in the JSON object even if + // its value is empty, i.e. equal to the Golang zero value. To learn what + // the zero values are, see https://go.dev/ref/spec#The_zero_value. + // + // Fields default to `omitempty`, which is the default behavior when this + // annotation is unset. When set to true, then the field value in the + // JSON object will be set, i.e. not `undefined`. + // + // Example: + // + // message Foo { + // string bar = 1; + // string baz = 2 [(amino.dont_omitempty) = true]; + // } + // + // f := Foo{}; + // out := AminoJSONEncoder(&f); + // out == {"baz":""} + bool dont_omitempty = 11110005; + + // oneof_name sets the type name for the given field oneof field. This is used + // by the Amino JSON encoder to encode the type of the oneof field, and must be the same string in + // the RegisterConcrete() method usage used to register the concrete type. + string oneof_name = 11110006; +} \ No newline at end of file diff --git a/proto/cerc/auction/module/v1/module.proto b/proto/cerc/auction/module/v1/module.proto new file mode 100644 index 0000000..3a7b2f6 --- /dev/null +++ b/proto/cerc/auction/module/v1/module.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package cerc.auction.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the app config object of the module. +// Learn more: https://docs.cosmos.network/main/building-modules/depinject +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import : "git.vdb.to/cerc-io/laconic2d/x/auction" + }; +} diff --git a/proto/vulcanize/auction/v1beta1/types.proto b/proto/cerc/auction/v1/auction.proto similarity index 83% rename from proto/vulcanize/auction/v1beta1/types.proto rename to proto/cerc/auction/v1/auction.proto index 4ec5462..592411a 100644 --- a/proto/vulcanize/auction/v1beta1/types.proto +++ b/proto/cerc/auction/v1/auction.proto @@ -1,39 +1,46 @@ syntax = "proto3"; -package vulcanize.auction.v1beta1; + +package cerc.auction.v1; + import "gogoproto/gogo.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/tharsis/ethermint/x/auction/types"; +option go_package = "git.vdb.to/cerc-io/laconic2d/x/auction"; // Params defines the auction module parameters message Params { + // Write custom stringer method option (gogoproto.goproto_stringer) = false; // Duration of the commits phase in seconds google.protobuf.Duration commits_duration = 1 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = false, (gogoproto.stdduration) = true, - (gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\"" + (gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\"" ]; + // Duration of the reveals phase in seconds google.protobuf.Duration reveals_duration = 2 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = false, (gogoproto.stdduration) = true, - (gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\"" + (gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\"" ]; + // Commit fees cosmos.base.v1beta1.Coin commit_fee = 3 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" ]; + // Reveal fees cosmos.base.v1beta1.Coin reveal_fee = 4 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" ]; + // Minimum acceptable bid amount cosmos.base.v1beta1.Coin minimum_bid = 5 [ (gogoproto.nullable) = false, @@ -45,28 +52,33 @@ message Params { message Auction { option (gogoproto.goproto_getters) = false; - string id = 1; + string id = 1; string status = 2; + // Address of the creator of the auction string owner_address = 3; + // Timestamp at which the auction was created google.protobuf.Timestamp create_time = 4 [ - (gogoproto.stdtime) = true, + (gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\"" ]; + // Timestamp at which the commits phase concluded google.protobuf.Timestamp commits_end_time = 5 [ - (gogoproto.stdtime) = true, + (gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"commits_end_time\" yaml:\"commits_end_time\"" ]; + // Timestamp at which the reveals phase concluded google.protobuf.Timestamp reveals_end_time = 6 [ - (gogoproto.stdtime) = true, + (gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"reveals_end_time\" yaml:\"reveals_end_time\"" ]; + // Commit and reveal fees must both be paid when committing a bid // Reveal fee is returned only if the bid is revealed cosmos.base.v1beta1.Coin commit_fee = 7 [ @@ -77,18 +89,22 @@ message Auction { (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" ]; + // Minimum acceptable bid amount for a valid commit cosmos.base.v1beta1.Coin minimum_bid = 9 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" ]; + // Address of the winner string winner_address = 10; + // Winning bid, i.e., the highest bid cosmos.base.v1beta1.Coin winning_bid = 11 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"winning_bid\" yaml:\"winning_bid\"" ]; + // Amount the winner pays, i.e. the second highest auction cosmos.base.v1beta1.Coin winning_price = 12 [ (gogoproto.nullable) = false, @@ -106,30 +122,35 @@ message Auctions { message Bid { option (gogoproto.goproto_getters) = false; - string auction_id = 1; - string bidder_address = 2; - string status = 3; - string commit_hash = 4; - google.protobuf.Timestamp commit_time = 5 [ - (gogoproto.stdtime) = true, + string auction_id = 1; + string bidder_address = 2; + string status = 3; + string commit_hash = 4; + + google.protobuf.Timestamp commit_time = 5 [ + (gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"commit_time\" yaml:\"commit_time\"" ]; + cosmos.base.v1beta1.Coin commit_fee = 6 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" ]; + google.protobuf.Timestamp reveal_time = 7 [ - (gogoproto.stdtime) = true, + (gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"reveal_time\" yaml:\"reveal_time\"" ]; + cosmos.base.v1beta1.Coin reveal_fee = 8 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" ]; + cosmos.base.v1beta1.Coin bid_amount = 9 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"bid_amount\" yaml:\"bid_amount\"" - ];; + ]; } diff --git a/proto/cerc/auction/v1/genesis.proto b/proto/cerc/auction/v1/genesis.proto new file mode 100644 index 0000000..716d9a6 --- /dev/null +++ b/proto/cerc/auction/v1/genesis.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package cerc.auction.v1; + +import "gogoproto/gogo.proto"; +import "cerc/auction/v1/auction.proto"; + +option go_package = "git.vdb.to/cerc-io/laconic2d/x/auction"; + +// GenesisState defines the genesis state of the auction module +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + Auctions auctions = 2 [(gogoproto.moretags) = "json:\"auctions\" yaml:\"auctions\""]; +} diff --git a/proto/vulcanize/auction/v1beta1/query.proto b/proto/cerc/auction/v1/query.proto similarity index 53% rename from proto/vulcanize/auction/v1beta1/query.proto rename to proto/cerc/auction/v1/query.proto index 6ef39d2..d4afe85 100644 --- a/proto/vulcanize/auction/v1beta1/query.proto +++ b/proto/cerc/auction/v1/query.proto @@ -1,22 +1,74 @@ syntax = "proto3"; -package vulcanize.auction.v1beta1; + +package cerc.auction.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/v1beta1/coin.proto"; -import "vulcanize/auction/v1beta1/types.proto"; +import "cerc/auction/v1/auction.proto"; -option go_package = "github.com/tharsis/ethermint/x/auction/types"; +option go_package = "git.vdb.to/cerc-io/laconic2d/x/auction"; + +// Query defines the gRPC querier interface for the auction module +service Query { + // Params queries auction module params + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cerc/auction/v1/params"; + } + + // Auctions queries all auctions + rpc Auctions(QueryAuctionsRequest) returns (QueryAuctionsResponse) { + option (google.api.http).get = "/cerc/auction/v1/auctions"; + } + + // GetAuction queries an auction + rpc GetAuction(QueryAuctionRequest) returns (QueryAuctionResponse) { + option (google.api.http).get = "/cerc/auction/v1/auctions/{id}"; + } + + // GetBid queries an auction bid + rpc GetBid(QueryBidRequest) returns (QueryBidResponse) { + option (google.api.http).get = "/cerc/auction/v1/bids/{auction_id}/{bidder}"; + } + + // GetBids queries all auction bids + rpc GetBids(QueryBidsRequest) returns (QueryBidsResponse) { + option (google.api.http).get = "/cerc/auction/v1/bids/{auction_id}"; + } + + // AuctionsByBidder queries auctions by bidder + rpc AuctionsByBidder(QueryAuctionsByBidderRequest) returns (QueryAuctionsByBidderResponse) { + option (google.api.http).get = "/cerc/auction/v1/by-bidder/{bidder_address}"; + } + + // AuctionsByOwner queries auctions by owner + rpc AuctionsByOwner(QueryAuctionsByOwnerRequest) returns (QueryAuctionsByOwnerResponse) { + option (google.api.http).get = "/cerc/auction/v1/by-owner/{owner_address}"; + } + + // GetAuctionModuleBalance queries the auction module account balance + rpc GetAuctionModuleBalance(QueryGetAuctionModuleBalanceRequest) returns (QueryGetAuctionModuleBalanceResponse) { + option (google.api.http).get = "/cerc/auction/v1/balance"; + } +} + +// QueryParamsRequest is the format to query the parameters of the auction module +message QueryParamsRequest {} + +// QueryParamsResponse returns parameters of the auction module +message QueryParamsResponse { + Params params = 1; +} // AuctionsRequest is the format for querying all the auctions -message AuctionsRequest { +message QueryAuctionsRequest { // pagination defines an optional pagination info for the next request cosmos.base.query.v1beta1.PageRequest pagination = 1; } // AuctionsResponse returns the list of all auctions -message AuctionsResponse { +message QueryAuctionsResponse { // List of auctions Auctions auctions = 1; // pagination defines an optional pagination info for the next request @@ -24,126 +76,75 @@ message AuctionsResponse { } // AuctionRequest is the format for querying a specific auction -message AuctionRequest { - // Auction ID +message QueryAuctionRequest { + // Auction id string id = 1; } // AuctionResponse returns the details of the queried auction -message AuctionResponse { +message QueryAuctionResponse { // Auction details Auction auction = 1; } // BidRequest is the format for querying a specific bid in an auction -message BidRequest { - // Auction ID +message QueryBidRequest { + // Auction id string auction_id = 1; // Bidder address string bidder = 2; } // BidResponse returns the details of the queried bid -message BidResponse { +message QueryBidResponse { // Bid details Bid bid = 1; } // BidsRequest is the format for querying all bids in an auction -message BidsRequest { - // Auction ID +message QueryBidsRequest { + // Auction id string auction_id = 1; } // BidsResponse returns details of all bids in an auction -message BidsResponse { +message QueryBidsResponse { // List of bids in the auction repeated Bid bids = 1; } // AuctionsByBidderRequest is the format for querying all auctions containing a bidder address -message AuctionsByBidderRequest { +message QueryAuctionsByBidderRequest { // Address of the bidder string bidder_address = 1; } // AuctionsByBidderResponse returns all auctions containing a bidder -message AuctionsByBidderResponse { +message QueryAuctionsByBidderResponse { // List of auctions Auctions auctions = 1; } // AuctionsByOwnerRequest is the format for querying all auctions created by an owner -message AuctionsByOwnerRequest { +message QueryAuctionsByOwnerRequest { // Address of the owner string owner_address = 1; } // AuctionsByOwnerResponse returns all auctions created by an owner -message AuctionsByOwnerResponse { +message QueryAuctionsByOwnerResponse { // List of auctions Auctions auctions = 1; } -// QueryParamsRequest is the format to query the parameters of the auction module -message QueryParamsRequest { -} - -// QueryParamsResponse returns parameters of the auction module -message QueryParamsResponse { - Params params = 1; -} - // BalanceRequest is the format to fetch all balances -message BalanceRequest { -} +message QueryGetAuctionModuleBalanceRequest {} -message BalanceResponse { +message QueryGetAuctionModuleBalanceResponse { // Set of all balances within the auction repeated cosmos.base.v1beta1.Coin balance = 1 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" ]; } - -// Query defines the gRPC querier interface for the auction module -service Query { - // Auctions queries all auctions - rpc Auctions(AuctionsRequest) returns (AuctionsResponse) { - option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions"; - } - - // GetAuction queries an auction - rpc GetAuction(AuctionRequest) returns (AuctionResponse) { - option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions/{id}"; - } - - // GetBid queries an auction bid - rpc GetBid(BidRequest) returns (BidResponse) { - option (google.api.http).get = "/vulcanize/auction/v1beta1/bids/{auction_id}/{bidder}"; - } - - // GetBids queries all auction bids - rpc GetBids(BidsRequest) returns (BidsResponse) { - option (google.api.http).get = "/vulcanize/auction/v1beta1/bids/{auction_id}"; - } - - // AuctionsByBidder queries auctions by bidder - rpc AuctionsByBidder(AuctionsByBidderRequest) returns (AuctionsByBidderResponse) { - option (google.api.http).get = "/vulcanize/auction/v1beta1/by-bidder/{bidder_address}"; - } - - // AuctionsByOwner queries auctions by owner - rpc AuctionsByOwner(AuctionsByOwnerRequest) returns (AuctionsByOwnerResponse) { - option (google.api.http).get = "/vulcanize/auction/v1beta1/by-owner/{owner_address}"; - } - - // QueryParams implements the params query command - rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/vulcanize/auction/v1beta1/params"; - } - - // Balance queries the auction module account balance - rpc Balance(BalanceRequest) returns (BalanceResponse) { - option (google.api.http).get = "/vulcanize/auction/v1beta1/balance"; - } -} diff --git a/proto/vulcanize/auction/v1beta1/tx.proto b/proto/cerc/auction/v1/tx.proto similarity index 53% rename from proto/vulcanize/auction/v1beta1/tx.proto rename to proto/cerc/auction/v1/tx.proto index 9602dec..ee6a714 100644 --- a/proto/vulcanize/auction/v1beta1/tx.proto +++ b/proto/cerc/auction/v1/tx.proto @@ -1,122 +1,129 @@ syntax = "proto3"; -package vulcanize.auction.v1beta1; +package cerc.auction.v1; + +import "cosmos/msg/v1/msg.proto"; import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; import "google/protobuf/duration.proto"; import "cosmos/base/v1beta1/coin.proto"; -import "vulcanize/auction/v1beta1/types.proto"; +import "cerc/auction/v1/auction.proto"; -option go_package = "github.com/tharsis/ethermint/x/auction/types"; +option go_package = "git.vdb.to/cerc-io/laconic2d/x/auction"; + +// Tx defines the gRPC tx interface +service Msg { + option (cosmos.msg.v1.service) = true; + + // CreateAuction is the command for creating an auction + rpc CreateAuction(MsgCreateAuction) returns (MsgCreateAuctionResponse) { + option (google.api.http).post = "/cerc/auction/v1/create_auction"; + }; + + // CommitBid is the command for committing a bid + rpc CommitBid(MsgCommitBid) returns (MsgCommitBidResponse) { + option (google.api.http).post = "/cerc/auction/v1/commit_bid"; + }; + + // RevealBid is the command for revealing a bid + rpc RevealBid(MsgRevealBid) returns (MsgRevealBidResponse) { + option (google.api.http).post = "/cerc/auction/v1/reveal_bid"; + }; +} // MsgCreateAuction defines a create auction message message MsgCreateAuction { option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; // Duration of the commits phase in seconds google.protobuf.Duration commits_duration = 1 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = false, (gogoproto.stdduration) = true, - (gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\"" + (gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\"" ]; + // Duration of the reveals phase in seconds google.protobuf.Duration reveals_duration = 2 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = false, (gogoproto.stdduration) = true, - (gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\"" + (gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\"" ]; + // Commit fees cosmos.base.v1beta1.Coin commit_fee = 3 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" ]; + // Reveal fees cosmos.base.v1beta1.Coin reveal_fee = 4 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" ]; + // Minimum acceptable bid amount cosmos.base.v1beta1.Coin minimum_bid = 5 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" ]; + // Address of the signer - string signer = 6 [ - (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" - ]; + string signer = 6 [(gogoproto.moretags) = "json:\"signer\" yaml:\"signer\""]; } // MsgCreateAuctionResponse returns the details of the created auction message MsgCreateAuctionResponse { option (gogoproto.goproto_getters) = false; + // Auction details - Auction auction = 1 [ - (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" - ]; + Auction auction = 1 [(gogoproto.moretags) = "json:\"auction\" yaml:\"auction\""]; } // CommitBid defines the message to commit a bid message MsgCommitBid { option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; + + // Auction id + string auction_id = 1 [(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""]; - // Auction ID - string auction_id = 1 [ - (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" - ]; // Commit Hash - string commit_hash = 2 [ - (gogoproto.moretags) = "json:\"commit_hash\" yaml:\"commit_hash\"" - ]; - // Address of the signer - string signer = 3 [ - (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" - ]; -} + string commit_hash = 2 [(gogoproto.moretags) = "json:\"commit_hash\" yaml:\"commit_hash\""]; -// RevealBid defines the message to reveal a bid -message MsgRevealBid { - option (gogoproto.goproto_getters) = false; - - // Auction ID - string auction_id = 1 [ - (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" - ]; - // Commit Hash - string reveal = 2 [ - (gogoproto.moretags) = "json:\"reveal\" yaml:\"reveal\"" - ]; // Address of the signer - string signer = 3 [ - (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" - ]; + string signer = 3 [(gogoproto.moretags) = "json:\"signer\" yaml:\"signer\""]; } // MsgCommitBidResponse returns the state of the auction after the bid creation message MsgCommitBidResponse { option (gogoproto.goproto_getters) = false; + // Auction details - Bid bid = 1 [ - (gogoproto.moretags) = "json:\"bid\" yaml:\"bid\"" - ]; + Bid bid = 1 [(gogoproto.moretags) = "json:\"bid\" yaml:\"bid\""]; } + +// RevealBid defines the message to reveal a bid +message MsgRevealBid { + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; + + // Auction id + string auction_id = 1 [(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""]; + + // Commit Hash + string reveal = 2 [(gogoproto.moretags) = "json:\"reveal\" yaml:\"reveal\""]; + + // Address of the signer + string signer = 3 [(gogoproto.moretags) = "json:\"signer\" yaml:\"signer\""]; +} + + // MsgRevealBidResponse returns the state of the auction after the bid reveal message MsgRevealBidResponse { option (gogoproto.goproto_getters) = false; + // Auction details - Auction auction = 1 [ - (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" - ]; + Auction auction = 1 [(gogoproto.moretags) = "json:\"auction\" yaml:\"auction\""]; } - -// Tx defines the gRPC tx interface -service Msg { - // CreateAuction is the command for creating an auction - rpc CreateAuction(MsgCreateAuction) returns (MsgCreateAuctionResponse); - - // CommitBid is the command for committing a bid - rpc CommitBid(MsgCommitBid) returns (MsgCommitBidResponse); - - //RevealBid is the command for revealing a bid - rpc RevealBid(MsgRevealBid) returns (MsgRevealBidResponse); -} - diff --git a/proto/cerc/bond/module/v1/module.proto b/proto/cerc/bond/module/v1/module.proto new file mode 100644 index 0000000..fb868aa --- /dev/null +++ b/proto/cerc/bond/module/v1/module.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package cerc.bond.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the app config object of the module. +// Learn more: https://docs.cosmos.network/main/building-modules/depinject +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import : "git.vdb.to/cerc-io/laconic2d/x/bond" + }; +} diff --git a/proto/vulcanize/bond/v1beta1/bond.proto b/proto/cerc/bond/v1/bond.proto similarity index 65% rename from proto/vulcanize/bond/v1beta1/bond.proto rename to proto/cerc/bond/v1/bond.proto index c5b3214..6b6cc21 100644 --- a/proto/vulcanize/bond/v1beta1/bond.proto +++ b/proto/cerc/bond/v1/bond.proto @@ -1,12 +1,13 @@ syntax = "proto3"; -package vulcanize.bond.v1beta1; -option go_package = "github.com/tharsis/ethermint/x/bond/types"; +package cerc.bond.v1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; -// Params defines the bond module parameters +option go_package = "git.vdb.to/cerc-io/laconic2d/x/bond"; + +// Params defines the parameters of the bond module. message Params { // max_bond_amount is maximum amount to bond cosmos.base.v1beta1.Coin max_bond_amount = 1 [ @@ -19,11 +20,14 @@ message Params { message Bond { // id is unique identifier of the bond string id = 1; + // owner of the bond string owner = 2; + // balance of the bond repeated cosmos.base.v1beta1.Coin balance = 3 [ - (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "json:\"balance\" yaml:\"balance\"" + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"balance\" yaml:\"balance\"" ]; } diff --git a/proto/vulcanize/bond/v1beta1/genesis.proto b/proto/cerc/bond/v1/genesis.proto similarity index 54% rename from proto/vulcanize/bond/v1beta1/genesis.proto rename to proto/cerc/bond/v1/genesis.proto index 7f46f06..b6f922f 100644 --- a/proto/vulcanize/bond/v1beta1/genesis.proto +++ b/proto/cerc/bond/v1/genesis.proto @@ -1,10 +1,11 @@ syntax = "proto3"; -package vulcanize.bond.v1beta1; + +package cerc.bond.v1; import "gogoproto/gogo.proto"; -import "vulcanize/bond/v1beta1/bond.proto"; +import "cerc/bond/v1/bond.proto"; -option go_package = "github.com/tharsis/ethermint/x/bond/types"; +option go_package = "git.vdb.to/cerc-io/laconic2d/x/bond"; // GenesisState defines the bond module's genesis state. message GenesisState { @@ -12,7 +13,5 @@ message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; // bonds defines all the bonds - repeated Bond bonds = 2 [ - (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\"" - ]; + repeated Bond bonds = 2 [(gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""]; } diff --git a/proto/vulcanize/bond/v1beta1/query.proto b/proto/cerc/bond/v1/query.proto similarity index 57% rename from proto/vulcanize/bond/v1beta1/query.proto rename to proto/cerc/bond/v1/query.proto index 866c3c0..9745232 100644 --- a/proto/vulcanize/bond/v1beta1/query.proto +++ b/proto/cerc/bond/v1/query.proto @@ -1,84 +1,80 @@ syntax = "proto3"; -package vulcanize.bond.v1beta1; + +package cerc.bond.v1; import "gogoproto/gogo.proto"; -import "vulcanize/bond/v1beta1/bond.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cerc/bond/v1/bond.proto"; +// import "cosmos/query/v1/query.proto"; -option go_package = "github.com/tharsis/ethermint/x/bond/types"; +option go_package = "git.vdb.to/cerc-io/laconic2d/x/bond"; // Query defines the gRPC querier service for bond module service Query { // Params queries bonds module params. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/vulcanize/bond/v1beta1/params"; + option (google.api.http).get = "/cerc/bond/v1/params"; } - // Bonds queries bonds list. + // Bonds queries bonds list rpc Bonds(QueryGetBondsRequest) returns (QueryGetBondsResponse) { - option (google.api.http).get = "/vulcanize/bond/v1beta1/bonds"; + // Mark query as module_query_safe? + // option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cerc/bond/v1/bonds"; } // GetBondById - rpc GetBondById(QueryGetBondByIdRequest) returns (QueryGetBondByIdResponse){ - option (google.api.http).get = "/vulcanize/bond/v1beta1/bonds/{id}"; + rpc GetBondById(QueryGetBondByIdRequest) returns (QueryGetBondByIdResponse) { + option (google.api.http).get = "/cerc/bond/v1/bonds/{id}"; } - // Get Bonds List by Owner - rpc GetBondsByOwner(QueryGetBondsByOwnerRequest) returns (QueryGetBondsByOwnerResponse){ - option (google.api.http).get = "/vulcanize/bond/v1beta1/by-owner/{owner}"; + // Get Bonds list by Owner + rpc GetBondsByOwner(QueryGetBondsByOwnerRequest) returns (QueryGetBondsByOwnerResponse) { + option (google.api.http).get = "/cerc/bond/v1/by-owner/{owner}"; } - // Get Bonds module balance - rpc GetBondsModuleBalance(QueryGetBondModuleBalanceRequest) returns (QueryGetBondModuleBalanceResponse){ - option (google.api.http).get = "/vulcanize/bond/v1beta1/balance"; + // Get Bond module balance + rpc GetBondsModuleBalance(QueryGetBondModuleBalanceRequest) returns (QueryGetBondModuleBalanceResponse) { + option (google.api.http).get = "/cerc/bond/v1/balance"; } } // QueryParamsRequest is request for query the bond module params -message QueryParamsRequest{ -} +message QueryParamsRequest {} // QueryParamsResponse returns response type of bond module params -message QueryParamsResponse{ - Params params = 1 [ - (gogoproto.moretags) = "json:\"params\" yaml:\"params\"" - ]; +message QueryParamsResponse { + Params params = 1 [(gogoproto.moretags) = "json:\"params\" yaml:\"params\""]; } -// QueryGetBondById queries a bond by bond-id. -message QueryGetBondsRequest{ +// QueryGetBondById queries a bonds. +message QueryGetBondsRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; } // QueryGetBondsResponse is response type for get the bonds by bond-id -message QueryGetBondsResponse{ - repeated Bond bonds = 1 [ - (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\"" - ]; +message QueryGetBondsResponse { + repeated Bond bonds = 1 [(gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""]; + // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryGetBondById -message QueryGetBondByIdRequest{ - string id = 1 [ - (gogoproto.moretags) = "json:\"id\" yaml:\"id\"" - ]; +message QueryGetBondByIdRequest { + string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""]; } // QueryGetBondByIdResponse returns QueryGetBondById query response -message QueryGetBondByIdResponse{ - Bond bond = 1 [ - (gogoproto.moretags) = "json:\"bond\" yaml:\"bond\"" - ]; +message QueryGetBondByIdResponse { + Bond bond = 1 [(gogoproto.moretags) = "json:\"bond\" yaml:\"bond\""]; } // QueryGetBondsByOwnerRequest is request type for Query/GetBondsByOwner RPC Method -message QueryGetBondsByOwnerRequest{ +message QueryGetBondsByOwnerRequest { string owner = 1; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -90,20 +86,19 @@ message QueryGetBondsByOwnerResponse { (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\"" ]; + // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryGetBondModuleBalanceRequest is request type for bond module balance rpc method -message QueryGetBondModuleBalanceRequest{ - -} +message QueryGetBondModuleBalanceRequest {} // QueryGetBondModuleBalanceResponse is the response type for bond module balance rpc method -message QueryGetBondModuleBalanceResponse{ - repeated cosmos.base.v1beta1.Coin balance = 2 [ - (gogoproto.nullable) = false, +message QueryGetBondModuleBalanceResponse { + repeated cosmos.base.v1beta1.Coin balance = 1 [ + (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" ]; } diff --git a/proto/cerc/bond/v1/tx.proto b/proto/cerc/bond/v1/tx.proto new file mode 100644 index 0000000..2fbc450 --- /dev/null +++ b/proto/cerc/bond/v1/tx.proto @@ -0,0 +1,95 @@ +syntax = "proto3"; + +package cerc.bond.v1; + +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "git.vdb.to/cerc-io/laconic2d/x/bond"; + +// Msg defines the bond Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // CreateBond defines a method for creating a new bond. + rpc CreateBond(MsgCreateBond) returns (MsgCreateBondResponse) { + option (google.api.http).post = "/cerc/bond/v1/create_bond"; + }; + + // RefillBond defines a method for refilling amount for bond. + rpc RefillBond(MsgRefillBond) returns (MsgRefillBondResponse) { + option (google.api.http).post = "/cerc/bond/v1/refill_bond"; + }; + + // WithdrawBond defines a method for withdrawing amount from bond. + rpc WithdrawBond(MsgWithdrawBond) returns (MsgWithdrawBondResponse) { + option (google.api.http).post = "/cerc/bond/v1/withdraw_bond"; + }; + + // CancelBond defines a method for cancelling a bond. + rpc CancelBond(MsgCancelBond) returns (MsgCancelBondResponse) { + option (google.api.http).post = "/cerc/bond/v1/cancel_bond"; + }; +} + +// MsgCreateBond defines a SDK message for creating a new bond. +message MsgCreateBond { + option (cosmos.msg.v1.signer) = "signer"; + + string signer = 1; + repeated cosmos.base.v1beta1.Coin coins = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" + ]; +} + +// MsgCreateBondResponse defines the Msg/CreateBond response type. +message MsgCreateBondResponse { + string id = 1; +} + +// MsgRefillBond defines a SDK message for refill the amount for bond. +message MsgRefillBond { + option (cosmos.msg.v1.signer) = "signer"; + + string id = 1; + string signer = 2; + repeated cosmos.base.v1beta1.Coin coins = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" + ]; +} + +// MsgRefillBondResponse defines the Msg/RefillBond response type. +message MsgRefillBondResponse {} + +// MsgWithdrawBond defines a SDK message for withdrawing amount from bond. +message MsgWithdrawBond { + option (cosmos.msg.v1.signer) = "signer"; + + string id = 1; + string signer = 2; + repeated cosmos.base.v1beta1.Coin coins = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" + ]; +} + +// MsgWithdrawBondResponse defines the Msg/WithdrawBond response type. +message MsgWithdrawBondResponse {} + +// MsgCancelBond defines a SDK message for the cancel the bond. +message MsgCancelBond { + option (cosmos.msg.v1.signer) = "signer"; + + string id = 1; + string signer = 2; +} + +// MsgCancelBondResponse defines the Msg/CancelBond response type. +message MsgCancelBondResponse {} diff --git a/proto/cerc/registry/module/v1/module.proto b/proto/cerc/registry/module/v1/module.proto new file mode 100644 index 0000000..b09e2fc --- /dev/null +++ b/proto/cerc/registry/module/v1/module.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package cerc.registry.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the app config object of the module. +// Learn more: https://docs.cosmos.network/main/building-modules/depinject +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import : "git.vdb.to/cerc-io/laconic2d/x/registry" + }; +} diff --git a/proto/cerc/registry/v1/genesis.proto b/proto/cerc/registry/v1/genesis.proto new file mode 100644 index 0000000..b622a79 --- /dev/null +++ b/proto/cerc/registry/v1/genesis.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package cerc.registry.v1; + +import "gogoproto/gogo.proto"; +import "cerc/registry/v1/registry.proto"; + +option go_package = "git.vdb.to/cerc-io/laconic2d/x/registry"; + +// GenesisState defines the registry module's genesis state. +message GenesisState { + // params defines all the params of registry module. + Params params = 1 [(gogoproto.nullable) = false]; + + // records + repeated Record records = 2 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"records\" yaml:\"records\"" + ]; + + // authorities + repeated AuthorityEntry authorities = 3 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"authorities\" yaml:\"authorities\"" + ]; + + // names + repeated NameEntry names = 4 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"names\" yaml:\"names\"" + ]; +} diff --git a/proto/cerc/registry/v1/query.proto b/proto/cerc/registry/v1/query.proto new file mode 100644 index 0000000..8e5ea12 --- /dev/null +++ b/proto/cerc/registry/v1/query.proto @@ -0,0 +1,200 @@ +syntax = "proto3"; + +package cerc.registry.v1; + +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cerc/registry/v1/registry.proto"; + +option go_package = "git.vdb.to/cerc-io/laconic2d/x/registry"; + +// Query defines the gRPC querier service for registry module +service Query { + // Params queries the registry module params. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cerc/registry/v1/params"; + } + + // Records queries all records + rpc Records(QueryRecordsRequest) returns (QueryRecordsResponse) { + option (google.api.http).get = "/cerc/registry/v1/records"; + } + + // Get record by id + rpc GetRecord(QueryRecordByIdRequest) returns (QueryRecordByIdResponse) { + option (google.api.http).get = "/cerc/registry/v1/records/{id}"; + } + + // Get records by bond id + rpc GetRecordsByBondId(QueryRecordsByBondIdRequest) returns (QueryRecordsByBondIdResponse) { + option (google.api.http).get = "/cerc/registry/v1/records-by-bond-id/{id}"; + } + + // NameRecords queries all name records + rpc NameRecords(QueryNameRecordsRequest) returns (QueryNameRecordsResponse) { + option (google.api.http).get = "/cerc/registry/v1/names"; + } + + // Whois method retrieve the name authority info + rpc Whois(QueryWhoisRequest) returns (QueryWhoisResponse) { + option (google.api.http).get = "/cerc/registry/v1/whois/{name}"; + } + + // LookupLrn + rpc LookupLrn(QueryLookupLrnRequest) returns (QueryLookupLrnResponse) { + option (google.api.http).get = "/cerc/registry/v1/lookup"; + } + + // ResolveLrn + rpc ResolveLrn(QueryResolveLrnRequest) returns (QueryResolveLrnResponse) { + option (google.api.http).get = "/cerc/registry/v1/resolve"; + } + + // Get registry module balance + rpc GetRegistryModuleBalance(QueryGetRegistryModuleBalanceRequest) returns (QueryGetRegistryModuleBalanceResponse) { + option (google.api.http).get = "/cerc/registry/v1/balance"; + } +} + +// QueryParamsRequest is request type for registry params +message QueryParamsRequest {} + +// QueryParamsResponse is response type for registry params +message QueryParamsResponse { + Params params = 1; +} + +// QueryRecordsRequest is request type for registry records list +message QueryRecordsRequest { + // TODO: Unused, check + // message LinkInput { + // string id = 1; + // } + + message ArrayInput { + repeated ValueInput values = 1; + } + message MapInput { + map values = 1; + } + message ValueInput { + // Type of record attribute value + oneof value { + string string = 1; + int64 int = 2; + double float = 3; + bool boolean = 4; + string link = 5; + ArrayInput array = 6; + MapInput map = 7; + } + } + message KeyValueInput { + string key = 1; + ValueInput value = 2; + } + + repeated KeyValueInput attributes = 1; + + bool all = 2; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 3; +} + +// QueryRecordsResponse is response type for registry records list +message QueryRecordsResponse { + repeated Record records = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryRecordByIdRequest is request type for registry records by id +message QueryRecordByIdRequest { + string id = 1; +} + +// QueryRecordByIdResponse is response type for registry records by id +message QueryRecordByIdResponse { + Record record = 1 [(gogoproto.nullable) = false]; +} + +// QueryRecordsByBondIdRequest is request type for get the records by bond-id +message QueryRecordsByBondIdRequest { + string id = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryRecordsByBondIdResponse is response type for records list by bond-id +message QueryRecordsByBondIdResponse { + repeated Record records = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryNameRecordsRequest is request type for registry names records +message QueryNameRecordsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryNameRecordsResponse is response type for registry names records +message QueryNameRecordsResponse { + repeated NameEntry names = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryWhoisRequest is request type for Get NameAuthority +message QueryWhoisRequest { + string name = 1; +} + +// QueryWhoisResponse is response type for whois request +message QueryWhoisResponse { + NameAuthority name_authority = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"name_authority\" yaml:\"name_authority\"" + ]; +} + +// QueryLookupLrnRequest is request type for LookupLrn +message QueryLookupLrnRequest { + string lrn = 1; +} + +// QueryLookupLrnResponse is response type for QueryLookupLrnRequest +message QueryLookupLrnResponse { + NameRecord name = 1; +} + +// QueryResolveLrnRequest is request type for ResolveLrn +message QueryResolveLrnRequest { + string lrn = 1; +} + +// QueryResolveLrnResponse is response type for QueryResolveLrnRequest +message QueryResolveLrnResponse { + Record record = 1; +} + +// QueryGetRegistryModuleBalanceRequest is request type for registry module accounts balance +message QueryGetRegistryModuleBalanceRequest {} + +// QueryGetRegistryModuleBalanceResponse is response type for registry module accounts balance +message QueryGetRegistryModuleBalanceResponse { + repeated AccountBalance balances = 1; +} + +// AccountBalance is registry module account balance +message AccountBalance { + string account_name = 1 [(gogoproto.moretags) = "json:\"account_name\" yaml:\"account_name\""]; + repeated cosmos.base.v1beta1.Coin balance = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"balance\" yaml:\"balance\"" + ]; +} diff --git a/proto/vulcanize/registry/v1beta1/registry.proto b/proto/cerc/registry/v1/registry.proto similarity index 56% rename from proto/vulcanize/registry/v1beta1/registry.proto rename to proto/cerc/registry/v1/registry.proto index 035d6c2..a97bbeb 100644 --- a/proto/vulcanize/registry/v1beta1/registry.proto +++ b/proto/cerc/registry/v1/registry.proto @@ -1,74 +1,88 @@ syntax = "proto3"; -package vulcanize.registry.v1beta1; + +package cerc.registry.v1; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/cerc-io/laconicd/x/registry/types"; +option go_package = "git.vdb.to/cerc-io/laconic2d/x/registry"; // Params defines the registry module parameters message Params { - cosmos.base.v1beta1.Coin record_rent = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"record_rent\" yaml:\"record_rent\""]; + cosmos.base.v1beta1.Coin record_rent = 1[ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"record_rent\" yaml:\"record_rent\"" + ]; + google.protobuf.Duration record_rent_duration = 2 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "json:\"record_rent_duration\" yaml:\"record_rent_duration\"" ]; - cosmos.base.v1beta1.Coin authority_rent = 3 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"authority_rent\" yaml:\"authority_rent\""]; + + cosmos.base.v1beta1.Coin authority_rent = 3 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"authority_rent\" yaml:\"authority_rent\"" + ]; + google.protobuf.Duration authority_rent_duration = 4 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "json:\"authority_rent_duration\" yaml:\"authority_rent_duration\"" ]; + google.protobuf.Duration authority_grace_period = 5 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "json:\"authority_grace_period\" yaml:\"authority_grace_period\"" ]; - bool authority_auction_enabled = 6 - [(gogoproto.moretags) = "json:\"authority_auction_enabled\" yaml:\"authority_auction_enabled\""]; + + bool authority_auction_enabled = 6 [(gogoproto.moretags) = "json:\"authority_auction_enabled\" yaml:\"authority_auction_enabled\""]; + google.protobuf.Duration authority_auction_commits_duration = 7 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "json:\"authority_auction_commits_duration\" yaml:\"authority_auction_commits_duration\"" ]; + google.protobuf.Duration authority_auction_reveals_duration = 8 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "json:\"authority_auction_reveals_duration\" yaml:\"authority_auction_reveals_duration\"" ]; + cosmos.base.v1beta1.Coin authority_auction_commit_fee = 9 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"authority_auction_commit_fee\" yaml:\"authority_auction_commit_fee\"" ]; + cosmos.base.v1beta1.Coin authority_auction_reveal_fee = 10 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"authority_auction_reveal_fee\" yaml:\"authority_auction_reveal_fee\"" ]; + cosmos.base.v1beta1.Coin authority_auction_minimum_bid = 11 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"authority_auction_minimum_bid\" yaml:\"authority_auction_minimum_bid\"" ]; } -// Params defines the registry module records +// Record defines a registry record message Record { - string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""]; - string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""]; - string create_time = 3 [(gogoproto.moretags) = "json:\"createTime\" yaml:\"createTime\""]; - string expiry_time = 4 [(gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\""]; - bool deleted = 5; - repeated string owners = 6 [(gogoproto.moretags) = "json:\"owners\" yaml:\"owners\""]; - bytes attributes = 7 [(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""]; - repeated string names = 8 [(gogoproto.moretags) = "json:\"names\" yaml:\"names\""]; - string type = 9 [(gogoproto.moretags) = "json:\"types\" yaml:\"types\""]; + string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""]; + string bond_id = 2 [(gogoproto.moretags) = "json:\"bond_id\" yaml:\"bond_id\""]; + string create_time = 3 [(gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\""]; + string expiry_time = 4 [(gogoproto.moretags) = "json:\"expiry_time\" yaml:\"expiry_time\""]; + bool deleted = 5; + repeated string owners = 6 [(gogoproto.moretags) = "json:\"owners\" yaml:\"owners\""]; + bytes attributes = 7 [(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""]; + repeated string names = 8 [(gogoproto.moretags) = "json:\"names\" yaml:\"names\""]; + string type = 9 [(gogoproto.moretags) = "json:\"types\" yaml:\"types\""]; } -// AuthorityEntry defines the registry module AuthorityEntries +// AuthorityEntry defines a registry authority message AuthorityEntry { string name = 1; NameAuthority entry = 2; @@ -77,18 +91,19 @@ message AuthorityEntry { // NameAuthority message NameAuthority { // Owner public key. - string owner_public_key = 1 [(gogoproto.moretags) = "json:\"ownerPublicKey\" yaml:\"ownerPublicKey\""]; + string owner_public_key = 1 [(gogoproto.moretags) = "json:\"owner_public_key\" yaml:\"owner_public_key\""]; // Owner address. - string owner_address = 2 [(gogoproto.moretags) = "json:\"ownerAddress\" yaml:\"ownerAddress\""]; + string owner_address = 2 [(gogoproto.moretags) = "json:\"owner_address\" yaml:\"owner_address\""]; // height at which name/authority was created. uint64 height = 3; string status = 4; - string auction_id = 5 [(gogoproto.moretags) = "json:\"auctionID\" yaml:\"auctionID\""]; - string bond_id = 6 [(gogoproto.moretags) = "json:\"bondID\" yaml:\"bondID\""]; + string auction_id = 5 [(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""]; + string bond_id = 6 [(gogoproto.moretags) = "json:\"bond_id\" yaml:\"bond_id\""]; + google.protobuf.Timestamp expiry_time = 7 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true, - (gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\"" + (gogoproto.moretags) = "json:\"expiry_time\" yaml:\"expiry_time\"" ]; } @@ -98,7 +113,7 @@ message NameEntry { NameRecord entry = 2; } -// NameRecord +// NameRecord defines a versioned name record message NameRecord { NameRecordEntry latest = 1; repeated NameRecordEntry history = 2; @@ -113,21 +128,19 @@ message NameRecordEntry { // Signature message Signature { string sig = 1 [(gogoproto.moretags) = "json:\"sig\" yaml:\"sig\""]; - string pub_key = 2 [(gogoproto.moretags) = "json:\"pubKey\" yaml:\"pubKey\""]; + string pub_key = 2 [(gogoproto.moretags) = "json:\"pub_key\" yaml:\"pub_key\""]; } -// BlockChangeSet -message BlockChangeSet { - int64 height = 1; - repeated string records = 2; - repeated string auctions = 3; - repeated AuctionBidInfo auction_bids = 4 [(gogoproto.moretags) = "json:\"auctionBids\" yaml:\"auctionBids\""]; - repeated string authorities = 5; - repeated string names = 6; +// ExpiryQueue: record / authority expiry queue type +// id: expiry time +// value: array of ids (record cids / authority names) +message ExpiryQueue { + string id = 1; + repeated string value = 2; } -// AuctionBidInfo -message AuctionBidInfo { - string auction_id = 1 [(gogoproto.moretags) = "json:\"auctionID\" yaml:\"auctionID\""]; - string bidder_address = 2 [(gogoproto.moretags) = "json:\"bidderAddress\" yaml:\"bidderAddress\""]; +// List of record ids +// Value type to be used in AttributesMap +message RecordsList { + repeated string value = 1; } diff --git a/proto/cerc/registry/v1/tx.proto b/proto/cerc/registry/v1/tx.proto new file mode 100644 index 0000000..8e88402 --- /dev/null +++ b/proto/cerc/registry/v1/tx.proto @@ -0,0 +1,194 @@ +syntax = "proto3"; + +package cerc.registry.v1; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cerc/registry/v1/registry.proto"; + +option go_package = "git.vdb.to/cerc-io/laconic2d/x/registry"; + +// Msg is a service which exposes the registry functionality +service Msg { + option (cosmos.msg.v1.service) = true; + + // SetRecord records a new record with given payload and bond id + rpc SetRecord(MsgSetRecord) returns (MsgSetRecordResponse) { + option (google.api.http).post = "/cerc/registry/v1/set_record"; + } + + // Renew Record renews an expired record + rpc RenewRecord(MsgRenewRecord) returns (MsgRenewRecordResponse) { + option (google.api.http).post = "/cerc/registry/v1/renew_record"; + } + + // AssociateBond + rpc AssociateBond(MsgAssociateBond) returns (MsgAssociateBondResponse) { + option (google.api.http).post = "/cerc/registry/v1/associate_bond"; + } + + // DissociateBond + rpc DissociateBond(MsgDissociateBond) returns (MsgDissociateBondResponse) { + option (google.api.http).post = "/cerc/registry/v1/dissociate_bond"; + } + + // DissociateRecords + rpc DissociateRecords(MsgDissociateRecords) returns (MsgDissociateRecordsResponse) { + option (google.api.http).post = "/cerc/registry/v1/dissociate_records"; + } + + // ReassociateRecords + rpc ReassociateRecords(MsgReassociateRecords) returns (MsgReassociateRecordsResponse) { + option (google.api.http).post = "/cerc/registry/v1/reassociate_records"; + } + + // SetName will store the name with given lrn and name + rpc SetName(MsgSetName) returns (MsgSetNameResponse) { + option (google.api.http).post = "/cerc/registry/v1/set_name"; + } + + // Reserve name + rpc ReserveName(MsgReserveAuthority) returns (MsgReserveAuthorityResponse) { + option (google.api.http).post = "/cerc/registry/v1/reserve_name"; + } + + // Delete Name method will remove authority name + rpc DeleteName(MsgDeleteNameAuthority) returns (MsgDeleteNameAuthorityResponse) { + option (google.api.http).post = "/cerc/registry/v1/delete_name"; + } + + // SetAuthorityBond + rpc SetAuthorityBond(MsgSetAuthorityBond) returns (MsgSetAuthorityBondResponse) { + option (google.api.http).post = "/cerc/registry/v1/set_authority_bond"; + } +} + +// MsgSetRecord +message MsgSetRecord { + option (cosmos.msg.v1.signer) = "signer"; + + string bond_id = 1 [(gogoproto.moretags) = "json:\"bond_id\" yaml:\"bond_id\""]; + string signer = 2; + Payload payload = 3 [(gogoproto.nullable) = false]; +} + +// MsgSetRecordResponse +message MsgSetRecordResponse { + string id = 1; +} + +// Payload +message Payload { + Record record = 1; + repeated Signature signatures = 2 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"signatures\" yaml:\"signatures\"" + ]; +} + +// MsgSetName +message MsgSetName { + option (cosmos.msg.v1.signer) = "signer"; + + string lrn = 1; + string cid = 2; + string signer = 3; +} + +// MsgSetNameResponse +message MsgSetNameResponse {} + +// MsgReserveName +message MsgReserveAuthority { + option (cosmos.msg.v1.signer) = "signer"; + + string name = 1; + string signer = 2; + + // if creating a sub-authority. + string owner = 3; +} + +// MsgReserveNameResponse +message MsgReserveAuthorityResponse {} + +// MsgSetAuthorityBond +message MsgSetAuthorityBond { + option (cosmos.msg.v1.signer) = "signer"; + + string name = 1; + string bond_id = 2 [(gogoproto.moretags) = "json:\"bond_id\" yaml:\"bond_id\""]; + string signer = 3; +} + +// MsgSetAuthorityBondResponse +message MsgSetAuthorityBondResponse {} + +// MsgDeleteNameAuthority +message MsgDeleteNameAuthority { + option (cosmos.msg.v1.signer) = "signer"; + + string lrn = 1; + string signer = 2; +} + +// MsgDeleteNameAuthorityResponse +message MsgDeleteNameAuthorityResponse {} + +// MsgRenewRecord +message MsgRenewRecord { + option (cosmos.msg.v1.signer) = "signer"; + + string record_id = 1 [(gogoproto.moretags) = "json:\"record_id\" yaml:\"record_id\""]; + string signer = 2; +} + +// MsgRenewRecordResponse +message MsgRenewRecordResponse {} + +// MsgAssociateBond +message MsgAssociateBond { + option (cosmos.msg.v1.signer) = "signer"; + + string record_id = 1 [(gogoproto.moretags) = "json:\"record_id\" yaml:\"record_id\""]; + string bond_id = 2 [(gogoproto.moretags) = "json:\"bond_id\" yaml:\"bond_id\""]; + string signer = 3; +} + +// MsgAssociateBondResponse +message MsgAssociateBondResponse {} + +// MsgDissociateBond +message MsgDissociateBond { + option (cosmos.msg.v1.signer) = "signer"; + + string record_id = 1 [(gogoproto.moretags) = "json:\"record_id\" yaml:\"record_id\""]; + string signer = 2; +} + +// MsgDissociateBondResponse +message MsgDissociateBondResponse {} + +// MsgDissociateRecords +message MsgDissociateRecords { + option (cosmos.msg.v1.signer) = "signer"; + + string bond_id = 1 [(gogoproto.moretags) = "json:\"bond_id\" yaml:\"bond_id\""]; + string signer = 2; +} + +// MsgDissociateRecordsResponse +message MsgDissociateRecordsResponse {} + +// MsgReassociateRecords +message MsgReassociateRecords { + option (cosmos.msg.v1.signer) = "signer"; + + string new_bond_id = 1 [(gogoproto.moretags) = "json:\"new_bond_id\" yaml:\"new_bond_id\""]; + string old_bond_id = 2 [(gogoproto.moretags) = "json:\"old_bond_id\" yaml:\"old_bond_id\""]; + string signer = 3; +} + +// MsgReassociateRecordsResponse +message MsgReassociateRecordsResponse {} diff --git a/proto/cosmos/app/v1alpha1/module.proto b/proto/cosmos/app/v1alpha1/module.proto new file mode 100644 index 0000000..e541378 --- /dev/null +++ b/proto/cosmos/app/v1alpha1/module.proto @@ -0,0 +1,91 @@ +syntax = "proto3"; + +package cosmos.app.v1alpha1; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.MessageOptions { + // module indicates that this proto type is a config object for an app module + // and optionally provides other descriptive information about the module. + // It is recommended that a new module config object and go module is versioned + // for every state machine breaking version of a module. The recommended + // pattern for doing this is to put module config objects in a separate proto + // package from the API they expose. Ex: the cosmos.group.v1 API would be + // exposed by module configs cosmos.group.module.v1, cosmos.group.module.v2, etc. + ModuleDescriptor module = 57193479; +} + +// ModuleDescriptor describes an app module. +message ModuleDescriptor { + // go_import names the package that should be imported by an app to load the + // module in the runtime module registry. It is required to make debugging + // of configuration errors easier for users. + string go_import = 1; + + // use_package refers to a protobuf package that this module + // uses and exposes to the world. In an app, only one module should "use" + // or own a single protobuf package. It is assumed that the module uses + // all of the .proto files in a single package. + repeated PackageReference use_package = 2; + + // can_migrate_from defines which module versions this module can migrate + // state from. The framework will check that one module version is able to + // migrate from a previous module version before attempting to update its + // config. It is assumed that modules can transitively migrate from earlier + // versions. For instance if v3 declares it can migrate from v2, and v2 + // declares it can migrate from v1, the framework knows how to migrate + // from v1 to v3, assuming all 3 module versions are registered at runtime. + repeated MigrateFromInfo can_migrate_from = 3; +} + +// PackageReference is a reference to a protobuf package used by a module. +message PackageReference { + // name is the fully-qualified name of the package. + string name = 1; + + // revision is the optional revision of the package that is being used. + // Protobuf packages used in Cosmos should generally have a major version + // as the last part of the package name, ex. foo.bar.baz.v1. + // The revision of a package can be thought of as the minor version of a + // package which has additional backwards compatible definitions that weren't + // present in a previous version. + // + // A package should indicate its revision with a source code comment + // above the package declaration in one of its files containing the + // text "Revision N" where N is an integer revision. All packages start + // at revision 0 the first time they are released in a module. + // + // When a new version of a module is released and items are added to existing + // .proto files, these definitions should contain comments of the form + // "Since: Revision N" where N is an integer revision. + // + // When the module runtime starts up, it will check the pinned proto + // image and panic if there are runtime protobuf definitions that are not + // in the pinned descriptor which do not have + // a "Since Revision N" comment or have a "Since Revision N" comment where + // N is <= to the revision specified here. This indicates that the protobuf + // files have been updated, but the pinned file descriptor hasn't. + // + // If there are items in the pinned file descriptor with a revision + // greater than the value indicated here, this will also cause a panic + // as it may mean that the pinned descriptor for a legacy module has been + // improperly updated or that there is some other versioning discrepancy. + // Runtime protobuf definitions will also be checked for compatibility + // with pinned file descriptors to make sure there are no incompatible changes. + // + // This behavior ensures that: + // * pinned proto images are up-to-date + // * protobuf files are carefully annotated with revision comments which + // are important good client UX + // * protobuf files are changed in backwards and forwards compatible ways + uint32 revision = 2; +} + +// MigrateFromInfo is information on a module version that a newer module +// can migrate from. +message MigrateFromInfo { + + // module is the fully-qualified protobuf name of the module config object + // for the previous module version, ex: "cosmos.group.module.v1.Module". + string module = 1; +} diff --git a/proto/cosmos/base/abci/v1beta1/abci.proto b/proto/cosmos/base/abci/v1beta1/abci.proto deleted file mode 100644 index 72da2aa..0000000 --- a/proto/cosmos/base/abci/v1beta1/abci.proto +++ /dev/null @@ -1,137 +0,0 @@ -syntax = "proto3"; -package cosmos.base.abci.v1beta1; - -import "gogoproto/gogo.proto"; -import "tendermint/abci/types.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/types"; -option (gogoproto.goproto_stringer_all) = false; - -// TxResponse defines a structure containing relevant tx data and metadata. The -// tags are stringified and the log is JSON decoded. -message TxResponse { - option (gogoproto.goproto_getters) = false; - // The block height - int64 height = 1; - // The transaction hash. - string txhash = 2 [(gogoproto.customname) = "TxHash"]; - // Namespace for the Code - string codespace = 3; - // Response code. - uint32 code = 4; - // Result bytes, if any. - string data = 5; - // The output of the application's logger (raw string). May be - // non-deterministic. - string raw_log = 6; - // The output of the application's logger (typed). May be non-deterministic. - repeated ABCIMessageLog logs = 7 [(gogoproto.castrepeated) = "ABCIMessageLogs", (gogoproto.nullable) = false]; - // Additional information. May be non-deterministic. - string info = 8; - // Amount of gas requested for transaction. - int64 gas_wanted = 9; - // Amount of gas consumed by transaction. - int64 gas_used = 10; - // The request transaction bytes. - google.protobuf.Any tx = 11; - // Time of the previous block. For heights > 1, it's the weighted median of - // the timestamps of the valid votes in the block.LastCommit. For height == 1, - // it's genesis time. - string timestamp = 12; -} - -// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. -message ABCIMessageLog { - option (gogoproto.stringer) = true; - - uint32 msg_index = 1; - string log = 2; - - // Events contains a slice of Event objects that were emitted during some - // execution. - repeated StringEvent events = 3 [(gogoproto.castrepeated) = "StringEvents", (gogoproto.nullable) = false]; -} - -// StringEvent defines en Event object wrapper where all the attributes -// contain key/value pairs that are strings instead of raw bytes. -message StringEvent { - option (gogoproto.stringer) = true; - - string type = 1; - repeated Attribute attributes = 2 [(gogoproto.nullable) = false]; -} - -// Attribute defines an attribute wrapper where the key and value are -// strings instead of raw bytes. -message Attribute { - string key = 1; - string value = 2; -} - -// GasInfo defines tx execution gas context. -message GasInfo { - // GasWanted is the maximum units of work we allow this tx to perform. - uint64 gas_wanted = 1 [(gogoproto.moretags) = "yaml:\"gas_wanted\""]; - - // GasUsed is the amount of gas actually consumed. - uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\""]; -} - -// Result is the union of ResponseFormat and ResponseCheckTx. -message Result { - option (gogoproto.goproto_getters) = false; - - // Data is any data returned from message or handler execution. It MUST be - // length prefixed in order to separate data from multiple message executions. - bytes data = 1; - - // Log contains the log information from message or handler execution. - string log = 2; - - // Events contains a slice of Event objects that were emitted during message - // or handler execution. - repeated tendermint.abci.Event events = 3 [(gogoproto.nullable) = false]; -} - -// SimulationResponse defines the response generated when a transaction is -// successfully simulated. -message SimulationResponse { - GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Result result = 2; -} - -// MsgData defines the data returned in a Result object during message -// execution. -message MsgData { - option (gogoproto.stringer) = true; - - string msg_type = 1; - bytes data = 2; -} - -// TxMsgData defines a list of MsgData. A transaction will have a MsgData object -// for each message. -message TxMsgData { - option (gogoproto.stringer) = true; - - repeated MsgData data = 1; -} - -// SearchTxsResult defines a structure for querying txs pageable -message SearchTxsResult { - option (gogoproto.stringer) = true; - - // Count of all txs - uint64 total_count = 1 [(gogoproto.moretags) = "yaml:\"total_count\"", (gogoproto.jsontag) = "total_count"]; - // Count of txs in current page - uint64 count = 2; - // Index of current page, start from 1 - uint64 page_number = 3 [(gogoproto.moretags) = "yaml:\"page_number\"", (gogoproto.jsontag) = "page_number"]; - // Count of total pages - uint64 page_total = 4 [(gogoproto.moretags) = "yaml:\"page_total\"", (gogoproto.jsontag) = "page_total"]; - // Max count txs per page - uint64 limit = 5; - // List of txs in current page - repeated TxResponse txs = 6; -} diff --git a/proto/cosmos/base/kv/v1beta1/kv.proto b/proto/cosmos/base/kv/v1beta1/kv.proto deleted file mode 100644 index 4e9b8d2..0000000 --- a/proto/cosmos/base/kv/v1beta1/kv.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; -package cosmos.base.kv.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/types/kv"; - -// Pairs defines a repeated slice of Pair objects. -message Pairs { - repeated Pair pairs = 1 [(gogoproto.nullable) = false]; -} - -// Pair defines a key/value bytes tuple. -message Pair { - bytes key = 1; - bytes value = 2; -} diff --git a/proto/cosmos/base/query/v1beta1/pagination.proto b/proto/cosmos/base/query/v1beta1/pagination.proto index 784c479..0a36814 100644 --- a/proto/cosmos/base/query/v1beta1/pagination.proto +++ b/proto/cosmos/base/query/v1beta1/pagination.proto @@ -32,6 +32,8 @@ message PageRequest { bool count_total = 4; // reverse is set to true if results are to be returned in the descending order. + // + // Since: cosmos-sdk 0.43 bool reverse = 5; } @@ -44,7 +46,8 @@ message PageRequest { // } message PageResponse { // next_key is the key to be passed to PageRequest.key to - // query the next page most efficiently + // query the next page most efficiently. It will be empty if + // there are no more results. bytes next_key = 1; // total is total number of results available if PageRequest.count_total diff --git a/proto/cosmos/base/reflection/v1beta1/reflection.proto b/proto/cosmos/base/reflection/v1beta1/reflection.proto deleted file mode 100644 index 22670e7..0000000 --- a/proto/cosmos/base/reflection/v1beta1/reflection.proto +++ /dev/null @@ -1,44 +0,0 @@ -syntax = "proto3"; -package cosmos.base.reflection.v1beta1; - -import "google/api/annotations.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/reflection"; - -// ReflectionService defines a service for interface reflection. -service ReflectionService { - // ListAllInterfaces lists all the interfaces registered in the interface - // registry. - rpc ListAllInterfaces(ListAllInterfacesRequest) returns (ListAllInterfacesResponse) { - option (google.api.http).get = "/cosmos/base/reflection/v1beta1/interfaces"; - }; - - // ListImplementations list all the concrete types that implement a given - // interface. - rpc ListImplementations(ListImplementationsRequest) returns (ListImplementationsResponse) { - option (google.api.http).get = "/cosmos/base/reflection/v1beta1/interfaces/" - "{interface_name}/implementations"; - }; -} - -// ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. -message ListAllInterfacesRequest {} - -// ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. -message ListAllInterfacesResponse { - // interface_names is an array of all the registered interfaces. - repeated string interface_names = 1; -} - -// ListImplementationsRequest is the request type of the ListImplementations -// RPC. -message ListImplementationsRequest { - // interface_name defines the interface to query the implementations for. - string interface_name = 1; -} - -// ListImplementationsResponse is the response type of the ListImplementations -// RPC. -message ListImplementationsResponse { - repeated string implementation_message_names = 1; -} diff --git a/proto/cosmos/base/reflection/v2alpha1/reflection.proto b/proto/cosmos/base/reflection/v2alpha1/reflection.proto deleted file mode 100644 index 3e8e940..0000000 --- a/proto/cosmos/base/reflection/v2alpha1/reflection.proto +++ /dev/null @@ -1,217 +0,0 @@ -syntax = "proto3"; -package cosmos.base.reflection.v2alpha1; - -import "google/api/annotations.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/server/grpc/reflection/v2alpha1"; - -// AppDescriptor describes a cosmos-sdk based application -message AppDescriptor { - // AuthnDescriptor provides information on how to authenticate transactions on the application - // NOTE: experimental and subject to change in future releases. - AuthnDescriptor authn = 1; - // chain provides the chain descriptor - ChainDescriptor chain = 2; - // codec provides metadata information regarding codec related types - CodecDescriptor codec = 3; - // configuration provides metadata information regarding the sdk.Config type - ConfigurationDescriptor configuration = 4; - // query_services provides metadata information regarding the available queriable endpoints - QueryServicesDescriptor query_services = 5; - // tx provides metadata information regarding how to send transactions to the given application - TxDescriptor tx = 6; -} - -// TxDescriptor describes the accepted transaction type -message TxDescriptor { - // fullname is the protobuf fullname of the raw transaction type (for instance the tx.Tx type) - // it is not meant to support polymorphism of transaction types, it is supposed to be used by - // reflection clients to understand if they can handle a specific transaction type in an application. - string fullname = 1; - // msgs lists the accepted application messages (sdk.Msg) - repeated MsgDescriptor msgs = 2; -} - -// AuthnDescriptor provides information on how to sign transactions without relying -// on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures -message AuthnDescriptor { - // sign_modes defines the supported signature algorithm - repeated SigningModeDescriptor sign_modes = 1; -} - -// SigningModeDescriptor provides information on a signing flow of the application -// NOTE(fdymylja): here we could go as far as providing an entire flow on how -// to sign a message given a SigningModeDescriptor, but it's better to think about -// this another time -message SigningModeDescriptor { - // name defines the unique name of the signing mode - string name = 1; - // number is the unique int32 identifier for the sign_mode enum - int32 number = 2; - // authn_info_provider_method_fullname defines the fullname of the method to call to get - // the metadata required to authenticate using the provided sign_modes - string authn_info_provider_method_fullname = 3; -} - -// ChainDescriptor describes chain information of the application -message ChainDescriptor { - // id is the chain id - string id = 1; -} - -// CodecDescriptor describes the registered interfaces and provides metadata information on the types -message CodecDescriptor { - // interfaces is a list of the registerted interfaces descriptors - repeated InterfaceDescriptor interfaces = 1; -} - -// InterfaceDescriptor describes the implementation of an interface -message InterfaceDescriptor { - // fullname is the name of the interface - string fullname = 1; - // interface_accepting_messages contains information regarding the proto messages which contain the interface as - // google.protobuf.Any field - repeated InterfaceAcceptingMessageDescriptor interface_accepting_messages = 2; - // interface_implementers is a list of the descriptors of the interface implementers - repeated InterfaceImplementerDescriptor interface_implementers = 3; -} - -// InterfaceImplementerDescriptor describes an interface implementer -message InterfaceImplementerDescriptor { - // fullname is the protobuf queryable name of the interface implementer - string fullname = 1; - // type_url defines the type URL used when marshalling the type as any - // this is required so we can provide type safe google.protobuf.Any marshalling and - // unmarshalling, making sure that we don't accept just 'any' type - // in our interface fields - string type_url = 2; -} - -// InterfaceAcceptingMessageDescriptor describes a protobuf message which contains -// an interface represented as a google.protobuf.Any -message InterfaceAcceptingMessageDescriptor { - // fullname is the protobuf fullname of the type containing the interface - string fullname = 1; - // field_descriptor_names is a list of the protobuf name (not fullname) of the field - // which contains the interface as google.protobuf.Any (the interface is the same, but - // it can be in multiple fields of the same proto message) - repeated string field_descriptor_names = 2; -} - -// ConfigurationDescriptor contains metadata information on the sdk.Config -message ConfigurationDescriptor { - // bech32_account_address_prefix is the account address prefix - string bech32_account_address_prefix = 1; -} - -// MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction -message MsgDescriptor { - // msg_type_url contains the TypeURL of a sdk.Msg. - string msg_type_url = 1; -} - -// ReflectionService defines a service for application reflection. -service ReflectionService { - // GetAuthnDescriptor returns information on how to authenticate transactions in the application - // NOTE: this RPC is still experimental and might be subject to breaking changes or removal in - // future releases of the cosmos-sdk. - rpc GetAuthnDescriptor(GetAuthnDescriptorRequest) returns (GetAuthnDescriptorResponse) { - option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/authn"; - } - // GetChainDescriptor returns the description of the chain - rpc GetChainDescriptor(GetChainDescriptorRequest) returns (GetChainDescriptorResponse) { - option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/chain"; - }; - // GetCodecDescriptor returns the descriptor of the codec of the application - rpc GetCodecDescriptor(GetCodecDescriptorRequest) returns (GetCodecDescriptorResponse) { - option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/codec"; - } - // GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application - rpc GetConfigurationDescriptor(GetConfigurationDescriptorRequest) returns (GetConfigurationDescriptorResponse) { - option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/configuration"; - } - // GetQueryServicesDescriptor returns the available gRPC queryable services of the application - rpc GetQueryServicesDescriptor(GetQueryServicesDescriptorRequest) returns (GetQueryServicesDescriptorResponse) { - option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/query_services"; - } - // GetTxDescriptor returns information on the used transaction object and available msgs that can be used - rpc GetTxDescriptor(GetTxDescriptorRequest) returns (GetTxDescriptorResponse) { - option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/tx_descriptor"; - } -} - -// GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC -message GetAuthnDescriptorRequest {} -// GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC -message GetAuthnDescriptorResponse { - // authn describes how to authenticate to the application when sending transactions - AuthnDescriptor authn = 1; -} - -// GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC -message GetChainDescriptorRequest {} -// GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC -message GetChainDescriptorResponse { - // chain describes application chain information - ChainDescriptor chain = 1; -} - -// GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC -message GetCodecDescriptorRequest {} -// GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC -message GetCodecDescriptorResponse { - // codec describes the application codec such as registered interfaces and implementations - CodecDescriptor codec = 1; -} - -// GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC -message GetConfigurationDescriptorRequest {} -// GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC -message GetConfigurationDescriptorResponse { - // config describes the application's sdk.Config - ConfigurationDescriptor config = 1; -} - -// GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC -message GetQueryServicesDescriptorRequest {} -// GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC -message GetQueryServicesDescriptorResponse { - // queries provides information on the available queryable services - QueryServicesDescriptor queries = 1; -} - -// GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC -message GetTxDescriptorRequest {} -// GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC -message GetTxDescriptorResponse { - // tx provides information on msgs that can be forwarded to the application - // alongside the accepted transaction protobuf type - TxDescriptor tx = 1; -} - -// QueryServicesDescriptor contains the list of cosmos-sdk queriable services -message QueryServicesDescriptor { - // query_services is a list of cosmos-sdk QueryServiceDescriptor - repeated QueryServiceDescriptor query_services = 1; -} - -// QueryServiceDescriptor describes a cosmos-sdk queryable service -message QueryServiceDescriptor { - // fullname is the protobuf fullname of the service descriptor - string fullname = 1; - // is_module describes if this service is actually exposed by an application's module - bool is_module = 2; - // methods provides a list of query service methods - repeated QueryMethodDescriptor methods = 3; -} - -// QueryMethodDescriptor describes a queryable method of a query service -// no other info is provided beside method name and tendermint queryable path -// because it would be redundant with the grpc reflection service -message QueryMethodDescriptor { - // name is the protobuf name (not fullname) of the method - string name = 1; - // full_query_path is the path that can be used to query - // this method via tendermint abci.Query - string full_query_path = 2; -} diff --git a/proto/cosmos/base/snapshots/v1beta1/snapshot.proto b/proto/cosmos/base/snapshots/v1beta1/snapshot.proto deleted file mode 100644 index 9ac5a7c..0000000 --- a/proto/cosmos/base/snapshots/v1beta1/snapshot.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto3"; -package cosmos.base.snapshots.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/snapshots/types"; - -// Snapshot contains Tendermint state sync snapshot info. -message Snapshot { - uint64 height = 1; - uint32 format = 2; - uint32 chunks = 3; - bytes hash = 4; - Metadata metadata = 5 [(gogoproto.nullable) = false]; -} - -// Metadata contains SDK-specific snapshot metadata. -message Metadata { - repeated bytes chunk_hashes = 1; // SHA-256 chunk hashes -} \ No newline at end of file diff --git a/proto/cosmos/base/store/v1beta1/commit_info.proto b/proto/cosmos/base/store/v1beta1/commit_info.proto deleted file mode 100644 index 98a33d3..0000000 --- a/proto/cosmos/base/store/v1beta1/commit_info.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; -package cosmos.base.store.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/store/types"; - -// CommitInfo defines commit information used by the multi-store when committing -// a version/height. -message CommitInfo { - int64 version = 1; - repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false]; -} - -// StoreInfo defines store-specific commit information. It contains a reference -// between a store name and the commit ID. -message StoreInfo { - string name = 1; - CommitID commit_id = 2 [(gogoproto.nullable) = false]; -} - -// CommitID defines the committment information when a specific store is -// committed. -message CommitID { - option (gogoproto.goproto_stringer) = false; - - int64 version = 1; - bytes hash = 2; -} diff --git a/proto/cosmos/base/store/v1beta1/listening.proto b/proto/cosmos/base/store/v1beta1/listening.proto deleted file mode 100644 index 186ecee..0000000 --- a/proto/cosmos/base/store/v1beta1/listening.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -package cosmos.base.store.v1beta1; - -option go_package = "github.com/cosmos/cosmos-sdk/store/types"; - -// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) -// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and -// Deletes -message StoreKVPair { - string store_key = 1; // the store key for the KVStore this pair originates from - bool delete = 2; // true indicates a delete operation, false indicates a set operation - bytes key = 3; - bytes value = 4; -} diff --git a/proto/cosmos/base/store/v1beta1/snapshot.proto b/proto/cosmos/base/store/v1beta1/snapshot.proto deleted file mode 100644 index 8348550..0000000 --- a/proto/cosmos/base/store/v1beta1/snapshot.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package cosmos.base.store.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/store/types"; - -// SnapshotItem is an item contained in a rootmulti.Store snapshot. -message SnapshotItem { - // item is the specific type of snapshot item. - oneof item { - SnapshotStoreItem store = 1; - SnapshotIAVLItem iavl = 2 [(gogoproto.customname) = "IAVL"]; - } -} - -// SnapshotStoreItem contains metadata about a snapshotted store. -message SnapshotStoreItem { - string name = 1; -} - -// SnapshotIAVLItem is an exported IAVL node. -message SnapshotIAVLItem { - bytes key = 1; - bytes value = 2; - int64 version = 3; - int32 height = 4; -} \ No newline at end of file diff --git a/proto/cosmos/base/tendermint/v1beta1/query.proto b/proto/cosmos/base/tendermint/v1beta1/query.proto deleted file mode 100644 index c98110c..0000000 --- a/proto/cosmos/base/tendermint/v1beta1/query.proto +++ /dev/null @@ -1,136 +0,0 @@ -syntax = "proto3"; -package cosmos.base.tendermint.v1beta1; - -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; - string cosmos_sdk_version = 8; -} - -// Module is the type for VersionInfo -message Module { - // module path - string path = 1; - // module version - string version = 2; - // checksum - string sum = 3; -} diff --git a/proto/cosmos/base/v1beta1/coin.proto b/proto/cosmos/base/v1beta1/coin.proto index fab7528..1447d64 100644 --- a/proto/cosmos/base/v1beta1/coin.proto +++ b/proto/cosmos/base/v1beta1/coin.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package cosmos.base.v1beta1; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/types"; option (gogoproto.goproto_stringer_all) = false; @@ -15,7 +17,12 @@ message Coin { option (gogoproto.equal) = true; string denom = 1; - string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } // DecCoin defines a token with a denomination and a decimal amount. @@ -26,15 +33,29 @@ message DecCoin { option (gogoproto.equal) = true; string denom = 1; - string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } // IntProto defines a Protobuf wrapper around an Int object. +// Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. message IntProto { - string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; + string int = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; } // DecProto defines a Protobuf wrapper around a Dec object. +// Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. message DecProto { - string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; + string dec = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } diff --git a/proto/cosmos/msg/v1/msg.proto b/proto/cosmos/msg/v1/msg.proto new file mode 100644 index 0000000..853efa1 --- /dev/null +++ b/proto/cosmos/msg/v1/msg.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package cosmos.msg.v1; + +import "google/protobuf/descriptor.proto"; + +// TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated. +// We need this right now because gogoproto codegen needs to import the extension. +option go_package = "github.com/cosmos/cosmos-sdk/types/msgservice"; + +extend google.protobuf.ServiceOptions { + // service indicates that the service is a Msg service and that requests + // must be transported via blockchain transactions rather than gRPC. + // Tooling can use this annotation to distinguish between Msg services and + // other types of services via reflection. + bool service = 11110000; +} + +extend google.protobuf.MessageOptions { + // signer must be used in cosmos messages in order + // to signal to external clients which fields in a + // given cosmos message must be filled with signer + // information (address). + // The field must be the protobuf name of the message + // field extended with this MessageOption. + // The field must either be of string kind, or of message + // kind in case the signer information is contained within + // a message inside the cosmos message. + repeated string signer = 11110000; +} diff --git a/proto/cosmos_proto/cosmos.proto b/proto/cosmos_proto/cosmos.proto new file mode 100644 index 0000000..5c63b86 --- /dev/null +++ b/proto/cosmos_proto/cosmos.proto @@ -0,0 +1,97 @@ +syntax = "proto3"; +package cosmos_proto; + +import "google/protobuf/descriptor.proto"; + +option go_package = "github.com/cosmos/cosmos-proto;cosmos_proto"; + +extend google.protobuf.MessageOptions { + + // implements_interface is used to indicate the type name of the interface + // that a message implements so that it can be used in google.protobuf.Any + // fields that accept that interface. A message can implement multiple + // interfaces. Interfaces should be declared using a declare_interface + // file option. + repeated string implements_interface = 93001; +} + +extend google.protobuf.FieldOptions { + + // accepts_interface is used to annotate that a google.protobuf.Any + // field accepts messages that implement the specified interface. + // Interfaces should be declared using a declare_interface file option. + string accepts_interface = 93001; + + // scalar is used to indicate that this field follows the formatting defined + // by the named scalar which should be declared with declare_scalar. Code + // generators may choose to use this information to map this field to a + // language-specific type representing the scalar. + string scalar = 93002; +} + +extend google.protobuf.FileOptions { + + // declare_interface declares an interface type to be used with + // accepts_interface and implements_interface. Interface names are + // expected to follow the following convention such that their declaration + // can be discovered by tools: for a given interface type a.b.C, it is + // expected that the declaration will be found in a protobuf file named + // a/b/interfaces.proto in the file descriptor set. + repeated InterfaceDescriptor declare_interface = 793021; + + // declare_scalar declares a scalar type to be used with + // the scalar field option. Scalar names are + // expected to follow the following convention such that their declaration + // can be discovered by tools: for a given scalar type a.b.C, it is + // expected that the declaration will be found in a protobuf file named + // a/b/scalars.proto in the file descriptor set. + repeated ScalarDescriptor declare_scalar = 793022; +} + +// InterfaceDescriptor describes an interface type to be used with +// accepts_interface and implements_interface and declared by declare_interface. +message InterfaceDescriptor { + + // name is the name of the interface. It should be a short-name (without + // a period) such that the fully qualified name of the interface will be + // package.name, ex. for the package a.b and interface named C, the + // fully-qualified name will be a.b.C. + string name = 1; + + // description is a human-readable description of the interface and its + // purpose. + string description = 2; +} + +// ScalarDescriptor describes an scalar type to be used with +// the scalar field option and declared by declare_scalar. +// Scalars extend simple protobuf built-in types with additional +// syntax and semantics, for instance to represent big integers. +// Scalars should ideally define an encoding such that there is only one +// valid syntactical representation for a given semantic meaning, +// i.e. the encoding should be deterministic. +message ScalarDescriptor { + + // name is the name of the scalar. It should be a short-name (without + // a period) such that the fully qualified name of the scalar will be + // package.name, ex. for the package a.b and scalar named C, the + // fully-qualified name will be a.b.C. + string name = 1; + + // description is a human-readable description of the scalar and its + // encoding format. For instance a big integer or decimal scalar should + // specify precisely the expected encoding format. + string description = 2; + + // field_type is the type of field with which this scalar can be used. + // Scalars can be used with one and only one type of field so that + // encoding standards and simple and clear. Currently only string and + // bytes fields are supported for scalars. + repeated ScalarType field_type = 3; +} + +enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0; + SCALAR_TYPE_STRING = 1; + SCALAR_TYPE_BYTES = 2; +} diff --git a/proto/google/api/httpbody.proto b/proto/google/api/httpbody.proto deleted file mode 100644 index 573f8d1..0000000 --- a/proto/google/api/httpbody.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2018 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/any.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; -option java_multiple_files = true; -option java_outer_classname = "HttpBodyProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Message that represents an arbitrary HTTP body. It should only be used for -// payload formats that can't be represented as JSON, such as raw binary or -// an HTML page. -// -// -// This message can be used both in streaming and non-streaming API methods in -// the request as well as the response. -// -// It can be used as a top-level request field, which is convenient if one -// wants to extract parameters from either the URL or HTTP template into the -// request fields and also want access to the raw HTTP body. -// -// Example: -// -// message GetResourceRequest { -// // A unique request id. -// string request_id = 1; -// -// // The raw HTTP body is bound to this field. -// google.api.HttpBody http_body = 2; -// } -// -// service ResourceService { -// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); -// rpc UpdateResource(google.api.HttpBody) returns -// (google.protobuf.Empty); -// } -// -// Example with streaming methods: -// -// service CaldavService { -// rpc GetCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// rpc UpdateCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// } -// -// Use of this type only changes how the request and response bodies are -// handled, all other features will continue to work unchanged. -message HttpBody { - // The HTTP Content-Type header value specifying the content type of the body. - string content_type = 1; - - // The HTTP request/response body as raw binary. - bytes data = 2; - - // Application specific response metadata. Must be set in the first response - // for streaming APIs. - repeated google.protobuf.Any extensions = 3; -} \ No newline at end of file diff --git a/proto/google/protobuf/any.proto b/proto/google/protobuf/any.proto deleted file mode 100644 index e1faae4..0000000 --- a/proto/google/protobuf/any.proto +++ /dev/null @@ -1,161 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -import "gogoproto/gogo.proto"; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "types"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "AnyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) -// ... -// foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -message Any { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - string type_url = 1; - - // Must be a valid serialized protocol buffer of the above specified type. - bytes value = 2; - - option (gogoproto.typedecl) = false; -} - -option (gogoproto.goproto_registration) = false; diff --git a/proto/google/protobuf/descriptor.proto b/proto/google/protobuf/descriptor.proto index 42832c9..f8eb216 100644 --- a/proto/google/protobuf/descriptor.proto +++ b/proto/google/protobuf/descriptor.proto @@ -36,16 +36,17 @@ // A valid .proto file can be translated directly to a FileDescriptorProto // without any other information (e.g. without reading its imports). + syntax = "proto2"; package google.protobuf; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_package = "com.google.protobuf"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; -option csharp_namespace = "Google.Protobuf.Reflection"; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; // descriptor.proto must be optimized for speed because reflection-based // algorithms don't work during bootstrapping. @@ -59,8 +60,8 @@ message FileDescriptorSet { // Describes a complete .proto file. message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. // Names of files imported by this file. repeated string dependency = 3; @@ -71,10 +72,10 @@ message FileDescriptorProto { repeated int32 weak_dependency = 11; // All top-level definitions in this file. - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; optional FileOptions options = 8; @@ -93,15 +94,15 @@ message FileDescriptorProto { message DescriptorProto { optional string name = 1; - repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto field = 2; repeated FieldDescriptorProto extension = 6; - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; message ExtensionRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. optional ExtensionRangeOptions options = 3; } @@ -115,8 +116,8 @@ message DescriptorProto { // fields or extension ranges in the same message. Reserved ranges may // not overlap. message ReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. } repeated ReservedRange reserved_range = 9; // Reserved field names, which may not be used by fields in the same message. @@ -128,6 +129,7 @@ message ExtensionRangeOptions { // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; + // Clients can define custom options in extensions of this message. See above. extensions 1000 to max; } @@ -138,33 +140,33 @@ message FieldDescriptorProto { // 0 is reserved for errors. // Order is weird for historical reasons. TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; + TYPE_FLOAT = 2; // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if // negative values are likely. - TYPE_INT64 = 3; + TYPE_INT64 = 3; TYPE_UINT64 = 4; // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if // negative values are likely. - TYPE_INT32 = 5; + TYPE_INT32 = 5; TYPE_FIXED64 = 6; TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; + TYPE_BOOL = 8; + TYPE_STRING = 9; // Tag-delimited aggregate. // Group type is deprecated and not supported in proto3. However, Proto3 // implementations should still be able to parse the group wire format and // treat group fields as unknown fields. - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; // Length-delimited aggregate. + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; // Length-delimited aggregate. // New in version 2. - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; TYPE_SFIXED32 = 15; TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. } enum Label { @@ -174,9 +176,9 @@ message FieldDescriptorProto { LABEL_REPEATED = 3; } - optional string name = 1; - optional int32 number = 3; - optional Label label = 4; + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; // If type_name is set, this need not be set. If both this and type_name // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. @@ -197,7 +199,6 @@ message FieldDescriptorProto { // For booleans, "true" or "false". // For strings, contains the default text contents (not escaped in any way). // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? optional string default_value = 7; // If set, gives the index of a oneof in the containing type's oneof_decl @@ -238,7 +239,7 @@ message FieldDescriptorProto { // Describes a oneof. message OneofDescriptorProto { - optional string name = 1; + optional string name = 1; optional OneofOptions options = 2; } @@ -257,8 +258,8 @@ message EnumDescriptorProto { // is inclusive such that it can appropriately represent the entire int32 // domain. message EnumReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Inclusive. + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. } // Range of reserved numeric values. Reserved numeric values may not be used @@ -273,15 +274,15 @@ message EnumDescriptorProto { // Describes a value within an enum. message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; + optional string name = 1; + optional int32 number = 2; optional EnumValueOptions options = 3; } // Describes a service. message ServiceDescriptorProto { - optional string name = 1; + optional string name = 1; repeated MethodDescriptorProto method = 2; optional ServiceOptions options = 3; @@ -293,7 +294,7 @@ message MethodDescriptorProto { // Input and output type names. These are resolved in the same way as // FieldDescriptorProto.type_name, but must refer to a message type. - optional string input_type = 2; + optional string input_type = 2; optional string output_type = 3; optional MethodOptions options = 4; @@ -304,6 +305,7 @@ message MethodDescriptorProto { optional bool server_streaming = 6 [default = false]; } + // =================================================================== // Options @@ -344,23 +346,24 @@ message FileOptions { // domain names. optional string java_package = 1; - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). + + // Controls the name of the wrapper Java class generated for the .proto file. + // That class will always contain the .proto file's getDescriptor() method as + // well as any top-level extensions defined in the .proto file. + // If java_multiple_files is disabled, then all the other classes from the + // .proto file will be nested inside the single wrapper outer class. optional string java_outer_classname = 8; - // If set true, then the Java code generator will generate a separate .java + // If enabled, then the Java code generator will generate a separate .java // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be + // file. Thus, these types will *not* be nested inside the wrapper class + // named by java_outer_classname. However, the wrapper class will still be // generated to contain the file's getDescriptor() method as well as any // top-level extensions defined in the file. optional bool java_multiple_files = 10 [default = false]; // This option does nothing. - optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + optional bool java_generate_equals_and_hash = 20 [deprecated=true]; // If set true, then the Java2 code generator will generate code that // throws an exception whenever an attempt is made to assign a non-UTF-8 @@ -370,12 +373,13 @@ message FileOptions { // This option has no effect on when used with the lite runtime. optional bool java_string_check_utf8 = 27 [default = false]; + // Generated classes can be optimized for speed or code size. enum OptimizeMode { - SPEED = 1; // Generate complete code for parsing, serialization, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. } optional OptimizeMode optimize_for = 9 [default = SPEED]; @@ -386,6 +390,9 @@ message FileOptions { // - Otherwise, the basename of the .proto file, without extension. optional string go_package = 11; + + + // Should generic services be generated in each language? "Generic" services // are not specific to any particular RPC system. They are generated by the // main code generators in each language (without additional plugins). @@ -396,10 +403,10 @@ message FileOptions { // that generate code specific to your particular RPC system. Therefore, // these default to false. Old code which depends on generic services should // explicitly set them to true. - optional bool cc_generic_services = 16 [default = false]; + optional bool cc_generic_services = 16 [default = false]; optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool php_generic_services = 42 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool php_generic_services = 42 [default = false]; // Is this file deprecated? // Depending on the target platform, this can emit Deprecated annotations @@ -411,6 +418,7 @@ message FileOptions { // only to generated classes for C++. optional bool cc_enable_arenas = 31 [default = true]; + // Sets the objective c class prefix which is prepended to all objective c // generated classes from this .proto. There is no default. optional string objc_class_prefix = 36; @@ -443,6 +451,7 @@ message FileOptions { // determining the ruby package. optional string ruby_package = 45; + // The parser stores options it doesn't recognize here. // See the documentation for the "Options" section above. repeated UninterpretedOption uninterpreted_option = 999; @@ -486,6 +495,8 @@ message MessageOptions { // this is a formalization for deprecating messages. optional bool deprecated = 3 [default = false]; + reserved 4, 5, 6; + // Whether the message is an automatically generated map entry type for the // maps field. // @@ -509,8 +520,9 @@ message MessageOptions { // parser. optional bool map_entry = 7; - reserved 8; // javalite_serializable - reserved 9; // javanano_as_lite + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -591,8 +603,19 @@ message FieldOptions { // implementation must either *always* check its required fields, or *never* // check its required fields, regardless of whether or not the message has // been parsed. + // + // As of 2021, lazy does no correctness checks on the byte stream during + // parsing. This may lead to crashes if and when an invalid byte stream is + // finally parsed upon access. + // + // TODO(b/211906113): Enable validation on lazy fields. optional bool lazy = 5 [default = false]; + // unverified_lazy does no correctness checks on the byte stream. This should + // only be used where lazy with verification is prohibitive for performance + // reasons. + optional bool unverified_lazy = 15 [default = false]; + // Is this field deprecated? // Depending on the target platform, this can emit Deprecated annotations // for accessors, or it will be completely ignored; in the very least, this @@ -602,13 +625,14 @@ message FieldOptions { // For Google-internal migration only. Do not use. optional bool weak = 10 [default = false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; // Clients can define custom options in extensions of this message. See above. extensions 1000 to max; - reserved 4; // removed jtype + reserved 4; // removed jtype } message OneofOptions { @@ -631,7 +655,7 @@ message EnumOptions { // is a formalization for deprecating enums. optional bool deprecated = 3 [default = false]; - reserved 5; // javanano_as_lite + reserved 5; // javanano_as_lite // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -692,10 +716,11 @@ message MethodOptions { // methods, and PUT verb for idempotent methods instead of the default POST. enum IdempotencyLevel { IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; // implies idempotent - IDEMPOTENT = 2; // idempotent, but may have side effects + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects } - optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + optional IdempotencyLevel idempotency_level = 34 + [default = IDEMPOTENCY_UNKNOWN]; // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -704,6 +729,7 @@ message MethodOptions { extensions 1000 to max; } + // A message representing a option the parser does not recognize. This only // appears in options protos created by the compiler::Parser class. // DescriptorPool resolves these when building Descriptor objects. Therefore, @@ -714,22 +740,22 @@ message UninterpretedOption { // The name of the uninterpreted option. Each string represents a segment in // a dot-separated name. is_extension is true iff a segment represents an // extension (denoted with parentheses in options specs in .proto files). - // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - // "foo.(bar.baz).qux". + // E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + // "foo.(bar.baz).moo". message NamePart { - required string name_part = 1; - required bool is_extension = 2; + required string name_part = 1; + required bool is_extension = 2; } repeated NamePart name = 2; // The value of the uninterpreted option, in whatever type the tokenizer // identified it as during parsing. Exactly one of these should be set. - optional string identifier_value = 3; + optional string identifier_value = 3; optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; } // =================================================================== @@ -782,13 +808,13 @@ message SourceCodeInfo { // ignore those that it doesn't understand, as more types of locations could // be recorded in the future. repeated Location location = 1; - message Location { + message Location { // Identifies which part of the FileDescriptorProto was defined at this // location. // // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: + // the root FileDescriptorProto to the place where the definition occurs. + // For example, this path: // [ 4, 3, 2, 7, 1 ] // refers to: // file.message_type(3) // 4, 3 @@ -842,13 +868,13 @@ message SourceCodeInfo { // // Comment attached to baz. // // Another line attached to baz. // - // // Comment attached to qux. + // // Comment attached to moo. // // - // // Another line attached to qux. - // optional double qux = 4; + // // Another line attached to moo. + // optional double moo = 4; // // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from + // // to moo or corge because there are blank lines separating it from // // both. // // // Detached comment for corge paragraph 2. @@ -862,8 +888,8 @@ message SourceCodeInfo { // optional int32 grault = 6; // // // ignored detached comments. - optional string leading_comments = 3; - optional string trailing_comments = 4; + optional string leading_comments = 3; + optional string trailing_comments = 4; repeated string leading_detached_comments = 6; } } @@ -875,7 +901,7 @@ message GeneratedCodeInfo { // An Annotation connects some span of text in generated code to an element // of its generating .proto file. repeated Annotation annotation = 1; - message Annotation { + message Annotation { // Identifies the element in the original source .proto file. This field // is formatted the same as SourceCodeInfo.Location.path. repeated int32 path = 1 [packed = true]; diff --git a/proto/google/protobuf/duration.proto b/proto/google/protobuf/duration.proto index 41f40c2..81c3e36 100644 --- a/proto/google/protobuf/duration.proto +++ b/proto/google/protobuf/duration.proto @@ -32,13 +32,13 @@ syntax = "proto3"; package google.protobuf; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; option go_package = "google.golang.org/protobuf/types/known/durationpb"; option java_package = "com.google.protobuf"; option java_outer_classname = "DurationProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // A Duration represents a signed, fixed-length span of time represented // as a count of seconds and fractions of seconds at nanosecond @@ -99,6 +99,7 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // be expressed in JSON format as "3.000000001s", and 3 seconds and 1 // microsecond should be expressed in JSON format as "3.000001s". // +// message Duration { // Signed seconds of the span of time. Must be from -315,576,000,000 // to +315,576,000,000 inclusive. Note: these bounds are computed from: diff --git a/proto/google/protobuf/timestamp.proto b/proto/google/protobuf/timestamp.proto index fd0bc07..3b2df6d 100644 --- a/proto/google/protobuf/timestamp.proto +++ b/proto/google/protobuf/timestamp.proto @@ -32,13 +32,13 @@ syntax = "proto3"; package google.protobuf; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; option go_package = "google.golang.org/protobuf/types/known/timestamppb"; option java_package = "com.google.protobuf"; option java_outer_classname = "TimestampProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // A Timestamp represents a point in time independent of any time zone or local // calendar, encoded as a count of seconds and fractions of seconds at @@ -90,6 +90,7 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) // .setNanos((int) ((millis % 1000) * 1000000)).build(); // +// // Example 5: Compute Timestamp from Java `Instant.now()`. // // Instant now = Instant.now(); @@ -98,6 +99,7 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) // .setNanos(now.getNano()).build(); // +// // Example 6: Compute Timestamp from current time in Python. // // timestamp = Timestamp() @@ -127,9 +129,10 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with // the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use // the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() +// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D // ) to obtain a formatter capable of generating timestamps in this format. // +// message Timestamp { // Represents seconds of UTC time since Unix epoch // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to diff --git a/proto/vulcanize/auction/v1beta1/genesis.proto b/proto/vulcanize/auction/v1beta1/genesis.proto deleted file mode 100644 index 9a50e3f..0000000 --- a/proto/vulcanize/auction/v1beta1/genesis.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -package vulcanize.auction.v1beta1; - -import "gogoproto/gogo.proto"; -import "vulcanize/auction/v1beta1/types.proto"; - -option go_package = "github.com/tharsis/ethermint/x/auction/types"; - -// GenesisState defines the genesis state of the auction module -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated Auction auctions = 2 [ - (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\"" - ]; -} diff --git a/proto/vulcanize/bond/v1beta1/tx.proto b/proto/vulcanize/bond/v1beta1/tx.proto deleted file mode 100644 index 16cfe8e..0000000 --- a/proto/vulcanize/bond/v1beta1/tx.proto +++ /dev/null @@ -1,77 +0,0 @@ -syntax = "proto3"; -package vulcanize.bond.v1beta1; - -option go_package = "github.com/tharsis/ethermint/x/bond/types"; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -// Msg defines the bond Msg service. -service Msg { - // CreateBond defines a method for creating a new bond. - rpc CreateBond(MsgCreateBond) returns (MsgCreateBondResponse); - - // RefillBond defines a method for refilling amount for bond. - rpc RefillBond(MsgRefillBond) returns (MsgRefillBondResponse); - - // WithdrawBond defines a method for withdrawing amount from bond. - rpc WithdrawBond(MsgWithdrawBond) returns (MsgWithdrawBondResponse); - - // CancelBond defines a method for cancelling a bond. - rpc CancelBond(MsgCancelBond) returns (MsgCancelBondResponse); -} - -// MsgCreateBond defines a SDK message for creating a new bond. -message MsgCreateBond{ - string signer = 1; - repeated cosmos.base.v1beta1.Coin coins = 2 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" - ]; -} - -// MsgCreateBondResponse defines the Msg/CreateBond response type. -message MsgCreateBondResponse{ - string id = 1; -} - -// MsgRefillBond defines a SDK message for refill the amount for bond. -message MsgRefillBond{ - string id = 1; - string signer = 2; - repeated cosmos.base.v1beta1.Coin coins = 3 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" - ]; -} - -// MsgRefillBondResponse defines the Msg/RefillBond response type. -message MsgRefillBondResponse{ -} - -// MsgWithdrawBond defines a SDK message for withdrawing amount from bond. -message MsgWithdrawBond { - string id = 1; - string signer = 2; - repeated cosmos.base.v1beta1.Coin coins = 3 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" - ]; -} - -// MsgWithdrawBondResponse defines the Msg/WithdrawBond response type. -message MsgWithdrawBondResponse{ -} - -// MsgCancelBond defines a SDK message for the cancel the bond. -message MsgCancelBond{ - string id = 1; - string signer = 2; -} - -// MsgCancelBondResponse defines the Msg/CancelBond response type. -message MsgCancelBondResponse{ -} diff --git a/proto/vulcanize/registry/v1beta1/genesis.proto b/proto/vulcanize/registry/v1beta1/genesis.proto deleted file mode 100644 index 19a34b6..0000000 --- a/proto/vulcanize/registry/v1beta1/genesis.proto +++ /dev/null @@ -1,21 +0,0 @@ -syntax = "proto3"; -package vulcanize.registry.v1beta1; - -import "gogoproto/gogo.proto"; -import "vulcanize/registry/v1beta1/registry.proto"; - -option go_package = "github.com/cerc-io/laconicd/x/registry/types"; - -// GenesisState defines the registry module's genesis state. -message GenesisState { - // params defines all the params of registry module. - Params params = 1 [(gogoproto.nullable) = false]; - // records - repeated Record records = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"records\" yaml:\"records\""]; - // authorities - repeated AuthorityEntry authorities = 3 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"authorities\" yaml:\"authorities\""]; - // names - repeated NameEntry names = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"names\" yaml:\"names\""]; -} diff --git a/proto/vulcanize/registry/v1beta1/query.proto b/proto/vulcanize/registry/v1beta1/query.proto deleted file mode 100644 index fc8c5d2..0000000 --- a/proto/vulcanize/registry/v1beta1/query.proto +++ /dev/null @@ -1,225 +0,0 @@ -syntax = "proto3"; -package vulcanize.registry.v1beta1; - -import "vulcanize/registry/v1beta1/registry.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/cerc-io/laconicd/x/registry/types"; - -// Query defines the gRPC querier service for registry module -service Query { - // Params queries the registry module params. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/params"; - } - // List records - rpc ListRecords(QueryListRecordsRequest) returns (QueryListRecordsResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/records"; - } - // Get record by id - rpc GetRecord(QueryRecordByIDRequest) returns (QueryRecordByIDResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/records/{id}"; - } - // Get records by bond id - rpc GetRecordByBondID(QueryRecordByBondIDRequest) returns (QueryRecordByBondIDResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/records-by-bond-id/{id}"; - } - // Get registry module balance - rpc GetRegistryModuleBalance(GetRegistryModuleBalanceRequest) returns (GetRegistryModuleBalanceResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/balance"; - } - // List name records - rpc ListNameRecords(QueryListNameRecordsRequest) returns (QueryListNameRecordsResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/names"; - } - // Whois method retrieve the name authority info - rpc Whois(QueryWhoisRequest) returns (QueryWhoisResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/whois/{name}"; - } - // LookupCrn - rpc LookupCrn(QueryLookupCrn) returns (QueryLookupCrnResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/lookup"; - } - // ResolveCrn - rpc ResolveCrn(QueryResolveCrn) returns (QueryResolveCrnResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/resolve"; - } - // GetRecordExpiryQueue - rpc GetRecordExpiryQueue(QueryGetRecordExpiryQueue) returns (QueryGetRecordExpiryQueueResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/record-expiry"; - } - // GetAuthorityExpiryQueue - rpc GetAuthorityExpiryQueue(QueryGetAuthorityExpiryQueue) returns (QueryGetAuthorityExpiryQueueResponse) { - option (google.api.http).get = "/vulcanize/registry/v1beta1/authority-expiry"; - } -} - -// QueryParamsRequest is request type for registry params -message QueryParamsRequest {} - -// QueryParamsResponse is response type for registry params -message QueryParamsResponse { - Params params = 1; -} - -// QueryListRecordsRequest is request type for registry records list -message QueryListRecordsRequest { - message LinkInput { - string id = 1; - } - message ArrayInput { - repeated ValueInput values = 1; - } - message MapInput { - map values = 1; - } - message ValueInput { - oneof value { - string string = 1; - int64 int = 2; - double float = 3; - bool boolean = 4; - string link = 5; - ArrayInput array = 6; - MapInput map = 7; - } - } - message KeyValueInput { - string key = 1; - ValueInput value = 2; - } - repeated KeyValueInput attributes = 1; - - bool all = 2; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 3; -} - -// QueryListRecordsResponse is response type for registry records list -message QueryListRecordsResponse { - repeated Record records = 1 [(gogoproto.nullable) = false]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryRecordByIDRequest is request type for registry records by id -message QueryRecordByIDRequest { - string id = 1; -} - -// QueryRecordByIDResponse is response type for registry records by id -message QueryRecordByIDResponse { - Record record = 1 [(gogoproto.nullable) = false]; -} - -// QueryRecordByBondIdRequest is request type for get the records by bond-id -message QueryRecordByBondIDRequest { - string id = 1; - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} - -// QueryRecordByBondIdResponse is response type for records list by bond-id -message QueryRecordByBondIDResponse { - repeated Record records = 1 [(gogoproto.nullable) = false]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// GetRegistryModuleBalanceRequest is request type for registry module accounts balance -message GetRegistryModuleBalanceRequest {} - -// GetRegistryModuleBalanceResponse is response type for registry module accounts balance -message GetRegistryModuleBalanceResponse { - repeated AccountBalance balances = 1; -} - -// AccountBalance is registry module account balance -message AccountBalance { - string account_name = 1 [(gogoproto.moretags) = "json:\"accountName\" yaml:\"accountName\""]; - repeated cosmos.base.v1beta1.Coin balance = 3 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "json:\"balance\" yaml:\"balance\"" - ]; -} - -// QueryListNameRecordsRequest is request type for registry names records -message QueryListNameRecordsRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -// QueryListNameRecordsResponse is response type for registry names records -message QueryListNameRecordsResponse { - repeated NameEntry names = 1 [(gogoproto.nullable) = false]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryWhoisRequest is request type for Get NameAuthority -message QueryWhoisRequest { - string name = 1; -} - -// QueryWhoisResponse is response type for whois request -message QueryWhoisResponse { - NameAuthority name_authority = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"nameAuthority\" yaml:\"nameAuthority\""]; -} - -// QueryLookupCrn is request type for LookupCrn -message QueryLookupCrn { - string crn = 1; -} - -// QueryLookupCrnResponse is response type for QueryLookupCrn -message QueryLookupCrnResponse { - NameRecord name = 1; -} - -// QueryResolveCrn is request type for ResolveCrn -message QueryResolveCrn { - string crn = 1; -} - -// QueryResolveCrnResponse is response type for QueryResolveCrn -message QueryResolveCrnResponse { - Record record = 1; -} - -// QueryGetRecordExpiryQueue -message QueryGetRecordExpiryQueue { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -// QueryGetRecordExpiryQueueResponse -message QueryGetRecordExpiryQueueResponse { - repeated ExpiryQueueRecord records = 1; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// ExpiryQueueRecord -message ExpiryQueueRecord { - string id = 1; - repeated string value = 2; -} - -// QueryGetAuthorityExpiryQueue -message QueryGetAuthorityExpiryQueue { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -// QueryGetAuthorityExpiryQueueResponse -message QueryGetAuthorityExpiryQueueResponse { - repeated ExpiryQueueRecord authorities = 1; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} diff --git a/proto/vulcanize/registry/v1beta1/tx.proto b/proto/vulcanize/registry/v1beta1/tx.proto deleted file mode 100644 index c9e11bc..0000000 --- a/proto/vulcanize/registry/v1beta1/tx.proto +++ /dev/null @@ -1,137 +0,0 @@ -syntax = "proto3"; -package vulcanize.registry.v1beta1; - -import "gogoproto/gogo.proto"; -import "vulcanize/registry/v1beta1/registry.proto"; - -option go_package = "github.com/cerc-io/laconicd/x/registry/types"; - -// Msg -service Msg { - // SetRecord will records a new record with given payload and bond id - rpc SetRecord(MsgSetRecord) returns (MsgSetRecordResponse) {} - // Renew Record will renew the expire record - rpc RenewRecord(MsgRenewRecord) returns (MsgRenewRecordResponse) {} - // AssociateBond - rpc AssociateBond(MsgAssociateBond) returns (MsgAssociateBondResponse) {} - // DissociateBond - rpc DissociateBond(MsgDissociateBond) returns (MsgDissociateBondResponse) {} - // DissociateRecords - rpc DissociateRecords(MsgDissociateRecords) returns (MsgDissociateRecordsResponse) {} - // ReAssociateRecords - rpc ReAssociateRecords(MsgReAssociateRecords) returns (MsgReAssociateRecordsResponse) {} - // SetName will store the name with given crn and name - rpc SetName(MsgSetName) returns (MsgSetNameResponse) {} - // Reserve name - rpc ReserveName(MsgReserveAuthority) returns (MsgReserveAuthorityResponse) {} - // Delete Name method will remove authority name - rpc DeleteName(MsgDeleteNameAuthority) returns (MsgDeleteNameAuthorityResponse) {} - // SetAuthorityBond - rpc SetAuthorityBond(MsgSetAuthorityBond) returns (MsgSetAuthorityBondResponse) {} -} - -// MsgSetRecord -message MsgSetRecord { - string bond_id = 1 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""]; - string signer = 2; - Payload payload = 3 [(gogoproto.nullable) = false]; -} - -// MsgSetRecordResponse -message MsgSetRecordResponse { - string id = 1; -} - -// Payload -message Payload { - Record record = 1; - repeated Signature signatures = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"signatures\" yaml:\"signatures\""]; -} - -// MsgSetName -message MsgSetName { - string crn = 1; - string cid = 2; - string signer = 3; -} - -// MsgSetNameResponse -message MsgSetNameResponse {} - -// MsgReserveName -message MsgReserveAuthority { - string name = 1; - string signer = 2; - // if creating a sub-authority. - string owner = 3; -} - -// MsgReserveNameResponse -message MsgReserveAuthorityResponse {} - -// MsgSetAuthorityBond is SDK message for SetAuthorityBond -message MsgSetAuthorityBond { - string name = 1; - string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""]; - string signer = 3; -} - -// MsgSetAuthorityBondResponse -message MsgSetAuthorityBondResponse {} - -// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority -message MsgDeleteNameAuthority { - string crn = 1; - string signer = 2; -} - -// MsgDeleteNameAuthorityResponse -message MsgDeleteNameAuthorityResponse {} - -// MsgRenewRecord is SDK message for Renew a record -message MsgRenewRecord { - string record_id = 1 [(gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""]; - string signer = 2; -} - -// MsgRenewRecordResponse -message MsgRenewRecordResponse {} - -// MsgAssociateBond -message MsgAssociateBond { - string record_id = 1 [(gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""]; - string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""]; - string signer = 3; -} - -// MsgAssociateBondResponse -message MsgAssociateBondResponse {} - -// MsgDissociateBond is SDK message for Msg/DissociateBond -message MsgDissociateBond { - string record_id = 1 [(gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""]; - string signer = 2; -} - -// MsgDissociateBondResponse is response type for MsgDissociateBond -message MsgDissociateBondResponse {} - -// MsgDissociateRecords is SDK message for Msg/DissociateRecords -message MsgDissociateRecords { - string bond_id = 1 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""]; - string signer = 2; -} - -// MsgDissociateRecordsResponse is response type for MsgDissociateRecords -message MsgDissociateRecordsResponse {} - -// MsgReAssociateRecords is SDK message for Msg/ReAssociateRecords -message MsgReAssociateRecords { - string new_bond_id = 1 [(gogoproto.moretags) = "json:\"newBondId\" yaml:\"newBondId\""]; - string old_bond_id = 2 [(gogoproto.moretags) = "json:\"oldBondId\" yaml:\"oldBondId\""]; - string signer = 3; -} - -// MsgReAssociateRecordsResponse is response type for MsgReAssociateRecords -message MsgReAssociateRecordsResponse {} diff --git a/scripts/proto-gen.sh b/scripts/proto-gen.sh index e5fd389..d0f4d5c 100755 --- a/scripts/proto-gen.sh +++ b/scripts/proto-gen.sh @@ -5,36 +5,15 @@ set -e REPO_ROOT=$(pwd) I=$REPO_ROOT/proto -DEST_TS=$REPO_ROOT/src/proto/ +DEST_TS=$REPO_ROOT/src/proto2/ echo "Generating protobuf files" mkdir -p $DEST_TS protoc \ - --plugin=protoc-gen-ts=$REPO_ROOT/node_modules/.bin/protoc-gen-ts \ - --ts_out=$DEST_TS \ + --plugin=$REPO_ROOT/node_modules/.bin/protoc-gen-ts_proto \ + --ts_proto_out=$DEST_TS \ --proto_path=$I \ - $(find $REPO_ROOT/proto/vulcanize -iname "*.proto") - -SED='sed -i' -if [[ "$OSTYPE" == "darwin"* ]]; then - SED='sed -i ""' -fi - -echo "Removing gRPC references..." -# https://github.com/tharsis/evmosjs/tree/main/packages/proto#note - -for file in $(find $REPO_ROOT/src/proto -type f) -do - line=$(grep -n '@grpc/grpc-js' $file | cut -f1 -d':') - if [[ -n "$line" ]] && [[ "$line" -gt 0 ]]; then - echo "Processing file: $file" - $SED "${line}d" ${file} - functions=$(grep -n 'interface GrpcUnaryServiceInterface' $file | cut -f1 -d':') - $SED "${functions},\$d" ${file} - echo '}' >> $file - fi - $SED '1s#^#/* eslint-disable */\n#' $file - $SED '1s#^#// @ts-nocheck\n#' $file -done + --ts_proto_opt="esModuleInterop=true,forceLong=long,useOptionals=messages" \ + $(find $REPO_ROOT/proto/cerc -iname "*.proto") diff --git a/src/proto2/amino/amino.ts b/src/proto2/amino/amino.ts new file mode 100644 index 0000000..4b67dcf --- /dev/null +++ b/src/proto2/amino/amino.ts @@ -0,0 +1,2 @@ +/* eslint-disable */ +export const protobufPackage = "amino"; diff --git a/src/proto2/cerc/auction/module/v1/module.ts b/src/proto2/cerc/auction/module/v1/module.ts new file mode 100644 index 0000000..6573f98 --- /dev/null +++ b/src/proto2/cerc/auction/module/v1/module.ts @@ -0,0 +1,83 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.auction.module.v1"; + +/** + * Module is the app config object of the module. + * Learn more: https://docs.cosmos.network/main/building-modules/depinject + */ +export interface Module {} + +function createBaseModule(): Module { + return {}; +} + +export const Module = { + encode(_: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Module { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/src/proto2/cerc/auction/v1/auction.ts b/src/proto2/cerc/auction/v1/auction.ts new file mode 100644 index 0000000..e24cb80 --- /dev/null +++ b/src/proto2/cerc/auction/v1/auction.ts @@ -0,0 +1,739 @@ +/* eslint-disable */ +import { Duration } from "../../../google/protobuf/duration"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.auction.v1"; + +/** Params defines the auction module parameters */ +export interface Params { + /** Duration of the commits phase in seconds */ + commitsDuration?: Duration; + /** Duration of the reveals phase in seconds */ + revealsDuration?: Duration; + /** Commit fees */ + commitFee?: Coin; + /** Reveal fees */ + revealFee?: Coin; + /** Minimum acceptable bid amount */ + minimumBid?: Coin; +} + +/** Auction represents a sealed-bid on-chain auction */ +export interface Auction { + id: string; + status: string; + /** Address of the creator of the auction */ + ownerAddress: string; + /** Timestamp at which the auction was created */ + createTime?: Date; + /** Timestamp at which the commits phase concluded */ + commitsEndTime?: Date; + /** Timestamp at which the reveals phase concluded */ + revealsEndTime?: Date; + /** + * Commit and reveal fees must both be paid when committing a bid + * Reveal fee is returned only if the bid is revealed + */ + commitFee?: Coin; + revealFee?: Coin; + /** Minimum acceptable bid amount for a valid commit */ + minimumBid?: Coin; + /** Address of the winner */ + winnerAddress: string; + /** Winning bid, i.e., the highest bid */ + winningBid?: Coin; + /** Amount the winner pays, i.e. the second highest auction */ + winningPrice?: Coin; +} + +export interface Auctions { + auctions: Auction[]; +} + +/** Bid represents a sealed bid (commit) made during the auction */ +export interface Bid { + auctionId: string; + bidderAddress: string; + status: string; + commitHash: string; + commitTime?: Date; + commitFee?: Coin; + revealTime?: Date; + revealFee?: Coin; + bidAmount?: Coin; +} + +function createBaseParams(): Params { + return { + commitsDuration: undefined, + revealsDuration: undefined, + commitFee: undefined, + revealFee: undefined, + minimumBid: undefined, + }; +} + +export const Params = { + encode( + message: Params, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.commitsDuration !== undefined) { + Duration.encode( + message.commitsDuration, + writer.uint32(10).fork() + ).ldelim(); + } + if (message.revealsDuration !== undefined) { + Duration.encode( + message.revealsDuration, + writer.uint32(18).fork() + ).ldelim(); + } + if (message.commitFee !== undefined) { + Coin.encode(message.commitFee, writer.uint32(26).fork()).ldelim(); + } + if (message.revealFee !== undefined) { + Coin.encode(message.revealFee, writer.uint32(34).fork()).ldelim(); + } + if (message.minimumBid !== undefined) { + Coin.encode(message.minimumBid, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commitsDuration = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.revealsDuration = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.commitFee = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.revealFee = Coin.decode(reader, reader.uint32()); + break; + case 5: + message.minimumBid = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + commitsDuration: isSet(object.commitsDuration) + ? Duration.fromJSON(object.commitsDuration) + : undefined, + revealsDuration: isSet(object.revealsDuration) + ? Duration.fromJSON(object.revealsDuration) + : undefined, + commitFee: isSet(object.commitFee) + ? Coin.fromJSON(object.commitFee) + : undefined, + revealFee: isSet(object.revealFee) + ? Coin.fromJSON(object.revealFee) + : undefined, + minimumBid: isSet(object.minimumBid) + ? Coin.fromJSON(object.minimumBid) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.commitsDuration !== undefined && + (obj.commitsDuration = message.commitsDuration + ? Duration.toJSON(message.commitsDuration) + : undefined); + message.revealsDuration !== undefined && + (obj.revealsDuration = message.revealsDuration + ? Duration.toJSON(message.revealsDuration) + : undefined); + message.commitFee !== undefined && + (obj.commitFee = message.commitFee + ? Coin.toJSON(message.commitFee) + : undefined); + message.revealFee !== undefined && + (obj.revealFee = message.revealFee + ? Coin.toJSON(message.revealFee) + : undefined); + message.minimumBid !== undefined && + (obj.minimumBid = message.minimumBid + ? Coin.toJSON(message.minimumBid) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.commitsDuration = + object.commitsDuration !== undefined && object.commitsDuration !== null + ? Duration.fromPartial(object.commitsDuration) + : undefined; + message.revealsDuration = + object.revealsDuration !== undefined && object.revealsDuration !== null + ? Duration.fromPartial(object.revealsDuration) + : undefined; + message.commitFee = + object.commitFee !== undefined && object.commitFee !== null + ? Coin.fromPartial(object.commitFee) + : undefined; + message.revealFee = + object.revealFee !== undefined && object.revealFee !== null + ? Coin.fromPartial(object.revealFee) + : undefined; + message.minimumBid = + object.minimumBid !== undefined && object.minimumBid !== null + ? Coin.fromPartial(object.minimumBid) + : undefined; + return message; + }, +}; + +function createBaseAuction(): Auction { + return { + id: "", + status: "", + ownerAddress: "", + createTime: undefined, + commitsEndTime: undefined, + revealsEndTime: undefined, + commitFee: undefined, + revealFee: undefined, + minimumBid: undefined, + winnerAddress: "", + winningBid: undefined, + winningPrice: undefined, + }; +} + +export const Auction = { + encode( + message: Auction, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.status !== "") { + writer.uint32(18).string(message.status); + } + if (message.ownerAddress !== "") { + writer.uint32(26).string(message.ownerAddress); + } + if (message.createTime !== undefined) { + Timestamp.encode( + toTimestamp(message.createTime), + writer.uint32(34).fork() + ).ldelim(); + } + if (message.commitsEndTime !== undefined) { + Timestamp.encode( + toTimestamp(message.commitsEndTime), + writer.uint32(42).fork() + ).ldelim(); + } + if (message.revealsEndTime !== undefined) { + Timestamp.encode( + toTimestamp(message.revealsEndTime), + writer.uint32(50).fork() + ).ldelim(); + } + if (message.commitFee !== undefined) { + Coin.encode(message.commitFee, writer.uint32(58).fork()).ldelim(); + } + if (message.revealFee !== undefined) { + Coin.encode(message.revealFee, writer.uint32(66).fork()).ldelim(); + } + if (message.minimumBid !== undefined) { + Coin.encode(message.minimumBid, writer.uint32(74).fork()).ldelim(); + } + if (message.winnerAddress !== "") { + writer.uint32(82).string(message.winnerAddress); + } + if (message.winningBid !== undefined) { + Coin.encode(message.winningBid, writer.uint32(90).fork()).ldelim(); + } + if (message.winningPrice !== undefined) { + Coin.encode(message.winningPrice, writer.uint32(98).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Auction { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.status = reader.string(); + break; + case 3: + message.ownerAddress = reader.string(); + break; + case 4: + message.createTime = fromTimestamp( + Timestamp.decode(reader, reader.uint32()) + ); + break; + case 5: + message.commitsEndTime = fromTimestamp( + Timestamp.decode(reader, reader.uint32()) + ); + break; + case 6: + message.revealsEndTime = fromTimestamp( + Timestamp.decode(reader, reader.uint32()) + ); + break; + case 7: + message.commitFee = Coin.decode(reader, reader.uint32()); + break; + case 8: + message.revealFee = Coin.decode(reader, reader.uint32()); + break; + case 9: + message.minimumBid = Coin.decode(reader, reader.uint32()); + break; + case 10: + message.winnerAddress = reader.string(); + break; + case 11: + message.winningBid = Coin.decode(reader, reader.uint32()); + break; + case 12: + message.winningPrice = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Auction { + return { + id: isSet(object.id) ? String(object.id) : "", + status: isSet(object.status) ? String(object.status) : "", + ownerAddress: isSet(object.ownerAddress) + ? String(object.ownerAddress) + : "", + createTime: isSet(object.createTime) + ? fromJsonTimestamp(object.createTime) + : undefined, + commitsEndTime: isSet(object.commitsEndTime) + ? fromJsonTimestamp(object.commitsEndTime) + : undefined, + revealsEndTime: isSet(object.revealsEndTime) + ? fromJsonTimestamp(object.revealsEndTime) + : undefined, + commitFee: isSet(object.commitFee) + ? Coin.fromJSON(object.commitFee) + : undefined, + revealFee: isSet(object.revealFee) + ? Coin.fromJSON(object.revealFee) + : undefined, + minimumBid: isSet(object.minimumBid) + ? Coin.fromJSON(object.minimumBid) + : undefined, + winnerAddress: isSet(object.winnerAddress) + ? String(object.winnerAddress) + : "", + winningBid: isSet(object.winningBid) + ? Coin.fromJSON(object.winningBid) + : undefined, + winningPrice: isSet(object.winningPrice) + ? Coin.fromJSON(object.winningPrice) + : undefined, + }; + }, + + toJSON(message: Auction): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.status !== undefined && (obj.status = message.status); + message.ownerAddress !== undefined && + (obj.ownerAddress = message.ownerAddress); + message.createTime !== undefined && + (obj.createTime = message.createTime.toISOString()); + message.commitsEndTime !== undefined && + (obj.commitsEndTime = message.commitsEndTime.toISOString()); + message.revealsEndTime !== undefined && + (obj.revealsEndTime = message.revealsEndTime.toISOString()); + message.commitFee !== undefined && + (obj.commitFee = message.commitFee + ? Coin.toJSON(message.commitFee) + : undefined); + message.revealFee !== undefined && + (obj.revealFee = message.revealFee + ? Coin.toJSON(message.revealFee) + : undefined); + message.minimumBid !== undefined && + (obj.minimumBid = message.minimumBid + ? Coin.toJSON(message.minimumBid) + : undefined); + message.winnerAddress !== undefined && + (obj.winnerAddress = message.winnerAddress); + message.winningBid !== undefined && + (obj.winningBid = message.winningBid + ? Coin.toJSON(message.winningBid) + : undefined); + message.winningPrice !== undefined && + (obj.winningPrice = message.winningPrice + ? Coin.toJSON(message.winningPrice) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Auction { + const message = createBaseAuction(); + message.id = object.id ?? ""; + message.status = object.status ?? ""; + message.ownerAddress = object.ownerAddress ?? ""; + message.createTime = object.createTime ?? undefined; + message.commitsEndTime = object.commitsEndTime ?? undefined; + message.revealsEndTime = object.revealsEndTime ?? undefined; + message.commitFee = + object.commitFee !== undefined && object.commitFee !== null + ? Coin.fromPartial(object.commitFee) + : undefined; + message.revealFee = + object.revealFee !== undefined && object.revealFee !== null + ? Coin.fromPartial(object.revealFee) + : undefined; + message.minimumBid = + object.minimumBid !== undefined && object.minimumBid !== null + ? Coin.fromPartial(object.minimumBid) + : undefined; + message.winnerAddress = object.winnerAddress ?? ""; + message.winningBid = + object.winningBid !== undefined && object.winningBid !== null + ? Coin.fromPartial(object.winningBid) + : undefined; + message.winningPrice = + object.winningPrice !== undefined && object.winningPrice !== null + ? Coin.fromPartial(object.winningPrice) + : undefined; + return message; + }, +}; + +function createBaseAuctions(): Auctions { + return { auctions: [] }; +} + +export const Auctions = { + encode( + message: Auctions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.auctions) { + Auction.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Auctions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuctions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctions.push(Auction.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Auctions { + return { + auctions: Array.isArray(object?.auctions) + ? object.auctions.map((e: any) => Auction.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Auctions): unknown { + const obj: any = {}; + if (message.auctions) { + obj.auctions = message.auctions.map((e) => + e ? Auction.toJSON(e) : undefined + ); + } else { + obj.auctions = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Auctions { + const message = createBaseAuctions(); + message.auctions = + object.auctions?.map((e) => Auction.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBid(): Bid { + return { + auctionId: "", + bidderAddress: "", + status: "", + commitHash: "", + commitTime: undefined, + commitFee: undefined, + revealTime: undefined, + revealFee: undefined, + bidAmount: undefined, + }; +} + +export const Bid = { + encode(message: Bid, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.auctionId !== "") { + writer.uint32(10).string(message.auctionId); + } + if (message.bidderAddress !== "") { + writer.uint32(18).string(message.bidderAddress); + } + if (message.status !== "") { + writer.uint32(26).string(message.status); + } + if (message.commitHash !== "") { + writer.uint32(34).string(message.commitHash); + } + if (message.commitTime !== undefined) { + Timestamp.encode( + toTimestamp(message.commitTime), + writer.uint32(42).fork() + ).ldelim(); + } + if (message.commitFee !== undefined) { + Coin.encode(message.commitFee, writer.uint32(50).fork()).ldelim(); + } + if (message.revealTime !== undefined) { + Timestamp.encode( + toTimestamp(message.revealTime), + writer.uint32(58).fork() + ).ldelim(); + } + if (message.revealFee !== undefined) { + Coin.encode(message.revealFee, writer.uint32(66).fork()).ldelim(); + } + if (message.bidAmount !== undefined) { + Coin.encode(message.bidAmount, writer.uint32(74).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Bid { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBid(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctionId = reader.string(); + break; + case 2: + message.bidderAddress = reader.string(); + break; + case 3: + message.status = reader.string(); + break; + case 4: + message.commitHash = reader.string(); + break; + case 5: + message.commitTime = fromTimestamp( + Timestamp.decode(reader, reader.uint32()) + ); + break; + case 6: + message.commitFee = Coin.decode(reader, reader.uint32()); + break; + case 7: + message.revealTime = fromTimestamp( + Timestamp.decode(reader, reader.uint32()) + ); + break; + case 8: + message.revealFee = Coin.decode(reader, reader.uint32()); + break; + case 9: + message.bidAmount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Bid { + return { + auctionId: isSet(object.auctionId) ? String(object.auctionId) : "", + bidderAddress: isSet(object.bidderAddress) + ? String(object.bidderAddress) + : "", + status: isSet(object.status) ? String(object.status) : "", + commitHash: isSet(object.commitHash) ? String(object.commitHash) : "", + commitTime: isSet(object.commitTime) + ? fromJsonTimestamp(object.commitTime) + : undefined, + commitFee: isSet(object.commitFee) + ? Coin.fromJSON(object.commitFee) + : undefined, + revealTime: isSet(object.revealTime) + ? fromJsonTimestamp(object.revealTime) + : undefined, + revealFee: isSet(object.revealFee) + ? Coin.fromJSON(object.revealFee) + : undefined, + bidAmount: isSet(object.bidAmount) + ? Coin.fromJSON(object.bidAmount) + : undefined, + }; + }, + + toJSON(message: Bid): unknown { + const obj: any = {}; + message.auctionId !== undefined && (obj.auctionId = message.auctionId); + message.bidderAddress !== undefined && + (obj.bidderAddress = message.bidderAddress); + message.status !== undefined && (obj.status = message.status); + message.commitHash !== undefined && (obj.commitHash = message.commitHash); + message.commitTime !== undefined && + (obj.commitTime = message.commitTime.toISOString()); + message.commitFee !== undefined && + (obj.commitFee = message.commitFee + ? Coin.toJSON(message.commitFee) + : undefined); + message.revealTime !== undefined && + (obj.revealTime = message.revealTime.toISOString()); + message.revealFee !== undefined && + (obj.revealFee = message.revealFee + ? Coin.toJSON(message.revealFee) + : undefined); + message.bidAmount !== undefined && + (obj.bidAmount = message.bidAmount + ? Coin.toJSON(message.bidAmount) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Bid { + const message = createBaseBid(); + message.auctionId = object.auctionId ?? ""; + message.bidderAddress = object.bidderAddress ?? ""; + message.status = object.status ?? ""; + message.commitHash = object.commitHash ?? ""; + message.commitTime = object.commitTime ?? undefined; + message.commitFee = + object.commitFee !== undefined && object.commitFee !== null + ? Coin.fromPartial(object.commitFee) + : undefined; + message.revealTime = object.revealTime ?? undefined; + message.revealFee = + object.revealFee !== undefined && object.revealFee !== null + ? Coin.fromPartial(object.revealFee) + : undefined; + message.bidAmount = + object.bidAmount !== undefined && object.bidAmount !== null + ? Coin.fromPartial(object.bidAmount) + : undefined; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +function toTimestamp(date: Date): Timestamp { + const seconds = numberToLong(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = t.seconds.toNumber() * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function numberToLong(number: number) { + return Long.fromNumber(number); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/auction/v1/genesis.ts b/src/proto2/cerc/auction/v1/genesis.ts new file mode 100644 index 0000000..5c40fb1 --- /dev/null +++ b/src/proto2/cerc/auction/v1/genesis.ts @@ -0,0 +1,124 @@ +/* eslint-disable */ +import { Params, Auctions } from "./auction"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.auction.v1"; + +/** GenesisState defines the genesis state of the auction module */ +export interface GenesisState { + params?: Params; + auctions?: Auctions; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, auctions: undefined }; +} + +export const GenesisState = { + encode( + message: GenesisState, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.auctions !== undefined) { + Auctions.encode(message.auctions, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.auctions = Auctions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + auctions: isSet(object.auctions) + ? Auctions.fromJSON(object.auctions) + : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.auctions !== undefined && + (obj.auctions = message.auctions + ? Auctions.toJSON(message.auctions) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): GenesisState { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.auctions = + object.auctions !== undefined && object.auctions !== null + ? Auctions.fromPartial(object.auctions) + : undefined; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/auction/v1/query.ts b/src/proto2/cerc/auction/v1/query.ts new file mode 100644 index 0000000..d819c2a --- /dev/null +++ b/src/proto2/cerc/auction/v1/query.ts @@ -0,0 +1,1236 @@ +/* eslint-disable */ +import { Params, Auctions, Auction, Bid } from "./auction"; +import { PageRequest } from "../../../cosmos/base/query/v1beta1/pagination"; +import Long from "long"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.auction.v1"; + +/** QueryParamsRequest is the format to query the parameters of the auction module */ +export interface QueryParamsRequest {} + +/** QueryParamsResponse returns parameters of the auction module */ +export interface QueryParamsResponse { + params?: Params; +} + +/** AuctionsRequest is the format for querying all the auctions */ +export interface QueryAuctionsRequest { + /** pagination defines an optional pagination info for the next request */ + pagination?: PageRequest; +} + +/** AuctionsResponse returns the list of all auctions */ +export interface QueryAuctionsResponse { + /** List of auctions */ + auctions?: Auctions; + /** pagination defines an optional pagination info for the next request */ + pagination?: PageRequest; +} + +/** AuctionRequest is the format for querying a specific auction */ +export interface QueryAuctionRequest { + /** Auction id */ + id: string; +} + +/** AuctionResponse returns the details of the queried auction */ +export interface QueryAuctionResponse { + /** Auction details */ + auction?: Auction; +} + +/** BidRequest is the format for querying a specific bid in an auction */ +export interface QueryBidRequest { + /** Auction id */ + auctionId: string; + /** Bidder address */ + bidder: string; +} + +/** BidResponse returns the details of the queried bid */ +export interface QueryBidResponse { + /** Bid details */ + bid?: Bid; +} + +/** BidsRequest is the format for querying all bids in an auction */ +export interface QueryBidsRequest { + /** Auction id */ + auctionId: string; +} + +/** BidsResponse returns details of all bids in an auction */ +export interface QueryBidsResponse { + /** List of bids in the auction */ + bids: Bid[]; +} + +/** AuctionsByBidderRequest is the format for querying all auctions containing a bidder address */ +export interface QueryAuctionsByBidderRequest { + /** Address of the bidder */ + bidderAddress: string; +} + +/** AuctionsByBidderResponse returns all auctions containing a bidder */ +export interface QueryAuctionsByBidderResponse { + /** List of auctions */ + auctions?: Auctions; +} + +/** AuctionsByOwnerRequest is the format for querying all auctions created by an owner */ +export interface QueryAuctionsByOwnerRequest { + /** Address of the owner */ + ownerAddress: string; +} + +/** AuctionsByOwnerResponse returns all auctions created by an owner */ +export interface QueryAuctionsByOwnerResponse { + /** List of auctions */ + auctions?: Auctions; +} + +/** BalanceRequest is the format to fetch all balances */ +export interface QueryGetAuctionModuleBalanceRequest {} + +export interface QueryGetAuctionModuleBalanceResponse { + /** Set of all balances within the auction */ + balance: Coin[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode( + _: QueryParamsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode( + message: QueryParamsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryAuctionsRequest(): QueryAuctionsRequest { + return { pagination: undefined }; +} + +export const QueryAuctionsRequest = { + encode( + message: QueryAuctionsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryAuctionsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuctionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAuctionsRequest { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryAuctionsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryAuctionsRequest { + const message = createBaseQueryAuctionsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuctionsResponse(): QueryAuctionsResponse { + return { auctions: undefined, pagination: undefined }; +} + +export const QueryAuctionsResponse = { + encode( + message: QueryAuctionsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auctions !== undefined) { + Auctions.encode(message.auctions, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryAuctionsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuctionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctions = Auctions.decode(reader, reader.uint32()); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAuctionsResponse { + return { + auctions: isSet(object.auctions) + ? Auctions.fromJSON(object.auctions) + : undefined, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryAuctionsResponse): unknown { + const obj: any = {}; + message.auctions !== undefined && + (obj.auctions = message.auctions + ? Auctions.toJSON(message.auctions) + : undefined); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryAuctionsResponse { + const message = createBaseQueryAuctionsResponse(); + message.auctions = + object.auctions !== undefined && object.auctions !== null + ? Auctions.fromPartial(object.auctions) + : undefined; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuctionRequest(): QueryAuctionRequest { + return { id: "" }; +} + +export const QueryAuctionRequest = { + encode( + message: QueryAuctionRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAuctionRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuctionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAuctionRequest { + return { + id: isSet(object.id) ? String(object.id) : "", + }; + }, + + toJSON(message: QueryAuctionRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryAuctionRequest { + const message = createBaseQueryAuctionRequest(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryAuctionResponse(): QueryAuctionResponse { + return { auction: undefined }; +} + +export const QueryAuctionResponse = { + encode( + message: QueryAuctionResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auction !== undefined) { + Auction.encode(message.auction, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryAuctionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuctionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auction = Auction.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAuctionResponse { + return { + auction: isSet(object.auction) + ? Auction.fromJSON(object.auction) + : undefined, + }; + }, + + toJSON(message: QueryAuctionResponse): unknown { + const obj: any = {}; + message.auction !== undefined && + (obj.auction = message.auction + ? Auction.toJSON(message.auction) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryAuctionResponse { + const message = createBaseQueryAuctionResponse(); + message.auction = + object.auction !== undefined && object.auction !== null + ? Auction.fromPartial(object.auction) + : undefined; + return message; + }, +}; + +function createBaseQueryBidRequest(): QueryBidRequest { + return { auctionId: "", bidder: "" }; +} + +export const QueryBidRequest = { + encode( + message: QueryBidRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auctionId !== "") { + writer.uint32(10).string(message.auctionId); + } + if (message.bidder !== "") { + writer.uint32(18).string(message.bidder); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBidRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBidRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctionId = reader.string(); + break; + case 2: + message.bidder = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBidRequest { + return { + auctionId: isSet(object.auctionId) ? String(object.auctionId) : "", + bidder: isSet(object.bidder) ? String(object.bidder) : "", + }; + }, + + toJSON(message: QueryBidRequest): unknown { + const obj: any = {}; + message.auctionId !== undefined && (obj.auctionId = message.auctionId); + message.bidder !== undefined && (obj.bidder = message.bidder); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryBidRequest { + const message = createBaseQueryBidRequest(); + message.auctionId = object.auctionId ?? ""; + message.bidder = object.bidder ?? ""; + return message; + }, +}; + +function createBaseQueryBidResponse(): QueryBidResponse { + return { bid: undefined }; +} + +export const QueryBidResponse = { + encode( + message: QueryBidResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bid !== undefined) { + Bid.encode(message.bid, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBidResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBidResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bid = Bid.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBidResponse { + return { + bid: isSet(object.bid) ? Bid.fromJSON(object.bid) : undefined, + }; + }, + + toJSON(message: QueryBidResponse): unknown { + const obj: any = {}; + message.bid !== undefined && + (obj.bid = message.bid ? Bid.toJSON(message.bid) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryBidResponse { + const message = createBaseQueryBidResponse(); + message.bid = + object.bid !== undefined && object.bid !== null + ? Bid.fromPartial(object.bid) + : undefined; + return message; + }, +}; + +function createBaseQueryBidsRequest(): QueryBidsRequest { + return { auctionId: "" }; +} + +export const QueryBidsRequest = { + encode( + message: QueryBidsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auctionId !== "") { + writer.uint32(10).string(message.auctionId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBidsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBidsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBidsRequest { + return { + auctionId: isSet(object.auctionId) ? String(object.auctionId) : "", + }; + }, + + toJSON(message: QueryBidsRequest): unknown { + const obj: any = {}; + message.auctionId !== undefined && (obj.auctionId = message.auctionId); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryBidsRequest { + const message = createBaseQueryBidsRequest(); + message.auctionId = object.auctionId ?? ""; + return message; + }, +}; + +function createBaseQueryBidsResponse(): QueryBidsResponse { + return { bids: [] }; +} + +export const QueryBidsResponse = { + encode( + message: QueryBidsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.bids) { + Bid.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBidsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBidsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bids.push(Bid.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBidsResponse { + return { + bids: Array.isArray(object?.bids) + ? object.bids.map((e: any) => Bid.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryBidsResponse): unknown { + const obj: any = {}; + if (message.bids) { + obj.bids = message.bids.map((e) => (e ? Bid.toJSON(e) : undefined)); + } else { + obj.bids = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryBidsResponse { + const message = createBaseQueryBidsResponse(); + message.bids = object.bids?.map((e) => Bid.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryAuctionsByBidderRequest(): QueryAuctionsByBidderRequest { + return { bidderAddress: "" }; +} + +export const QueryAuctionsByBidderRequest = { + encode( + message: QueryAuctionsByBidderRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bidderAddress !== "") { + writer.uint32(10).string(message.bidderAddress); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryAuctionsByBidderRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuctionsByBidderRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bidderAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAuctionsByBidderRequest { + return { + bidderAddress: isSet(object.bidderAddress) + ? String(object.bidderAddress) + : "", + }; + }, + + toJSON(message: QueryAuctionsByBidderRequest): unknown { + const obj: any = {}; + message.bidderAddress !== undefined && + (obj.bidderAddress = message.bidderAddress); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryAuctionsByBidderRequest { + const message = createBaseQueryAuctionsByBidderRequest(); + message.bidderAddress = object.bidderAddress ?? ""; + return message; + }, +}; + +function createBaseQueryAuctionsByBidderResponse(): QueryAuctionsByBidderResponse { + return { auctions: undefined }; +} + +export const QueryAuctionsByBidderResponse = { + encode( + message: QueryAuctionsByBidderResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auctions !== undefined) { + Auctions.encode(message.auctions, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryAuctionsByBidderResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuctionsByBidderResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctions = Auctions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAuctionsByBidderResponse { + return { + auctions: isSet(object.auctions) + ? Auctions.fromJSON(object.auctions) + : undefined, + }; + }, + + toJSON(message: QueryAuctionsByBidderResponse): unknown { + const obj: any = {}; + message.auctions !== undefined && + (obj.auctions = message.auctions + ? Auctions.toJSON(message.auctions) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryAuctionsByBidderResponse { + const message = createBaseQueryAuctionsByBidderResponse(); + message.auctions = + object.auctions !== undefined && object.auctions !== null + ? Auctions.fromPartial(object.auctions) + : undefined; + return message; + }, +}; + +function createBaseQueryAuctionsByOwnerRequest(): QueryAuctionsByOwnerRequest { + return { ownerAddress: "" }; +} + +export const QueryAuctionsByOwnerRequest = { + encode( + message: QueryAuctionsByOwnerRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.ownerAddress !== "") { + writer.uint32(10).string(message.ownerAddress); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryAuctionsByOwnerRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuctionsByOwnerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ownerAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAuctionsByOwnerRequest { + return { + ownerAddress: isSet(object.ownerAddress) + ? String(object.ownerAddress) + : "", + }; + }, + + toJSON(message: QueryAuctionsByOwnerRequest): unknown { + const obj: any = {}; + message.ownerAddress !== undefined && + (obj.ownerAddress = message.ownerAddress); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryAuctionsByOwnerRequest { + const message = createBaseQueryAuctionsByOwnerRequest(); + message.ownerAddress = object.ownerAddress ?? ""; + return message; + }, +}; + +function createBaseQueryAuctionsByOwnerResponse(): QueryAuctionsByOwnerResponse { + return { auctions: undefined }; +} + +export const QueryAuctionsByOwnerResponse = { + encode( + message: QueryAuctionsByOwnerResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auctions !== undefined) { + Auctions.encode(message.auctions, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryAuctionsByOwnerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuctionsByOwnerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctions = Auctions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAuctionsByOwnerResponse { + return { + auctions: isSet(object.auctions) + ? Auctions.fromJSON(object.auctions) + : undefined, + }; + }, + + toJSON(message: QueryAuctionsByOwnerResponse): unknown { + const obj: any = {}; + message.auctions !== undefined && + (obj.auctions = message.auctions + ? Auctions.toJSON(message.auctions) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryAuctionsByOwnerResponse { + const message = createBaseQueryAuctionsByOwnerResponse(); + message.auctions = + object.auctions !== undefined && object.auctions !== null + ? Auctions.fromPartial(object.auctions) + : undefined; + return message; + }, +}; + +function createBaseQueryGetAuctionModuleBalanceRequest(): QueryGetAuctionModuleBalanceRequest { + return {}; +} + +export const QueryGetAuctionModuleBalanceRequest = { + encode( + _: QueryGetAuctionModuleBalanceRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetAuctionModuleBalanceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetAuctionModuleBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryGetAuctionModuleBalanceRequest { + return {}; + }, + + toJSON(_: QueryGetAuctionModuleBalanceRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial< + I extends Exact, I> + >(_: I): QueryGetAuctionModuleBalanceRequest { + const message = createBaseQueryGetAuctionModuleBalanceRequest(); + return message; + }, +}; + +function createBaseQueryGetAuctionModuleBalanceResponse(): QueryGetAuctionModuleBalanceResponse { + return { balance: [] }; +} + +export const QueryGetAuctionModuleBalanceResponse = { + encode( + message: QueryGetAuctionModuleBalanceResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.balance) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetAuctionModuleBalanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetAuctionModuleBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balance.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetAuctionModuleBalanceResponse { + return { + balance: Array.isArray(object?.balance) + ? object.balance.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryGetAuctionModuleBalanceResponse): unknown { + const obj: any = {}; + if (message.balance) { + obj.balance = message.balance.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.balance = []; + } + return obj; + }, + + fromPartial< + I extends Exact, I> + >(object: I): QueryGetAuctionModuleBalanceResponse { + const message = createBaseQueryGetAuctionModuleBalanceResponse(); + message.balance = object.balance?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +/** Query defines the gRPC querier interface for the auction module */ +export interface Query { + /** Params queries auction module params */ + Params(request: QueryParamsRequest): Promise; + /** Auctions queries all auctions */ + Auctions(request: QueryAuctionsRequest): Promise; + /** GetAuction queries an auction */ + GetAuction(request: QueryAuctionRequest): Promise; + /** GetBid queries an auction bid */ + GetBid(request: QueryBidRequest): Promise; + /** GetBids queries all auction bids */ + GetBids(request: QueryBidsRequest): Promise; + /** AuctionsByBidder queries auctions by bidder */ + AuctionsByBidder( + request: QueryAuctionsByBidderRequest + ): Promise; + /** AuctionsByOwner queries auctions by owner */ + AuctionsByOwner( + request: QueryAuctionsByOwnerRequest + ): Promise; + /** GetAuctionModuleBalance queries the auction module account balance */ + GetAuctionModuleBalance( + request: QueryGetAuctionModuleBalanceRequest + ): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Auctions = this.Auctions.bind(this); + this.GetAuction = this.GetAuction.bind(this); + this.GetBid = this.GetBid.bind(this); + this.GetBids = this.GetBids.bind(this); + this.AuctionsByBidder = this.AuctionsByBidder.bind(this); + this.AuctionsByOwner = this.AuctionsByOwner.bind(this); + this.GetAuctionModuleBalance = this.GetAuctionModuleBalance.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.auction.v1.Query", "Params", data); + return promise.then((data) => + QueryParamsResponse.decode(new _m0.Reader(data)) + ); + } + + Auctions(request: QueryAuctionsRequest): Promise { + const data = QueryAuctionsRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.auction.v1.Query", "Auctions", data); + return promise.then((data) => + QueryAuctionsResponse.decode(new _m0.Reader(data)) + ); + } + + GetAuction(request: QueryAuctionRequest): Promise { + const data = QueryAuctionRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.auction.v1.Query", + "GetAuction", + data + ); + return promise.then((data) => + QueryAuctionResponse.decode(new _m0.Reader(data)) + ); + } + + GetBid(request: QueryBidRequest): Promise { + const data = QueryBidRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.auction.v1.Query", "GetBid", data); + return promise.then((data) => + QueryBidResponse.decode(new _m0.Reader(data)) + ); + } + + GetBids(request: QueryBidsRequest): Promise { + const data = QueryBidsRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.auction.v1.Query", "GetBids", data); + return promise.then((data) => + QueryBidsResponse.decode(new _m0.Reader(data)) + ); + } + + AuctionsByBidder( + request: QueryAuctionsByBidderRequest + ): Promise { + const data = QueryAuctionsByBidderRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.auction.v1.Query", + "AuctionsByBidder", + data + ); + return promise.then((data) => + QueryAuctionsByBidderResponse.decode(new _m0.Reader(data)) + ); + } + + AuctionsByOwner( + request: QueryAuctionsByOwnerRequest + ): Promise { + const data = QueryAuctionsByOwnerRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.auction.v1.Query", + "AuctionsByOwner", + data + ); + return promise.then((data) => + QueryAuctionsByOwnerResponse.decode(new _m0.Reader(data)) + ); + } + + GetAuctionModuleBalance( + request: QueryGetAuctionModuleBalanceRequest + ): Promise { + const data = QueryGetAuctionModuleBalanceRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.auction.v1.Query", + "GetAuctionModuleBalance", + data + ); + return promise.then((data) => + QueryGetAuctionModuleBalanceResponse.decode(new _m0.Reader(data)) + ); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/auction/v1/tx.ts b/src/proto2/cerc/auction/v1/tx.ts new file mode 100644 index 0000000..f3b2c04 --- /dev/null +++ b/src/proto2/cerc/auction/v1/tx.ts @@ -0,0 +1,641 @@ +/* eslint-disable */ +import { Duration } from "../../../google/protobuf/duration"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import { Auction, Bid } from "./auction"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.auction.v1"; + +/** MsgCreateAuction defines a create auction message */ +export interface MsgCreateAuction { + /** Duration of the commits phase in seconds */ + commitsDuration?: Duration; + /** Duration of the reveals phase in seconds */ + revealsDuration?: Duration; + /** Commit fees */ + commitFee?: Coin; + /** Reveal fees */ + revealFee?: Coin; + /** Minimum acceptable bid amount */ + minimumBid?: Coin; + /** Address of the signer */ + signer: string; +} + +/** MsgCreateAuctionResponse returns the details of the created auction */ +export interface MsgCreateAuctionResponse { + /** Auction details */ + auction?: Auction; +} + +/** CommitBid defines the message to commit a bid */ +export interface MsgCommitBid { + /** Auction id */ + auctionId: string; + /** Commit Hash */ + commitHash: string; + /** Address of the signer */ + signer: string; +} + +/** MsgCommitBidResponse returns the state of the auction after the bid creation */ +export interface MsgCommitBidResponse { + /** Auction details */ + bid?: Bid; +} + +/** RevealBid defines the message to reveal a bid */ +export interface MsgRevealBid { + /** Auction id */ + auctionId: string; + /** Commit Hash */ + reveal: string; + /** Address of the signer */ + signer: string; +} + +/** MsgRevealBidResponse returns the state of the auction after the bid reveal */ +export interface MsgRevealBidResponse { + /** Auction details */ + auction?: Auction; +} + +function createBaseMsgCreateAuction(): MsgCreateAuction { + return { + commitsDuration: undefined, + revealsDuration: undefined, + commitFee: undefined, + revealFee: undefined, + minimumBid: undefined, + signer: "", + }; +} + +export const MsgCreateAuction = { + encode( + message: MsgCreateAuction, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.commitsDuration !== undefined) { + Duration.encode( + message.commitsDuration, + writer.uint32(10).fork() + ).ldelim(); + } + if (message.revealsDuration !== undefined) { + Duration.encode( + message.revealsDuration, + writer.uint32(18).fork() + ).ldelim(); + } + if (message.commitFee !== undefined) { + Coin.encode(message.commitFee, writer.uint32(26).fork()).ldelim(); + } + if (message.revealFee !== undefined) { + Coin.encode(message.revealFee, writer.uint32(34).fork()).ldelim(); + } + if (message.minimumBid !== undefined) { + Coin.encode(message.minimumBid, writer.uint32(42).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(50).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateAuction { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commitsDuration = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.revealsDuration = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.commitFee = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.revealFee = Coin.decode(reader, reader.uint32()); + break; + case 5: + message.minimumBid = Coin.decode(reader, reader.uint32()); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateAuction { + return { + commitsDuration: isSet(object.commitsDuration) + ? Duration.fromJSON(object.commitsDuration) + : undefined, + revealsDuration: isSet(object.revealsDuration) + ? Duration.fromJSON(object.revealsDuration) + : undefined, + commitFee: isSet(object.commitFee) + ? Coin.fromJSON(object.commitFee) + : undefined, + revealFee: isSet(object.revealFee) + ? Coin.fromJSON(object.revealFee) + : undefined, + minimumBid: isSet(object.minimumBid) + ? Coin.fromJSON(object.minimumBid) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgCreateAuction): unknown { + const obj: any = {}; + message.commitsDuration !== undefined && + (obj.commitsDuration = message.commitsDuration + ? Duration.toJSON(message.commitsDuration) + : undefined); + message.revealsDuration !== undefined && + (obj.revealsDuration = message.revealsDuration + ? Duration.toJSON(message.revealsDuration) + : undefined); + message.commitFee !== undefined && + (obj.commitFee = message.commitFee + ? Coin.toJSON(message.commitFee) + : undefined); + message.revealFee !== undefined && + (obj.revealFee = message.revealFee + ? Coin.toJSON(message.revealFee) + : undefined); + message.minimumBid !== undefined && + (obj.minimumBid = message.minimumBid + ? Coin.toJSON(message.minimumBid) + : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCreateAuction { + const message = createBaseMsgCreateAuction(); + message.commitsDuration = + object.commitsDuration !== undefined && object.commitsDuration !== null + ? Duration.fromPartial(object.commitsDuration) + : undefined; + message.revealsDuration = + object.revealsDuration !== undefined && object.revealsDuration !== null + ? Duration.fromPartial(object.revealsDuration) + : undefined; + message.commitFee = + object.commitFee !== undefined && object.commitFee !== null + ? Coin.fromPartial(object.commitFee) + : undefined; + message.revealFee = + object.revealFee !== undefined && object.revealFee !== null + ? Coin.fromPartial(object.revealFee) + : undefined; + message.minimumBid = + object.minimumBid !== undefined && object.minimumBid !== null + ? Coin.fromPartial(object.minimumBid) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuctionResponse(): MsgCreateAuctionResponse { + return { auction: undefined }; +} + +export const MsgCreateAuctionResponse = { + encode( + message: MsgCreateAuctionResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auction !== undefined) { + Auction.encode(message.auction, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgCreateAuctionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuctionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auction = Auction.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateAuctionResponse { + return { + auction: isSet(object.auction) + ? Auction.fromJSON(object.auction) + : undefined, + }; + }, + + toJSON(message: MsgCreateAuctionResponse): unknown { + const obj: any = {}; + message.auction !== undefined && + (obj.auction = message.auction + ? Auction.toJSON(message.auction) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCreateAuctionResponse { + const message = createBaseMsgCreateAuctionResponse(); + message.auction = + object.auction !== undefined && object.auction !== null + ? Auction.fromPartial(object.auction) + : undefined; + return message; + }, +}; + +function createBaseMsgCommitBid(): MsgCommitBid { + return { auctionId: "", commitHash: "", signer: "" }; +} + +export const MsgCommitBid = { + encode( + message: MsgCommitBid, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auctionId !== "") { + writer.uint32(10).string(message.auctionId); + } + if (message.commitHash !== "") { + writer.uint32(18).string(message.commitHash); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommitBid { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommitBid(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctionId = reader.string(); + break; + case 2: + message.commitHash = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCommitBid { + return { + auctionId: isSet(object.auctionId) ? String(object.auctionId) : "", + commitHash: isSet(object.commitHash) ? String(object.commitHash) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgCommitBid): unknown { + const obj: any = {}; + message.auctionId !== undefined && (obj.auctionId = message.auctionId); + message.commitHash !== undefined && (obj.commitHash = message.commitHash); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCommitBid { + const message = createBaseMsgCommitBid(); + message.auctionId = object.auctionId ?? ""; + message.commitHash = object.commitHash ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgCommitBidResponse(): MsgCommitBidResponse { + return { bid: undefined }; +} + +export const MsgCommitBidResponse = { + encode( + message: MsgCommitBidResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bid !== undefined) { + Bid.encode(message.bid, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgCommitBidResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommitBidResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bid = Bid.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCommitBidResponse { + return { + bid: isSet(object.bid) ? Bid.fromJSON(object.bid) : undefined, + }; + }, + + toJSON(message: MsgCommitBidResponse): unknown { + const obj: any = {}; + message.bid !== undefined && + (obj.bid = message.bid ? Bid.toJSON(message.bid) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCommitBidResponse { + const message = createBaseMsgCommitBidResponse(); + message.bid = + object.bid !== undefined && object.bid !== null + ? Bid.fromPartial(object.bid) + : undefined; + return message; + }, +}; + +function createBaseMsgRevealBid(): MsgRevealBid { + return { auctionId: "", reveal: "", signer: "" }; +} + +export const MsgRevealBid = { + encode( + message: MsgRevealBid, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auctionId !== "") { + writer.uint32(10).string(message.auctionId); + } + if (message.reveal !== "") { + writer.uint32(18).string(message.reveal); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevealBid { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevealBid(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctionId = reader.string(); + break; + case 2: + message.reveal = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgRevealBid { + return { + auctionId: isSet(object.auctionId) ? String(object.auctionId) : "", + reveal: isSet(object.reveal) ? String(object.reveal) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgRevealBid): unknown { + const obj: any = {}; + message.auctionId !== undefined && (obj.auctionId = message.auctionId); + message.reveal !== undefined && (obj.reveal = message.reveal); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgRevealBid { + const message = createBaseMsgRevealBid(); + message.auctionId = object.auctionId ?? ""; + message.reveal = object.reveal ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgRevealBidResponse(): MsgRevealBidResponse { + return { auction: undefined }; +} + +export const MsgRevealBidResponse = { + encode( + message: MsgRevealBidResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.auction !== undefined) { + Auction.encode(message.auction, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgRevealBidResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevealBidResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auction = Auction.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgRevealBidResponse { + return { + auction: isSet(object.auction) + ? Auction.fromJSON(object.auction) + : undefined, + }; + }, + + toJSON(message: MsgRevealBidResponse): unknown { + const obj: any = {}; + message.auction !== undefined && + (obj.auction = message.auction + ? Auction.toJSON(message.auction) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgRevealBidResponse { + const message = createBaseMsgRevealBidResponse(); + message.auction = + object.auction !== undefined && object.auction !== null + ? Auction.fromPartial(object.auction) + : undefined; + return message; + }, +}; + +/** Tx defines the gRPC tx interface */ +export interface Msg { + /** CreateAuction is the command for creating an auction */ + CreateAuction(request: MsgCreateAuction): Promise; + /** CommitBid is the command for committing a bid */ + CommitBid(request: MsgCommitBid): Promise; + /** RevealBid is the command for revealing a bid */ + RevealBid(request: MsgRevealBid): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.CreateAuction = this.CreateAuction.bind(this); + this.CommitBid = this.CommitBid.bind(this); + this.RevealBid = this.RevealBid.bind(this); + } + CreateAuction(request: MsgCreateAuction): Promise { + const data = MsgCreateAuction.encode(request).finish(); + const promise = this.rpc.request( + "cerc.auction.v1.Msg", + "CreateAuction", + data + ); + return promise.then((data) => + MsgCreateAuctionResponse.decode(new _m0.Reader(data)) + ); + } + + CommitBid(request: MsgCommitBid): Promise { + const data = MsgCommitBid.encode(request).finish(); + const promise = this.rpc.request("cerc.auction.v1.Msg", "CommitBid", data); + return promise.then((data) => + MsgCommitBidResponse.decode(new _m0.Reader(data)) + ); + } + + RevealBid(request: MsgRevealBid): Promise { + const data = MsgRevealBid.encode(request).finish(); + const promise = this.rpc.request("cerc.auction.v1.Msg", "RevealBid", data); + return promise.then((data) => + MsgRevealBidResponse.decode(new _m0.Reader(data)) + ); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/bond/module/v1/module.ts b/src/proto2/cerc/bond/module/v1/module.ts new file mode 100644 index 0000000..f5faaf0 --- /dev/null +++ b/src/proto2/cerc/bond/module/v1/module.ts @@ -0,0 +1,83 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.bond.module.v1"; + +/** + * Module is the app config object of the module. + * Learn more: https://docs.cosmos.network/main/building-modules/depinject + */ +export interface Module {} + +function createBaseModule(): Module { + return {}; +} + +export const Module = { + encode(_: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Module { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/src/proto2/cerc/bond/v1/bond.ts b/src/proto2/cerc/bond/v1/bond.ts new file mode 100644 index 0000000..a75987d --- /dev/null +++ b/src/proto2/cerc/bond/v1/bond.ts @@ -0,0 +1,194 @@ +/* eslint-disable */ +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.bond.v1"; + +/** Params defines the parameters of the bond module. */ +export interface Params { + /** max_bond_amount is maximum amount to bond */ + maxBondAmount?: Coin; +} + +/** Bond represents funds deposited by an account for record rent payments. */ +export interface Bond { + /** id is unique identifier of the bond */ + id: string; + /** owner of the bond */ + owner: string; + /** balance of the bond */ + balance: Coin[]; +} + +function createBaseParams(): Params { + return { maxBondAmount: undefined }; +} + +export const Params = { + encode( + message: Params, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.maxBondAmount !== undefined) { + Coin.encode(message.maxBondAmount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxBondAmount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + maxBondAmount: isSet(object.maxBondAmount) + ? Coin.fromJSON(object.maxBondAmount) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.maxBondAmount !== undefined && + (obj.maxBondAmount = message.maxBondAmount + ? Coin.toJSON(message.maxBondAmount) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.maxBondAmount = + object.maxBondAmount !== undefined && object.maxBondAmount !== null + ? Coin.fromPartial(object.maxBondAmount) + : undefined; + return message; + }, +}; + +function createBaseBond(): Bond { + return { id: "", owner: "", balance: [] }; +} + +export const Bond = { + encode(message: Bond, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + for (const v of message.balance) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Bond { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.owner = reader.string(); + break; + case 3: + message.balance.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Bond { + return { + id: isSet(object.id) ? String(object.id) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + balance: Array.isArray(object?.balance) + ? object.balance.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Bond): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.owner !== undefined && (obj.owner = message.owner); + if (message.balance) { + obj.balance = message.balance.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.balance = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Bond { + const message = createBaseBond(); + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + message.balance = object.balance?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/bond/v1/genesis.ts b/src/proto2/cerc/bond/v1/genesis.ts new file mode 100644 index 0000000..b2803d9 --- /dev/null +++ b/src/proto2/cerc/bond/v1/genesis.ts @@ -0,0 +1,124 @@ +/* eslint-disable */ +import { Params, Bond } from "./bond"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.bond.v1"; + +/** GenesisState defines the bond module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; + /** bonds defines all the bonds */ + bonds: Bond[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, bonds: [] }; +} + +export const GenesisState = { + encode( + message: GenesisState, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.bonds) { + Bond.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.bonds.push(Bond.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + bonds: Array.isArray(object?.bonds) + ? object.bonds.map((e: any) => Bond.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.bonds) { + obj.bonds = message.bonds.map((e) => (e ? Bond.toJSON(e) : undefined)); + } else { + obj.bonds = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): GenesisState { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.bonds = object.bonds?.map((e) => Bond.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/bond/v1/query.ts b/src/proto2/cerc/bond/v1/query.ts new file mode 100644 index 0000000..ffee412 --- /dev/null +++ b/src/proto2/cerc/bond/v1/query.ts @@ -0,0 +1,834 @@ +/* eslint-disable */ +import { Params, Bond } from "./bond"; +import { + PageRequest, + PageResponse, +} from "../../../cosmos/base/query/v1beta1/pagination"; +import Long from "long"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.bond.v1"; + +/** QueryParamsRequest is request for query the bond module params */ +export interface QueryParamsRequest {} + +/** QueryParamsResponse returns response type of bond module params */ +export interface QueryParamsResponse { + params?: Params; +} + +/** QueryGetBondById queries a bonds. */ +export interface QueryGetBondsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGetBondsResponse is response type for get the bonds by bond-id */ +export interface QueryGetBondsResponse { + bonds: Bond[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGetBondById */ +export interface QueryGetBondByIdRequest { + id: string; +} + +/** QueryGetBondByIdResponse returns QueryGetBondById query response */ +export interface QueryGetBondByIdResponse { + bond?: Bond; +} + +/** QueryGetBondsByOwnerRequest is request type for Query/GetBondsByOwner RPC Method */ +export interface QueryGetBondsByOwnerRequest { + owner: string; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGetBondsByOwnerResponse is response type for Query/GetBondsByOwner RPC Method */ +export interface QueryGetBondsByOwnerResponse { + bonds: Bond[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGetBondModuleBalanceRequest is request type for bond module balance rpc method */ +export interface QueryGetBondModuleBalanceRequest {} + +/** QueryGetBondModuleBalanceResponse is the response type for bond module balance rpc method */ +export interface QueryGetBondModuleBalanceResponse { + balance: Coin[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode( + _: QueryParamsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode( + message: QueryParamsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGetBondsRequest(): QueryGetBondsRequest { + return { pagination: undefined }; +} + +export const QueryGetBondsRequest = { + encode( + message: QueryGetBondsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetBondsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetBondsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetBondsRequest { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryGetBondsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryGetBondsRequest { + const message = createBaseQueryGetBondsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGetBondsResponse(): QueryGetBondsResponse { + return { bonds: [], pagination: undefined }; +} + +export const QueryGetBondsResponse = { + encode( + message: QueryGetBondsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.bonds) { + Bond.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetBondsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetBondsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bonds.push(Bond.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetBondsResponse { + return { + bonds: Array.isArray(object?.bonds) + ? object.bonds.map((e: any) => Bond.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryGetBondsResponse): unknown { + const obj: any = {}; + if (message.bonds) { + obj.bonds = message.bonds.map((e) => (e ? Bond.toJSON(e) : undefined)); + } else { + obj.bonds = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryGetBondsResponse { + const message = createBaseQueryGetBondsResponse(); + message.bonds = object.bonds?.map((e) => Bond.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGetBondByIdRequest(): QueryGetBondByIdRequest { + return { id: "" }; +} + +export const QueryGetBondByIdRequest = { + encode( + message: QueryGetBondByIdRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetBondByIdRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetBondByIdRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetBondByIdRequest { + return { + id: isSet(object.id) ? String(object.id) : "", + }; + }, + + toJSON(message: QueryGetBondByIdRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryGetBondByIdRequest { + const message = createBaseQueryGetBondByIdRequest(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryGetBondByIdResponse(): QueryGetBondByIdResponse { + return { bond: undefined }; +} + +export const QueryGetBondByIdResponse = { + encode( + message: QueryGetBondByIdResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bond !== undefined) { + Bond.encode(message.bond, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetBondByIdResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetBondByIdResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bond = Bond.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetBondByIdResponse { + return { + bond: isSet(object.bond) ? Bond.fromJSON(object.bond) : undefined, + }; + }, + + toJSON(message: QueryGetBondByIdResponse): unknown { + const obj: any = {}; + message.bond !== undefined && + (obj.bond = message.bond ? Bond.toJSON(message.bond) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryGetBondByIdResponse { + const message = createBaseQueryGetBondByIdResponse(); + message.bond = + object.bond !== undefined && object.bond !== null + ? Bond.fromPartial(object.bond) + : undefined; + return message; + }, +}; + +function createBaseQueryGetBondsByOwnerRequest(): QueryGetBondsByOwnerRequest { + return { owner: "", pagination: undefined }; +} + +export const QueryGetBondsByOwnerRequest = { + encode( + message: QueryGetBondsByOwnerRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetBondsByOwnerRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetBondsByOwnerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetBondsByOwnerRequest { + return { + owner: isSet(object.owner) ? String(object.owner) : "", + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryGetBondsByOwnerRequest): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryGetBondsByOwnerRequest { + const message = createBaseQueryGetBondsByOwnerRequest(); + message.owner = object.owner ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGetBondsByOwnerResponse(): QueryGetBondsByOwnerResponse { + return { bonds: [], pagination: undefined }; +} + +export const QueryGetBondsByOwnerResponse = { + encode( + message: QueryGetBondsByOwnerResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.bonds) { + Bond.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetBondsByOwnerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetBondsByOwnerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bonds.push(Bond.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetBondsByOwnerResponse { + return { + bonds: Array.isArray(object?.bonds) + ? object.bonds.map((e: any) => Bond.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryGetBondsByOwnerResponse): unknown { + const obj: any = {}; + if (message.bonds) { + obj.bonds = message.bonds.map((e) => (e ? Bond.toJSON(e) : undefined)); + } else { + obj.bonds = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryGetBondsByOwnerResponse { + const message = createBaseQueryGetBondsByOwnerResponse(); + message.bonds = object.bonds?.map((e) => Bond.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGetBondModuleBalanceRequest(): QueryGetBondModuleBalanceRequest { + return {}; +} + +export const QueryGetBondModuleBalanceRequest = { + encode( + _: QueryGetBondModuleBalanceRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetBondModuleBalanceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetBondModuleBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryGetBondModuleBalanceRequest { + return {}; + }, + + toJSON(_: QueryGetBondModuleBalanceRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial< + I extends Exact, I> + >(_: I): QueryGetBondModuleBalanceRequest { + const message = createBaseQueryGetBondModuleBalanceRequest(); + return message; + }, +}; + +function createBaseQueryGetBondModuleBalanceResponse(): QueryGetBondModuleBalanceResponse { + return { balance: [] }; +} + +export const QueryGetBondModuleBalanceResponse = { + encode( + message: QueryGetBondModuleBalanceResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.balance) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetBondModuleBalanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetBondModuleBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balance.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetBondModuleBalanceResponse { + return { + balance: Array.isArray(object?.balance) + ? object.balance.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryGetBondModuleBalanceResponse): unknown { + const obj: any = {}; + if (message.balance) { + obj.balance = message.balance.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.balance = []; + } + return obj; + }, + + fromPartial< + I extends Exact, I> + >(object: I): QueryGetBondModuleBalanceResponse { + const message = createBaseQueryGetBondModuleBalanceResponse(); + message.balance = object.balance?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +/** Query defines the gRPC querier service for bond module */ +export interface Query { + /** Params queries bonds module params. */ + Params(request: QueryParamsRequest): Promise; + /** Bonds queries bonds list */ + Bonds(request: QueryGetBondsRequest): Promise; + /** GetBondById */ + GetBondById( + request: QueryGetBondByIdRequest + ): Promise; + /** Get Bonds list by Owner */ + GetBondsByOwner( + request: QueryGetBondsByOwnerRequest + ): Promise; + /** Get Bond module balance */ + GetBondsModuleBalance( + request: QueryGetBondModuleBalanceRequest + ): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Bonds = this.Bonds.bind(this); + this.GetBondById = this.GetBondById.bind(this); + this.GetBondsByOwner = this.GetBondsByOwner.bind(this); + this.GetBondsModuleBalance = this.GetBondsModuleBalance.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.bond.v1.Query", "Params", data); + return promise.then((data) => + QueryParamsResponse.decode(new _m0.Reader(data)) + ); + } + + Bonds(request: QueryGetBondsRequest): Promise { + const data = QueryGetBondsRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.bond.v1.Query", "Bonds", data); + return promise.then((data) => + QueryGetBondsResponse.decode(new _m0.Reader(data)) + ); + } + + GetBondById( + request: QueryGetBondByIdRequest + ): Promise { + const data = QueryGetBondByIdRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.bond.v1.Query", "GetBondById", data); + return promise.then((data) => + QueryGetBondByIdResponse.decode(new _m0.Reader(data)) + ); + } + + GetBondsByOwner( + request: QueryGetBondsByOwnerRequest + ): Promise { + const data = QueryGetBondsByOwnerRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.bond.v1.Query", + "GetBondsByOwner", + data + ); + return promise.then((data) => + QueryGetBondsByOwnerResponse.decode(new _m0.Reader(data)) + ); + } + + GetBondsModuleBalance( + request: QueryGetBondModuleBalanceRequest + ): Promise { + const data = QueryGetBondModuleBalanceRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.bond.v1.Query", + "GetBondsModuleBalance", + data + ); + return promise.then((data) => + QueryGetBondModuleBalanceResponse.decode(new _m0.Reader(data)) + ); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/bond/v1/tx.ts b/src/proto2/cerc/bond/v1/tx.ts new file mode 100644 index 0000000..233653b --- /dev/null +++ b/src/proto2/cerc/bond/v1/tx.ts @@ -0,0 +1,631 @@ +/* eslint-disable */ +import Long from "long"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.bond.v1"; + +/** MsgCreateBond defines a SDK message for creating a new bond. */ +export interface MsgCreateBond { + signer: string; + coins: Coin[]; +} + +/** MsgCreateBondResponse defines the Msg/CreateBond response type. */ +export interface MsgCreateBondResponse { + id: string; +} + +/** MsgRefillBond defines a SDK message for refill the amount for bond. */ +export interface MsgRefillBond { + id: string; + signer: string; + coins: Coin[]; +} + +/** MsgRefillBondResponse defines the Msg/RefillBond response type. */ +export interface MsgRefillBondResponse {} + +/** MsgWithdrawBond defines a SDK message for withdrawing amount from bond. */ +export interface MsgWithdrawBond { + id: string; + signer: string; + coins: Coin[]; +} + +/** MsgWithdrawBondResponse defines the Msg/WithdrawBond response type. */ +export interface MsgWithdrawBondResponse {} + +/** MsgCancelBond defines a SDK message for the cancel the bond. */ +export interface MsgCancelBond { + id: string; + signer: string; +} + +/** MsgCancelBondResponse defines the Msg/CancelBond response type. */ +export interface MsgCancelBondResponse {} + +function createBaseMsgCreateBond(): MsgCreateBond { + return { signer: "", coins: [] }; +} + +export const MsgCreateBond = { + encode( + message: MsgCreateBond, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateBond { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.coins.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateBond { + return { + signer: isSet(object.signer) ? String(object.signer) : "", + coins: Array.isArray(object?.coins) + ? object.coins.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateBond): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + if (message.coins) { + obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.coins = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCreateBond { + const message = createBaseMsgCreateBond(); + message.signer = object.signer ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateBondResponse(): MsgCreateBondResponse { + return { id: "" }; +} + +export const MsgCreateBondResponse = { + encode( + message: MsgCreateBondResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgCreateBondResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateBondResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateBondResponse { + return { + id: isSet(object.id) ? String(object.id) : "", + }; + }, + + toJSON(message: MsgCreateBondResponse): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCreateBondResponse { + const message = createBaseMsgCreateBondResponse(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseMsgRefillBond(): MsgRefillBond { + return { id: "", signer: "", coins: [] }; +} + +export const MsgRefillBond = { + encode( + message: MsgRefillBond, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRefillBond { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRefillBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + case 3: + message.coins.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgRefillBond { + return { + id: isSet(object.id) ? String(object.id) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + coins: Array.isArray(object?.coins) + ? object.coins.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgRefillBond): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.signer !== undefined && (obj.signer = message.signer); + if (message.coins) { + obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.coins = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgRefillBond { + const message = createBaseMsgRefillBond(); + message.id = object.id ?? ""; + message.signer = object.signer ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgRefillBondResponse(): MsgRefillBondResponse { + return {}; +} + +export const MsgRefillBondResponse = { + encode( + _: MsgRefillBondResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgRefillBondResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRefillBondResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgRefillBondResponse { + return {}; + }, + + toJSON(_: MsgRefillBondResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgRefillBondResponse { + const message = createBaseMsgRefillBondResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawBond(): MsgWithdrawBond { + return { id: "", signer: "", coins: [] }; +} + +export const MsgWithdrawBond = { + encode( + message: MsgWithdrawBond, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawBond { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + case 3: + message.coins.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawBond { + return { + id: isSet(object.id) ? String(object.id) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + coins: Array.isArray(object?.coins) + ? object.coins.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgWithdrawBond): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.signer !== undefined && (obj.signer = message.signer); + if (message.coins) { + obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.coins = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgWithdrawBond { + const message = createBaseMsgWithdrawBond(); + message.id = object.id ?? ""; + message.signer = object.signer ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawBondResponse(): MsgWithdrawBondResponse { + return {}; +} + +export const MsgWithdrawBondResponse = { + encode( + _: MsgWithdrawBondResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgWithdrawBondResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawBondResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgWithdrawBondResponse { + return {}; + }, + + toJSON(_: MsgWithdrawBondResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgWithdrawBondResponse { + const message = createBaseMsgWithdrawBondResponse(); + return message; + }, +}; + +function createBaseMsgCancelBond(): MsgCancelBond { + return { id: "", signer: "" }; +} + +export const MsgCancelBond = { + encode( + message: MsgCancelBond, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelBond { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCancelBond { + return { + id: isSet(object.id) ? String(object.id) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgCancelBond): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCancelBond { + const message = createBaseMsgCancelBond(); + message.id = object.id ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgCancelBondResponse(): MsgCancelBondResponse { + return {}; +} + +export const MsgCancelBondResponse = { + encode( + _: MsgCancelBondResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgCancelBondResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelBondResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCancelBondResponse { + return {}; + }, + + toJSON(_: MsgCancelBondResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgCancelBondResponse { + const message = createBaseMsgCancelBondResponse(); + return message; + }, +}; + +/** Msg defines the bond Msg service. */ +export interface Msg { + /** CreateBond defines a method for creating a new bond. */ + CreateBond(request: MsgCreateBond): Promise; + /** RefillBond defines a method for refilling amount for bond. */ + RefillBond(request: MsgRefillBond): Promise; + /** WithdrawBond defines a method for withdrawing amount from bond. */ + WithdrawBond(request: MsgWithdrawBond): Promise; + /** CancelBond defines a method for cancelling a bond. */ + CancelBond(request: MsgCancelBond): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.CreateBond = this.CreateBond.bind(this); + this.RefillBond = this.RefillBond.bind(this); + this.WithdrawBond = this.WithdrawBond.bind(this); + this.CancelBond = this.CancelBond.bind(this); + } + CreateBond(request: MsgCreateBond): Promise { + const data = MsgCreateBond.encode(request).finish(); + const promise = this.rpc.request("cerc.bond.v1.Msg", "CreateBond", data); + return promise.then((data) => + MsgCreateBondResponse.decode(new _m0.Reader(data)) + ); + } + + RefillBond(request: MsgRefillBond): Promise { + const data = MsgRefillBond.encode(request).finish(); + const promise = this.rpc.request("cerc.bond.v1.Msg", "RefillBond", data); + return promise.then((data) => + MsgRefillBondResponse.decode(new _m0.Reader(data)) + ); + } + + WithdrawBond(request: MsgWithdrawBond): Promise { + const data = MsgWithdrawBond.encode(request).finish(); + const promise = this.rpc.request("cerc.bond.v1.Msg", "WithdrawBond", data); + return promise.then((data) => + MsgWithdrawBondResponse.decode(new _m0.Reader(data)) + ); + } + + CancelBond(request: MsgCancelBond): Promise { + const data = MsgCancelBond.encode(request).finish(); + const promise = this.rpc.request("cerc.bond.v1.Msg", "CancelBond", data); + return promise.then((data) => + MsgCancelBondResponse.decode(new _m0.Reader(data)) + ); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/registry/module/v1/module.ts b/src/proto2/cerc/registry/module/v1/module.ts new file mode 100644 index 0000000..499297f --- /dev/null +++ b/src/proto2/cerc/registry/module/v1/module.ts @@ -0,0 +1,83 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.registry.module.v1"; + +/** + * Module is the app config object of the module. + * Learn more: https://docs.cosmos.network/main/building-modules/depinject + */ +export interface Module {} + +function createBaseModule(): Module { + return {}; +} + +export const Module = { + encode(_: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Module { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/src/proto2/cerc/registry/v1/genesis.ts b/src/proto2/cerc/registry/v1/genesis.ts new file mode 100644 index 0000000..a3e2a81 --- /dev/null +++ b/src/proto2/cerc/registry/v1/genesis.ts @@ -0,0 +1,167 @@ +/* eslint-disable */ +import { Params, Record, AuthorityEntry, NameEntry } from "./registry"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.registry.v1"; + +/** GenesisState defines the registry module's genesis state. */ +export interface GenesisState { + /** params defines all the params of registry module. */ + params?: Params; + /** records */ + records: Record[]; + /** authorities */ + authorities: AuthorityEntry[]; + /** names */ + names: NameEntry[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, records: [], authorities: [], names: [] }; +} + +export const GenesisState = { + encode( + message: GenesisState, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.records) { + Record.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.authorities) { + AuthorityEntry.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.names) { + NameEntry.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.records.push(Record.decode(reader, reader.uint32())); + break; + case 3: + message.authorities.push( + AuthorityEntry.decode(reader, reader.uint32()) + ); + break; + case 4: + message.names.push(NameEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + records: Array.isArray(object?.records) + ? object.records.map((e: any) => Record.fromJSON(e)) + : [], + authorities: Array.isArray(object?.authorities) + ? object.authorities.map((e: any) => AuthorityEntry.fromJSON(e)) + : [], + names: Array.isArray(object?.names) + ? object.names.map((e: any) => NameEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.records) { + obj.records = message.records.map((e) => + e ? Record.toJSON(e) : undefined + ); + } else { + obj.records = []; + } + if (message.authorities) { + obj.authorities = message.authorities.map((e) => + e ? AuthorityEntry.toJSON(e) : undefined + ); + } else { + obj.authorities = []; + } + if (message.names) { + obj.names = message.names.map((e) => + e ? NameEntry.toJSON(e) : undefined + ); + } else { + obj.names = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): GenesisState { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.records = object.records?.map((e) => Record.fromPartial(e)) || []; + message.authorities = + object.authorities?.map((e) => AuthorityEntry.fromPartial(e)) || []; + message.names = object.names?.map((e) => NameEntry.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/registry/v1/query.ts b/src/proto2/cerc/registry/v1/query.ts new file mode 100644 index 0000000..601cc2f --- /dev/null +++ b/src/proto2/cerc/registry/v1/query.ts @@ -0,0 +1,2068 @@ +/* eslint-disable */ +import { + Params, + Record, + NameAuthority, + NameRecord, + NameEntry, +} from "./registry"; +import { + PageRequest, + PageResponse, +} from "../../../cosmos/base/query/v1beta1/pagination"; +import Long from "long"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.registry.v1"; + +/** QueryParamsRequest is request type for registry params */ +export interface QueryParamsRequest {} + +/** QueryParamsResponse is response type for registry params */ +export interface QueryParamsResponse { + params?: Params; +} + +/** QueryRecordsRequest is request type for registry records list */ +export interface QueryRecordsRequest { + attributes: QueryRecordsRequest_KeyValueInput[]; + all: boolean; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryRecordsRequest_ArrayInput { + values: QueryRecordsRequest_ValueInput[]; +} + +export interface QueryRecordsRequest_MapInput { + values: { [key: string]: QueryRecordsRequest_ValueInput }; +} + +export interface QueryRecordsRequest_MapInput_ValuesEntry { + key: string; + value?: QueryRecordsRequest_ValueInput; +} + +export interface QueryRecordsRequest_ValueInput { + string: string | undefined; + int: Long | undefined; + float: number | undefined; + boolean: boolean | undefined; + link: string | undefined; + array?: QueryRecordsRequest_ArrayInput | undefined; + map?: QueryRecordsRequest_MapInput | undefined; +} + +export interface QueryRecordsRequest_KeyValueInput { + key: string; + value?: QueryRecordsRequest_ValueInput; +} + +/** QueryRecordsResponse is response type for registry records list */ +export interface QueryRecordsResponse { + records: Record[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryRecordByIdRequest is request type for registry records by id */ +export interface QueryRecordByIdRequest { + id: string; +} + +/** QueryRecordByIdResponse is response type for registry records by id */ +export interface QueryRecordByIdResponse { + record?: Record; +} + +/** QueryRecordsByBondIdRequest is request type for get the records by bond-id */ +export interface QueryRecordsByBondIdRequest { + id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryRecordsByBondIdResponse is response type for records list by bond-id */ +export interface QueryRecordsByBondIdResponse { + records: Record[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryNameRecordsRequest is request type for registry names records */ +export interface QueryNameRecordsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryNameRecordsResponse is response type for registry names records */ +export interface QueryNameRecordsResponse { + names: NameEntry[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryWhoisRequest is request type for Get NameAuthority */ +export interface QueryWhoisRequest { + name: string; +} + +/** QueryWhoisResponse is response type for whois request */ +export interface QueryWhoisResponse { + nameAuthority?: NameAuthority; +} + +/** QueryLookupLrnRequest is request type for LookupLrn */ +export interface QueryLookupLrnRequest { + lrn: string; +} + +/** QueryLookupLrnResponse is response type for QueryLookupLrnRequest */ +export interface QueryLookupLrnResponse { + name?: NameRecord; +} + +/** QueryResolveLrnRequest is request type for ResolveLrn */ +export interface QueryResolveLrnRequest { + lrn: string; +} + +/** QueryResolveLrnResponse is response type for QueryResolveLrnRequest */ +export interface QueryResolveLrnResponse { + record?: Record; +} + +/** QueryGetRegistryModuleBalanceRequest is request type for registry module accounts balance */ +export interface QueryGetRegistryModuleBalanceRequest {} + +/** QueryGetRegistryModuleBalanceResponse is response type for registry module accounts balance */ +export interface QueryGetRegistryModuleBalanceResponse { + balances: AccountBalance[]; +} + +/** AccountBalance is registry module account balance */ +export interface AccountBalance { + accountName: string; + balance: Coin[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode( + _: QueryParamsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode( + message: QueryParamsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryRecordsRequest(): QueryRecordsRequest { + return { attributes: [], all: false, pagination: undefined }; +} + +export const QueryRecordsRequest = { + encode( + message: QueryRecordsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.attributes) { + QueryRecordsRequest_KeyValueInput.encode( + v!, + writer.uint32(10).fork() + ).ldelim(); + } + if (message.all === true) { + writer.uint32(16).bool(message.all); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryRecordsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attributes.push( + QueryRecordsRequest_KeyValueInput.decode(reader, reader.uint32()) + ); + break; + case 2: + message.all = reader.bool(); + break; + case 3: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordsRequest { + return { + attributes: Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => + QueryRecordsRequest_KeyValueInput.fromJSON(e) + ) + : [], + all: isSet(object.all) ? Boolean(object.all) : false, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryRecordsRequest): unknown { + const obj: any = {}; + if (message.attributes) { + obj.attributes = message.attributes.map((e) => + e ? QueryRecordsRequest_KeyValueInput.toJSON(e) : undefined + ); + } else { + obj.attributes = []; + } + message.all !== undefined && (obj.all = message.all); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryRecordsRequest { + const message = createBaseQueryRecordsRequest(); + message.attributes = + object.attributes?.map((e) => + QueryRecordsRequest_KeyValueInput.fromPartial(e) + ) || []; + message.all = object.all ?? false; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRecordsRequest_ArrayInput(): QueryRecordsRequest_ArrayInput { + return { values: [] }; +} + +export const QueryRecordsRequest_ArrayInput = { + encode( + message: QueryRecordsRequest_ArrayInput, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.values) { + QueryRecordsRequest_ValueInput.encode( + v!, + writer.uint32(10).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordsRequest_ArrayInput { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordsRequest_ArrayInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.values.push( + QueryRecordsRequest_ValueInput.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordsRequest_ArrayInput { + return { + values: Array.isArray(object?.values) + ? object.values.map((e: any) => + QueryRecordsRequest_ValueInput.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: QueryRecordsRequest_ArrayInput): unknown { + const obj: any = {}; + if (message.values) { + obj.values = message.values.map((e) => + e ? QueryRecordsRequest_ValueInput.toJSON(e) : undefined + ); + } else { + obj.values = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryRecordsRequest_ArrayInput { + const message = createBaseQueryRecordsRequest_ArrayInput(); + message.values = + object.values?.map((e) => + QueryRecordsRequest_ValueInput.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseQueryRecordsRequest_MapInput(): QueryRecordsRequest_MapInput { + return { values: {} }; +} + +export const QueryRecordsRequest_MapInput = { + encode( + message: QueryRecordsRequest_MapInput, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + Object.entries(message.values).forEach(([key, value]) => { + QueryRecordsRequest_MapInput_ValuesEntry.encode( + { key: key as any, value }, + writer.uint32(10).fork() + ).ldelim(); + }); + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordsRequest_MapInput { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordsRequest_MapInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + const entry1 = QueryRecordsRequest_MapInput_ValuesEntry.decode( + reader, + reader.uint32() + ); + if (entry1.value !== undefined) { + message.values[entry1.key] = entry1.value; + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordsRequest_MapInput { + return { + values: isObject(object.values) + ? Object.entries(object.values).reduce<{ + [key: string]: QueryRecordsRequest_ValueInput; + }>((acc, [key, value]) => { + acc[key] = QueryRecordsRequest_ValueInput.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: QueryRecordsRequest_MapInput): unknown { + const obj: any = {}; + obj.values = {}; + if (message.values) { + Object.entries(message.values).forEach(([k, v]) => { + obj.values[k] = QueryRecordsRequest_ValueInput.toJSON(v); + }); + } + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryRecordsRequest_MapInput { + const message = createBaseQueryRecordsRequest_MapInput(); + message.values = Object.entries(object.values ?? {}).reduce<{ + [key: string]: QueryRecordsRequest_ValueInput; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = QueryRecordsRequest_ValueInput.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseQueryRecordsRequest_MapInput_ValuesEntry(): QueryRecordsRequest_MapInput_ValuesEntry { + return { key: "", value: undefined }; +} + +export const QueryRecordsRequest_MapInput_ValuesEntry = { + encode( + message: QueryRecordsRequest_MapInput_ValuesEntry, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + QueryRecordsRequest_ValueInput.encode( + message.value, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordsRequest_MapInput_ValuesEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordsRequest_MapInput_ValuesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.value = QueryRecordsRequest_ValueInput.decode( + reader, + reader.uint32() + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordsRequest_MapInput_ValuesEntry { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) + ? QueryRecordsRequest_ValueInput.fromJSON(object.value) + : undefined, + }; + }, + + toJSON(message: QueryRecordsRequest_MapInput_ValuesEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && + (obj.value = message.value + ? QueryRecordsRequest_ValueInput.toJSON(message.value) + : undefined); + return obj; + }, + + fromPartial< + I extends Exact, I> + >(object: I): QueryRecordsRequest_MapInput_ValuesEntry { + const message = createBaseQueryRecordsRequest_MapInput_ValuesEntry(); + message.key = object.key ?? ""; + message.value = + object.value !== undefined && object.value !== null + ? QueryRecordsRequest_ValueInput.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseQueryRecordsRequest_ValueInput(): QueryRecordsRequest_ValueInput { + return { + string: undefined, + int: undefined, + float: undefined, + boolean: undefined, + link: undefined, + array: undefined, + map: undefined, + }; +} + +export const QueryRecordsRequest_ValueInput = { + encode( + message: QueryRecordsRequest_ValueInput, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.string !== undefined) { + writer.uint32(10).string(message.string); + } + if (message.int !== undefined) { + writer.uint32(16).int64(message.int); + } + if (message.float !== undefined) { + writer.uint32(25).double(message.float); + } + if (message.boolean !== undefined) { + writer.uint32(32).bool(message.boolean); + } + if (message.link !== undefined) { + writer.uint32(42).string(message.link); + } + if (message.array !== undefined) { + QueryRecordsRequest_ArrayInput.encode( + message.array, + writer.uint32(50).fork() + ).ldelim(); + } + if (message.map !== undefined) { + QueryRecordsRequest_MapInput.encode( + message.map, + writer.uint32(58).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordsRequest_ValueInput { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordsRequest_ValueInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.string = reader.string(); + break; + case 2: + message.int = reader.int64() as Long; + break; + case 3: + message.float = reader.double(); + break; + case 4: + message.boolean = reader.bool(); + break; + case 5: + message.link = reader.string(); + break; + case 6: + message.array = QueryRecordsRequest_ArrayInput.decode( + reader, + reader.uint32() + ); + break; + case 7: + message.map = QueryRecordsRequest_MapInput.decode( + reader, + reader.uint32() + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordsRequest_ValueInput { + return { + string: isSet(object.string) ? String(object.string) : undefined, + int: isSet(object.int) ? Long.fromValue(object.int) : undefined, + float: isSet(object.float) ? Number(object.float) : undefined, + boolean: isSet(object.boolean) ? Boolean(object.boolean) : undefined, + link: isSet(object.link) ? String(object.link) : undefined, + array: isSet(object.array) + ? QueryRecordsRequest_ArrayInput.fromJSON(object.array) + : undefined, + map: isSet(object.map) + ? QueryRecordsRequest_MapInput.fromJSON(object.map) + : undefined, + }; + }, + + toJSON(message: QueryRecordsRequest_ValueInput): unknown { + const obj: any = {}; + message.string !== undefined && (obj.string = message.string); + message.int !== undefined && + (obj.int = (message.int || undefined).toString()); + message.float !== undefined && (obj.float = message.float); + message.boolean !== undefined && (obj.boolean = message.boolean); + message.link !== undefined && (obj.link = message.link); + message.array !== undefined && + (obj.array = message.array + ? QueryRecordsRequest_ArrayInput.toJSON(message.array) + : undefined); + message.map !== undefined && + (obj.map = message.map + ? QueryRecordsRequest_MapInput.toJSON(message.map) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryRecordsRequest_ValueInput { + const message = createBaseQueryRecordsRequest_ValueInput(); + message.string = object.string ?? undefined; + message.int = + object.int !== undefined && object.int !== null + ? Long.fromValue(object.int) + : undefined; + message.float = object.float ?? undefined; + message.boolean = object.boolean ?? undefined; + message.link = object.link ?? undefined; + message.array = + object.array !== undefined && object.array !== null + ? QueryRecordsRequest_ArrayInput.fromPartial(object.array) + : undefined; + message.map = + object.map !== undefined && object.map !== null + ? QueryRecordsRequest_MapInput.fromPartial(object.map) + : undefined; + return message; + }, +}; + +function createBaseQueryRecordsRequest_KeyValueInput(): QueryRecordsRequest_KeyValueInput { + return { key: "", value: undefined }; +} + +export const QueryRecordsRequest_KeyValueInput = { + encode( + message: QueryRecordsRequest_KeyValueInput, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + QueryRecordsRequest_ValueInput.encode( + message.value, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordsRequest_KeyValueInput { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordsRequest_KeyValueInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.value = QueryRecordsRequest_ValueInput.decode( + reader, + reader.uint32() + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordsRequest_KeyValueInput { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) + ? QueryRecordsRequest_ValueInput.fromJSON(object.value) + : undefined, + }; + }, + + toJSON(message: QueryRecordsRequest_KeyValueInput): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && + (obj.value = message.value + ? QueryRecordsRequest_ValueInput.toJSON(message.value) + : undefined); + return obj; + }, + + fromPartial< + I extends Exact, I> + >(object: I): QueryRecordsRequest_KeyValueInput { + const message = createBaseQueryRecordsRequest_KeyValueInput(); + message.key = object.key ?? ""; + message.value = + object.value !== undefined && object.value !== null + ? QueryRecordsRequest_ValueInput.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseQueryRecordsResponse(): QueryRecordsResponse { + return { records: [], pagination: undefined }; +} + +export const QueryRecordsResponse = { + encode( + message: QueryRecordsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.records) { + Record.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.records.push(Record.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordsResponse { + return { + records: Array.isArray(object?.records) + ? object.records.map((e: any) => Record.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryRecordsResponse): unknown { + const obj: any = {}; + if (message.records) { + obj.records = message.records.map((e) => + e ? Record.toJSON(e) : undefined + ); + } else { + obj.records = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryRecordsResponse { + const message = createBaseQueryRecordsResponse(); + message.records = object.records?.map((e) => Record.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRecordByIdRequest(): QueryRecordByIdRequest { + return { id: "" }; +} + +export const QueryRecordByIdRequest = { + encode( + message: QueryRecordByIdRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordByIdRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordByIdRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordByIdRequest { + return { + id: isSet(object.id) ? String(object.id) : "", + }; + }, + + toJSON(message: QueryRecordByIdRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryRecordByIdRequest { + const message = createBaseQueryRecordByIdRequest(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryRecordByIdResponse(): QueryRecordByIdResponse { + return { record: undefined }; +} + +export const QueryRecordByIdResponse = { + encode( + message: QueryRecordByIdResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.record !== undefined) { + Record.encode(message.record, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordByIdResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordByIdResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.record = Record.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordByIdResponse { + return { + record: isSet(object.record) ? Record.fromJSON(object.record) : undefined, + }; + }, + + toJSON(message: QueryRecordByIdResponse): unknown { + const obj: any = {}; + message.record !== undefined && + (obj.record = message.record ? Record.toJSON(message.record) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryRecordByIdResponse { + const message = createBaseQueryRecordByIdResponse(); + message.record = + object.record !== undefined && object.record !== null + ? Record.fromPartial(object.record) + : undefined; + return message; + }, +}; + +function createBaseQueryRecordsByBondIdRequest(): QueryRecordsByBondIdRequest { + return { id: "", pagination: undefined }; +} + +export const QueryRecordsByBondIdRequest = { + encode( + message: QueryRecordsByBondIdRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordsByBondIdRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordsByBondIdRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordsByBondIdRequest { + return { + id: isSet(object.id) ? String(object.id) : "", + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryRecordsByBondIdRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryRecordsByBondIdRequest { + const message = createBaseQueryRecordsByBondIdRequest(); + message.id = object.id ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRecordsByBondIdResponse(): QueryRecordsByBondIdResponse { + return { records: [], pagination: undefined }; +} + +export const QueryRecordsByBondIdResponse = { + encode( + message: QueryRecordsByBondIdResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.records) { + Record.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryRecordsByBondIdResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecordsByBondIdResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.records.push(Record.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRecordsByBondIdResponse { + return { + records: Array.isArray(object?.records) + ? object.records.map((e: any) => Record.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryRecordsByBondIdResponse): unknown { + const obj: any = {}; + if (message.records) { + obj.records = message.records.map((e) => + e ? Record.toJSON(e) : undefined + ); + } else { + obj.records = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryRecordsByBondIdResponse { + const message = createBaseQueryRecordsByBondIdResponse(); + message.records = object.records?.map((e) => Record.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryNameRecordsRequest(): QueryNameRecordsRequest { + return { pagination: undefined }; +} + +export const QueryNameRecordsRequest = { + encode( + message: QueryNameRecordsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryNameRecordsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNameRecordsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNameRecordsRequest { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryNameRecordsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryNameRecordsRequest { + const message = createBaseQueryNameRecordsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryNameRecordsResponse(): QueryNameRecordsResponse { + return { names: [], pagination: undefined }; +} + +export const QueryNameRecordsResponse = { + encode( + message: QueryNameRecordsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.names) { + NameEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryNameRecordsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNameRecordsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.names.push(NameEntry.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNameRecordsResponse { + return { + names: Array.isArray(object?.names) + ? object.names.map((e: any) => NameEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryNameRecordsResponse): unknown { + const obj: any = {}; + if (message.names) { + obj.names = message.names.map((e) => + e ? NameEntry.toJSON(e) : undefined + ); + } else { + obj.names = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryNameRecordsResponse { + const message = createBaseQueryNameRecordsResponse(); + message.names = object.names?.map((e) => NameEntry.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryWhoisRequest(): QueryWhoisRequest { + return { name: "" }; +} + +export const QueryWhoisRequest = { + encode( + message: QueryWhoisRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryWhoisRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhoisRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryWhoisRequest { + return { + name: isSet(object.name) ? String(object.name) : "", + }; + }, + + toJSON(message: QueryWhoisRequest): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryWhoisRequest { + const message = createBaseQueryWhoisRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryWhoisResponse(): QueryWhoisResponse { + return { nameAuthority: undefined }; +} + +export const QueryWhoisResponse = { + encode( + message: QueryWhoisResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.nameAuthority !== undefined) { + NameAuthority.encode( + message.nameAuthority, + writer.uint32(10).fork() + ).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryWhoisResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhoisResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nameAuthority = NameAuthority.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryWhoisResponse { + return { + nameAuthority: isSet(object.nameAuthority) + ? NameAuthority.fromJSON(object.nameAuthority) + : undefined, + }; + }, + + toJSON(message: QueryWhoisResponse): unknown { + const obj: any = {}; + message.nameAuthority !== undefined && + (obj.nameAuthority = message.nameAuthority + ? NameAuthority.toJSON(message.nameAuthority) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryWhoisResponse { + const message = createBaseQueryWhoisResponse(); + message.nameAuthority = + object.nameAuthority !== undefined && object.nameAuthority !== null + ? NameAuthority.fromPartial(object.nameAuthority) + : undefined; + return message; + }, +}; + +function createBaseQueryLookupLrnRequest(): QueryLookupLrnRequest { + return { lrn: "" }; +} + +export const QueryLookupLrnRequest = { + encode( + message: QueryLookupLrnRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.lrn !== "") { + writer.uint32(10).string(message.lrn); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryLookupLrnRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLookupLrnRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lrn = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryLookupLrnRequest { + return { + lrn: isSet(object.lrn) ? String(object.lrn) : "", + }; + }, + + toJSON(message: QueryLookupLrnRequest): unknown { + const obj: any = {}; + message.lrn !== undefined && (obj.lrn = message.lrn); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryLookupLrnRequest { + const message = createBaseQueryLookupLrnRequest(); + message.lrn = object.lrn ?? ""; + return message; + }, +}; + +function createBaseQueryLookupLrnResponse(): QueryLookupLrnResponse { + return { name: undefined }; +} + +export const QueryLookupLrnResponse = { + encode( + message: QueryLookupLrnResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== undefined) { + NameRecord.encode(message.name, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryLookupLrnResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLookupLrnResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = NameRecord.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryLookupLrnResponse { + return { + name: isSet(object.name) ? NameRecord.fromJSON(object.name) : undefined, + }; + }, + + toJSON(message: QueryLookupLrnResponse): unknown { + const obj: any = {}; + message.name !== undefined && + (obj.name = message.name ? NameRecord.toJSON(message.name) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryLookupLrnResponse { + const message = createBaseQueryLookupLrnResponse(); + message.name = + object.name !== undefined && object.name !== null + ? NameRecord.fromPartial(object.name) + : undefined; + return message; + }, +}; + +function createBaseQueryResolveLrnRequest(): QueryResolveLrnRequest { + return { lrn: "" }; +} + +export const QueryResolveLrnRequest = { + encode( + message: QueryResolveLrnRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.lrn !== "") { + writer.uint32(10).string(message.lrn); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryResolveLrnRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryResolveLrnRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lrn = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryResolveLrnRequest { + return { + lrn: isSet(object.lrn) ? String(object.lrn) : "", + }; + }, + + toJSON(message: QueryResolveLrnRequest): unknown { + const obj: any = {}; + message.lrn !== undefined && (obj.lrn = message.lrn); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryResolveLrnRequest { + const message = createBaseQueryResolveLrnRequest(); + message.lrn = object.lrn ?? ""; + return message; + }, +}; + +function createBaseQueryResolveLrnResponse(): QueryResolveLrnResponse { + return { record: undefined }; +} + +export const QueryResolveLrnResponse = { + encode( + message: QueryResolveLrnResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.record !== undefined) { + Record.encode(message.record, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryResolveLrnResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryResolveLrnResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.record = Record.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryResolveLrnResponse { + return { + record: isSet(object.record) ? Record.fromJSON(object.record) : undefined, + }; + }, + + toJSON(message: QueryResolveLrnResponse): unknown { + const obj: any = {}; + message.record !== undefined && + (obj.record = message.record ? Record.toJSON(message.record) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryResolveLrnResponse { + const message = createBaseQueryResolveLrnResponse(); + message.record = + object.record !== undefined && object.record !== null + ? Record.fromPartial(object.record) + : undefined; + return message; + }, +}; + +function createBaseQueryGetRegistryModuleBalanceRequest(): QueryGetRegistryModuleBalanceRequest { + return {}; +} + +export const QueryGetRegistryModuleBalanceRequest = { + encode( + _: QueryGetRegistryModuleBalanceRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetRegistryModuleBalanceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetRegistryModuleBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryGetRegistryModuleBalanceRequest { + return {}; + }, + + toJSON(_: QueryGetRegistryModuleBalanceRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial< + I extends Exact, I> + >(_: I): QueryGetRegistryModuleBalanceRequest { + const message = createBaseQueryGetRegistryModuleBalanceRequest(); + return message; + }, +}; + +function createBaseQueryGetRegistryModuleBalanceResponse(): QueryGetRegistryModuleBalanceResponse { + return { balances: [] }; +} + +export const QueryGetRegistryModuleBalanceResponse = { + encode( + message: QueryGetRegistryModuleBalanceResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.balances) { + AccountBalance.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryGetRegistryModuleBalanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetRegistryModuleBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balances.push(AccountBalance.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetRegistryModuleBalanceResponse { + return { + balances: Array.isArray(object?.balances) + ? object.balances.map((e: any) => AccountBalance.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryGetRegistryModuleBalanceResponse): unknown { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map((e) => + e ? AccountBalance.toJSON(e) : undefined + ); + } else { + obj.balances = []; + } + return obj; + }, + + fromPartial< + I extends Exact, I> + >(object: I): QueryGetRegistryModuleBalanceResponse { + const message = createBaseQueryGetRegistryModuleBalanceResponse(); + message.balances = + object.balances?.map((e) => AccountBalance.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAccountBalance(): AccountBalance { + return { accountName: "", balance: [] }; +} + +export const AccountBalance = { + encode( + message: AccountBalance, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.accountName !== "") { + writer.uint32(10).string(message.accountName); + } + for (const v of message.balance) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AccountBalance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountBalance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.accountName = reader.string(); + break; + case 3: + message.balance.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AccountBalance { + return { + accountName: isSet(object.accountName) ? String(object.accountName) : "", + balance: Array.isArray(object?.balance) + ? object.balance.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AccountBalance): unknown { + const obj: any = {}; + message.accountName !== undefined && + (obj.accountName = message.accountName); + if (message.balance) { + obj.balance = message.balance.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.balance = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): AccountBalance { + const message = createBaseAccountBalance(); + message.accountName = object.accountName ?? ""; + message.balance = object.balance?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +/** Query defines the gRPC querier service for registry module */ +export interface Query { + /** Params queries the registry module params. */ + Params(request: QueryParamsRequest): Promise; + /** Records queries all records */ + Records(request: QueryRecordsRequest): Promise; + /** Get record by id */ + GetRecord(request: QueryRecordByIdRequest): Promise; + /** Get records by bond id */ + GetRecordsByBondId( + request: QueryRecordsByBondIdRequest + ): Promise; + /** NameRecords queries all name records */ + NameRecords( + request: QueryNameRecordsRequest + ): Promise; + /** Whois method retrieve the name authority info */ + Whois(request: QueryWhoisRequest): Promise; + /** LookupLrn */ + LookupLrn(request: QueryLookupLrnRequest): Promise; + /** ResolveLrn */ + ResolveLrn(request: QueryResolveLrnRequest): Promise; + /** Get registry module balance */ + GetRegistryModuleBalance( + request: QueryGetRegistryModuleBalanceRequest + ): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Records = this.Records.bind(this); + this.GetRecord = this.GetRecord.bind(this); + this.GetRecordsByBondId = this.GetRecordsByBondId.bind(this); + this.NameRecords = this.NameRecords.bind(this); + this.Whois = this.Whois.bind(this); + this.LookupLrn = this.LookupLrn.bind(this); + this.ResolveLrn = this.ResolveLrn.bind(this); + this.GetRegistryModuleBalance = this.GetRegistryModuleBalance.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.registry.v1.Query", "Params", data); + return promise.then((data) => + QueryParamsResponse.decode(new _m0.Reader(data)) + ); + } + + Records(request: QueryRecordsRequest): Promise { + const data = QueryRecordsRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.registry.v1.Query", "Records", data); + return promise.then((data) => + QueryRecordsResponse.decode(new _m0.Reader(data)) + ); + } + + GetRecord(request: QueryRecordByIdRequest): Promise { + const data = QueryRecordByIdRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Query", + "GetRecord", + data + ); + return promise.then((data) => + QueryRecordByIdResponse.decode(new _m0.Reader(data)) + ); + } + + GetRecordsByBondId( + request: QueryRecordsByBondIdRequest + ): Promise { + const data = QueryRecordsByBondIdRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Query", + "GetRecordsByBondId", + data + ); + return promise.then((data) => + QueryRecordsByBondIdResponse.decode(new _m0.Reader(data)) + ); + } + + NameRecords( + request: QueryNameRecordsRequest + ): Promise { + const data = QueryNameRecordsRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Query", + "NameRecords", + data + ); + return promise.then((data) => + QueryNameRecordsResponse.decode(new _m0.Reader(data)) + ); + } + + Whois(request: QueryWhoisRequest): Promise { + const data = QueryWhoisRequest.encode(request).finish(); + const promise = this.rpc.request("cerc.registry.v1.Query", "Whois", data); + return promise.then((data) => + QueryWhoisResponse.decode(new _m0.Reader(data)) + ); + } + + LookupLrn(request: QueryLookupLrnRequest): Promise { + const data = QueryLookupLrnRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Query", + "LookupLrn", + data + ); + return promise.then((data) => + QueryLookupLrnResponse.decode(new _m0.Reader(data)) + ); + } + + ResolveLrn( + request: QueryResolveLrnRequest + ): Promise { + const data = QueryResolveLrnRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Query", + "ResolveLrn", + data + ); + return promise.then((data) => + QueryResolveLrnResponse.decode(new _m0.Reader(data)) + ); + } + + GetRegistryModuleBalance( + request: QueryGetRegistryModuleBalanceRequest + ): Promise { + const data = QueryGetRegistryModuleBalanceRequest.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Query", + "GetRegistryModuleBalance", + data + ); + return promise.then((data) => + QueryGetRegistryModuleBalanceResponse.decode(new _m0.Reader(data)) + ); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/registry/v1/registry.ts b/src/proto2/cerc/registry/v1/registry.ts new file mode 100644 index 0000000..2ee6f9f --- /dev/null +++ b/src/proto2/cerc/registry/v1/registry.ts @@ -0,0 +1,1259 @@ +/* eslint-disable */ +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.registry.v1"; + +/** Params defines the registry module parameters */ +export interface Params { + recordRent?: Coin; + recordRentDuration?: Duration; + authorityRent?: Coin; + authorityRentDuration?: Duration; + authorityGracePeriod?: Duration; + authorityAuctionEnabled: boolean; + authorityAuctionCommitsDuration?: Duration; + authorityAuctionRevealsDuration?: Duration; + authorityAuctionCommitFee?: Coin; + authorityAuctionRevealFee?: Coin; + authorityAuctionMinimumBid?: Coin; +} + +/** Record defines a registry record */ +export interface Record { + id: string; + bondId: string; + createTime: string; + expiryTime: string; + deleted: boolean; + owners: string[]; + attributes: Uint8Array; + names: string[]; + type: string; +} + +/** AuthorityEntry defines a registry authority */ +export interface AuthorityEntry { + name: string; + entry?: NameAuthority; +} + +/** NameAuthority */ +export interface NameAuthority { + /** Owner public key. */ + ownerPublicKey: string; + /** Owner address. */ + ownerAddress: string; + /** height at which name/authority was created. */ + height: Long; + status: string; + auctionId: string; + bondId: string; + expiryTime?: Date; +} + +/** NameEntry */ +export interface NameEntry { + name: string; + entry?: NameRecord; +} + +/** NameRecord defines a versioned name record */ +export interface NameRecord { + latest?: NameRecordEntry; + history: NameRecordEntry[]; +} + +/** NameRecordEntry */ +export interface NameRecordEntry { + id: string; + height: Long; +} + +/** Signature */ +export interface Signature { + sig: string; + pubKey: string; +} + +/** + * ExpiryQueue: record / authority expiry queue type + * id: expiry time + * value: array of ids (record cids / authority names) + */ +export interface ExpiryQueue { + id: string; + value: string[]; +} + +/** + * List of record ids + * Value type to be used in AttributesMap + */ +export interface RecordsList { + value: string[]; +} + +function createBaseParams(): Params { + return { + recordRent: undefined, + recordRentDuration: undefined, + authorityRent: undefined, + authorityRentDuration: undefined, + authorityGracePeriod: undefined, + authorityAuctionEnabled: false, + authorityAuctionCommitsDuration: undefined, + authorityAuctionRevealsDuration: undefined, + authorityAuctionCommitFee: undefined, + authorityAuctionRevealFee: undefined, + authorityAuctionMinimumBid: undefined, + }; +} + +export const Params = { + encode( + message: Params, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.recordRent !== undefined) { + Coin.encode(message.recordRent, writer.uint32(10).fork()).ldelim(); + } + if (message.recordRentDuration !== undefined) { + Duration.encode( + message.recordRentDuration, + writer.uint32(18).fork() + ).ldelim(); + } + if (message.authorityRent !== undefined) { + Coin.encode(message.authorityRent, writer.uint32(26).fork()).ldelim(); + } + if (message.authorityRentDuration !== undefined) { + Duration.encode( + message.authorityRentDuration, + writer.uint32(34).fork() + ).ldelim(); + } + if (message.authorityGracePeriod !== undefined) { + Duration.encode( + message.authorityGracePeriod, + writer.uint32(42).fork() + ).ldelim(); + } + if (message.authorityAuctionEnabled === true) { + writer.uint32(48).bool(message.authorityAuctionEnabled); + } + if (message.authorityAuctionCommitsDuration !== undefined) { + Duration.encode( + message.authorityAuctionCommitsDuration, + writer.uint32(58).fork() + ).ldelim(); + } + if (message.authorityAuctionRevealsDuration !== undefined) { + Duration.encode( + message.authorityAuctionRevealsDuration, + writer.uint32(66).fork() + ).ldelim(); + } + if (message.authorityAuctionCommitFee !== undefined) { + Coin.encode( + message.authorityAuctionCommitFee, + writer.uint32(74).fork() + ).ldelim(); + } + if (message.authorityAuctionRevealFee !== undefined) { + Coin.encode( + message.authorityAuctionRevealFee, + writer.uint32(82).fork() + ).ldelim(); + } + if (message.authorityAuctionMinimumBid !== undefined) { + Coin.encode( + message.authorityAuctionMinimumBid, + writer.uint32(90).fork() + ).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recordRent = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.recordRentDuration = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.authorityRent = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.authorityRentDuration = Duration.decode( + reader, + reader.uint32() + ); + break; + case 5: + message.authorityGracePeriod = Duration.decode( + reader, + reader.uint32() + ); + break; + case 6: + message.authorityAuctionEnabled = reader.bool(); + break; + case 7: + message.authorityAuctionCommitsDuration = Duration.decode( + reader, + reader.uint32() + ); + break; + case 8: + message.authorityAuctionRevealsDuration = Duration.decode( + reader, + reader.uint32() + ); + break; + case 9: + message.authorityAuctionCommitFee = Coin.decode( + reader, + reader.uint32() + ); + break; + case 10: + message.authorityAuctionRevealFee = Coin.decode( + reader, + reader.uint32() + ); + break; + case 11: + message.authorityAuctionMinimumBid = Coin.decode( + reader, + reader.uint32() + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + recordRent: isSet(object.recordRent) + ? Coin.fromJSON(object.recordRent) + : undefined, + recordRentDuration: isSet(object.recordRentDuration) + ? Duration.fromJSON(object.recordRentDuration) + : undefined, + authorityRent: isSet(object.authorityRent) + ? Coin.fromJSON(object.authorityRent) + : undefined, + authorityRentDuration: isSet(object.authorityRentDuration) + ? Duration.fromJSON(object.authorityRentDuration) + : undefined, + authorityGracePeriod: isSet(object.authorityGracePeriod) + ? Duration.fromJSON(object.authorityGracePeriod) + : undefined, + authorityAuctionEnabled: isSet(object.authorityAuctionEnabled) + ? Boolean(object.authorityAuctionEnabled) + : false, + authorityAuctionCommitsDuration: isSet( + object.authorityAuctionCommitsDuration + ) + ? Duration.fromJSON(object.authorityAuctionCommitsDuration) + : undefined, + authorityAuctionRevealsDuration: isSet( + object.authorityAuctionRevealsDuration + ) + ? Duration.fromJSON(object.authorityAuctionRevealsDuration) + : undefined, + authorityAuctionCommitFee: isSet(object.authorityAuctionCommitFee) + ? Coin.fromJSON(object.authorityAuctionCommitFee) + : undefined, + authorityAuctionRevealFee: isSet(object.authorityAuctionRevealFee) + ? Coin.fromJSON(object.authorityAuctionRevealFee) + : undefined, + authorityAuctionMinimumBid: isSet(object.authorityAuctionMinimumBid) + ? Coin.fromJSON(object.authorityAuctionMinimumBid) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.recordRent !== undefined && + (obj.recordRent = message.recordRent + ? Coin.toJSON(message.recordRent) + : undefined); + message.recordRentDuration !== undefined && + (obj.recordRentDuration = message.recordRentDuration + ? Duration.toJSON(message.recordRentDuration) + : undefined); + message.authorityRent !== undefined && + (obj.authorityRent = message.authorityRent + ? Coin.toJSON(message.authorityRent) + : undefined); + message.authorityRentDuration !== undefined && + (obj.authorityRentDuration = message.authorityRentDuration + ? Duration.toJSON(message.authorityRentDuration) + : undefined); + message.authorityGracePeriod !== undefined && + (obj.authorityGracePeriod = message.authorityGracePeriod + ? Duration.toJSON(message.authorityGracePeriod) + : undefined); + message.authorityAuctionEnabled !== undefined && + (obj.authorityAuctionEnabled = message.authorityAuctionEnabled); + message.authorityAuctionCommitsDuration !== undefined && + (obj.authorityAuctionCommitsDuration = + message.authorityAuctionCommitsDuration + ? Duration.toJSON(message.authorityAuctionCommitsDuration) + : undefined); + message.authorityAuctionRevealsDuration !== undefined && + (obj.authorityAuctionRevealsDuration = + message.authorityAuctionRevealsDuration + ? Duration.toJSON(message.authorityAuctionRevealsDuration) + : undefined); + message.authorityAuctionCommitFee !== undefined && + (obj.authorityAuctionCommitFee = message.authorityAuctionCommitFee + ? Coin.toJSON(message.authorityAuctionCommitFee) + : undefined); + message.authorityAuctionRevealFee !== undefined && + (obj.authorityAuctionRevealFee = message.authorityAuctionRevealFee + ? Coin.toJSON(message.authorityAuctionRevealFee) + : undefined); + message.authorityAuctionMinimumBid !== undefined && + (obj.authorityAuctionMinimumBid = message.authorityAuctionMinimumBid + ? Coin.toJSON(message.authorityAuctionMinimumBid) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.recordRent = + object.recordRent !== undefined && object.recordRent !== null + ? Coin.fromPartial(object.recordRent) + : undefined; + message.recordRentDuration = + object.recordRentDuration !== undefined && + object.recordRentDuration !== null + ? Duration.fromPartial(object.recordRentDuration) + : undefined; + message.authorityRent = + object.authorityRent !== undefined && object.authorityRent !== null + ? Coin.fromPartial(object.authorityRent) + : undefined; + message.authorityRentDuration = + object.authorityRentDuration !== undefined && + object.authorityRentDuration !== null + ? Duration.fromPartial(object.authorityRentDuration) + : undefined; + message.authorityGracePeriod = + object.authorityGracePeriod !== undefined && + object.authorityGracePeriod !== null + ? Duration.fromPartial(object.authorityGracePeriod) + : undefined; + message.authorityAuctionEnabled = object.authorityAuctionEnabled ?? false; + message.authorityAuctionCommitsDuration = + object.authorityAuctionCommitsDuration !== undefined && + object.authorityAuctionCommitsDuration !== null + ? Duration.fromPartial(object.authorityAuctionCommitsDuration) + : undefined; + message.authorityAuctionRevealsDuration = + object.authorityAuctionRevealsDuration !== undefined && + object.authorityAuctionRevealsDuration !== null + ? Duration.fromPartial(object.authorityAuctionRevealsDuration) + : undefined; + message.authorityAuctionCommitFee = + object.authorityAuctionCommitFee !== undefined && + object.authorityAuctionCommitFee !== null + ? Coin.fromPartial(object.authorityAuctionCommitFee) + : undefined; + message.authorityAuctionRevealFee = + object.authorityAuctionRevealFee !== undefined && + object.authorityAuctionRevealFee !== null + ? Coin.fromPartial(object.authorityAuctionRevealFee) + : undefined; + message.authorityAuctionMinimumBid = + object.authorityAuctionMinimumBid !== undefined && + object.authorityAuctionMinimumBid !== null + ? Coin.fromPartial(object.authorityAuctionMinimumBid) + : undefined; + return message; + }, +}; + +function createBaseRecord(): Record { + return { + id: "", + bondId: "", + createTime: "", + expiryTime: "", + deleted: false, + owners: [], + attributes: new Uint8Array(), + names: [], + type: "", + }; +} + +export const Record = { + encode( + message: Record, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.bondId !== "") { + writer.uint32(18).string(message.bondId); + } + if (message.createTime !== "") { + writer.uint32(26).string(message.createTime); + } + if (message.expiryTime !== "") { + writer.uint32(34).string(message.expiryTime); + } + if (message.deleted === true) { + writer.uint32(40).bool(message.deleted); + } + for (const v of message.owners) { + writer.uint32(50).string(v!); + } + if (message.attributes.length !== 0) { + writer.uint32(58).bytes(message.attributes); + } + for (const v of message.names) { + writer.uint32(66).string(v!); + } + if (message.type !== "") { + writer.uint32(74).string(message.type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.bondId = reader.string(); + break; + case 3: + message.createTime = reader.string(); + break; + case 4: + message.expiryTime = reader.string(); + break; + case 5: + message.deleted = reader.bool(); + break; + case 6: + message.owners.push(reader.string()); + break; + case 7: + message.attributes = reader.bytes(); + break; + case 8: + message.names.push(reader.string()); + break; + case 9: + message.type = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Record { + return { + id: isSet(object.id) ? String(object.id) : "", + bondId: isSet(object.bondId) ? String(object.bondId) : "", + createTime: isSet(object.createTime) ? String(object.createTime) : "", + expiryTime: isSet(object.expiryTime) ? String(object.expiryTime) : "", + deleted: isSet(object.deleted) ? Boolean(object.deleted) : false, + owners: Array.isArray(object?.owners) + ? object.owners.map((e: any) => String(e)) + : [], + attributes: isSet(object.attributes) + ? bytesFromBase64(object.attributes) + : new Uint8Array(), + names: Array.isArray(object?.names) + ? object.names.map((e: any) => String(e)) + : [], + type: isSet(object.type) ? String(object.type) : "", + }; + }, + + toJSON(message: Record): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.bondId !== undefined && (obj.bondId = message.bondId); + message.createTime !== undefined && (obj.createTime = message.createTime); + message.expiryTime !== undefined && (obj.expiryTime = message.expiryTime); + message.deleted !== undefined && (obj.deleted = message.deleted); + if (message.owners) { + obj.owners = message.owners.map((e) => e); + } else { + obj.owners = []; + } + message.attributes !== undefined && + (obj.attributes = base64FromBytes( + message.attributes !== undefined ? message.attributes : new Uint8Array() + )); + if (message.names) { + obj.names = message.names.map((e) => e); + } else { + obj.names = []; + } + message.type !== undefined && (obj.type = message.type); + return obj; + }, + + fromPartial, I>>(object: I): Record { + const message = createBaseRecord(); + message.id = object.id ?? ""; + message.bondId = object.bondId ?? ""; + message.createTime = object.createTime ?? ""; + message.expiryTime = object.expiryTime ?? ""; + message.deleted = object.deleted ?? false; + message.owners = object.owners?.map((e) => e) || []; + message.attributes = object.attributes ?? new Uint8Array(); + message.names = object.names?.map((e) => e) || []; + message.type = object.type ?? ""; + return message; + }, +}; + +function createBaseAuthorityEntry(): AuthorityEntry { + return { name: "", entry: undefined }; +} + +export const AuthorityEntry = { + encode( + message: AuthorityEntry, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.entry !== undefined) { + NameAuthority.encode(message.entry, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AuthorityEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorityEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.entry = NameAuthority.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AuthorityEntry { + return { + name: isSet(object.name) ? String(object.name) : "", + entry: isSet(object.entry) + ? NameAuthority.fromJSON(object.entry) + : undefined, + }; + }, + + toJSON(message: AuthorityEntry): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.entry !== undefined && + (obj.entry = message.entry + ? NameAuthority.toJSON(message.entry) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): AuthorityEntry { + const message = createBaseAuthorityEntry(); + message.name = object.name ?? ""; + message.entry = + object.entry !== undefined && object.entry !== null + ? NameAuthority.fromPartial(object.entry) + : undefined; + return message; + }, +}; + +function createBaseNameAuthority(): NameAuthority { + return { + ownerPublicKey: "", + ownerAddress: "", + height: Long.UZERO, + status: "", + auctionId: "", + bondId: "", + expiryTime: undefined, + }; +} + +export const NameAuthority = { + encode( + message: NameAuthority, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.ownerPublicKey !== "") { + writer.uint32(10).string(message.ownerPublicKey); + } + if (message.ownerAddress !== "") { + writer.uint32(18).string(message.ownerAddress); + } + if (!message.height.isZero()) { + writer.uint32(24).uint64(message.height); + } + if (message.status !== "") { + writer.uint32(34).string(message.status); + } + if (message.auctionId !== "") { + writer.uint32(42).string(message.auctionId); + } + if (message.bondId !== "") { + writer.uint32(50).string(message.bondId); + } + if (message.expiryTime !== undefined) { + Timestamp.encode( + toTimestamp(message.expiryTime), + writer.uint32(58).fork() + ).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NameAuthority { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNameAuthority(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ownerPublicKey = reader.string(); + break; + case 2: + message.ownerAddress = reader.string(); + break; + case 3: + message.height = reader.uint64() as Long; + break; + case 4: + message.status = reader.string(); + break; + case 5: + message.auctionId = reader.string(); + break; + case 6: + message.bondId = reader.string(); + break; + case 7: + message.expiryTime = fromTimestamp( + Timestamp.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NameAuthority { + return { + ownerPublicKey: isSet(object.ownerPublicKey) + ? String(object.ownerPublicKey) + : "", + ownerAddress: isSet(object.ownerAddress) + ? String(object.ownerAddress) + : "", + height: isSet(object.height) ? Long.fromValue(object.height) : Long.UZERO, + status: isSet(object.status) ? String(object.status) : "", + auctionId: isSet(object.auctionId) ? String(object.auctionId) : "", + bondId: isSet(object.bondId) ? String(object.bondId) : "", + expiryTime: isSet(object.expiryTime) + ? fromJsonTimestamp(object.expiryTime) + : undefined, + }; + }, + + toJSON(message: NameAuthority): unknown { + const obj: any = {}; + message.ownerPublicKey !== undefined && + (obj.ownerPublicKey = message.ownerPublicKey); + message.ownerAddress !== undefined && + (obj.ownerAddress = message.ownerAddress); + message.height !== undefined && + (obj.height = (message.height || Long.UZERO).toString()); + message.status !== undefined && (obj.status = message.status); + message.auctionId !== undefined && (obj.auctionId = message.auctionId); + message.bondId !== undefined && (obj.bondId = message.bondId); + message.expiryTime !== undefined && + (obj.expiryTime = message.expiryTime.toISOString()); + return obj; + }, + + fromPartial, I>>( + object: I + ): NameAuthority { + const message = createBaseNameAuthority(); + message.ownerPublicKey = object.ownerPublicKey ?? ""; + message.ownerAddress = object.ownerAddress ?? ""; + message.height = + object.height !== undefined && object.height !== null + ? Long.fromValue(object.height) + : Long.UZERO; + message.status = object.status ?? ""; + message.auctionId = object.auctionId ?? ""; + message.bondId = object.bondId ?? ""; + message.expiryTime = object.expiryTime ?? undefined; + return message; + }, +}; + +function createBaseNameEntry(): NameEntry { + return { name: "", entry: undefined }; +} + +export const NameEntry = { + encode( + message: NameEntry, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.entry !== undefined) { + NameRecord.encode(message.entry, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NameEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNameEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.entry = NameRecord.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NameEntry { + return { + name: isSet(object.name) ? String(object.name) : "", + entry: isSet(object.entry) + ? NameRecord.fromJSON(object.entry) + : undefined, + }; + }, + + toJSON(message: NameEntry): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.entry !== undefined && + (obj.entry = message.entry + ? NameRecord.toJSON(message.entry) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): NameEntry { + const message = createBaseNameEntry(); + message.name = object.name ?? ""; + message.entry = + object.entry !== undefined && object.entry !== null + ? NameRecord.fromPartial(object.entry) + : undefined; + return message; + }, +}; + +function createBaseNameRecord(): NameRecord { + return { latest: undefined, history: [] }; +} + +export const NameRecord = { + encode( + message: NameRecord, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.latest !== undefined) { + NameRecordEntry.encode(message.latest, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.history) { + NameRecordEntry.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NameRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNameRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.latest = NameRecordEntry.decode(reader, reader.uint32()); + break; + case 2: + message.history.push(NameRecordEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NameRecord { + return { + latest: isSet(object.latest) + ? NameRecordEntry.fromJSON(object.latest) + : undefined, + history: Array.isArray(object?.history) + ? object.history.map((e: any) => NameRecordEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NameRecord): unknown { + const obj: any = {}; + message.latest !== undefined && + (obj.latest = message.latest + ? NameRecordEntry.toJSON(message.latest) + : undefined); + if (message.history) { + obj.history = message.history.map((e) => + e ? NameRecordEntry.toJSON(e) : undefined + ); + } else { + obj.history = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): NameRecord { + const message = createBaseNameRecord(); + message.latest = + object.latest !== undefined && object.latest !== null + ? NameRecordEntry.fromPartial(object.latest) + : undefined; + message.history = + object.history?.map((e) => NameRecordEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNameRecordEntry(): NameRecordEntry { + return { id: "", height: Long.UZERO }; +} + +export const NameRecordEntry = { + encode( + message: NameRecordEntry, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (!message.height.isZero()) { + writer.uint32(16).uint64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NameRecordEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNameRecordEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.height = reader.uint64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NameRecordEntry { + return { + id: isSet(object.id) ? String(object.id) : "", + height: isSet(object.height) ? Long.fromValue(object.height) : Long.UZERO, + }; + }, + + toJSON(message: NameRecordEntry): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.height !== undefined && + (obj.height = (message.height || Long.UZERO).toString()); + return obj; + }, + + fromPartial, I>>( + object: I + ): NameRecordEntry { + const message = createBaseNameRecordEntry(); + message.id = object.id ?? ""; + message.height = + object.height !== undefined && object.height !== null + ? Long.fromValue(object.height) + : Long.UZERO; + return message; + }, +}; + +function createBaseSignature(): Signature { + return { sig: "", pubKey: "" }; +} + +export const Signature = { + encode( + message: Signature, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.sig !== "") { + writer.uint32(10).string(message.sig); + } + if (message.pubKey !== "") { + writer.uint32(18).string(message.pubKey); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Signature { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sig = reader.string(); + break; + case 2: + message.pubKey = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Signature { + return { + sig: isSet(object.sig) ? String(object.sig) : "", + pubKey: isSet(object.pubKey) ? String(object.pubKey) : "", + }; + }, + + toJSON(message: Signature): unknown { + const obj: any = {}; + message.sig !== undefined && (obj.sig = message.sig); + message.pubKey !== undefined && (obj.pubKey = message.pubKey); + return obj; + }, + + fromPartial, I>>( + object: I + ): Signature { + const message = createBaseSignature(); + message.sig = object.sig ?? ""; + message.pubKey = object.pubKey ?? ""; + return message; + }, +}; + +function createBaseExpiryQueue(): ExpiryQueue { + return { id: "", value: [] }; +} + +export const ExpiryQueue = { + encode( + message: ExpiryQueue, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + for (const v of message.value) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ExpiryQueue { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExpiryQueue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.value.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ExpiryQueue { + return { + id: isSet(object.id) ? String(object.id) : "", + value: Array.isArray(object?.value) + ? object.value.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: ExpiryQueue): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + if (message.value) { + obj.value = message.value.map((e) => e); + } else { + obj.value = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): ExpiryQueue { + const message = createBaseExpiryQueue(); + message.id = object.id ?? ""; + message.value = object.value?.map((e) => e) || []; + return message; + }, +}; + +function createBaseRecordsList(): RecordsList { + return { value: [] }; +} + +export const RecordsList = { + encode( + message: RecordsList, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.value) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RecordsList { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecordsList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RecordsList { + return { + value: Array.isArray(object?.value) + ? object.value.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: RecordsList): unknown { + const obj: any = {}; + if (message.value) { + obj.value = message.value.map((e) => e); + } else { + obj.value = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): RecordsList { + const message = createBaseRecordsList(); + message.value = object.value?.map((e) => e) || []; + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw "Unable to locate global object"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +function toTimestamp(date: Date): Timestamp { + const seconds = numberToLong(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = t.seconds.toNumber() * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function numberToLong(number: number) { + return Long.fromNumber(number); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cerc/registry/v1/tx.ts b/src/proto2/cerc/registry/v1/tx.ts new file mode 100644 index 0000000..9a569a8 --- /dev/null +++ b/src/proto2/cerc/registry/v1/tx.ts @@ -0,0 +1,1584 @@ +/* eslint-disable */ +import { Record, Signature } from "./registry"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cerc.registry.v1"; + +/** MsgSetRecord */ +export interface MsgSetRecord { + bondId: string; + signer: string; + payload?: Payload; +} + +/** MsgSetRecordResponse */ +export interface MsgSetRecordResponse { + id: string; +} + +/** Payload */ +export interface Payload { + record?: Record; + signatures: Signature[]; +} + +/** MsgSetName */ +export interface MsgSetName { + lrn: string; + cid: string; + signer: string; +} + +/** MsgSetNameResponse */ +export interface MsgSetNameResponse {} + +/** MsgReserveName */ +export interface MsgReserveAuthority { + name: string; + signer: string; + /** if creating a sub-authority. */ + owner: string; +} + +/** MsgReserveNameResponse */ +export interface MsgReserveAuthorityResponse {} + +/** MsgSetAuthorityBond */ +export interface MsgSetAuthorityBond { + name: string; + bondId: string; + signer: string; +} + +/** MsgSetAuthorityBondResponse */ +export interface MsgSetAuthorityBondResponse {} + +/** MsgDeleteNameAuthority */ +export interface MsgDeleteNameAuthority { + lrn: string; + signer: string; +} + +/** MsgDeleteNameAuthorityResponse */ +export interface MsgDeleteNameAuthorityResponse {} + +/** MsgRenewRecord */ +export interface MsgRenewRecord { + recordId: string; + signer: string; +} + +/** MsgRenewRecordResponse */ +export interface MsgRenewRecordResponse {} + +/** MsgAssociateBond */ +export interface MsgAssociateBond { + recordId: string; + bondId: string; + signer: string; +} + +/** MsgAssociateBondResponse */ +export interface MsgAssociateBondResponse {} + +/** MsgDissociateBond */ +export interface MsgDissociateBond { + recordId: string; + signer: string; +} + +/** MsgDissociateBondResponse */ +export interface MsgDissociateBondResponse {} + +/** MsgDissociateRecords */ +export interface MsgDissociateRecords { + bondId: string; + signer: string; +} + +/** MsgDissociateRecordsResponse */ +export interface MsgDissociateRecordsResponse {} + +/** MsgReassociateRecords */ +export interface MsgReassociateRecords { + newBondId: string; + oldBondId: string; + signer: string; +} + +/** MsgReassociateRecordsResponse */ +export interface MsgReassociateRecordsResponse {} + +function createBaseMsgSetRecord(): MsgSetRecord { + return { bondId: "", signer: "", payload: undefined }; +} + +export const MsgSetRecord = { + encode( + message: MsgSetRecord, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bondId !== "") { + writer.uint32(10).string(message.bondId); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + if (message.payload !== undefined) { + Payload.encode(message.payload, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bondId = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + case 3: + message.payload = Payload.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSetRecord { + return { + bondId: isSet(object.bondId) ? String(object.bondId) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + payload: isSet(object.payload) + ? Payload.fromJSON(object.payload) + : undefined, + }; + }, + + toJSON(message: MsgSetRecord): unknown { + const obj: any = {}; + message.bondId !== undefined && (obj.bondId = message.bondId); + message.signer !== undefined && (obj.signer = message.signer); + message.payload !== undefined && + (obj.payload = message.payload + ? Payload.toJSON(message.payload) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgSetRecord { + const message = createBaseMsgSetRecord(); + message.bondId = object.bondId ?? ""; + message.signer = object.signer ?? ""; + message.payload = + object.payload !== undefined && object.payload !== null + ? Payload.fromPartial(object.payload) + : undefined; + return message; + }, +}; + +function createBaseMsgSetRecordResponse(): MsgSetRecordResponse { + return { id: "" }; +} + +export const MsgSetRecordResponse = { + encode( + message: MsgSetRecordResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgSetRecordResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetRecordResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSetRecordResponse { + return { + id: isSet(object.id) ? String(object.id) : "", + }; + }, + + toJSON(message: MsgSetRecordResponse): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgSetRecordResponse { + const message = createBaseMsgSetRecordResponse(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBasePayload(): Payload { + return { record: undefined, signatures: [] }; +} + +export const Payload = { + encode( + message: Payload, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.record !== undefined) { + Record.encode(message.record, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.signatures) { + Signature.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Payload { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.record = Record.decode(reader, reader.uint32()); + break; + case 2: + message.signatures.push(Signature.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Payload { + return { + record: isSet(object.record) ? Record.fromJSON(object.record) : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => Signature.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Payload): unknown { + const obj: any = {}; + message.record !== undefined && + (obj.record = message.record ? Record.toJSON(message.record) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => + e ? Signature.toJSON(e) : undefined + ); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Payload { + const message = createBasePayload(); + message.record = + object.record !== undefined && object.record !== null + ? Record.fromPartial(object.record) + : undefined; + message.signatures = + object.signatures?.map((e) => Signature.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgSetName(): MsgSetName { + return { lrn: "", cid: "", signer: "" }; +} + +export const MsgSetName = { + encode( + message: MsgSetName, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.lrn !== "") { + writer.uint32(10).string(message.lrn); + } + if (message.cid !== "") { + writer.uint32(18).string(message.cid); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetName { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetName(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lrn = reader.string(); + break; + case 2: + message.cid = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSetName { + return { + lrn: isSet(object.lrn) ? String(object.lrn) : "", + cid: isSet(object.cid) ? String(object.cid) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgSetName): unknown { + const obj: any = {}; + message.lrn !== undefined && (obj.lrn = message.lrn); + message.cid !== undefined && (obj.cid = message.cid); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgSetName { + const message = createBaseMsgSetName(); + message.lrn = object.lrn ?? ""; + message.cid = object.cid ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgSetNameResponse(): MsgSetNameResponse { + return {}; +} + +export const MsgSetNameResponse = { + encode( + _: MsgSetNameResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetNameResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgSetNameResponse { + return {}; + }, + + toJSON(_: MsgSetNameResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgSetNameResponse { + const message = createBaseMsgSetNameResponse(); + return message; + }, +}; + +function createBaseMsgReserveAuthority(): MsgReserveAuthority { + return { name: "", signer: "", owner: "" }; +} + +export const MsgReserveAuthority = { + encode( + message: MsgReserveAuthority, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgReserveAuthority { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgReserveAuthority(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + case 3: + message.owner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgReserveAuthority { + return { + name: isSet(object.name) ? String(object.name) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + }; + }, + + toJSON(message: MsgReserveAuthority): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.signer !== undefined && (obj.signer = message.signer); + message.owner !== undefined && (obj.owner = message.owner); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgReserveAuthority { + const message = createBaseMsgReserveAuthority(); + message.name = object.name ?? ""; + message.signer = object.signer ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseMsgReserveAuthorityResponse(): MsgReserveAuthorityResponse { + return {}; +} + +export const MsgReserveAuthorityResponse = { + encode( + _: MsgReserveAuthorityResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgReserveAuthorityResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgReserveAuthorityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgReserveAuthorityResponse { + return {}; + }, + + toJSON(_: MsgReserveAuthorityResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgReserveAuthorityResponse { + const message = createBaseMsgReserveAuthorityResponse(); + return message; + }, +}; + +function createBaseMsgSetAuthorityBond(): MsgSetAuthorityBond { + return { name: "", bondId: "", signer: "" }; +} + +export const MsgSetAuthorityBond = { + encode( + message: MsgSetAuthorityBond, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.bondId !== "") { + writer.uint32(18).string(message.bondId); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetAuthorityBond { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetAuthorityBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.bondId = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSetAuthorityBond { + return { + name: isSet(object.name) ? String(object.name) : "", + bondId: isSet(object.bondId) ? String(object.bondId) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgSetAuthorityBond): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.bondId !== undefined && (obj.bondId = message.bondId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgSetAuthorityBond { + const message = createBaseMsgSetAuthorityBond(); + message.name = object.name ?? ""; + message.bondId = object.bondId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgSetAuthorityBondResponse(): MsgSetAuthorityBondResponse { + return {}; +} + +export const MsgSetAuthorityBondResponse = { + encode( + _: MsgSetAuthorityBondResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgSetAuthorityBondResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetAuthorityBondResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgSetAuthorityBondResponse { + return {}; + }, + + toJSON(_: MsgSetAuthorityBondResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgSetAuthorityBondResponse { + const message = createBaseMsgSetAuthorityBondResponse(); + return message; + }, +}; + +function createBaseMsgDeleteNameAuthority(): MsgDeleteNameAuthority { + return { lrn: "", signer: "" }; +} + +export const MsgDeleteNameAuthority = { + encode( + message: MsgDeleteNameAuthority, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.lrn !== "") { + writer.uint32(10).string(message.lrn); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgDeleteNameAuthority { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteNameAuthority(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lrn = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDeleteNameAuthority { + return { + lrn: isSet(object.lrn) ? String(object.lrn) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgDeleteNameAuthority): unknown { + const obj: any = {}; + message.lrn !== undefined && (obj.lrn = message.lrn); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgDeleteNameAuthority { + const message = createBaseMsgDeleteNameAuthority(); + message.lrn = object.lrn ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteNameAuthorityResponse(): MsgDeleteNameAuthorityResponse { + return {}; +} + +export const MsgDeleteNameAuthorityResponse = { + encode( + _: MsgDeleteNameAuthorityResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgDeleteNameAuthorityResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteNameAuthorityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgDeleteNameAuthorityResponse { + return {}; + }, + + toJSON(_: MsgDeleteNameAuthorityResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgDeleteNameAuthorityResponse { + const message = createBaseMsgDeleteNameAuthorityResponse(); + return message; + }, +}; + +function createBaseMsgRenewRecord(): MsgRenewRecord { + return { recordId: "", signer: "" }; +} + +export const MsgRenewRecord = { + encode( + message: MsgRenewRecord, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.recordId !== "") { + writer.uint32(10).string(message.recordId); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRenewRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRenewRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recordId = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgRenewRecord { + return { + recordId: isSet(object.recordId) ? String(object.recordId) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgRenewRecord): unknown { + const obj: any = {}; + message.recordId !== undefined && (obj.recordId = message.recordId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgRenewRecord { + const message = createBaseMsgRenewRecord(); + message.recordId = object.recordId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgRenewRecordResponse(): MsgRenewRecordResponse { + return {}; +} + +export const MsgRenewRecordResponse = { + encode( + _: MsgRenewRecordResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgRenewRecordResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRenewRecordResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgRenewRecordResponse { + return {}; + }, + + toJSON(_: MsgRenewRecordResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgRenewRecordResponse { + const message = createBaseMsgRenewRecordResponse(); + return message; + }, +}; + +function createBaseMsgAssociateBond(): MsgAssociateBond { + return { recordId: "", bondId: "", signer: "" }; +} + +export const MsgAssociateBond = { + encode( + message: MsgAssociateBond, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.recordId !== "") { + writer.uint32(10).string(message.recordId); + } + if (message.bondId !== "") { + writer.uint32(18).string(message.bondId); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgAssociateBond { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAssociateBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recordId = reader.string(); + break; + case 2: + message.bondId = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgAssociateBond { + return { + recordId: isSet(object.recordId) ? String(object.recordId) : "", + bondId: isSet(object.bondId) ? String(object.bondId) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgAssociateBond): unknown { + const obj: any = {}; + message.recordId !== undefined && (obj.recordId = message.recordId); + message.bondId !== undefined && (obj.bondId = message.bondId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgAssociateBond { + const message = createBaseMsgAssociateBond(); + message.recordId = object.recordId ?? ""; + message.bondId = object.bondId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgAssociateBondResponse(): MsgAssociateBondResponse { + return {}; +} + +export const MsgAssociateBondResponse = { + encode( + _: MsgAssociateBondResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgAssociateBondResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAssociateBondResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgAssociateBondResponse { + return {}; + }, + + toJSON(_: MsgAssociateBondResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgAssociateBondResponse { + const message = createBaseMsgAssociateBondResponse(); + return message; + }, +}; + +function createBaseMsgDissociateBond(): MsgDissociateBond { + return { recordId: "", signer: "" }; +} + +export const MsgDissociateBond = { + encode( + message: MsgDissociateBond, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.recordId !== "") { + writer.uint32(10).string(message.recordId); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDissociateBond { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDissociateBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recordId = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDissociateBond { + return { + recordId: isSet(object.recordId) ? String(object.recordId) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgDissociateBond): unknown { + const obj: any = {}; + message.recordId !== undefined && (obj.recordId = message.recordId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgDissociateBond { + const message = createBaseMsgDissociateBond(); + message.recordId = object.recordId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgDissociateBondResponse(): MsgDissociateBondResponse { + return {}; +} + +export const MsgDissociateBondResponse = { + encode( + _: MsgDissociateBondResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgDissociateBondResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDissociateBondResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgDissociateBondResponse { + return {}; + }, + + toJSON(_: MsgDissociateBondResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgDissociateBondResponse { + const message = createBaseMsgDissociateBondResponse(); + return message; + }, +}; + +function createBaseMsgDissociateRecords(): MsgDissociateRecords { + return { bondId: "", signer: "" }; +} + +export const MsgDissociateRecords = { + encode( + message: MsgDissociateRecords, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bondId !== "") { + writer.uint32(10).string(message.bondId); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgDissociateRecords { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDissociateRecords(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bondId = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDissociateRecords { + return { + bondId: isSet(object.bondId) ? String(object.bondId) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgDissociateRecords): unknown { + const obj: any = {}; + message.bondId !== undefined && (obj.bondId = message.bondId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgDissociateRecords { + const message = createBaseMsgDissociateRecords(); + message.bondId = object.bondId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgDissociateRecordsResponse(): MsgDissociateRecordsResponse { + return {}; +} + +export const MsgDissociateRecordsResponse = { + encode( + _: MsgDissociateRecordsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgDissociateRecordsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDissociateRecordsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgDissociateRecordsResponse { + return {}; + }, + + toJSON(_: MsgDissociateRecordsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgDissociateRecordsResponse { + const message = createBaseMsgDissociateRecordsResponse(); + return message; + }, +}; + +function createBaseMsgReassociateRecords(): MsgReassociateRecords { + return { newBondId: "", oldBondId: "", signer: "" }; +} + +export const MsgReassociateRecords = { + encode( + message: MsgReassociateRecords, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.newBondId !== "") { + writer.uint32(10).string(message.newBondId); + } + if (message.oldBondId !== "") { + writer.uint32(18).string(message.oldBondId); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgReassociateRecords { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgReassociateRecords(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.newBondId = reader.string(); + break; + case 2: + message.oldBondId = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgReassociateRecords { + return { + newBondId: isSet(object.newBondId) ? String(object.newBondId) : "", + oldBondId: isSet(object.oldBondId) ? String(object.oldBondId) : "", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgReassociateRecords): unknown { + const obj: any = {}; + message.newBondId !== undefined && (obj.newBondId = message.newBondId); + message.oldBondId !== undefined && (obj.oldBondId = message.oldBondId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgReassociateRecords { + const message = createBaseMsgReassociateRecords(); + message.newBondId = object.newBondId ?? ""; + message.oldBondId = object.oldBondId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgReassociateRecordsResponse(): MsgReassociateRecordsResponse { + return {}; +} + +export const MsgReassociateRecordsResponse = { + encode( + _: MsgReassociateRecordsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgReassociateRecordsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgReassociateRecordsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgReassociateRecordsResponse { + return {}; + }, + + toJSON(_: MsgReassociateRecordsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgReassociateRecordsResponse { + const message = createBaseMsgReassociateRecordsResponse(); + return message; + }, +}; + +/** Msg is a service which exposes the registry functionality */ +export interface Msg { + /** SetRecord records a new record with given payload and bond id */ + SetRecord(request: MsgSetRecord): Promise; + /** Renew Record renews an expired record */ + RenewRecord(request: MsgRenewRecord): Promise; + /** AssociateBond */ + AssociateBond(request: MsgAssociateBond): Promise; + /** DissociateBond */ + DissociateBond( + request: MsgDissociateBond + ): Promise; + /** DissociateRecords */ + DissociateRecords( + request: MsgDissociateRecords + ): Promise; + /** ReassociateRecords */ + ReassociateRecords( + request: MsgReassociateRecords + ): Promise; + /** SetName will store the name with given lrn and name */ + SetName(request: MsgSetName): Promise; + /** Reserve name */ + ReserveName( + request: MsgReserveAuthority + ): Promise; + /** Delete Name method will remove authority name */ + DeleteName( + request: MsgDeleteNameAuthority + ): Promise; + /** SetAuthorityBond */ + SetAuthorityBond( + request: MsgSetAuthorityBond + ): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.SetRecord = this.SetRecord.bind(this); + this.RenewRecord = this.RenewRecord.bind(this); + this.AssociateBond = this.AssociateBond.bind(this); + this.DissociateBond = this.DissociateBond.bind(this); + this.DissociateRecords = this.DissociateRecords.bind(this); + this.ReassociateRecords = this.ReassociateRecords.bind(this); + this.SetName = this.SetName.bind(this); + this.ReserveName = this.ReserveName.bind(this); + this.DeleteName = this.DeleteName.bind(this); + this.SetAuthorityBond = this.SetAuthorityBond.bind(this); + } + SetRecord(request: MsgSetRecord): Promise { + const data = MsgSetRecord.encode(request).finish(); + const promise = this.rpc.request("cerc.registry.v1.Msg", "SetRecord", data); + return promise.then((data) => + MsgSetRecordResponse.decode(new _m0.Reader(data)) + ); + } + + RenewRecord(request: MsgRenewRecord): Promise { + const data = MsgRenewRecord.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Msg", + "RenewRecord", + data + ); + return promise.then((data) => + MsgRenewRecordResponse.decode(new _m0.Reader(data)) + ); + } + + AssociateBond(request: MsgAssociateBond): Promise { + const data = MsgAssociateBond.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Msg", + "AssociateBond", + data + ); + return promise.then((data) => + MsgAssociateBondResponse.decode(new _m0.Reader(data)) + ); + } + + DissociateBond( + request: MsgDissociateBond + ): Promise { + const data = MsgDissociateBond.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Msg", + "DissociateBond", + data + ); + return promise.then((data) => + MsgDissociateBondResponse.decode(new _m0.Reader(data)) + ); + } + + DissociateRecords( + request: MsgDissociateRecords + ): Promise { + const data = MsgDissociateRecords.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Msg", + "DissociateRecords", + data + ); + return promise.then((data) => + MsgDissociateRecordsResponse.decode(new _m0.Reader(data)) + ); + } + + ReassociateRecords( + request: MsgReassociateRecords + ): Promise { + const data = MsgReassociateRecords.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Msg", + "ReassociateRecords", + data + ); + return promise.then((data) => + MsgReassociateRecordsResponse.decode(new _m0.Reader(data)) + ); + } + + SetName(request: MsgSetName): Promise { + const data = MsgSetName.encode(request).finish(); + const promise = this.rpc.request("cerc.registry.v1.Msg", "SetName", data); + return promise.then((data) => + MsgSetNameResponse.decode(new _m0.Reader(data)) + ); + } + + ReserveName( + request: MsgReserveAuthority + ): Promise { + const data = MsgReserveAuthority.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Msg", + "ReserveName", + data + ); + return promise.then((data) => + MsgReserveAuthorityResponse.decode(new _m0.Reader(data)) + ); + } + + DeleteName( + request: MsgDeleteNameAuthority + ): Promise { + const data = MsgDeleteNameAuthority.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Msg", + "DeleteName", + data + ); + return promise.then((data) => + MsgDeleteNameAuthorityResponse.decode(new _m0.Reader(data)) + ); + } + + SetAuthorityBond( + request: MsgSetAuthorityBond + ): Promise { + const data = MsgSetAuthorityBond.encode(request).finish(); + const promise = this.rpc.request( + "cerc.registry.v1.Msg", + "SetAuthorityBond", + data + ); + return promise.then((data) => + MsgSetAuthorityBondResponse.decode(new _m0.Reader(data)) + ); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cosmos/app/v1alpha1/module.ts b/src/proto2/cosmos/app/v1alpha1/module.ts new file mode 100644 index 0000000..e0daca6 --- /dev/null +++ b/src/proto2/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,337 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.app.v1alpha1"; + +/** ModuleDescriptor describes an app module. */ +export interface ModuleDescriptor { + /** + * go_import names the package that should be imported by an app to load the + * module in the runtime module registry. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: string; + /** + * use_package refers to a protobuf package that this module + * uses and exposes to the world. In an app, only one module should "use" + * or own a single protobuf package. It is assumed that the module uses + * all of the .proto files in a single package. + */ + usePackage: PackageReference[]; + /** + * can_migrate_from defines which module versions this module can migrate + * state from. The framework will check that one module version is able to + * migrate from a previous module version before attempting to update its + * config. It is assumed that modules can transitively migrate from earlier + * versions. For instance if v3 declares it can migrate from v2, and v2 + * declares it can migrate from v1, the framework knows how to migrate + * from v1 to v3, assuming all 3 module versions are registered at runtime. + */ + canMigrateFrom: MigrateFromInfo[]; +} + +/** PackageReference is a reference to a protobuf package used by a module. */ +export interface PackageReference { + /** name is the fully-qualified name of the package. */ + name: string; + /** + * revision is the optional revision of the package that is being used. + * Protobuf packages used in Cosmos should generally have a major version + * as the last part of the package name, ex. foo.bar.baz.v1. + * The revision of a package can be thought of as the minor version of a + * package which has additional backwards compatible definitions that weren't + * present in a previous version. + * + * A package should indicate its revision with a source code comment + * above the package declaration in one of its files containing the + * text "Revision N" where N is an integer revision. All packages start + * at revision 0 the first time they are released in a module. + * + * When a new version of a module is released and items are added to existing + * .proto files, these definitions should contain comments of the form + * "Since: Revision N" where N is an integer revision. + * + * When the module runtime starts up, it will check the pinned proto + * image and panic if there are runtime protobuf definitions that are not + * in the pinned descriptor which do not have + * a "Since Revision N" comment or have a "Since Revision N" comment where + * N is <= to the revision specified here. This indicates that the protobuf + * files have been updated, but the pinned file descriptor hasn't. + * + * If there are items in the pinned file descriptor with a revision + * greater than the value indicated here, this will also cause a panic + * as it may mean that the pinned descriptor for a legacy module has been + * improperly updated or that there is some other versioning discrepancy. + * Runtime protobuf definitions will also be checked for compatibility + * with pinned file descriptors to make sure there are no incompatible changes. + * + * This behavior ensures that: + * * pinned proto images are up-to-date + * * protobuf files are carefully annotated with revision comments which + * are important good client UX + * * protobuf files are changed in backwards and forwards compatible ways + */ + revision: number; +} + +/** + * MigrateFromInfo is information on a module version that a newer module + * can migrate from. + */ +export interface MigrateFromInfo { + /** + * module is the fully-qualified protobuf name of the module config object + * for the previous module version, ex: "cosmos.group.module.v1.Module". + */ + module: string; +} + +function createBaseModuleDescriptor(): ModuleDescriptor { + return { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor = { + encode( + message: ModuleDescriptor, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.goImport = reader.string(); + break; + case 2: + message.usePackage.push( + PackageReference.decode(reader, reader.uint32()) + ); + break; + case 3: + message.canMigrateFrom.push( + MigrateFromInfo.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? String(object.goImport) : "", + usePackage: Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + message.goImport !== undefined && (obj.goImport = message.goImport); + if (message.usePackage) { + obj.usePackage = message.usePackage.map((e) => + e ? PackageReference.toJSON(e) : undefined + ); + } else { + obj.usePackage = []; + } + if (message.canMigrateFrom) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => + e ? MigrateFromInfo.toJSON(e) : undefined + ); + } else { + obj.canMigrateFrom = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = + object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = + object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference = { + encode( + message: PackageReference, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePackageReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.revision = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? String(object.name) : "", + revision: isSet(object.revision) ? Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.revision !== undefined && + (obj.revision = Math.round(message.revision)); + return obj; + }, + + fromPartial, I>>( + object: I + ): PackageReference { + const message = createBasePackageReference(); + message.name = object.name ?? ""; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseMigrateFromInfo(): MigrateFromInfo { + return { module: "" }; +} + +export const MigrateFromInfo = { + encode( + message: MigrateFromInfo, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMigrateFromInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { + module: isSet(object.module) ? String(object.module) : "", + }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + message.module !== undefined && (obj.module = message.module); + return obj; + }, + + fromPartial, I>>( + object: I + ): MigrateFromInfo { + const message = createBaseMigrateFromInfo(); + message.module = object.module ?? ""; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cosmos/base/query/v1beta1/pagination.ts b/src/proto2/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 0000000..fe65b07 --- /dev/null +++ b/src/proto2/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,322 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: Long; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: Long; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: Long; +} + +function createBasePageRequest(): PageRequest { + return { + key: new Uint8Array(), + offset: Long.UZERO, + limit: Long.UZERO, + countTotal: false, + reverse: false, + }; +} + +export const PageRequest = { + encode( + message: PageRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (!message.offset.isZero()) { + writer.uint32(16).uint64(message.offset); + } + if (!message.limit.isZero()) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal === true) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.offset = reader.uint64() as Long; + break; + case 3: + message.limit = reader.uint64() as Long; + break; + case 4: + message.countTotal = reader.bool(); + break; + case 5: + message.reverse = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + offset: isSet(object.offset) ? Long.fromValue(object.offset) : Long.UZERO, + limit: isSet(object.limit) ? Long.fromValue(object.limit) : Long.UZERO, + countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes( + message.key !== undefined ? message.key : new Uint8Array() + )); + message.offset !== undefined && + (obj.offset = (message.offset || Long.UZERO).toString()); + message.limit !== undefined && + (obj.limit = (message.limit || Long.UZERO).toString()); + message.countTotal !== undefined && (obj.countTotal = message.countTotal); + message.reverse !== undefined && (obj.reverse = message.reverse); + return obj; + }, + + fromPartial, I>>( + object: I + ): PageRequest { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(); + message.offset = + object.offset !== undefined && object.offset !== null + ? Long.fromValue(object.offset) + : Long.UZERO; + message.limit = + object.limit !== undefined && object.limit !== null + ? Long.fromValue(object.limit) + : Long.UZERO; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(), total: Long.UZERO }; +} + +export const PageResponse = { + encode( + message: PageResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (!message.total.isZero()) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nextKey = reader.bytes(); + break; + case 2: + message.total = reader.uint64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) + ? bytesFromBase64(object.nextKey) + : new Uint8Array(), + total: isSet(object.total) ? Long.fromValue(object.total) : Long.UZERO, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + message.nextKey !== undefined && + (obj.nextKey = base64FromBytes( + message.nextKey !== undefined ? message.nextKey : new Uint8Array() + )); + message.total !== undefined && + (obj.total = (message.total || Long.UZERO).toString()); + return obj; + }, + + fromPartial, I>>( + object: I + ): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(); + message.total = + object.total !== undefined && object.total !== null + ? Long.fromValue(object.total) + : Long.UZERO; + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw "Unable to locate global object"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cosmos/base/v1beta1/coin.ts b/src/proto2/cosmos/base/v1beta1/coin.ts new file mode 100644 index 0000000..ba71c31 --- /dev/null +++ b/src/proto2/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,303 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ +export interface IntProto { + int: string; +} + +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ +export interface DecProto { + dec: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin = { + encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Coin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): Coin { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin = { + encode( + message: DecCoin, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): DecCoin { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +export const IntProto = { + encode( + message: IntProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.int = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): IntProto { + return { + int: isSet(object.int) ? String(object.int) : "", + }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + message.int !== undefined && (obj.int = message.int); + return obj; + }, + + fromPartial, I>>(object: I): IntProto { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, +}; + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +export const DecProto = { + encode( + message: DecProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dec = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DecProto { + return { + dec: isSet(object.dec) ? String(object.dec) : "", + }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + message.dec !== undefined && (obj.dec = message.dec); + return obj; + }, + + fromPartial, I>>(object: I): DecProto { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/cosmos/msg/v1/msg.ts b/src/proto2/cosmos/msg/v1/msg.ts new file mode 100644 index 0000000..f0ff44e --- /dev/null +++ b/src/proto2/cosmos/msg/v1/msg.ts @@ -0,0 +1,2 @@ +/* eslint-disable */ +export const protobufPackage = "cosmos.msg.v1"; diff --git a/src/proto2/cosmos_proto/cosmos.ts b/src/proto2/cosmos_proto/cosmos.ts new file mode 100644 index 0000000..5d37e0c --- /dev/null +++ b/src/proto2/cosmos_proto/cosmos.ts @@ -0,0 +1,284 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos_proto"; + +export enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1, +} + +export function scalarTypeFromJSON(object: any): ScalarType { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} + +export function scalarTypeToJSON(object: ScalarType): string { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} + +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { name: "", description: "" }; +} + +export const InterfaceDescriptor = { + encode( + message: InterfaceDescriptor, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && + (obj.description = message.description); + return obj; + }, + + fromPartial, I>>( + object: I + ): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseScalarDescriptor(): ScalarDescriptor { + return { name: "", description: "", fieldType: [] }; +} + +export const ScalarDescriptor = { + encode( + message: ScalarDescriptor, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push(reader.int32() as any); + } + } else { + message.fieldType.push(reader.int32() as any); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ScalarDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + fieldType: Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], + }; + }, + + toJSON(message: ScalarDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && + (obj.description = message.description); + if (message.fieldType) { + obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e)); + } else { + obj.fieldType = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): ScalarDescriptor { + const message = createBaseScalarDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/gogoproto/gogo.ts b/src/proto2/gogoproto/gogo.ts new file mode 100644 index 0000000..3f41a04 --- /dev/null +++ b/src/proto2/gogoproto/gogo.ts @@ -0,0 +1,2 @@ +/* eslint-disable */ +export const protobufPackage = "gogoproto"; diff --git a/src/proto2/google/api/annotations.ts b/src/proto2/google/api/annotations.ts new file mode 100644 index 0000000..aace478 --- /dev/null +++ b/src/proto2/google/api/annotations.ts @@ -0,0 +1,2 @@ +/* eslint-disable */ +export const protobufPackage = "google.api"; diff --git a/src/proto2/google/api/http.ts b/src/proto2/google/api/http.ts new file mode 100644 index 0000000..1ca1521 --- /dev/null +++ b/src/proto2/google/api/http.ts @@ -0,0 +1,647 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.api"; + +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface Http { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRule[]; + /** + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fullyDecodeReservedExpansion: boolean; +} + +/** + * `HttpRule` defines the mapping of an RPC method to one or more HTTP + * REST API methods. The mapping specifies how different portions of the RPC + * request message are mapped to URL path, URL query parameters, and + * HTTP request body. The mapping is typically specified as an + * `google.api.http` annotation on the RPC method, + * see "google/api/annotations.proto" for details. + * + * The mapping consists of a field specifying the path template and + * method kind. The path template can refer to fields in the request + * message, as in the example below which describes a REST GET + * operation on a resource collection of messages: + * + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http).get = + * "/v1/messages/{message_id}/{sub.subfield}"; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // mapped to the URL + * SubMessage sub = 2; // `sub.subfield` is url-mapped + * } + * message Message { + * string text = 1; // content of the resource + * } + * + * The same http annotation can alternatively be expressed inside the + * `GRPC API Configuration` YAML file. + * + * http: + * rules: + * - selector: .Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * This definition enables an automatic, bidrectional mapping of HTTP + * JSON to RPC. Example: + * + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: + * SubMessage(subfield: "foo"))` + * + * In general, not only fields but also field paths can be referenced + * from a path pattern. Fields mapped to the path pattern cannot be + * repeated and must have a primitive (non-message) type. + * + * Any fields in the request message which are not bound by the path + * pattern automatically become (optional) HTTP query + * parameters. Assume the following definition of the request message: + * + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http).get = "/v1/messages/{message_id}"; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // mapped to the URL + * int64 revision = 2; // becomes a parameter + * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * } + * + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to HTTP parameters must have a + * primitive type or a repeated primitive type. Message types are not + * allowed. In the case of a repeated type, the parameter can be + * repeated in the URL, as in `...?param=A¶m=B`. + * + * For HTTP method kinds which allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * put: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | RPC + * -----|----- + * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * put: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | RPC + * -----|----- + * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice of + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * + * This enables the following two alternative HTTP JSON to RPC + * mappings: + * + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * # Rules for HTTP mapping + * + * The rules for mapping HTTP path, query parameters, and body fields + * to the request message are as follows: + * + * 1. The `body` field specifies either `*` or a field path, or is + * omitted. If omitted, it indicates there is no HTTP request body. + * 2. Leaf fields (recursive expansion of nested messages in the + * request) can be classified into three types: + * (a) Matched in the URL template. + * (b) Covered by body (if body is `*`, everything except (a) fields; + * else everything under the body field) + * (c) All other fields. + * 3. URL query parameters found in the HTTP request are mapped to (c) fields. + * 4. Any body sent with an HTTP request can contain only (b) fields. + * + * The syntax of the path template is as follows: + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single path segment. The syntax `**` matches zero + * or more path segments, which must be the last part of the path except the + * `Verb`. The syntax `LITERAL` matches literal text in the path. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path, all characters + * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the + * Discovery Document as `{var}`. + * + * If a variable contains one or more path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path, all + * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables + * show up in the Discovery Document as `{+var}`. + * + * NOTE: While the single segment variable matches the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 + * Simple String Expansion, the multi segment variable **does not** match + * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. + * + * NOTE: the field paths in variables and in the `body` must not refer to + * repeated fields or map fields. + */ +export interface HttpRule { + /** + * Selects methods to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + */ + selector: string; + /** Used for listing and getting information about resources. */ + get: string | undefined; + /** Used for updating a resource. */ + put: string | undefined; + /** Used for creating a resource. */ + post: string | undefined; + /** Used for deleting a resource. */ + delete: string | undefined; + /** Used for updating a resource. */ + patch: string | undefined; + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + */ + custom?: CustomHttpPattern | undefined; + /** + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} + +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} + +function createBaseHttp(): Http { + return { rules: [], fullyDecodeReservedExpansion: false }; +} + +export const Http = { + encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fullyDecodeReservedExpansion === true) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Http { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rules.push(HttpRule.decode(reader, reader.uint32())); + break; + case 2: + message.fullyDecodeReservedExpansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Http { + return { + rules: Array.isArray(object?.rules) + ? object.rules.map((e: any) => HttpRule.fromJSON(e)) + : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) + ? Boolean(object.fullyDecodeReservedExpansion) + : false, + }; + }, + + toJSON(message: Http): unknown { + const obj: any = {}; + if (message.rules) { + obj.rules = message.rules.map((e) => + e ? HttpRule.toJSON(e) : undefined + ); + } else { + obj.rules = []; + } + message.fullyDecodeReservedExpansion !== undefined && + (obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion); + return obj; + }, + + fromPartial, I>>(object: I): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; + message.fullyDecodeReservedExpansion = + object.fullyDecodeReservedExpansion ?? false; + return message; + }, +}; + +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [], + }; +} + +export const HttpRule = { + encode( + message: HttpRule, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + CustomHttpPattern.encode( + message.custom, + writer.uint32(66).fork() + ).ldelim(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selector = reader.string(); + break; + case 2: + message.get = reader.string(); + break; + case 3: + message.put = reader.string(); + break; + case 4: + message.post = reader.string(); + break; + case 5: + message.delete = reader.string(); + break; + case 6: + message.patch = reader.string(); + break; + case 8: + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 7: + message.body = reader.string(); + break; + case 12: + message.responseBody = reader.string(); + break; + case 11: + message.additionalBindings.push( + HttpRule.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): HttpRule { + return { + selector: isSet(object.selector) ? String(object.selector) : "", + get: isSet(object.get) ? String(object.get) : undefined, + put: isSet(object.put) ? String(object.put) : undefined, + post: isSet(object.post) ? String(object.post) : undefined, + delete: isSet(object.delete) ? String(object.delete) : undefined, + patch: isSet(object.patch) ? String(object.patch) : undefined, + custom: isSet(object.custom) + ? CustomHttpPattern.fromJSON(object.custom) + : undefined, + body: isSet(object.body) ? String(object.body) : "", + responseBody: isSet(object.responseBody) + ? String(object.responseBody) + : "", + additionalBindings: Array.isArray(object?.additionalBindings) + ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HttpRule): unknown { + const obj: any = {}; + message.selector !== undefined && (obj.selector = message.selector); + message.get !== undefined && (obj.get = message.get); + message.put !== undefined && (obj.put = message.put); + message.post !== undefined && (obj.post = message.post); + message.delete !== undefined && (obj.delete = message.delete); + message.patch !== undefined && (obj.patch = message.patch); + message.custom !== undefined && + (obj.custom = message.custom + ? CustomHttpPattern.toJSON(message.custom) + : undefined); + message.body !== undefined && (obj.body = message.body); + message.responseBody !== undefined && + (obj.responseBody = message.responseBody); + if (message.additionalBindings) { + obj.additionalBindings = message.additionalBindings.map((e) => + e ? HttpRule.toJSON(e) : undefined + ); + } else { + obj.additionalBindings = []; + } + return obj; + }, + + fromPartial, I>>(object: I): HttpRule { + const message = createBaseHttpRule(); + message.selector = object.selector ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = + object.custom !== undefined && object.custom !== null + ? CustomHttpPattern.fromPartial(object.custom) + : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = + object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { kind: "", path: "" }; +} + +export const CustomHttpPattern = { + encode( + message: CustomHttpPattern, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.kind = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CustomHttpPattern { + return { + kind: isSet(object.kind) ? String(object.kind) : "", + path: isSet(object.path) ? String(object.path) : "", + }; + }, + + toJSON(message: CustomHttpPattern): unknown { + const obj: any = {}; + message.kind !== undefined && (obj.kind = message.kind); + message.path !== undefined && (obj.path = message.path); + return obj; + }, + + fromPartial, I>>( + object: I + ): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/google/protobuf/descriptor.ts b/src/proto2/google/protobuf/descriptor.ts new file mode 100644 index 0000000..e1cda94 --- /dev/null +++ b/src/proto2/google/protobuf/descriptor.ts @@ -0,0 +1,4395 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} + +/** Describes a complete .proto file. */ +export interface FileDescriptorProto { + /** file name, relative to root of source tree */ + name: string; + /** e.g. "foo", "foo.bar", etc. */ + package: string; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + publicDependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weakDependency: number[]; + /** All top-level definitions in this file. */ + messageType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + service: ServiceDescriptorProto[]; + extension: FieldDescriptorProto[]; + options?: FileOptions; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + sourceCodeInfo?: SourceCodeInfo; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + */ + syntax: string; +} + +/** Describes a message type. */ +export interface DescriptorProto { + name: string; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nestedType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + extensionRange: DescriptorProto_ExtensionRange[]; + oneofDecl: OneofDescriptorProto[]; + options?: MessageOptions; + reservedRange: DescriptorProto_ReservedRange[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reservedName: string[]; +} + +export interface DescriptorProto_ExtensionRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; + options?: ExtensionRangeOptions; +} + +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; +} + +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name: string; + number: number; + label: FieldDescriptorProto_Label; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + */ + type: FieldDescriptorProto_Type; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + typeName: string; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee: string; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + */ + defaultValue: string; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneofIndex: number; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + jsonName: string; + options?: FieldOptions; + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * + * When proto3_optional is true, this field must be belong to a oneof to + * signal to old proto3 clients that presence is tracked for this field. This + * oneof is known as a "synthetic" oneof, and this field must be its sole + * member (each proto3 optional field gets its own synthetic oneof). Synthetic + * oneofs exist in the descriptor only, and do not generate any API. Synthetic + * oneofs must be ordered after all "real" oneofs. + * + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + */ + proto3Optional: boolean; +} + +export enum FieldDescriptorProto_Type { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + */ + TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} + +export function fieldDescriptorProto_TypeFromJSON( + object: any +): FieldDescriptorProto_Type { + switch (object) { + case 1: + case "TYPE_DOUBLE": + return FieldDescriptorProto_Type.TYPE_DOUBLE; + case 2: + case "TYPE_FLOAT": + return FieldDescriptorProto_Type.TYPE_FLOAT; + case 3: + case "TYPE_INT64": + return FieldDescriptorProto_Type.TYPE_INT64; + case 4: + case "TYPE_UINT64": + return FieldDescriptorProto_Type.TYPE_UINT64; + case 5: + case "TYPE_INT32": + return FieldDescriptorProto_Type.TYPE_INT32; + case 6: + case "TYPE_FIXED64": + return FieldDescriptorProto_Type.TYPE_FIXED64; + case 7: + case "TYPE_FIXED32": + return FieldDescriptorProto_Type.TYPE_FIXED32; + case 8: + case "TYPE_BOOL": + return FieldDescriptorProto_Type.TYPE_BOOL; + case 9: + case "TYPE_STRING": + return FieldDescriptorProto_Type.TYPE_STRING; + case 10: + case "TYPE_GROUP": + return FieldDescriptorProto_Type.TYPE_GROUP; + case 11: + case "TYPE_MESSAGE": + return FieldDescriptorProto_Type.TYPE_MESSAGE; + case 12: + case "TYPE_BYTES": + return FieldDescriptorProto_Type.TYPE_BYTES; + case 13: + case "TYPE_UINT32": + return FieldDescriptorProto_Type.TYPE_UINT32; + case 14: + case "TYPE_ENUM": + return FieldDescriptorProto_Type.TYPE_ENUM; + case 15: + case "TYPE_SFIXED32": + return FieldDescriptorProto_Type.TYPE_SFIXED32; + case 16: + case "TYPE_SFIXED64": + return FieldDescriptorProto_Type.TYPE_SFIXED64; + case 17: + case "TYPE_SINT32": + return FieldDescriptorProto_Type.TYPE_SINT32; + case 18: + case "TYPE_SINT64": + return FieldDescriptorProto_Type.TYPE_SINT64; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Type.UNRECOGNIZED; + } +} + +export function fieldDescriptorProto_TypeToJSON( + object: FieldDescriptorProto_Type +): string { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProto_Type.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProto_Type.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProto_Type.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProto_Type.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProto_Type.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProto_Type.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProto_Type.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProto_Type.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProto_Type.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProto_Type.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProto_Type.TYPE_SINT64: + return "TYPE_SINT64"; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + UNRECOGNIZED = -1, +} + +export function fieldDescriptorProto_LabelFromJSON( + object: any +): FieldDescriptorProto_Label { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Label.UNRECOGNIZED; + } +} + +export function fieldDescriptorProto_LabelToJSON( + object: FieldDescriptorProto_Label +): string { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name: string; + options?: OneofOptions; +} + +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name: string; + value: EnumValueDescriptorProto[]; + options?: EnumOptions; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; +} + +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRange { + /** Inclusive. */ + start: number; + /** Inclusive. */ + end: number; +} + +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name: string; + number: number; + options?: EnumValueOptions; +} + +/** Describes a service. */ +export interface ServiceDescriptorProto { + name: string; + method: MethodDescriptorProto[]; + options?: ServiceOptions; +} + +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name: string; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType: string; + outputType: string; + options?: MethodOptions; + /** Identifies if client streams multiple client messages */ + clientStreaming: boolean; + /** Identifies if server streams multiple server messages */ + serverStreaming: boolean; +} + +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + javaPackage: string; + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + */ + javaOuterClassname: string; + /** + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + javaMultipleFiles: boolean; + /** + * This option does nothing. + * + * @deprecated + */ + javaGenerateEqualsAndHash: boolean; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + javaStringCheckUtf8: boolean; + optimizeFor: FileOptions_OptimizeMode; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + goPackage: string; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + ccGenericServices: boolean; + javaGenericServices: boolean; + pyGenericServices: boolean; + phpGenericServices: boolean; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated: boolean; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas: boolean; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix: string; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace: string; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swiftPrefix: string; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix: string; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + phpNamespace: string; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + phpMetadataNamespace: string; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + rubyPackage: string; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} + +/** Generated classes can be optimized for speed or code size. */ +export enum FileOptions_OptimizeMode { + /** SPEED - Generate complete code for parsing, serialization, */ + SPEED = 1, + /** CODE_SIZE - etc. */ + CODE_SIZE = 2, + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = 3, + UNRECOGNIZED = -1, +} + +export function fileOptions_OptimizeModeFromJSON( + object: any +): FileOptions_OptimizeMode { + switch (object) { + case 1: + case "SPEED": + return FileOptions_OptimizeMode.SPEED; + case 2: + case "CODE_SIZE": + return FileOptions_OptimizeMode.CODE_SIZE; + case 3: + case "LITE_RUNTIME": + return FileOptions_OptimizeMode.LITE_RUNTIME; + case -1: + case "UNRECOGNIZED": + default: + return FileOptions_OptimizeMode.UNRECOGNIZED; + } +} + +export function fileOptions_OptimizeModeToJSON( + object: FileOptions_OptimizeMode +): string { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return "SPEED"; + case FileOptions_OptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + messageSetWireFormat: boolean; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + noStandardDescriptorAccessor: boolean; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated: boolean; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + mapEntry: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface FieldOptions { + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + */ + ctype: FieldOptions_CType; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + */ + packed: boolean; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype: FieldOptions_JSType; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + * + * As of 2021, lazy does no correctness checks on the byte stream during + * parsing. This may lead to crashes if and when an invalid byte stream is + * finally parsed upon access. + * + * TODO(b/211906113): Enable validation on lazy fields. + */ + lazy: boolean; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. + */ + unverifiedLazy: boolean; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated: boolean; + /** For Google-internal migration only. Do not use. */ + weak: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { + switch (object) { + case 0: + case "STRING": + return FieldOptions_CType.STRING; + case 1: + case "CORD": + return FieldOptions_CType.CORD; + case 2: + case "STRING_PIECE": + return FieldOptions_CType.STRING_PIECE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_CType.UNRECOGNIZED; + } +} + +export function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string { + switch (object) { + case FieldOptions_CType.STRING: + return "STRING"; + case FieldOptions_CType.CORD: + return "CORD"; + case FieldOptions_CType.STRING_PIECE: + return "STRING_PIECE"; + case FieldOptions_CType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FieldOptions_JSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = 0, + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = 1, + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { + switch (object) { + case 0: + case "JS_NORMAL": + return FieldOptions_JSType.JS_NORMAL; + case 1: + case "JS_STRING": + return FieldOptions_JSType.JS_STRING; + case 2: + case "JS_NUMBER": + return FieldOptions_JSType.JS_NUMBER; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_JSType.UNRECOGNIZED; + } +} + +export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptions_JSType.JS_STRING: + return "JS_STRING"; + case FieldOptions_JSType.JS_NUMBER: + return "JS_NUMBER"; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface OneofOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allowAlias: boolean; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface EnumValueOptions { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface ServiceOptions { + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface MethodOptions { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated: boolean; + idempotencyLevel: MethodOptions_IdempotencyLevel; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +/** + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. + */ +export enum MethodOptions_IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = 1, + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = 2, + UNRECOGNIZED = -1, +} + +export function methodOptions_IdempotencyLevelFromJSON( + object: any +): MethodOptions_IdempotencyLevel { + switch (object) { + case 0: + case "IDEMPOTENCY_UNKNOWN": + return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + case 1: + case "NO_SIDE_EFFECTS": + return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; + case 2: + case "IDEMPOTENT": + return MethodOptions_IdempotencyLevel.IDEMPOTENT; + case -1: + case "UNRECOGNIZED": + default: + return MethodOptions_IdempotencyLevel.UNRECOGNIZED; + } +} + +export function methodOptions_IdempotencyLevelToJSON( + object: MethodOptions_IdempotencyLevel +): string { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue: string; + positiveIntValue: Long; + negativeIntValue: Long; + doubleValue: number; + stringValue: Uint8Array; + aggregateValue: string; +} + +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} + +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfo { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location: SourceCodeInfo_Location[]; +} + +export interface SourceCodeInfo_Location { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition occurs. + * For example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to moo. + * // + * // Another line attached to moo. + * optional double moo = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to moo or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. * / + * /* Block comment attached to + * * grault. * / + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leadingComments: string; + trailingComments: string; + leadingDetachedComments: string[]; +} + +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfo { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfo_Annotation[]; +} + +export interface GeneratedCodeInfo_Annotation { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path: number[]; + /** Identifies the filesystem path to the original source .proto. */ + sourceFile: string; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin: number; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end: number; +} + +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { file: [] }; +} + +export const FileDescriptorSet = { + encode( + message: FileDescriptorSet, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.file.push( + FileDescriptorProto.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FileDescriptorSet { + return { + file: Array.isArray(object?.file) + ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileDescriptorSet): unknown { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map((e) => + e ? FileDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.file = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = + object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFileDescriptorProto(): FileDescriptorProto { + return { + name: "", + package: "", + dependency: [], + publicDependency: [], + weakDependency: [], + messageType: [], + enumType: [], + service: [], + extension: [], + options: undefined, + sourceCodeInfo: undefined, + syntax: "", + }; +} + +export const FileDescriptorProto = { + encode( + message: FileDescriptorProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.package !== "") { + writer.uint32(18).string(message.package); + } + for (const v of message.dependency) { + writer.uint32(26).string(v!); + } + writer.uint32(82).fork(); + for (const v of message.publicDependency) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(90).fork(); + for (const v of message.weakDependency) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.messageType) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.service) { + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.options !== undefined) { + FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + if (message.sourceCodeInfo !== undefined) { + SourceCodeInfo.encode( + message.sourceCodeInfo, + writer.uint32(74).fork() + ).ldelim(); + } + if (message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.package = reader.string(); + break; + case 3: + message.dependency.push(reader.string()); + break; + case 10: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.publicDependency.push(reader.int32()); + } + } else { + message.publicDependency.push(reader.int32()); + } + break; + case 11: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weakDependency.push(reader.int32()); + } + } else { + message.weakDependency.push(reader.int32()); + } + break; + case 4: + message.messageType.push( + DescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 5: + message.enumType.push( + EnumDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 6: + message.service.push( + ServiceDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 7: + message.extension.push( + FieldDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 8: + message.options = FileOptions.decode(reader, reader.uint32()); + break; + case 9: + message.sourceCodeInfo = SourceCodeInfo.decode( + reader, + reader.uint32() + ); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FileDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + package: isSet(object.package) ? String(object.package) : "", + dependency: Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => String(e)) + : [], + publicDependency: Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => Number(e)) + : [], + weakDependency: Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => Number(e)) + : [], + messageType: Array.isArray(object?.messageType) + ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enumType: Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) + ? FileOptions.fromJSON(object.options) + : undefined, + sourceCodeInfo: isSet(object.sourceCodeInfo) + ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) + : undefined, + syntax: isSet(object.syntax) ? String(object.syntax) : "", + }; + }, + + toJSON(message: FileDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.package !== undefined && (obj.package = message.package); + if (message.dependency) { + obj.dependency = message.dependency.map((e) => e); + } else { + obj.dependency = []; + } + if (message.publicDependency) { + obj.publicDependency = message.publicDependency.map((e) => Math.round(e)); + } else { + obj.publicDependency = []; + } + if (message.weakDependency) { + obj.weakDependency = message.weakDependency.map((e) => Math.round(e)); + } else { + obj.weakDependency = []; + } + if (message.messageType) { + obj.messageType = message.messageType.map((e) => + e ? DescriptorProto.toJSON(e) : undefined + ); + } else { + obj.messageType = []; + } + if (message.enumType) { + obj.enumType = message.enumType.map((e) => + e ? EnumDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.enumType = []; + } + if (message.service) { + obj.service = message.service.map((e) => + e ? ServiceDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => + e ? FieldDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.extension = []; + } + message.options !== undefined && + (obj.options = message.options + ? FileOptions.toJSON(message.options) + : undefined); + message.sourceCodeInfo !== undefined && + (obj.sourceCodeInfo = message.sourceCodeInfo + ? SourceCodeInfo.toJSON(message.sourceCodeInfo) + : undefined); + message.syntax !== undefined && (obj.syntax = message.syntax); + return obj; + }, + + fromPartial, I>>( + object: I + ): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map((e) => e) || []; + message.publicDependency = object.publicDependency?.map((e) => e) || []; + message.weakDependency = object.weakDependency?.map((e) => e) || []; + message.messageType = + object.messageType?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enumType = + object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.service = + object.service?.map((e) => ServiceDescriptorProto.fromPartial(e)) || []; + message.extension = + object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.options = + object.options !== undefined && object.options !== null + ? FileOptions.fromPartial(object.options) + : undefined; + message.sourceCodeInfo = + object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null + ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) + : undefined; + message.syntax = object.syntax ?? ""; + return message; + }, +}; + +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [], + }; +} + +export const DescriptorProto = { + encode( + message: DescriptorProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.nestedType) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.extensionRange) { + DescriptorProto_ExtensionRange.encode( + v!, + writer.uint32(42).fork() + ).ldelim(); + } + for (const v of message.oneofDecl) { + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + } + if (message.options !== undefined) { + MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.reservedRange) { + DescriptorProto_ReservedRange.encode( + v!, + writer.uint32(74).fork() + ).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(82).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.field.push( + FieldDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 6: + message.extension.push( + FieldDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 3: + message.nestedType.push( + DescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 4: + message.enumType.push( + EnumDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 5: + message.extensionRange.push( + DescriptorProto_ExtensionRange.decode(reader, reader.uint32()) + ); + break; + case 8: + message.oneofDecl.push( + OneofDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 7: + message.options = MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + message.reservedRange.push( + DescriptorProto_ReservedRange.decode(reader, reader.uint32()) + ); + break; + case 10: + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + field: Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + nestedType: Array.isArray(object?.nestedType) + ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enumType: Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: Array.isArray(object?.extensionRange) + ? object.extensionRange.map((e: any) => + DescriptorProto_ExtensionRange.fromJSON(e) + ) + : [], + oneofDecl: Array.isArray(object?.oneofDecl) + ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) + ? MessageOptions.fromJSON(object.options) + : undefined, + reservedRange: Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e: any) => + DescriptorProto_ReservedRange.fromJSON(e) + ) + : [], + reservedName: Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: DescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.field) { + obj.field = message.field.map((e) => + e ? FieldDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => + e ? FieldDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.extension = []; + } + if (message.nestedType) { + obj.nestedType = message.nestedType.map((e) => + e ? DescriptorProto.toJSON(e) : undefined + ); + } else { + obj.nestedType = []; + } + if (message.enumType) { + obj.enumType = message.enumType.map((e) => + e ? EnumDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.enumType = []; + } + if (message.extensionRange) { + obj.extensionRange = message.extensionRange.map((e) => + e ? DescriptorProto_ExtensionRange.toJSON(e) : undefined + ); + } else { + obj.extensionRange = []; + } + if (message.oneofDecl) { + obj.oneofDecl = message.oneofDecl.map((e) => + e ? OneofDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.oneofDecl = []; + } + message.options !== undefined && + (obj.options = message.options + ? MessageOptions.toJSON(message.options) + : undefined); + if (message.reservedRange) { + obj.reservedRange = message.reservedRange.map((e) => + e ? DescriptorProto_ReservedRange.toJSON(e) : undefined + ); + } else { + obj.reservedRange = []; + } + if (message.reservedName) { + obj.reservedName = message.reservedName.map((e) => e); + } else { + obj.reservedName = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): DescriptorProto { + const message = createBaseDescriptorProto(); + message.name = object.name ?? ""; + message.field = + object.field?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.extension = + object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.nestedType = + object.nestedType?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enumType = + object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.extensionRange = + object.extensionRange?.map((e) => + DescriptorProto_ExtensionRange.fromPartial(e) + ) || []; + message.oneofDecl = + object.oneofDecl?.map((e) => OneofDescriptorProto.fromPartial(e)) || []; + message.options = + object.options !== undefined && object.options !== null + ? MessageOptions.fromPartial(object.options) + : undefined; + message.reservedRange = + object.reservedRange?.map((e) => + DescriptorProto_ReservedRange.fromPartial(e) + ) || []; + message.reservedName = object.reservedName?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { + return { start: 0, end: 0, options: undefined }; +} + +export const DescriptorProto_ExtensionRange = { + encode( + message: DescriptorProto_ExtensionRange, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + if (message.options !== undefined) { + ExtensionRangeOptions.encode( + message.options, + writer.uint32(26).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): DescriptorProto_ExtensionRange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ExtensionRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + case 3: + message.options = ExtensionRangeOptions.decode( + reader, + reader.uint32() + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DescriptorProto_ExtensionRange { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + options: isSet(object.options) + ? ExtensionRangeOptions.fromJSON(object.options) + : undefined, + }; + }, + + toJSON(message: DescriptorProto_ExtensionRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + message.options !== undefined && + (obj.options = message.options + ? ExtensionRangeOptions.toJSON(message.options) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + message.options = + object.options !== undefined && object.options !== null + ? ExtensionRangeOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { + return { start: 0, end: 0 }; +} + +export const DescriptorProto_ReservedRange = { + encode( + message: DescriptorProto_ReservedRange, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): DescriptorProto_ReservedRange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DescriptorProto_ReservedRange { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + }; + }, + + toJSON(message: DescriptorProto_ReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + fromPartial, I>>( + object: I + ): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseExtensionRangeOptions(): ExtensionRangeOptions { + return { uninterpretedOption: [] }; +} + +export const ExtensionRangeOptions = { + encode( + message: ExtensionRangeOptions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): ExtensionRangeOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + message.uninterpretedOption.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions { + return { + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => + UninterpretedOption.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: ExtensionRangeOptions): unknown { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = + object.uninterpretedOption?.map((e) => + UninterpretedOption.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto = { + encode( + message: FieldDescriptorProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + if (message.proto3Optional === true) { + writer.uint32(136).bool(message.proto3Optional); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): FieldDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.number = reader.int32(); + break; + case 4: + message.label = reader.int32() as any; + break; + case 5: + message.type = reader.int32() as any; + break; + case 6: + message.typeName = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.defaultValue = reader.string(); + break; + case 9: + message.oneofIndex = reader.int32(); + break; + case 10: + message.jsonName = reader.string(); + break; + case 8: + message.options = FieldOptions.decode(reader, reader.uint32()); + break; + case 17: + message.proto3Optional = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FieldDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + label: isSet(object.label) + ? fieldDescriptorProto_LabelFromJSON(object.label) + : 1, + type: isSet(object.type) + ? fieldDescriptorProto_TypeFromJSON(object.type) + : 1, + typeName: isSet(object.typeName) ? String(object.typeName) : "", + extendee: isSet(object.extendee) ? String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) + ? String(object.defaultValue) + : "", + oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + options: isSet(object.options) + ? FieldOptions.fromJSON(object.options) + : undefined, + proto3Optional: isSet(object.proto3Optional) + ? Boolean(object.proto3Optional) + : false, + }; + }, + + toJSON(message: FieldDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.label !== undefined && + (obj.label = fieldDescriptorProto_LabelToJSON(message.label)); + message.type !== undefined && + (obj.type = fieldDescriptorProto_TypeToJSON(message.type)); + message.typeName !== undefined && (obj.typeName = message.typeName); + message.extendee !== undefined && (obj.extendee = message.extendee); + message.defaultValue !== undefined && + (obj.defaultValue = message.defaultValue); + message.oneofIndex !== undefined && + (obj.oneofIndex = Math.round(message.oneofIndex)); + message.jsonName !== undefined && (obj.jsonName = message.jsonName); + message.options !== undefined && + (obj.options = message.options + ? FieldOptions.toJSON(message.options) + : undefined); + message.proto3Optional !== undefined && + (obj.proto3Optional = message.proto3Optional); + return obj; + }, + + fromPartial, I>>( + object: I + ): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? 1; + message.type = object.type ?? 1; + message.typeName = object.typeName ?? ""; + message.extendee = object.extendee ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.oneofIndex = object.oneofIndex ?? 0; + message.jsonName = object.jsonName ?? ""; + message.options = + object.options !== undefined && object.options !== null + ? FieldOptions.fromPartial(object.options) + : undefined; + message.proto3Optional = object.proto3Optional ?? false; + return message; + }, +}; + +function createBaseOneofDescriptorProto(): OneofDescriptorProto { + return { name: "", options: undefined }; +} + +export const OneofDescriptorProto = { + encode( + message: OneofDescriptorProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): OneofDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.options = OneofOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): OneofDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + options: isSet(object.options) + ? OneofOptions.fromJSON(object.options) + : undefined, + }; + }, + + toJSON(message: OneofDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.options !== undefined && + (obj.options = message.options + ? OneofOptions.toJSON(message.options) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = + object.options !== undefined && object.options !== null + ? OneofOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseEnumDescriptorProto(): EnumDescriptorProto { + return { + name: "", + value: [], + options: undefined, + reservedRange: [], + reservedName: [], + }; +} + +export const EnumDescriptorProto = { + encode( + message: EnumDescriptorProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.reservedRange) { + EnumDescriptorProto_EnumReservedRange.encode( + v!, + writer.uint32(34).fork() + ).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.value.push( + EnumValueDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 3: + message.options = EnumOptions.decode(reader, reader.uint32()); + break; + case 4: + message.reservedRange.push( + EnumDescriptorProto_EnumReservedRange.decode( + reader, + reader.uint32() + ) + ); + break; + case 5: + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + value: Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) + ? EnumOptions.fromJSON(object.options) + : undefined, + reservedRange: Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e: any) => + EnumDescriptorProto_EnumReservedRange.fromJSON(e) + ) + : [], + reservedName: Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: EnumDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.value) { + obj.value = message.value.map((e) => + e ? EnumValueDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.value = []; + } + message.options !== undefined && + (obj.options = message.options + ? EnumOptions.toJSON(message.options) + : undefined); + if (message.reservedRange) { + obj.reservedRange = message.reservedRange.map((e) => + e ? EnumDescriptorProto_EnumReservedRange.toJSON(e) : undefined + ); + } else { + obj.reservedRange = []; + } + if (message.reservedName) { + obj.reservedName = message.reservedName.map((e) => e); + } else { + obj.reservedName = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + message.name = object.name ?? ""; + message.value = + object.value?.map((e) => EnumValueDescriptorProto.fromPartial(e)) || []; + message.options = + object.options !== undefined && object.options !== null + ? EnumOptions.fromPartial(object.options) + : undefined; + message.reservedRange = + object.reservedRange?.map((e) => + EnumDescriptorProto_EnumReservedRange.fromPartial(e) + ) || []; + message.reservedName = object.reservedName?.map((e) => e) || []; + return message; + }, +}; + +function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { + return { start: 0, end: 0 }; +} + +export const EnumDescriptorProto_EnumReservedRange = { + encode( + message: EnumDescriptorProto_EnumReservedRange, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + }; + }, + + toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + fromPartial< + I extends Exact, I> + >(object: I): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { + return { name: "", number: 0, options: undefined }; +} + +export const EnumValueDescriptorProto = { + encode( + message: EnumValueDescriptorProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.options !== undefined) { + EnumValueOptions.encode( + message.options, + writer.uint32(26).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): EnumValueDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.number = reader.int32(); + break; + case 3: + message.options = EnumValueOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumValueDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + options: isSet(object.options) + ? EnumValueOptions.fromJSON(object.options) + : undefined, + }; + }, + + toJSON(message: EnumValueDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.options !== undefined && + (obj.options = message.options + ? EnumValueOptions.toJSON(message.options) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.options = + object.options !== undefined && object.options !== null + ? EnumValueOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseServiceDescriptorProto(): ServiceDescriptorProto { + return { name: "", method: [], options: undefined }; +} + +export const ServiceDescriptorProto = { + encode( + message: ServiceDescriptorProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): ServiceDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.method.push( + MethodDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 3: + message.options = ServiceOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ServiceDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + method: Array.isArray(object?.method) + ? object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) + ? ServiceOptions.fromJSON(object.options) + : undefined, + }; + }, + + toJSON(message: ServiceDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.method) { + obj.method = message.method.map((e) => + e ? MethodDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.method = []; + } + message.options !== undefined && + (obj.options = message.options + ? ServiceOptions.toJSON(message.options) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + message.name = object.name ?? ""; + message.method = + object.method?.map((e) => MethodDescriptorProto.fromPartial(e)) || []; + message.options = + object.options !== undefined && object.options !== null + ? ServiceOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseMethodDescriptorProto(): MethodDescriptorProto { + return { + name: "", + inputType: "", + outputType: "", + options: undefined, + clientStreaming: false, + serverStreaming: false, + }; +} + +export const MethodDescriptorProto = { + encode( + message: MethodDescriptorProto, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.inputType !== "") { + writer.uint32(18).string(message.inputType); + } + if (message.outputType !== "") { + writer.uint32(26).string(message.outputType); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + } + if (message.clientStreaming === true) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming === true) { + writer.uint32(48).bool(message.serverStreaming); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MethodDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.inputType = reader.string(); + break; + case 3: + message.outputType = reader.string(); + break; + case 4: + message.options = MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.clientStreaming = reader.bool(); + break; + case 6: + message.serverStreaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MethodDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + inputType: isSet(object.inputType) ? String(object.inputType) : "", + outputType: isSet(object.outputType) ? String(object.outputType) : "", + options: isSet(object.options) + ? MethodOptions.fromJSON(object.options) + : undefined, + clientStreaming: isSet(object.clientStreaming) + ? Boolean(object.clientStreaming) + : false, + serverStreaming: isSet(object.serverStreaming) + ? Boolean(object.serverStreaming) + : false, + }; + }, + + toJSON(message: MethodDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.inputType !== undefined && (obj.inputType = message.inputType); + message.outputType !== undefined && (obj.outputType = message.outputType); + message.options !== undefined && + (obj.options = message.options + ? MethodOptions.toJSON(message.options) + : undefined); + message.clientStreaming !== undefined && + (obj.clientStreaming = message.clientStreaming); + message.serverStreaming !== undefined && + (obj.serverStreaming = message.serverStreaming); + return obj; + }, + + fromPartial, I>>( + object: I + ): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.inputType = object.inputType ?? ""; + message.outputType = object.outputType ?? ""; + message.options = + object.options !== undefined && object.options !== null + ? MethodOptions.fromPartial(object.options) + : undefined; + message.clientStreaming = object.clientStreaming ?? false; + message.serverStreaming = object.serverStreaming ?? false; + return message; + }, +}; + +function createBaseFileOptions(): FileOptions { + return { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + phpGenericServices: false, + deprecated: false, + ccEnableArenas: false, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + uninterpretedOption: [], + }; +} + +export const FileOptions = { + encode( + message: FileOptions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.javaPackage !== "") { + writer.uint32(10).string(message.javaPackage); + } + if (message.javaOuterClassname !== "") { + writer.uint32(66).string(message.javaOuterClassname); + } + if (message.javaMultipleFiles === true) { + writer.uint32(80).bool(message.javaMultipleFiles); + } + if (message.javaGenerateEqualsAndHash === true) { + writer.uint32(160).bool(message.javaGenerateEqualsAndHash); + } + if (message.javaStringCheckUtf8 === true) { + writer.uint32(216).bool(message.javaStringCheckUtf8); + } + if (message.optimizeFor !== 1) { + writer.uint32(72).int32(message.optimizeFor); + } + if (message.goPackage !== "") { + writer.uint32(90).string(message.goPackage); + } + if (message.ccGenericServices === true) { + writer.uint32(128).bool(message.ccGenericServices); + } + if (message.javaGenericServices === true) { + writer.uint32(136).bool(message.javaGenericServices); + } + if (message.pyGenericServices === true) { + writer.uint32(144).bool(message.pyGenericServices); + } + if (message.phpGenericServices === true) { + writer.uint32(336).bool(message.phpGenericServices); + } + if (message.deprecated === true) { + writer.uint32(184).bool(message.deprecated); + } + if (message.ccEnableArenas === true) { + writer.uint32(248).bool(message.ccEnableArenas); + } + if (message.objcClassPrefix !== "") { + writer.uint32(290).string(message.objcClassPrefix); + } + if (message.csharpNamespace !== "") { + writer.uint32(298).string(message.csharpNamespace); + } + if (message.swiftPrefix !== "") { + writer.uint32(314).string(message.swiftPrefix); + } + if (message.phpClassPrefix !== "") { + writer.uint32(322).string(message.phpClassPrefix); + } + if (message.phpNamespace !== "") { + writer.uint32(330).string(message.phpNamespace); + } + if (message.phpMetadataNamespace !== "") { + writer.uint32(354).string(message.phpMetadataNamespace); + } + if (message.rubyPackage !== "") { + writer.uint32(362).string(message.rubyPackage); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.javaPackage = reader.string(); + break; + case 8: + message.javaOuterClassname = reader.string(); + break; + case 10: + message.javaMultipleFiles = reader.bool(); + break; + case 20: + message.javaGenerateEqualsAndHash = reader.bool(); + break; + case 27: + message.javaStringCheckUtf8 = reader.bool(); + break; + case 9: + message.optimizeFor = reader.int32() as any; + break; + case 11: + message.goPackage = reader.string(); + break; + case 16: + message.ccGenericServices = reader.bool(); + break; + case 17: + message.javaGenericServices = reader.bool(); + break; + case 18: + message.pyGenericServices = reader.bool(); + break; + case 42: + message.phpGenericServices = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.ccEnableArenas = reader.bool(); + break; + case 36: + message.objcClassPrefix = reader.string(); + break; + case 37: + message.csharpNamespace = reader.string(); + break; + case 39: + message.swiftPrefix = reader.string(); + break; + case 40: + message.phpClassPrefix = reader.string(); + break; + case 41: + message.phpNamespace = reader.string(); + break; + case 44: + message.phpMetadataNamespace = reader.string(); + break; + case 45: + message.rubyPackage = reader.string(); + break; + case 999: + message.uninterpretedOption.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FileOptions { + return { + javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) + ? String(object.javaOuterClassname) + : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) + ? Boolean(object.javaMultipleFiles) + : false, + javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) + ? Boolean(object.javaGenerateEqualsAndHash) + : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) + ? Boolean(object.javaStringCheckUtf8) + : false, + optimizeFor: isSet(object.optimizeFor) + ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) + : 1, + goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) + ? Boolean(object.ccGenericServices) + : false, + javaGenericServices: isSet(object.javaGenericServices) + ? Boolean(object.javaGenericServices) + : false, + pyGenericServices: isSet(object.pyGenericServices) + ? Boolean(object.pyGenericServices) + : false, + phpGenericServices: isSet(object.phpGenericServices) + ? Boolean(object.phpGenericServices) + : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) + ? Boolean(object.ccEnableArenas) + : false, + objcClassPrefix: isSet(object.objcClassPrefix) + ? String(object.objcClassPrefix) + : "", + csharpNamespace: isSet(object.csharpNamespace) + ? String(object.csharpNamespace) + : "", + swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) + ? String(object.phpClassPrefix) + : "", + phpNamespace: isSet(object.phpNamespace) + ? String(object.phpNamespace) + : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) + ? String(object.phpMetadataNamespace) + : "", + rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => + UninterpretedOption.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: FileOptions): unknown { + const obj: any = {}; + message.javaPackage !== undefined && + (obj.javaPackage = message.javaPackage); + message.javaOuterClassname !== undefined && + (obj.javaOuterClassname = message.javaOuterClassname); + message.javaMultipleFiles !== undefined && + (obj.javaMultipleFiles = message.javaMultipleFiles); + message.javaGenerateEqualsAndHash !== undefined && + (obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash); + message.javaStringCheckUtf8 !== undefined && + (obj.javaStringCheckUtf8 = message.javaStringCheckUtf8); + message.optimizeFor !== undefined && + (obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor)); + message.goPackage !== undefined && (obj.goPackage = message.goPackage); + message.ccGenericServices !== undefined && + (obj.ccGenericServices = message.ccGenericServices); + message.javaGenericServices !== undefined && + (obj.javaGenericServices = message.javaGenericServices); + message.pyGenericServices !== undefined && + (obj.pyGenericServices = message.pyGenericServices); + message.phpGenericServices !== undefined && + (obj.phpGenericServices = message.phpGenericServices); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.ccEnableArenas !== undefined && + (obj.ccEnableArenas = message.ccEnableArenas); + message.objcClassPrefix !== undefined && + (obj.objcClassPrefix = message.objcClassPrefix); + message.csharpNamespace !== undefined && + (obj.csharpNamespace = message.csharpNamespace); + message.swiftPrefix !== undefined && + (obj.swiftPrefix = message.swiftPrefix); + message.phpClassPrefix !== undefined && + (obj.phpClassPrefix = message.phpClassPrefix); + message.phpNamespace !== undefined && + (obj.phpNamespace = message.phpNamespace); + message.phpMetadataNamespace !== undefined && + (obj.phpMetadataNamespace = message.phpMetadataNamespace); + message.rubyPackage !== undefined && + (obj.rubyPackage = message.rubyPackage); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): FileOptions { + const message = createBaseFileOptions(); + message.javaPackage = object.javaPackage ?? ""; + message.javaOuterClassname = object.javaOuterClassname ?? ""; + message.javaMultipleFiles = object.javaMultipleFiles ?? false; + message.javaGenerateEqualsAndHash = + object.javaGenerateEqualsAndHash ?? false; + message.javaStringCheckUtf8 = object.javaStringCheckUtf8 ?? false; + message.optimizeFor = object.optimizeFor ?? 1; + message.goPackage = object.goPackage ?? ""; + message.ccGenericServices = object.ccGenericServices ?? false; + message.javaGenericServices = object.javaGenericServices ?? false; + message.pyGenericServices = object.pyGenericServices ?? false; + message.phpGenericServices = object.phpGenericServices ?? false; + message.deprecated = object.deprecated ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? false; + message.objcClassPrefix = object.objcClassPrefix ?? ""; + message.csharpNamespace = object.csharpNamespace ?? ""; + message.swiftPrefix = object.swiftPrefix ?? ""; + message.phpClassPrefix = object.phpClassPrefix ?? ""; + message.phpNamespace = object.phpNamespace ?? ""; + message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; + message.rubyPackage = object.rubyPackage ?? ""; + message.uninterpretedOption = + object.uninterpretedOption?.map((e) => + UninterpretedOption.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseMessageOptions(): MessageOptions { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + uninterpretedOption: [], + }; +} + +export const MessageOptions = { + encode( + message: MessageOptions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.messageSetWireFormat === true) { + writer.uint32(8).bool(message.messageSetWireFormat); + } + if (message.noStandardDescriptorAccessor === true) { + writer.uint32(16).bool(message.noStandardDescriptorAccessor); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.mapEntry === true) { + writer.uint32(56).bool(message.mapEntry); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageSetWireFormat = reader.bool(); + break; + case 2: + message.noStandardDescriptorAccessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.mapEntry = reader.bool(); + break; + case 999: + message.uninterpretedOption.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MessageOptions { + return { + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? Boolean(object.messageSetWireFormat) + : false, + noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) + ? Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => + UninterpretedOption.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: MessageOptions): unknown { + const obj: any = {}; + message.messageSetWireFormat !== undefined && + (obj.messageSetWireFormat = message.messageSetWireFormat); + message.noStandardDescriptorAccessor !== undefined && + (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.mapEntry !== undefined && (obj.mapEntry = message.mapEntry); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): MessageOptions { + const message = createBaseMessageOptions(); + message.messageSetWireFormat = object.messageSetWireFormat ?? false; + message.noStandardDescriptorAccessor = + object.noStandardDescriptorAccessor ?? false; + message.deprecated = object.deprecated ?? false; + message.mapEntry = object.mapEntry ?? false; + message.uninterpretedOption = + object.uninterpretedOption?.map((e) => + UninterpretedOption.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseFieldOptions(): FieldOptions { + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + uninterpretedOption: [], + }; +} + +export const FieldOptions = { + encode( + message: FieldOptions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.ctype !== 0) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed === true) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== 0) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy === true) { + writer.uint32(40).bool(message.lazy); + } + if (message.unverifiedLazy === true) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak === true) { + writer.uint32(80).bool(message.weak); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ctype = reader.int32() as any; + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = reader.int32() as any; + break; + case 5: + message.lazy = reader.bool(); + break; + case 15: + message.unverifiedLazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + message.uninterpretedOption.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FieldOptions { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + packed: isSet(object.packed) ? Boolean(object.packed) : false, + jstype: isSet(object.jstype) + ? fieldOptions_JSTypeFromJSON(object.jstype) + : 0, + lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) + ? Boolean(object.unverifiedLazy) + : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? Boolean(object.weak) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => + UninterpretedOption.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: FieldOptions): unknown { + const obj: any = {}; + message.ctype !== undefined && + (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); + message.packed !== undefined && (obj.packed = message.packed); + message.jstype !== undefined && + (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); + message.lazy !== undefined && (obj.lazy = message.lazy); + message.unverifiedLazy !== undefined && + (obj.unverifiedLazy = message.unverifiedLazy); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.weak !== undefined && (obj.weak = message.weak); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): FieldOptions { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? 0; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 0; + message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.uninterpretedOption = + object.uninterpretedOption?.map((e) => + UninterpretedOption.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { uninterpretedOption: [] }; +} + +export const OneofOptions = { + encode( + message: OneofOptions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + message.uninterpretedOption.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => + UninterpretedOption.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): OneofOptions { + const message = createBaseOneofOptions(); + message.uninterpretedOption = + object.uninterpretedOption?.map((e) => + UninterpretedOption.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +} + +export const EnumOptions = { + encode( + message: EnumOptions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.allowAlias === true) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allowAlias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => + UninterpretedOption.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): EnumOptions { + const message = createBaseEnumOptions(); + message.allowAlias = object.allowAlias ?? false; + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = + object.uninterpretedOption?.map((e) => + UninterpretedOption.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseEnumValueOptions(): EnumValueOptions { + return { deprecated: false, uninterpretedOption: [] }; +} + +export const EnumValueOptions = { + encode( + message: EnumValueOptions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(8).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumValueOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => + UninterpretedOption.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: EnumValueOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): EnumValueOptions { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = + object.uninterpretedOption?.map((e) => + UninterpretedOption.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseServiceOptions(): ServiceOptions { + return { deprecated: false, uninterpretedOption: [] }; +} + +export const ServiceOptions = { + encode( + message: ServiceOptions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ServiceOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => + UninterpretedOption.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: ServiceOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): ServiceOptions { + const message = createBaseServiceOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = + object.uninterpretedOption?.map((e) => + UninterpretedOption.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseMethodOptions(): MethodOptions { + return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; +} + +export const MethodOptions = { + encode( + message: MethodOptions, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotencyLevel !== 0) { + writer.uint32(272).int32(message.idempotencyLevel); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 34: + message.idempotencyLevel = reader.int32() as any; + break; + case 999: + message.uninterpretedOption.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MethodOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + idempotencyLevel: isSet(object.idempotencyLevel) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) + : 0, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => + UninterpretedOption.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: MethodOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.idempotencyLevel !== undefined && + (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON( + message.idempotencyLevel + )); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): MethodOptions { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.uninterpretedOption = + object.uninterpretedOption?.map((e) => + UninterpretedOption.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseUninterpretedOption(): UninterpretedOption { + return { + name: [], + identifierValue: "", + positiveIntValue: Long.UZERO, + negativeIntValue: Long.ZERO, + doubleValue: 0, + stringValue: new Uint8Array(), + aggregateValue: "", + }; +} + +export const UninterpretedOption = { + encode( + message: UninterpretedOption, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.name) { + UninterpretedOption_NamePart.encode( + v!, + writer.uint32(18).fork() + ).ldelim(); + } + if (message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (!message.positiveIntValue.isZero()) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (!message.negativeIntValue.isZero()) { + writer.uint32(40).int64(message.negativeIntValue); + } + if (message.doubleValue !== 0) { + writer.uint32(49).double(message.doubleValue); + } + if (message.stringValue.length !== 0) { + writer.uint32(58).bytes(message.stringValue); + } + if (message.aggregateValue !== "") { + writer.uint32(66).string(message.aggregateValue); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.name.push( + UninterpretedOption_NamePart.decode(reader, reader.uint32()) + ); + break; + case 3: + message.identifierValue = reader.string(); + break; + case 4: + message.positiveIntValue = reader.uint64() as Long; + break; + case 5: + message.negativeIntValue = reader.int64() as Long; + break; + case 6: + message.doubleValue = reader.double(); + break; + case 7: + message.stringValue = reader.bytes(); + break; + case 8: + message.aggregateValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UninterpretedOption { + return { + name: Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) + ? String(object.identifierValue) + : "", + positiveIntValue: isSet(object.positiveIntValue) + ? Long.fromValue(object.positiveIntValue) + : Long.UZERO, + negativeIntValue: isSet(object.negativeIntValue) + ? Long.fromValue(object.negativeIntValue) + : Long.ZERO, + doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + stringValue: isSet(object.stringValue) + ? bytesFromBase64(object.stringValue) + : new Uint8Array(), + aggregateValue: isSet(object.aggregateValue) + ? String(object.aggregateValue) + : "", + }; + }, + + toJSON(message: UninterpretedOption): unknown { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map((e) => + e ? UninterpretedOption_NamePart.toJSON(e) : undefined + ); + } else { + obj.name = []; + } + message.identifierValue !== undefined && + (obj.identifierValue = message.identifierValue); + message.positiveIntValue !== undefined && + (obj.positiveIntValue = ( + message.positiveIntValue || Long.UZERO + ).toString()); + message.negativeIntValue !== undefined && + (obj.negativeIntValue = ( + message.negativeIntValue || Long.ZERO + ).toString()); + message.doubleValue !== undefined && + (obj.doubleValue = message.doubleValue); + message.stringValue !== undefined && + (obj.stringValue = base64FromBytes( + message.stringValue !== undefined + ? message.stringValue + : new Uint8Array() + )); + message.aggregateValue !== undefined && + (obj.aggregateValue = message.aggregateValue); + return obj; + }, + + fromPartial, I>>( + object: I + ): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = + object.name?.map((e) => UninterpretedOption_NamePart.fromPartial(e)) || + []; + message.identifierValue = object.identifierValue ?? ""; + message.positiveIntValue = + object.positiveIntValue !== undefined && object.positiveIntValue !== null + ? Long.fromValue(object.positiveIntValue) + : Long.UZERO; + message.negativeIntValue = + object.negativeIntValue !== undefined && object.negativeIntValue !== null + ? Long.fromValue(object.negativeIntValue) + : Long.ZERO; + message.doubleValue = object.doubleValue ?? 0; + message.stringValue = object.stringValue ?? new Uint8Array(); + message.aggregateValue = object.aggregateValue ?? ""; + return message; + }, +}; + +function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { + return { namePart: "", isExtension: false }; +} + +export const UninterpretedOption_NamePart = { + encode( + message: UninterpretedOption_NamePart, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension === true) { + writer.uint32(16).bool(message.isExtension); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): UninterpretedOption_NamePart { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption_NamePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namePart = reader.string(); + break; + case 2: + message.isExtension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UninterpretedOption_NamePart { + return { + namePart: isSet(object.namePart) ? String(object.namePart) : "", + isExtension: isSet(object.isExtension) + ? Boolean(object.isExtension) + : false, + }; + }, + + toJSON(message: UninterpretedOption_NamePart): unknown { + const obj: any = {}; + message.namePart !== undefined && (obj.namePart = message.namePart); + message.isExtension !== undefined && + (obj.isExtension = message.isExtension); + return obj; + }, + + fromPartial, I>>( + object: I + ): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + message.namePart = object.namePart ?? ""; + message.isExtension = object.isExtension ?? false; + return message; + }, +}; + +function createBaseSourceCodeInfo(): SourceCodeInfo { + return { location: [] }; +} + +export const SourceCodeInfo = { + encode( + message: SourceCodeInfo, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.location.push( + SourceCodeInfo_Location.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SourceCodeInfo { + return { + location: Array.isArray(object?.location) + ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo): unknown { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map((e) => + e ? SourceCodeInfo_Location.toJSON(e) : undefined + ); + } else { + obj.location = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = + object.location?.map((e) => SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { + return { + path: [], + span: [], + leadingComments: "", + trailingComments: "", + leadingDetachedComments: [], + }; +} + +export const SourceCodeInfo_Location = { + encode( + message: SourceCodeInfo_Location, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.ldelim(); + if (message.leadingComments !== "") { + writer.uint32(26).string(message.leadingComments); + } + if (message.trailingComments !== "") { + writer.uint32(34).string(message.trailingComments); + } + for (const v of message.leadingDetachedComments) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): SourceCodeInfo_Location { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo_Location(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.span.push(reader.int32()); + } + } else { + message.span.push(reader.int32()); + } + break; + case 3: + message.leadingComments = reader.string(); + break; + case 4: + message.trailingComments = reader.string(); + break; + case 6: + message.leadingDetachedComments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SourceCodeInfo_Location { + return { + path: Array.isArray(object?.path) + ? object.path.map((e: any) => Number(e)) + : [], + span: Array.isArray(object?.span) + ? object.span.map((e: any) => Number(e)) + : [], + leadingComments: isSet(object.leadingComments) + ? String(object.leadingComments) + : "", + trailingComments: isSet(object.trailingComments) + ? String(object.trailingComments) + : "", + leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo_Location): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map((e) => Math.round(e)); + } else { + obj.span = []; + } + message.leadingComments !== undefined && + (obj.leadingComments = message.leadingComments); + message.trailingComments !== undefined && + (obj.trailingComments = message.trailingComments); + if (message.leadingDetachedComments) { + obj.leadingDetachedComments = message.leadingDetachedComments.map( + (e) => e + ); + } else { + obj.leadingDetachedComments = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map((e) => e) || []; + message.span = object.span?.map((e) => e) || []; + message.leadingComments = object.leadingComments ?? ""; + message.trailingComments = object.trailingComments ?? ""; + message.leadingDetachedComments = + object.leadingDetachedComments?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { + return { annotation: [] }; +} + +export const GeneratedCodeInfo = { + encode( + message: GeneratedCodeInfo, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode( + v!, + writer.uint32(10).fork() + ).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.annotation.push( + GeneratedCodeInfo_Annotation.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GeneratedCodeInfo { + return { + annotation: Array.isArray(object?.annotation) + ? object.annotation.map((e: any) => + GeneratedCodeInfo_Annotation.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: GeneratedCodeInfo): unknown { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map((e) => + e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined + ); + } else { + obj.annotation = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = + object.annotation?.map((e) => + GeneratedCodeInfo_Annotation.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { + return { path: [], sourceFile: "", begin: 0, end: 0 }; +} + +export const GeneratedCodeInfo_Annotation = { + encode( + message: GeneratedCodeInfo_Annotation, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + if (message.sourceFile !== "") { + writer.uint32(18).string(message.sourceFile); + } + if (message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== 0) { + writer.uint32(32).int32(message.end); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): GeneratedCodeInfo_Annotation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo_Annotation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + case 2: + message.sourceFile = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GeneratedCodeInfo_Annotation { + return { + path: Array.isArray(object?.path) + ? object.path.map((e: any) => Number(e)) + : [], + sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", + begin: isSet(object.begin) ? Number(object.begin) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + }; + }, + + toJSON(message: GeneratedCodeInfo_Annotation): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } else { + obj.path = []; + } + message.sourceFile !== undefined && (obj.sourceFile = message.sourceFile); + message.begin !== undefined && (obj.begin = Math.round(message.begin)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + fromPartial, I>>( + object: I + ): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map((e) => e) || []; + message.sourceFile = object.sourceFile ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw "Unable to locate global object"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/google/protobuf/duration.ts b/src/proto2/google/protobuf/duration.ts new file mode 100644 index 0000000..922cc24 --- /dev/null +++ b/src/proto2/google/protobuf/duration.ts @@ -0,0 +1,187 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: Long; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: Long.ZERO, nanos: 0 }; +} + +export const Duration = { + encode( + message: Duration, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Duration { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64() as Long; + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) + ? Long.fromValue(object.seconds) + : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + message.seconds !== undefined && + (obj.seconds = (message.seconds || Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + fromPartial, I>>(object: I): Duration { + const message = createBaseDuration(); + message.seconds = + object.seconds !== undefined && object.seconds !== null + ? Long.fromValue(object.seconds) + : Long.ZERO; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/proto2/google/protobuf/timestamp.ts b/src/proto2/google/protobuf/timestamp.ts new file mode 100644 index 0000000..66245b7 --- /dev/null +++ b/src/proto2/google/protobuf/timestamp.ts @@ -0,0 +1,220 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: Long; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: Long.ZERO, nanos: 0 }; +} + +export const Timestamp = { + encode( + message: Timestamp, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64() as Long; + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) + ? Long.fromValue(object.seconds) + : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + message.seconds !== undefined && + (obj.seconds = (message.seconds || Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + fromPartial, I>>( + object: I + ): Timestamp { + const message = createBaseTimestamp(); + message.seconds = + object.seconds !== undefined && object.seconds !== null + ? Long.fromValue(object.seconds) + : Long.ZERO; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/yarn.lock b/yarn.lock index 2c2c0f7..0c36b70 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1250,6 +1250,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.45.tgz#2c0fafd78705e7a18b7906b5201a522719dc5190" integrity sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw== +"@types/object-hash@^1.3.0": + version "1.3.4" + resolved "https://registry.yarnpkg.com/@types/object-hash/-/object-hash-1.3.4.tgz#079ba142be65833293673254831b5e3e847fe58b" + integrity sha512-xFdpkAkikBgqBdG9vIlsqffDV8GpvnPEzs0IUtr1v3BEB97ijsFQ4RXVbUZwjFThhB4MDSTUfvmxUD5PGx0wXA== + "@types/pbkdf2@^3.0.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.0.tgz#039a0e9b67da0cdc4ee5dab865caa6b267bb66b1" @@ -1776,6 +1781,11 @@ crypto-addr-codec@^0.1.7: safe-buffer "^5.2.0" sha3 "^2.1.1" +dataloader@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-1.4.0.tgz#bca11d867f5d3f1b9ed9f737bd15970c65dff5c8" + integrity sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw== + debug@^4.1.0, debug@^4.1.1: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -2780,7 +2790,7 @@ lodash.memoize@4.x: resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== -lodash@^4.17.21: +lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -2790,7 +2800,7 @@ long@^4.0.0: resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== -long@^5.2.0: +long@^5.0.0, long@^5.2.0: version "5.2.3" resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== @@ -2938,6 +2948,11 @@ npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" +object-hash@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df" + integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA== + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -3041,6 +3056,11 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +prettier@^2.5.1: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + pretty-format@^27.0.0, pretty-format@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e" @@ -3074,7 +3094,26 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" -protobufjs@~6.11.2: +protobufjs@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.0.0.tgz#8c678e1351fd926178fce5a4213913e8d990974f" + integrity sha512-ffNIEm+quOcYtQvHdW406v1NQmZSuqVklxsXk076BtuFnlYZfigLU+JOMrTD8TUOyqHYbRI/fSVNvgd25YeN3w== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.1" + "@types/node" ">=13.7.0" + long "^5.0.0" + +protobufjs@^6.11.3, protobufjs@^6.8.8, protobufjs@~6.11.2: version "6.11.4" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.4.tgz#29a412c38bf70d89e537b6d02d904a6f448173aa" integrity sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw== @@ -3093,11 +3132,6 @@ protobufjs@~6.11.2: "@types/node" ">=13.7.0" long "^4.0.0" -protoc-gen-ts@^0.8.7: - version "0.8.7" - resolved "https://registry.yarnpkg.com/protoc-gen-ts/-/protoc-gen-ts-0.8.7.tgz#63e4d9af2ad30b753acf6f739323d01fc9f80b52" - integrity sha512-jr4VJey2J9LVYCV7EVyVe53g1VMw28cCmYJhBe5e3YX5wiyiDwgxWxeDf9oTqAe4P1bN/YGAkW2jhlH8LohwiQ== - pure-rand@^6.0.0: version "6.0.3" resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.3.tgz#3c9e6b53c09e52ac3cedffc85ab7c1c7094b38cb" @@ -3442,6 +3476,34 @@ ts-jest@^29.0.2: semver "^7.5.3" yargs-parser "^21.0.1" +ts-poet@^4.15.0: + version "4.15.0" + resolved "https://registry.yarnpkg.com/ts-poet/-/ts-poet-4.15.0.tgz#637145fa554d3b27c56541578df0ce08cd9eb328" + integrity sha512-sLLR8yQBvHzi9d4R1F4pd+AzQxBfzOSSjfxiJxQhkUoH5bL7RsAC6wgvtVUQdGqiCsyS9rT6/8X2FI7ipdir5g== + dependencies: + lodash "^4.17.15" + prettier "^2.5.1" + +ts-proto-descriptors@1.7.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/ts-proto-descriptors/-/ts-proto-descriptors-1.7.1.tgz#685d00305b06adfa929fd5a016a419382cd64c50" + integrity sha512-oIKUh3K4Xts4v29USGLfUG+2mEk32MsqpgZAOUyUlkrcIdv34yE+k2oZ2Nzngm6cV/JgFdOxRCqeyvmWHuYAyw== + dependencies: + long "^4.0.0" + protobufjs "^6.8.8" + +ts-proto@1.121.6: + version "1.121.6" + resolved "https://registry.yarnpkg.com/ts-proto/-/ts-proto-1.121.6.tgz#7eceac6149f5e6c5f89bd29ed4bf7207d4d9212e" + integrity sha512-RURk69YVm5ZL537tRXi+9C1xyK4Upf4kcMdactxakHsF4c4CQoUSCQXqRP4At2rslS6hD+tGWpPG5wIvOUIzVw== + dependencies: + "@types/object-hash" "^1.3.0" + dataloader "^1.4.0" + object-hash "^1.3.1" + protobufjs "^6.11.3" + ts-poet "^4.15.0" + ts-proto-descriptors "1.7.1" + tweetnacl-util@^0.15.1: version "0.15.1" resolved "https://registry.yarnpkg.com/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz#b80fcdb5c97bcc508be18c44a4be50f022eea00b"