Remove stake API from this PR

This commit is contained in:
HaoyangLiu 2018-09-27 19:54:33 +08:00
parent 4e3066131e
commit bf24a42a29
2 changed files with 3 additions and 379 deletions

View File

@ -579,351 +579,6 @@
}
}
}
},
"/stake/delegators/{delegatorAddr}": {
"parameters": [
{
"in": "path",
"name": "delegatorAddr",
"description": "AccAddress of Delegator",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Get all delegations (delegation, undelegation) from a delegator",
"tags": [
"stake"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/stake/delegators/{delegatorAddr}/validators": {
"parameters": [
{
"in": "path",
"name": "delegatorAddr",
"description": "Bech32 AccAddress of Delegator",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Query all validators that a delegator is bonded to",
"tags": [
"stake"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found"
}
}
}
},
"/stake/delegators/{delegatorAddr}/validators/{validatorAddr}": {
"parameters": [
{
"in": "path",
"name": "delegatorAddr",
"description": "Bech32 AccAddress of Delegator",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "validatorAddr",
"description": "Bech32 ValAddress of Delegator",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Query a validator that a delegator is bonded to",
"tags": [
"stake"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found"
}
}
}
},
"/stake/delegators/{delegatorAddr}/txs": {
"parameters": [
{
"in": "path",
"name": "delegatorAddr",
"description": "AccAddress of Delegator",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Get all staking txs (i.e msgs) from a delegator",
"tags": [
"stake"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Tx"
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/stake/delegators/{delegatorAddr}/delegations": {
"parameters": [
{
"in": "path",
"name": "delegatorAddr",
"description": "Bech32 AccAddress of Delegator",
"required": true,
"type": "string"
}
],
"post": {
"summary": "Submit delegation",
"parameters": [
{
"in": "body",
"name": "delegation",
"description": "The password of the account to remove from the KMS",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"password": {
"type": "string"
},
"account_number": {
"type": "number"
},
"delegations": {
"type": "array",
"items": {
"type": "string"
}
},
"begin_unbondings": {
"type": "array",
"items": {
"type": "string"
}
},
"complete_unbondings": {
"type": "array",
"items": {
"type": "string"
}
},
"begin_redelegates": {
"type": "array",
"items": {
"type": "string"
}
},
"complete_redelegates": {
"type": "array",
"items": {
"type": "string"
}
},
"chain_id": {
"type": "string"
},
"gas": {
"type": "number"
},
"sequence": {
"type": "number"
}
}
}
}
],
"tags": [
"stake"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Tx"
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/stake/delegators/{delegatorAddr}/delegations/{validatorAddr}": {
"parameters": [
{
"in": "path",
"name": "delegatorAddr",
"description": "Bech32 AccAddress of Delegator",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "validatorAddr",
"description": "Bech32 ValAddress of Delegator",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Query the current delegation status between a delegator and a validator",
"tags": [
"stake"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found"
}
}
}
},
"/stake/delegators/{delegatorAddr}/unbonding_delegations/{validatorAddr}": {
"parameters": [
{
"in": "path",
"name": "delegatorAddr",
"description": "Bech32 AccAddress of Delegator",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "validatorAddr",
"description": "Bech32 ValAddress of Delegator",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Query all unbonding delegations between a delegator and a validator",
"tags": [
"stake"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/stake/validators": {
"get": {
"summary": "Get all validator candidates",
"tags": [
"stake"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/stake/validators/{validatorAddr}": {
"parameters": [
{
"in": "path",
"name": "validatorAddr",
"description": "Bech32 ValAddress of Delegator",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Query the information from a single validator",
"tags": [
"stake"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
}
}
}
},
"definitions": {

View File

@ -10,19 +10,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
)
const (
// Returns with the response from CheckTx.
flagSync = "sync"
// Returns right away, with no response
flagAsync = "async"
// Only returns error if mempool.BroadcastTx errs (ie. problem with the app) or if we timeout waiting for tx to commit.
flagBlock = "block"
)
type broadcastBody struct {
Tx auth.StdTx `json:"tx"`
Return string `json:"return"`
}
// BroadcastTxRequestHandlerFn returns the broadcast tx REST handler
@ -38,29 +27,9 @@ func BroadcastTxRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) ht
utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
var res interface{}
switch m.Return {
case flagBlock:
res, err = cliCtx.BroadcastTx(txBytes)
if err != nil {
utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
case flagSync:
res, err = cliCtx.BroadcastTxSync(txBytes)
if err != nil {
utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
case flagAsync:
res, err = cliCtx.BroadcastTxAsync(txBytes)
if err != nil {
utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
default:
utils.WriteErrorResponse(w, http.StatusInternalServerError,
"Unsupported return type. Supported types: block, sync, async")
res, err := cliCtx.BroadcastTx(txBytes)
if err != nil {
utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}