Remove stake API from this PR
This commit is contained in:
parent
4e3066131e
commit
bf24a42a29
|
@ -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": {
|
"definitions": {
|
||||||
|
|
|
@ -10,19 +10,8 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
"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 {
|
type broadcastBody struct {
|
||||||
Tx auth.StdTx `json:"tx"`
|
Tx auth.StdTx `json:"tx"`
|
||||||
Return string `json:"return"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BroadcastTxRequestHandlerFn returns the broadcast tx REST handler
|
// BroadcastTxRequestHandlerFn returns the broadcast tx REST handler
|
||||||
|
@ -38,31 +27,11 @@ func BroadcastTxRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) ht
|
||||||
utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var res interface{}
|
res, err := cliCtx.BroadcastTx(txBytes)
|
||||||
switch m.Return {
|
|
||||||
case flagBlock:
|
|
||||||
res, err = cliCtx.BroadcastTx(txBytes)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
||||||
return
|
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")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
output, err := codec.MarshalJSONIndent(cdc, res)
|
output, err := codec.MarshalJSONIndent(cdc, res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue