Merge branch 'develop' into jack/fix-empty-return
This commit is contained in:
+2
-1
@@ -7,9 +7,10 @@ import (
|
||||
"path"
|
||||
"strconv"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
|
||||
"github.com/pelletier/go-toml"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
@@ -13,14 +13,15 @@ import (
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
cskeys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmlite "github.com/tendermint/tendermint/lite"
|
||||
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
|
||||
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
cskeys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
const ctxAccStoreName = "acc"
|
||||
@@ -46,7 +47,7 @@ type CLIContext struct {
|
||||
JSON bool
|
||||
PrintResponse bool
|
||||
Verifier tmlite.Verifier
|
||||
DryRun bool
|
||||
Simulate bool
|
||||
GenerateOnly bool
|
||||
fromAddress types.AccAddress
|
||||
fromName string
|
||||
@@ -84,7 +85,7 @@ func NewCLIContext() CLIContext {
|
||||
JSON: viper.GetBool(client.FlagJson),
|
||||
PrintResponse: viper.GetBool(client.FlagPrintResponse),
|
||||
Verifier: verifier,
|
||||
DryRun: viper.GetBool(client.FlagDryRun),
|
||||
Simulate: viper.GetBool(client.FlagDryRun),
|
||||
GenerateOnly: viper.GetBool(client.FlagGenerateOnly),
|
||||
fromAddress: fromAddress,
|
||||
fromName: fromName,
|
||||
@@ -243,3 +244,15 @@ func (ctx CLIContext) WithVerifier(verifier tmlite.Verifier) CLIContext {
|
||||
ctx.Verifier = verifier
|
||||
return ctx
|
||||
}
|
||||
|
||||
// WithGenerateOnly returns a copy of the context with updated GenerateOnly value
|
||||
func (ctx CLIContext) WithGenerateOnly(generateOnly bool) CLIContext {
|
||||
ctx.GenerateOnly = generateOnly
|
||||
return ctx
|
||||
}
|
||||
|
||||
// WithSimulation returns a copy of the context with updated Simulate value
|
||||
func (ctx CLIContext) WithSimulation(simulate bool) CLIContext {
|
||||
ctx.Simulate = simulate
|
||||
return ctx
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// ErrInvalidAccount returns a standardized error reflecting that a given
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto/merkle"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
@@ -18,6 +17,8 @@ import (
|
||||
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
|
||||
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store"
|
||||
)
|
||||
|
||||
// GetNode returns an RPC client. If the context's client is not defined, an
|
||||
|
||||
@@ -43,6 +43,7 @@ const (
|
||||
FlagSSLHosts = "ssl-hosts"
|
||||
FlagSSLCertFile = "ssl-certfile"
|
||||
FlagSSLKeyFile = "ssl-keyfile"
|
||||
FlagOutputDocument = "output-document" // inspired by wget -O
|
||||
)
|
||||
|
||||
// LineBreak can be included in a command list to provide a blank line
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
)
|
||||
|
||||
// GetKeyBase initializes a keybase based on the given db.
|
||||
|
||||
@@ -10,10 +10,11 @@ import (
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
keys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
keyerror "github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -4,9 +4,10 @@ import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
|
||||
bip39 "github.com/bartekn/go-bip39"
|
||||
)
|
||||
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
package keys
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
)
|
||||
|
||||
// Commands registers a sub-tree of commands to interact with
|
||||
|
||||
+5
-3
@@ -4,17 +4,19 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tendermint/tendermint/crypto/multisig"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -5,12 +5,14 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
keys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
keys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
)
|
||||
|
||||
func updateKeyCommand() *cobra.Command {
|
||||
|
||||
@@ -5,14 +5,15 @@ import (
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// KeyDBName is the directory under root where we store the keys
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package keys
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
)
|
||||
|
||||
func TestGetKeyBaseLocks(t *testing.T) {
|
||||
|
||||
+34
-51
@@ -279,29 +279,29 @@ func TestCoinSend(t *testing.T) {
|
||||
require.Equal(t, int64(1), mycoins.Amount.Int64())
|
||||
|
||||
// test failure with too little gas
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "100", 0, "")
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "100", 0, false, false)
|
||||
require.Equal(t, http.StatusInternalServerError, res.StatusCode, body)
|
||||
|
||||
// test failure with negative gas
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "-200", 0, "")
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "-200", 0, false, false)
|
||||
require.Equal(t, http.StatusBadRequest, res.StatusCode, body)
|
||||
|
||||
// test failure with 0 gas
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "0", 0, "")
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "0", 0, false, false)
|
||||
require.Equal(t, http.StatusInternalServerError, res.StatusCode, body)
|
||||
|
||||
// test failure with wrong adjustment
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "simulate", 0.1, "")
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "simulate", 0.1, false, false)
|
||||
require.Equal(t, http.StatusInternalServerError, res.StatusCode, body)
|
||||
|
||||
// run simulation and test success with estimated gas
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "", 0, "?simulate=true")
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "", 0, true, false)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
var responseBody struct {
|
||||
GasEstimate int64 `json:"gas_estimate"`
|
||||
}
|
||||
require.Nil(t, json.Unmarshal([]byte(body), &responseBody))
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, fmt.Sprintf("%v", responseBody.GasEstimate), 0, "")
|
||||
res, body, _ = doSendWithGas(t, port, seed, name, password, addr, fmt.Sprintf("%v", responseBody.GasEstimate), 0, false, false)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ func TestCoinSendGenerateSignAndBroadcast(t *testing.T) {
|
||||
acc := getAccount(t, port, addr)
|
||||
|
||||
// generate TX
|
||||
res, body, _ := doSendWithGas(t, port, seed, name, password, addr, "simulate", 0, "?generate_only=true")
|
||||
res, body, _ := doSendWithGas(t, port, seed, name, "", addr, "simulate", 0, false, true)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
var msg auth.StdTx
|
||||
require.Nil(t, cdc.UnmarshalJSON([]byte(body), &msg))
|
||||
@@ -897,7 +897,9 @@ func getAccount(t *testing.T, port string, addr sdk.AccAddress) auth.Account {
|
||||
return acc
|
||||
}
|
||||
|
||||
func doSendWithGas(t *testing.T, port, seed, name, password string, addr sdk.AccAddress, gas string, gasAdjustment float64, queryStr string) (res *http.Response, body string, receiveAddr sdk.AccAddress) {
|
||||
func doSendWithGas(t *testing.T, port, seed, name, password string, addr sdk.AccAddress, gas string,
|
||||
gasAdjustment float64, simulate, generateOnly bool) (
|
||||
res *http.Response, body string, receiveAddr sdk.AccAddress) {
|
||||
|
||||
// create receive address
|
||||
kb := client.MockKeyBase()
|
||||
@@ -935,11 +937,13 @@ func doSendWithGas(t *testing.T, port, seed, name, password string, addr sdk.Acc
|
||||
"password": "%s",
|
||||
"chain_id": "%s",
|
||||
"account_number":"%d",
|
||||
"sequence":"%d"
|
||||
"sequence": "%d",
|
||||
"simulate": %v,
|
||||
"generate_only": %v
|
||||
}
|
||||
}`, coinbz, gasStr, gasAdjustmentStr, name, password, chainID, accnum, sequence))
|
||||
}`, coinbz, gasStr, gasAdjustmentStr, name, password, chainID, accnum, sequence, simulate, generateOnly))
|
||||
|
||||
res, body = Request(t, port, "POST", fmt.Sprintf("/bank/accounts/%s/transfers%v", receiveAddr, queryStr), jsonStr)
|
||||
res, body = Request(t, port, "POST", fmt.Sprintf("/bank/accounts/%s/transfers", receiveAddr), jsonStr)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -958,7 +962,7 @@ func doRecoverKey(t *testing.T, port, recoverName, recoverPassword, seed string)
|
||||
}
|
||||
|
||||
func doSend(t *testing.T, port, seed, name, password string, addr sdk.AccAddress) (receiveAddr sdk.AccAddress, resultTx ctypes.ResultBroadcastTxCommit) {
|
||||
res, body, receiveAddr := doSendWithGas(t, port, seed, name, password, addr, "", 0, "")
|
||||
res, body, receiveAddr := doSendWithGas(t, port, seed, name, password, addr, "", 0, false, false)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
err := cdc.UnmarshalJSON([]byte(body), &resultTx)
|
||||
@@ -1172,15 +1176,9 @@ func doDelegate(t *testing.T, port, seed, name, password string,
|
||||
chainID := viper.GetString(client.FlagChainID)
|
||||
|
||||
jsonStr := []byte(fmt.Sprintf(`{
|
||||
"delegations": [
|
||||
{
|
||||
"delegator_addr": "%s",
|
||||
"validator_addr": "%s",
|
||||
"delegation": { "denom": "%s", "amount": "%d" }
|
||||
}
|
||||
],
|
||||
"begin_unbondings": [],
|
||||
"begin_redelegates": [],
|
||||
"delegator_addr": "%s",
|
||||
"validator_addr": "%s",
|
||||
"delegation": { "denom": "%s", "amount": "%d" },
|
||||
"base_req": {
|
||||
"name": "%s",
|
||||
"password": "%s",
|
||||
@@ -1193,11 +1191,10 @@ func doDelegate(t *testing.T, port, seed, name, password string,
|
||||
res, body := Request(t, port, "POST", fmt.Sprintf("/stake/delegators/%s/delegations", delAddr), jsonStr)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
var results []ctypes.ResultBroadcastTxCommit
|
||||
err := cdc.UnmarshalJSON([]byte(body), &results)
|
||||
err := cdc.UnmarshalJSON([]byte(body), &resultTx)
|
||||
require.Nil(t, err)
|
||||
|
||||
return results[0]
|
||||
return
|
||||
}
|
||||
|
||||
func doBeginUnbonding(t *testing.T, port, seed, name, password string,
|
||||
@@ -1209,15 +1206,9 @@ func doBeginUnbonding(t *testing.T, port, seed, name, password string,
|
||||
chainID := viper.GetString(client.FlagChainID)
|
||||
|
||||
jsonStr := []byte(fmt.Sprintf(`{
|
||||
"delegations": [],
|
||||
"begin_unbondings": [
|
||||
{
|
||||
"delegator_addr": "%s",
|
||||
"validator_addr": "%s",
|
||||
"shares": "%d"
|
||||
}
|
||||
],
|
||||
"begin_redelegates": [],
|
||||
"delegator_addr": "%s",
|
||||
"validator_addr": "%s",
|
||||
"shares": "%d",
|
||||
"base_req": {
|
||||
"name": "%s",
|
||||
"password": "%s",
|
||||
@@ -1227,14 +1218,13 @@ func doBeginUnbonding(t *testing.T, port, seed, name, password string,
|
||||
}
|
||||
}`, delAddr, valAddr, amount, name, password, chainID, accnum, sequence))
|
||||
|
||||
res, body := Request(t, port, "POST", fmt.Sprintf("/stake/delegators/%s/delegations", delAddr), jsonStr)
|
||||
res, body := Request(t, port, "POST", fmt.Sprintf("/stake/delegators/%s/unbonding_delegations", delAddr), jsonStr)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
var results []ctypes.ResultBroadcastTxCommit
|
||||
err := cdc.UnmarshalJSON([]byte(body), &results)
|
||||
err := cdc.UnmarshalJSON([]byte(body), &resultTx)
|
||||
require.Nil(t, err)
|
||||
|
||||
return results[0]
|
||||
return
|
||||
}
|
||||
|
||||
func doBeginRedelegation(t *testing.T, port, seed, name, password string,
|
||||
@@ -1247,16 +1237,10 @@ func doBeginRedelegation(t *testing.T, port, seed, name, password string,
|
||||
chainID := viper.GetString(client.FlagChainID)
|
||||
|
||||
jsonStr := []byte(fmt.Sprintf(`{
|
||||
"delegations": [],
|
||||
"begin_unbondings": [],
|
||||
"begin_redelegates": [
|
||||
{
|
||||
"delegator_addr": "%s",
|
||||
"validator_src_addr": "%s",
|
||||
"validator_dst_addr": "%s",
|
||||
"shares": "%d"
|
||||
}
|
||||
],
|
||||
"delegator_addr": "%s",
|
||||
"validator_src_addr": "%s",
|
||||
"validator_dst_addr": "%s",
|
||||
"shares": "%d",
|
||||
"base_req": {
|
||||
"name": "%s",
|
||||
"password": "%s",
|
||||
@@ -1266,14 +1250,13 @@ func doBeginRedelegation(t *testing.T, port, seed, name, password string,
|
||||
}
|
||||
}`, delAddr, valSrcAddr, valDstAddr, amount, name, password, chainID, accnum, sequence))
|
||||
|
||||
res, body := Request(t, port, "POST", fmt.Sprintf("/stake/delegators/%s/delegations", delAddr), jsonStr)
|
||||
res, body := Request(t, port, "POST", fmt.Sprintf("/stake/delegators/%s/redelegations", delAddr), jsonStr)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
var results []ctypes.ResultBroadcastTxCommit
|
||||
err := cdc.UnmarshalJSON([]byte(body), &results)
|
||||
err := cdc.UnmarshalJSON([]byte(body), &resultTx)
|
||||
require.Nil(t, err)
|
||||
|
||||
return results[0]
|
||||
return
|
||||
}
|
||||
|
||||
func getValidators(t *testing.T, port string) []stake.Validator {
|
||||
|
||||
+7
-6
@@ -7,12 +7,6 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
keybase "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/rakyll/statik/fs"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -20,6 +14,13 @@ import (
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
rpcserver "github.com/tendermint/tendermint/rpc/lib/server"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
keybase "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
|
||||
// Import statik for light client stuff
|
||||
_ "github.com/cosmos/cosmos-sdk/client/lcd/statik"
|
||||
)
|
||||
|
||||
+355
-352
@@ -376,16 +376,6 @@ paths:
|
||||
produces:
|
||||
- application/json
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- in: path
|
||||
name: address
|
||||
description: Account address in bech32 format
|
||||
@@ -635,81 +625,6 @@ paths:
|
||||
description: Bech32 AccAddress of Delegator
|
||||
required: true
|
||||
type: string
|
||||
post:
|
||||
summary: Submit delegation
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- in: body
|
||||
name: delegation
|
||||
description: The password of the account to remove from the KMS
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
delegations:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
delegation:
|
||||
$ref: "#/definitions/Coin"
|
||||
begin_unbondings:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
shares:
|
||||
type: string
|
||||
example: "100"
|
||||
begin_redelegates:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_src_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
validator_dst_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
shares:
|
||||
type: string
|
||||
example: "100"
|
||||
tags:
|
||||
- ICS21
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid delegator address or delegation body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
get:
|
||||
summary: Get all delegations from a delegator
|
||||
tags:
|
||||
@@ -722,12 +637,72 @@ paths:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
"$ref": "#/definitions/Delegation"
|
||||
$ref: "#/definitions/Delegation"
|
||||
400:
|
||||
description: Invalid delegator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Submit delegation
|
||||
parameters:
|
||||
- in: body
|
||||
name: delegation
|
||||
description: The password of the account to remove from the KMS
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
delegation:
|
||||
$ref: "#/definitions/Coin"
|
||||
tags:
|
||||
- ICS21
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid delegator address or delegation request body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
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 OperatorAddress of validator
|
||||
required: true
|
||||
type: string
|
||||
get:
|
||||
summary: Query the current delegation between a delegator and a validator
|
||||
tags:
|
||||
- ICS21
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/Delegation"
|
||||
400:
|
||||
description: Invalid delegator address or validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/unbonding_delegations:
|
||||
parameters:
|
||||
- in: path
|
||||
@@ -747,12 +722,85 @@ paths:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
"$ref": "#/definitions/UnbondingDelegation"
|
||||
$ref: "#/definitions/UnbondingDelegation"
|
||||
400:
|
||||
description: Invalid delegator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Submit an unbonding delegation
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- in: body
|
||||
name: delegation
|
||||
description: The password of the account to remove from the KMS
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
shares:
|
||||
type: string
|
||||
example: "100"
|
||||
tags:
|
||||
- ICS21
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid delegator address or unbonding delegation request body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/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 OperatorAddress of validator
|
||||
required: true
|
||||
type: string
|
||||
get:
|
||||
summary: Query all unbonding delegations between a delegator and a validator
|
||||
tags:
|
||||
- ICS21
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/UnbondingDelegation"
|
||||
400:
|
||||
description: Invalid delegator address or validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/redelegations:
|
||||
parameters:
|
||||
- in: path
|
||||
@@ -772,12 +820,58 @@ paths:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
"$ref": "#/definitions/Redelegation"
|
||||
$ref: "#/definitions/Redelegation"
|
||||
400:
|
||||
description: Invalid delegator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Submit a redelegation
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- in: body
|
||||
name: delegation
|
||||
description: The password of the account to remove from the KMS
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_src_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
validator_dst_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
shares:
|
||||
type: string
|
||||
example: "100"
|
||||
tags:
|
||||
- ICS21
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid delegator address or redelegation request body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/validators:
|
||||
parameters:
|
||||
- in: path
|
||||
@@ -855,63 +949,6 @@ paths:
|
||||
description: Invalid delegator address
|
||||
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 OperatorAddress of validator
|
||||
required: true
|
||||
type: string
|
||||
get:
|
||||
summary: Query the current delegation between a delegator and a validator
|
||||
tags:
|
||||
- ICS21
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/Delegation"
|
||||
400:
|
||||
description: Invalid delegator address or validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/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 OperatorAddress of validator
|
||||
required: true
|
||||
type: string
|
||||
get:
|
||||
summary: Query all unbonding delegations between a delegator and a validator
|
||||
tags:
|
||||
- ICS21
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
"$ref": "#/definitions/UnbondingDelegation"
|
||||
400:
|
||||
description: Invalid delegator address or validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/validators:
|
||||
get:
|
||||
summary: Get all validator candidates
|
||||
@@ -1123,16 +1160,6 @@ paths:
|
||||
tags:
|
||||
- ICS23
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- type: string
|
||||
description: Bech32 validator address
|
||||
name: validatorAddr
|
||||
@@ -1146,7 +1173,7 @@ paths:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
$ref: "#/definitions/BaseReq"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
@@ -1169,16 +1196,6 @@ paths:
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- description: valid value of `"proposal_type"` can be `"text"`, `"parameter_change"`, `"software_upgrade"`
|
||||
name: post_proposal_body
|
||||
in: body
|
||||
@@ -1187,7 +1204,7 @@ paths:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
$ref: "#/definitions/BaseReq"
|
||||
title:
|
||||
type: string
|
||||
description:
|
||||
@@ -1196,7 +1213,7 @@ paths:
|
||||
type: string
|
||||
example: "text"
|
||||
proposer:
|
||||
"$ref": "#/definitions/Address"
|
||||
$ref: "#/definitions/Address"
|
||||
initial_deposit:
|
||||
type: array
|
||||
items:
|
||||
@@ -1205,7 +1222,7 @@ paths:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
"$ref": "#/definitions/BroadcastTxCommitResult"
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal body
|
||||
401:
|
||||
@@ -1241,184 +1258,11 @@ paths:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/TextProposal"
|
||||
$ref: "#/definitions/TextProposal"
|
||||
400:
|
||||
description: Invalid query parameters
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/deposits:
|
||||
post:
|
||||
summary: Deposit tokens to a proposal
|
||||
description: Send transaction to deposit tokens to a proposal
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
- description: ''
|
||||
name: post_deposit_body
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
depositor:
|
||||
"$ref": "#/definitions/Address"
|
||||
amount:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Coin"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
"$ref": "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal id or deposit body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
get:
|
||||
summary: Query deposits
|
||||
description: Query deposits by proposalId
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/Deposit"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/tally:
|
||||
get:
|
||||
summary: Get a proposal's tally result at the current time
|
||||
description: Gets a proposal's tally result at the current time. If the proposal is pending deposits (i.e status 'DepositPeriod') it returns an empty tally result.
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/TallyResult"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/votes:
|
||||
post:
|
||||
summary: Vote a proposal
|
||||
description: Send transaction to vote a proposal
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
- description: valid value of `"option"` field can be `"yes"`, `"no"`, `"no_with_veto"` and `"abstain"`
|
||||
name: post_vote_body
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
voter:
|
||||
"$ref": "#/definitions/Address"
|
||||
option:
|
||||
type: string
|
||||
example: "yes"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
"$ref": "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal id or vote body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
get:
|
||||
summary: Query voters
|
||||
description: Query voters information by proposalId
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/Vote"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}:
|
||||
get:
|
||||
summary: Query a proposal
|
||||
@@ -1436,11 +1280,76 @@ paths:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
"$ref": "#/definitions/TextProposal"
|
||||
$ref: "#/definitions/TextProposal"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/deposits:
|
||||
get:
|
||||
summary: Query deposits
|
||||
description: Query deposits by proposalId
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Deposit"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Deposit tokens to a proposal
|
||||
description: Send transaction to deposit tokens to a proposal
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
- description: ''
|
||||
name: post_deposit_body
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
depositor:
|
||||
$ref: "#/definitions/Address"
|
||||
amount:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Coin"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal id or deposit body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/deposits/{depositor}:
|
||||
get:
|
||||
summary: Query deposit
|
||||
@@ -1471,6 +1380,71 @@ paths:
|
||||
description: Found no deposit
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/votes:
|
||||
get:
|
||||
summary: Query voters
|
||||
description: Query voters information by proposalId
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Vote"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Vote a proposal
|
||||
description: Send transaction to vote a proposal
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
- description: valid value of `"option"` field can be `"yes"`, `"no"`, `"no_with_veto"` and `"abstain"`
|
||||
name: post_vote_body
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
voter:
|
||||
$ref: "#/definitions/Address"
|
||||
option:
|
||||
type: string
|
||||
example: "yes"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal id or vote body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/votes/{voter}:
|
||||
get:
|
||||
summary: Query vote
|
||||
@@ -1501,6 +1475,29 @@ paths:
|
||||
description: Found no vote
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/tally:
|
||||
get:
|
||||
summary: Get a proposal's tally result at the current time
|
||||
description: Gets a proposal's tally result at the current time. If the proposal is pending deposits (i.e status 'DepositPeriod') it returns an empty tally result.
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/TallyResult"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/parameters/deposit:
|
||||
get:
|
||||
summary: Query governance deposit parameters
|
||||
@@ -1598,7 +1595,7 @@ definitions:
|
||||
tags:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/KVPair"
|
||||
$ref: "#/definitions/KVPair"
|
||||
example:
|
||||
code: 0
|
||||
data: data
|
||||
@@ -1627,7 +1624,7 @@ definitions:
|
||||
tags:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/KVPair"
|
||||
$ref: "#/definitions/KVPair"
|
||||
example:
|
||||
code: 5
|
||||
data: data
|
||||
@@ -1888,6 +1885,12 @@ definitions:
|
||||
gas_adjustment:
|
||||
type: string
|
||||
example: "1.2"
|
||||
generate_only:
|
||||
type: boolean
|
||||
example: false
|
||||
simulate:
|
||||
type: boolean
|
||||
example: true
|
||||
TendermintValidator:
|
||||
type: object
|
||||
properties:
|
||||
@@ -1922,7 +1925,7 @@ definitions:
|
||||
total_deposit:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/Coin"
|
||||
$ref: "#/definitions/Coin"
|
||||
voting_start_time:
|
||||
type: string
|
||||
Deposit:
|
||||
@@ -1931,11 +1934,11 @@ definitions:
|
||||
amount:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/Coin"
|
||||
$ref: "#/definitions/Coin"
|
||||
proposal_id:
|
||||
type: integer
|
||||
depositor:
|
||||
"$ref": "#/definitions/Address"
|
||||
$ref: "#/definitions/Address"
|
||||
TallyResult:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -14,9 +14,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
|
||||
stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
"github.com/cosmos/cosmos-sdk/client/rpc"
|
||||
@@ -33,7 +34,6 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
txbuilder "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
tmcfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
@@ -48,6 +48,8 @@ import (
|
||||
tmrpc "github.com/tendermint/tendermint/rpc/lib/server"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
txbuilder "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
|
||||
|
||||
authRest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
|
||||
bankRest "github.com/cosmos/cosmos-sdk/x/bank/client/rest"
|
||||
govRest "github.com/cosmos/cosmos-sdk/x/gov/client/rest"
|
||||
|
||||
+2
-1
@@ -8,11 +8,12 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
)
|
||||
|
||||
//BlockCommand returns the verified block data for a given heights
|
||||
|
||||
+2
-1
@@ -5,9 +5,10 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -7,11 +7,12 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/spf13/viper"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
)
|
||||
|
||||
// StatusCommand returns the status of the network
|
||||
|
||||
@@ -9,12 +9,13 @@ import (
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/spf13/viper"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
// TODO these next two functions feel kinda hacky based on their placement
|
||||
|
||||
@@ -3,10 +3,11 @@ package tx
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+2
-1
@@ -12,13 +12,14 @@ import (
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// QueryTxCmd implements the default command for a tx query.
|
||||
|
||||
+19
-35
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -17,11 +16,6 @@ import (
|
||||
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
|
||||
)
|
||||
|
||||
const (
|
||||
queryArgDryRun = "simulate"
|
||||
queryArgGenerateOnly = "generate_only"
|
||||
)
|
||||
|
||||
//----------------------------------------
|
||||
// Basic HTTP utilities
|
||||
|
||||
@@ -39,18 +33,6 @@ func WriteSimulationResponse(w http.ResponseWriter, gas uint64) {
|
||||
w.Write([]byte(fmt.Sprintf(`{"gas_estimate":%v}`, gas)))
|
||||
}
|
||||
|
||||
// HasDryRunArg returns true if the request's URL query contains the dry run
|
||||
// argument and its value is set to "true".
|
||||
func HasDryRunArg(r *http.Request) bool {
|
||||
return urlQueryHasArg(r.URL, queryArgDryRun)
|
||||
}
|
||||
|
||||
// HasGenerateOnlyArg returns whether a URL's query "generate-only" parameter
|
||||
// is set to "true".
|
||||
func HasGenerateOnlyArg(r *http.Request) bool {
|
||||
return urlQueryHasArg(r.URL, queryArgGenerateOnly)
|
||||
}
|
||||
|
||||
// ParseInt64OrReturnBadRequest converts s to a int64 value.
|
||||
func ParseInt64OrReturnBadRequest(w http.ResponseWriter, s string) (n int64, ok bool) {
|
||||
var err error
|
||||
@@ -113,8 +95,6 @@ func WriteGenerateStdTxResponse(w http.ResponseWriter, txBldr authtxb.TxBuilder,
|
||||
return
|
||||
}
|
||||
|
||||
func urlQueryHasArg(url *url.URL, arg string) bool { return url.Query().Get(arg) == "true" }
|
||||
|
||||
//----------------------------------------
|
||||
// Building / Sending utilities
|
||||
|
||||
@@ -128,6 +108,8 @@ type BaseReq struct {
|
||||
Sequence uint64 `json:"sequence"`
|
||||
Gas string `json:"gas"`
|
||||
GasAdjustment string `json:"gas_adjustment"`
|
||||
GenerateOnly bool `json:"generate_only"`
|
||||
Simulate bool `json:"simulate"`
|
||||
}
|
||||
|
||||
// Sanitize performs basic sanitization on a BaseReq object.
|
||||
@@ -140,6 +122,8 @@ func (br BaseReq) Sanitize() BaseReq {
|
||||
GasAdjustment: strings.TrimSpace(br.GasAdjustment),
|
||||
AccountNumber: br.AccountNumber,
|
||||
Sequence: br.Sequence,
|
||||
GenerateOnly: br.GenerateOnly,
|
||||
Simulate: br.Simulate,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,21 +159,21 @@ func ReadRESTReq(w http.ResponseWriter, r *http.Request, cdc *codec.Codec, req i
|
||||
// ValidateBasic performs basic validation of a BaseReq. If custom validation
|
||||
// logic is needed, the implementing request handler should perform those
|
||||
// checks manually.
|
||||
func (br BaseReq) ValidateBasic(w http.ResponseWriter) bool {
|
||||
switch {
|
||||
case len(br.Name) == 0:
|
||||
func (br BaseReq) ValidateBasic(w http.ResponseWriter, cliCtx context.CLIContext) bool {
|
||||
if !cliCtx.GenerateOnly && !cliCtx.Simulate {
|
||||
switch {
|
||||
case len(br.Password) == 0:
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "password required but not specified")
|
||||
return false
|
||||
case len(br.ChainID) == 0:
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "chain-id required but not specified")
|
||||
return false
|
||||
}
|
||||
}
|
||||
if len(br.Name) == 0 {
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "name required but not specified")
|
||||
return false
|
||||
|
||||
case len(br.Password) == 0:
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "password required but not specified")
|
||||
return false
|
||||
|
||||
case len(br.ChainID) == 0:
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "chainID required but not specified")
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -223,14 +207,14 @@ func CompleteAndBroadcastTxREST(w http.ResponseWriter, r *http.Request, cliCtx c
|
||||
Sequence: baseReq.Sequence,
|
||||
}
|
||||
|
||||
if HasDryRunArg(r) || txBldr.SimulateGas {
|
||||
if baseReq.Simulate || txBldr.SimulateGas {
|
||||
newBldr, err := EnrichCtxWithGas(txBldr, cliCtx, baseReq.Name, msgs)
|
||||
if err != nil {
|
||||
WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if HasDryRunArg(r) {
|
||||
if baseReq.Simulate {
|
||||
WriteSimulationResponse(w, newBldr.Gas)
|
||||
return
|
||||
}
|
||||
@@ -238,7 +222,7 @@ func CompleteAndBroadcastTxREST(w http.ResponseWriter, r *http.Request, cliCtx c
|
||||
txBldr = newBldr
|
||||
}
|
||||
|
||||
if HasGenerateOnlyArg(r) {
|
||||
if baseReq.GenerateOnly {
|
||||
WriteGenerateStdTxResponse(w, txBldr, msgs)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -6,13 +6,14 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/tendermint/go-amino"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
|
||||
"github.com/tendermint/go-amino"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
)
|
||||
|
||||
// CompleteAndBroadcastTxCli implements a utility function that facilitates
|
||||
@@ -33,14 +34,14 @@ func CompleteAndBroadcastTxCli(txBldr authtxb.TxBuilder, cliCtx context.CLIConte
|
||||
return err
|
||||
}
|
||||
|
||||
if txBldr.SimulateGas || cliCtx.DryRun {
|
||||
if txBldr.SimulateGas || cliCtx.Simulate {
|
||||
txBldr, err = EnrichCtxWithGas(txBldr, cliCtx, name, msgs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "estimated gas = %v\n", txBldr.Gas)
|
||||
}
|
||||
if cliCtx.DryRun {
|
||||
if cliCtx.Simulate {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func TestParseQueryResponse(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user