diff --git a/Makefile b/Makefile index 21693b87..cb77da3c 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ DOCKER := $(shell which docker) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.0.0-rc8 +PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git) ############################################################################### ### Protobuf ### @@ -10,6 +11,7 @@ DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bu protoVer=v0.7 protoImageName=tendermintdev/sdk-proto-gen:$(protoVer) protoImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) +protoGenSwagger=$(PROJECT_NAME)-proto-gen-swagger-$(protoVer) proto-all: proto-format proto-lint proto-gen @@ -17,6 +19,11 @@ proto-gen: @echo "Generating Protobuf files" @$(protoImage) sh ./scripts/protocgen.sh +proto-swagger-gen: + @echo "Generating Protobuf Swagger" + @if docker ps -a --format '{{.Names}}' | grep -Eq "^${protoGenSwagger}$$"; then docker start -a $(protoGenSwagger); else docker run --name $(protoGenSwagger) -v $(CURDIR):/workspaces/multi-staking --workdir /workspaces/multi-staking $(protoImageName) \ + sh ./scripts/protoc-swagger-gen.sh; fi + proto-format: @$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \; diff --git a/docs/config.json b/docs/config.json new file mode 100644 index 00000000..5a9b8113 --- /dev/null +++ b/docs/config.json @@ -0,0 +1,18 @@ +{ + "swagger": "2.0", + "info": { + "title": "Cosmos SDK - gRPC Gateway docs", + "description": "A REST interface for state queries", + "version": "1.0.0" + }, + "apis": [ + { + "url": "./tmp-swagger-gen/multistaking/v1/query.swagger.json", + "operationIds": { + "rename": { + "Params": "MultiStakingParams" + } + } + } + ] +} \ No newline at end of file diff --git a/docs/swagger-ui/swagger.yaml b/docs/swagger-ui/swagger.yaml new file mode 100644 index 00000000..6fcb320c --- /dev/null +++ b/docs/swagger-ui/swagger.yaml @@ -0,0 +1,1835 @@ +swagger: '2.0' +info: + title: Cosmos SDK - gRPC Gateway docs + description: A REST interface for state queries + version: 1.0.0 +paths: + /realiotech/multistaking/v1/coin-infos: + get: + operationId: MultiStakingCoinInfos + responses: + '200': + description: A successful response. + schema: + type: object + properties: + infos: + type: array + items: + type: object + properties: + denom: + type: string + bond_weight: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + 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. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + 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; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pagination.key + description: |- + 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. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + 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. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + 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. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + 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. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /realiotech/multistaking/v1/lock/{validator_address}/{multi_staker_address}: + get: + operationId: MultiStakingLock + responses: + '200': + description: A successful response. + schema: + type: object + properties: + lock: + type: object + properties: + lockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + locked_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + found: + type: boolean + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: validator_address + in: path + required: true + type: string + - name: multi_staker_address + in: path + required: true + type: string + tags: + - Query + /realiotech/multistaking/v1/locks: + get: + operationId: MultiStakingLocks + responses: + '200': + description: A successful response. + schema: + type: object + properties: + locks: + type: array + items: + type: object + properties: + lockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + locked_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + 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. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + 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; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pagination.key + description: |- + 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. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + 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. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + 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. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + 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. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /realiotech/multistaking/v1/unlock/{validator_address}/{multi_staker_address}: + get: + operationId: MultiStakingUnlock + responses: + '200': + description: A successful response. + schema: + type: object + properties: + unlock: + type: object + properties: + unlockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + entries: + type: array + items: + type: object + properties: + creation_height: + type: string + format: int64 + description: >- + creation_height is the height which the unbonding + took place. + unlocking_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + found: + type: boolean + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: validator_address + in: path + required: true + type: string + - name: multi_staker_address + in: path + required: true + type: string + tags: + - Query + /realiotech/multistaking/v1/unlocks: + get: + operationId: MultiStakingUnlocks + responses: + '200': + description: A successful response. + schema: + type: object + properties: + unlocks: + type: array + items: + type: object + properties: + unlockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + entries: + type: array + items: + type: object + properties: + creation_height: + type: string + format: int64 + description: >- + creation_height is the height which the unbonding + took place. + unlocking_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + 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. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + 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; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pagination.key + description: |- + 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. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + 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. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + 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. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + 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. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /realiotech/multistaking/v1/validator-coin/{validator_addr}: + get: + operationId: ValidatorMultiStakingCoin + responses: + '200': + description: A successful response. + schema: + type: object + properties: + denom: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: validator_addr + in: path + required: true + type: string + tags: + - Query + /realiotech/multistaking/v1/validators: + get: + operationId: Validators + responses: + '200': + description: A successful response. + schema: + type: object + properties: + validators: + type: array + items: + type: object + properties: + operator_address: + type: string + consensus_pubkey: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + jailed: + type: boolean + status: + type: string + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + description: |- + BondStatus is the status of a validator. + + - BOND_STATUS_UNSPECIFIED: UNSPECIFIED defines an invalid validator status. + - BOND_STATUS_UNBONDED: UNBONDED defines a validator that is not bonded. + - BOND_STATUS_UNBONDING: UNBONDING defines a validator that is unbonding. + - BOND_STATUS_BONDED: BONDED defines a validator that is bonded. + tokens: + type: string + delegator_shares: + type: string + description: + type: object + properties: + moniker: + type: string + description: >- + moniker defines a human-readable name for the + validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. + UPort or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for + security contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + unbonding_height: + type: string + format: int64 + unbonding_time: + type: string + format: date-time + commission: + type: object + properties: + commission_rates: + description: >- + commission_rates defines the initial commission + rates to be used for creating a validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to + delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate + which validator can ever charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily + increase of the validator commission, as a + fraction. + update_time: + type: string + format: date-time + description: >- + update_time is the last time the commission rate was + changed. + description: >- + Commission defines commission parameters for a given + validator. + min_self_delegation: + type: string + bond_denom: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + 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. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + 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; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + + value: + type: string + format: byte + parameters: + - name: status + in: query + required: false + type: string + - name: pagination.key + description: |- + 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. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + 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. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + 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. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + 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. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /realiotech/multistaking/v1/validators/{validator_addr}: + get: + operationId: Validator + responses: + '200': + description: A successful response. + schema: + type: object + properties: + validator: + type: object + properties: + operator_address: + type: string + consensus_pubkey: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + jailed: + type: boolean + status: + type: string + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + description: |- + BondStatus is the status of a validator. + + - BOND_STATUS_UNSPECIFIED: UNSPECIFIED defines an invalid validator status. + - BOND_STATUS_UNBONDED: UNBONDED defines a validator that is not bonded. + - BOND_STATUS_UNBONDING: UNBONDING defines a validator that is unbonding. + - BOND_STATUS_BONDED: BONDED defines a validator that is bonded. + tokens: + type: string + delegator_shares: + type: string + description: + type: object + properties: + moniker: + type: string + description: >- + moniker defines a human-readable name for the + validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. + UPort or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for + security contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + unbonding_height: + type: string + format: int64 + unbonding_time: + type: string + format: date-time + commission: + type: object + properties: + commission_rates: + description: >- + commission_rates defines the initial commission rates + to be used for creating a validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to delegators, + as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which + validator can ever charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase + of the validator commission, as a fraction. + update_time: + type: string + format: date-time + description: >- + update_time is the last time the commission rate was + changed. + description: >- + Commission defines commission parameters for a given + validator. + min_self_delegation: + type: string + bond_denom: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + + value: + type: string + format: byte + parameters: + - name: validator_addr + in: path + required: true + type: string + tags: + - Query + /realiotech/multistaking/v1/weight/{denom}: + get: + operationId: BondWeight + responses: + '200': + description: A successful response. + schema: + type: object + properties: + weight: + type: string + found: + type: boolean + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: denom + in: path + required: true + type: string + tags: + - Query +definitions: + cosmos.base.query.v1beta1.PageRequest: + type: object + properties: + key: + type: string + format: byte + description: |- + 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. + offset: + type: string + format: uint64 + description: |- + 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. + limit: + type: string + format: uint64 + description: >- + 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. + count_total: + type: boolean + description: >- + 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. + reverse: + type: boolean + description: >- + reverse is set to true if results are to be returned in the descending + order. + + + Since: cosmos-sdk 0.43 + description: |- + message SomeRequest { + Foo some_parameter = 1; + PageRequest pagination = 2; + } + title: |- + PageRequest is to be embedded in gRPC request messages for efficient + pagination. Ex: + cosmos.base.query.v1beta1.PageResponse: + type: object + properties: + next_key: + type: string + format: byte + description: |- + 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. + total: + type: string + format: uint64 + title: |- + total is total number of results available if PageRequest.count_total + was set, its value is undefined otherwise + description: |- + 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; + } + cosmos.staking.v1beta1.BondStatus: + type: string + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + description: |- + BondStatus is the status of a validator. + + - BOND_STATUS_UNSPECIFIED: UNSPECIFIED defines an invalid validator status. + - BOND_STATUS_UNBONDED: UNBONDED defines a validator that is not bonded. + - BOND_STATUS_UNBONDING: UNBONDING defines a validator that is unbonding. + - BOND_STATUS_BONDED: BONDED defines a validator that is bonded. + cosmos.staking.v1beta1.Commission: + type: object + properties: + commission_rates: + description: >- + commission_rates defines the initial commission rates to be used for + creating a validator. + type: object + properties: + rate: + type: string + description: rate is the commission rate charged to delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which validator can + ever charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of the + validator commission, as a fraction. + update_time: + type: string + format: date-time + description: update_time is the last time the commission rate was changed. + description: Commission defines commission parameters for a given validator. + cosmos.staking.v1beta1.CommissionRates: + type: object + properties: + rate: + type: string + description: rate is the commission rate charged to delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which validator can ever + charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of the validator + commission, as a fraction. + description: >- + CommissionRates defines the initial commission rates to be used for + creating + + a validator. + cosmos.staking.v1beta1.Description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort or + Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: security_contact defines an optional email for security contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + google.protobuf.Any: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + grpc.gateway.runtime.Error: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + multistaking.v1.LockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + multistaking.v1.MultiStakingCoin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + multistaking.v1.MultiStakingCoinInfo: + type: object + properties: + denom: + type: string + bond_weight: + type: string + multistaking.v1.MultiStakingLock: + type: object + properties: + lockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + locked_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + multistaking.v1.MultiStakingUnlock: + type: object + properties: + unlockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + entries: + type: array + items: + type: object + properties: + creation_height: + type: string + format: int64 + description: creation_height is the height which the unbonding took place. + unlocking_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + multistaking.v1.QueryBondWeightResponse: + type: object + properties: + weight: + type: string + found: + type: boolean + multistaking.v1.QueryMultiStakingCoinInfosResponse: + type: object + properties: + infos: + type: array + items: + type: object + properties: + denom: + type: string + bond_weight: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + 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. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + 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; + } + multistaking.v1.QueryMultiStakingLockResponse: + type: object + properties: + lock: + type: object + properties: + lockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + locked_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + found: + type: boolean + multistaking.v1.QueryMultiStakingLocksResponse: + type: object + properties: + locks: + type: array + items: + type: object + properties: + lockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + locked_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + 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. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + 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; + } + multistaking.v1.QueryMultiStakingUnlockResponse: + type: object + properties: + unlock: + type: object + properties: + unlockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + entries: + type: array + items: + type: object + properties: + creation_height: + type: string + format: int64 + description: >- + creation_height is the height which the unbonding took + place. + unlocking_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + found: + type: boolean + multistaking.v1.QueryMultiStakingUnlocksResponse: + type: object + properties: + unlocks: + type: array + items: + type: object + properties: + unlockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + entries: + type: array + items: + type: object + properties: + creation_height: + type: string + format: int64 + description: >- + creation_height is the height which the unbonding took + place. + unlocking_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + 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. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + 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; + } + multistaking.v1.QueryValidatorMultiStakingCoinResponse: + type: object + properties: + denom: + type: string + multistaking.v1.QueryValidatorResponse: + type: object + properties: + validator: + type: object + properties: + operator_address: + type: string + consensus_pubkey: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + jailed: + type: boolean + status: + type: string + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + description: |- + BondStatus is the status of a validator. + + - BOND_STATUS_UNSPECIFIED: UNSPECIFIED defines an invalid validator status. + - BOND_STATUS_UNBONDED: UNBONDED defines a validator that is not bonded. + - BOND_STATUS_UNBONDING: UNBONDING defines a validator that is unbonding. + - BOND_STATUS_BONDED: BONDED defines a validator that is bonded. + tokens: + type: string + delegator_shares: + type: string + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort or + Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for security + contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + unbonding_height: + type: string + format: int64 + unbonding_time: + type: string + format: date-time + commission: + type: object + properties: + commission_rates: + description: >- + commission_rates defines the initial commission rates to be + used for creating a validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to delegators, as a + fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which + validator can ever charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of the + validator commission, as a fraction. + update_time: + type: string + format: date-time + description: update_time is the last time the commission rate was changed. + description: Commission defines commission parameters for a given validator. + min_self_delegation: + type: string + bond_denom: + type: string + multistaking.v1.QueryValidatorsResponse: + type: object + properties: + validators: + type: array + items: + type: object + properties: + operator_address: + type: string + consensus_pubkey: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + jailed: + type: boolean + status: + type: string + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + description: |- + BondStatus is the status of a validator. + + - BOND_STATUS_UNSPECIFIED: UNSPECIFIED defines an invalid validator status. + - BOND_STATUS_UNBONDED: UNBONDED defines a validator that is not bonded. + - BOND_STATUS_UNBONDING: UNBONDING defines a validator that is unbonding. + - BOND_STATUS_BONDED: BONDED defines a validator that is bonded. + tokens: + type: string + delegator_shares: + type: string + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort + or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for security + contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + unbonding_height: + type: string + format: int64 + unbonding_time: + type: string + format: date-time + commission: + type: object + properties: + commission_rates: + description: >- + commission_rates defines the initial commission rates to be + used for creating a validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to delegators, as a + fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which + validator can ever charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of + the validator commission, as a fraction. + update_time: + type: string + format: date-time + description: >- + update_time is the last time the commission rate was + changed. + description: Commission defines commission parameters for a given validator. + min_self_delegation: + type: string + bond_denom: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + 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. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + 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; + } + multistaking.v1.UnlockEntry: + type: object + properties: + creation_height: + type: string + format: int64 + description: creation_height is the height which the unbonding took place. + unlocking_coin: + type: object + properties: + denom: + type: string + amount: + type: string + bond_weight: + type: string + multistaking.v1.UnlockID: + type: object + properties: + multi_staker_addr: + type: string + val_addr: + type: string + multistaking.v1.ValidatorInfo: + type: object + properties: + operator_address: + type: string + consensus_pubkey: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + jailed: + type: boolean + status: + type: string + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + description: |- + BondStatus is the status of a validator. + + - BOND_STATUS_UNSPECIFIED: UNSPECIFIED defines an invalid validator status. + - BOND_STATUS_UNBONDED: UNBONDED defines a validator that is not bonded. + - BOND_STATUS_UNBONDING: UNBONDING defines a validator that is unbonding. + - BOND_STATUS_BONDED: BONDED defines a validator that is bonded. + tokens: + type: string + delegator_shares: + type: string + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort or + Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: security_contact defines an optional email for security contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + unbonding_height: + type: string + format: int64 + unbonding_time: + type: string + format: date-time + commission: + type: object + properties: + commission_rates: + description: >- + commission_rates defines the initial commission rates to be used + for creating a validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to delegators, as a + fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which validator + can ever charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of the + validator commission, as a fraction. + update_time: + type: string + format: date-time + description: update_time is the last time the commission rate was changed. + description: Commission defines commission parameters for a given validator. + min_self_delegation: + type: string + bond_denom: + type: string diff --git a/proto/buf.gen.swagger.yaml b/proto/buf.gen.swagger.yaml new file mode 100644 index 00000000..d0f7535b --- /dev/null +++ b/proto/buf.gen.swagger.yaml @@ -0,0 +1,5 @@ +version: v1 +plugins: + - name: swagger + out: ../tmp-swagger-gen + opt: logtostderr=true,fqn_for_swagger_name=true,simple_operation_ids=true diff --git a/scripts/protoc-swagger-gen.sh b/scripts/protoc-swagger-gen.sh new file mode 100755 index 00000000..88238a97 --- /dev/null +++ b/scripts/protoc-swagger-gen.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -eo pipefail + +mkdir -p ./tmp-swagger-gen +cd proto +proto_dirs=$(find ../proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) +for dir in $proto_dirs; do + # generate swagger files (filter query files) + query_file=$(find "${dir}" -maxdepth 1 \( -name 'query.proto' -o -name 'service.proto' \)) + if [[ ! -z "$query_file" ]]; then + buf generate --template buf.gen.swagger.yaml $query_file + fi +done + +cd .. +# combine swagger files +# uses nodejs package `swagger-combine`. +# all the individual swagger files need to be configured in `config.json` for merging +swagger-combine ./docs/config.json -o ./docs/swagger-ui/swagger.yaml -f yaml --continueOnConflictingPaths true --includeDefinitions true + +# clean swagger files +rm -rf ./tmp-swagger-gen \ No newline at end of file