func (f *Fixtures) QueryGovParamVoting(flags ...string) gov.VotingParams {
	args := fmt.Sprintf("voting --node=%s -o=json", f.RPCAddr)
	cmd := govcli.GetCmdQueryParam()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var votingParam gov.VotingParams
	err = legacy.Cdc.UnmarshalJSON(out.Bytes(), &votingParam)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return votingParam
}
QueryGovParamVoting is lfb query gov param voting
package clitest
import (
	"bufio"
	"context"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"os"
	"os/exec"
	"path"
	"path/filepath"
	"strings"
	"sync/atomic"
	"testing"
	"time"
	"github.com/spf13/cobra"
	"github.com/stretchr/testify/require"
	"github.com/line/lfb/app"
	lfbcmd "github.com/line/lfb/cmd/lfb/cmd"
	lfbtypes "github.com/line/lfb/types"
	"github.com/line/lbm-sdk/baseapp"
	"github.com/line/lbm-sdk/client"
	clientkeys "github.com/line/lbm-sdk/client/keys"
	"github.com/line/lbm-sdk/client/rpc"
	"github.com/line/lbm-sdk/codec/legacy"
	"github.com/line/lbm-sdk/crypto/hd"
	"github.com/line/lbm-sdk/crypto/keyring"
	"github.com/line/lbm-sdk/server"
	srvconfig "github.com/line/lbm-sdk/server/config"
	servertypes "github.com/line/lbm-sdk/server/types"
	storetypes "github.com/line/lbm-sdk/store/types"
	"github.com/line/lbm-sdk/testutil"
	testcli "github.com/line/lbm-sdk/testutil/cli"
	testnet "github.com/line/lbm-sdk/testutil/network"
	sdk "github.com/line/lbm-sdk/types"
	"github.com/line/lbm-sdk/types/tx"
	authcli "github.com/line/lbm-sdk/x/auth/client/cli"
	authtypes "github.com/line/lbm-sdk/x/auth/types"
	bankcli "github.com/line/lbm-sdk/x/bank/client/cli"
	banktypes "github.com/line/lbm-sdk/x/bank/types"
	distcli "github.com/line/lbm-sdk/x/distribution/client/cli"
	disttypes "github.com/line/lbm-sdk/x/distribution/types"
	"github.com/line/lbm-sdk/x/genutil"
	genutilcli "github.com/line/lbm-sdk/x/genutil/client/cli"
	govcli "github.com/line/lbm-sdk/x/gov/client/cli"
	gov "github.com/line/lbm-sdk/x/gov/types"
	slashingcli "github.com/line/lbm-sdk/x/slashing/client/cli"
	slashing "github.com/line/lbm-sdk/x/slashing/types"
	stakingcli "github.com/line/lbm-sdk/x/staking/client/cli"
	staking "github.com/line/lbm-sdk/x/staking/types"
	wasmcli "github.com/line/lbm-sdk/x/wasm/client/cli"
	wasmtypes "github.com/line/lbm-sdk/x/wasm/types"
	ostcfg "github.com/line/ostracon/config"
	ostflags "github.com/line/ostracon/libs/cli/flags"
	"github.com/line/ostracon/libs/log"
	osthttp "github.com/line/ostracon/rpc/client/http"
	ostctypes "github.com/line/ostracon/rpc/core/types"
	osttypes "github.com/line/ostracon/types"
)
const (
	denom        = "stake"
	keyFoo       = "foo"
	keyBar       = "bar"
	fooDenom     = "foot"
	feeDenom     = "feet"
	fee2Denom    = "fee2t"
	keyBaz       = "baz"
	keyVesting   = "vesting"
	keyFooBarBaz = "foobarbaz"
	DenomStake = "stake2"
	DenomLink  = "link"
	UserTina   = "tina"
	UserKevin  = "kevin"
	UserRinah  = "rinah"
	UserBrian  = "brian"
	UserEvelyn = "evelyn"
	UserSam    = "sam"
)
const (
	namePrefix        = "node"
	networkNamePrefix = "line-lfbnode-testnet-"
)
var curPort int32 = 26656
var (
	TotalCoins = sdk.NewCoins(
		sdk.NewCoin(DenomLink, sdk.TokensFromConsensusPower(6000)),
		sdk.NewCoin(DenomStake, sdk.TokensFromConsensusPower(600000000)),
		sdk.NewCoin(fee2Denom, sdk.TokensFromConsensusPower(2000000)),
		sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(2000000)),
		sdk.NewCoin(fooDenom, sdk.TokensFromConsensusPower(2000)),
		sdk.NewCoin(denom, sdk.TokensFromConsensusPower(300)),  
	)
	startCoins = sdk.NewCoins(
		sdk.NewCoin(fee2Denom, sdk.TokensFromConsensusPower(1000000)),
		sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(1000000)),
		sdk.NewCoin(fooDenom, sdk.TokensFromConsensusPower(1000)),
		sdk.NewCoin(denom, sdk.TokensFromConsensusPower(150)),
	)
	vestingCoins = sdk.NewCoins(
		sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(500000)),
	)
	defaultCoins = sdk.NewCoins(
		sdk.NewCoin(DenomLink, sdk.TokensFromConsensusPower(1000)),
		sdk.NewCoin(DenomStake, sdk.TokensFromConsensusPower(100000000)),
	)
	ostraconCmd = &cobra.Command{
		Use:   "ostracon",
		Short: "Ostracon subcommands",
	}
)
func init() {
	testnet := false
	config := sdk.GetConfig()
	config.SetBech32PrefixForAccount(lfbtypes.Bech32PrefixAcc(testnet), lfbtypes.Bech32PrefixAccPub(testnet))
	config.SetBech32PrefixForValidator(lfbtypes.Bech32PrefixValAddr(testnet), lfbtypes.Bech32PrefixValPub(testnet))
	config.SetBech32PrefixForConsensusNode(lfbtypes.Bech32PrefixConsAddr(testnet), lfbtypes.Bech32PrefixConsPub(testnet))
	config.SetCoinType(lfbtypes.CoinType)
	config.SetFullFundraiserPath(lfbtypes.FullFundraiserPath)
	config.Seal()
	ostraconCmd.AddCommand(
		server.ShowNodeIDCmd(),
		server.ShowValidatorCmd(),
		server.ShowAddressCmd(),
		server.VersionCmd(),
	)
}
type Fixtures struct {
	ChainID  string
	RPCAddr  string
	Port     string
	Home     string
	P2PAddr  string
	P2PPort  string
	GRPCAddr string
	GRPCPort string
	TMAddr   string
	TMPort   string
	Moniker  string
	T        *testing.T
}
func getHomeDir(t *testing.T) string {
	tmpDir := path.Join(os.ExpandEnv("$HOME"), ".lfbtest")
	err := os.MkdirAll(tmpDir, os.ModePerm)
	require.NoError(t, err)
	tmpDir, err = ioutil.TempDir(tmpDir, "link_integration_"+strings.Split(t.Name(), "/")[0]+"_")
	require.NoError(t, err)
	return tmpDir
}
func NewFixtures(t *testing.T, homeDir string) *Fixtures {
	if err := os.MkdirAll(filepath.Join(homeDir, "config/"), os.ModePerm); err != nil {
		panic(err)
	}
	servAddr, servPort := newTCPAddr(t)
	p2pAddr, p2pPort := newTCPAddr(t)
	grpcAddr, grpcPort := newGRPCAddr(t)
	return &Fixtures{
		T:        t,
		Home:     homeDir,
		RPCAddr:  servAddr,
		P2PAddr:  p2pAddr,
		Port:     servPort,
		P2PPort:  p2pPort,
		GRPCAddr: grpcAddr,
		GRPCPort: grpcPort,
		Moniker:  "",  
	}
}
func newTCPAddr(t *testing.T) (addr, port string) {
	portI := atomic.AddInt32(&curPort, 1)
	require.Less(t, portI, int32(32768), "A new port should be less than ip_local_port_range.min")
	port = fmt.Sprintf("%d", portI)
	addr = fmt.Sprintf("tcp://0.0.0.0:%s", port)
	return
}
func newGRPCAddr(t *testing.T) (addr, port string) {
	portI := atomic.AddInt32(&curPort, 1)
	require.Less(t, portI, int32(32768), "A new port should be less than ip_local_port_range.min")
	port = fmt.Sprintf("%d", portI)
	addr = fmt.Sprintf("0.0.0.0:%s", port)
	return
}
func (f *Fixtures) LogResult(isSuccess bool, stdOut, stdErr string) {
	if !isSuccess {
		f.T.Error(stdErr)
	} else {
		f.T.Log(stdOut)
	}
}
func (f Fixtures) Clone() *Fixtures {
	newF := NewFixtures(f.T, getHomeDir(f.T))
	newF.ChainID = f.ChainID
	if err := copyDirectory(f.Home, newF.Home); err != nil {
		os.Exit(0)
	}
	return newF
}
func copyDirectory(src, dest string) error {
	cmd := exec.Command("cp", "-r", src, dest)
	return cmd.Start()
}
func (f Fixtures) GenesisFile() string {
	return filepath.Join(f.Home, "config", "genesis.json")
}
func (f Fixtures) PrivValidatorKeyFile() string {
	return filepath.Join(f.Home, "config", "priv_validator_key.json")
}
func (f Fixtures) GenesisState() app.GenesisState {
	genDoc, err := osttypes.GenesisDocFromFile(f.GenesisFile())
	require.NoError(f.T, err)
	var appState app.GenesisState
	require.NoError(f.T, legacy.Cdc.UnmarshalJSON(genDoc.AppState, &appState))
	return appState
}
func InitFixtures(t *testing.T) (f *Fixtures) {
	f = NewFixtures(t, getHomeDir(t))
	f.KeysDelete(keyFoo)
	f.KeysDelete(keyBar)
	f.KeysDelete(keyBaz)
	f.KeysDelete(keyVesting)
	f.KeysDelete(keyFooBarBaz)
	f.KeysAdd(keyFoo)
	f.KeysAdd(keyBar)
	f.KeysAdd(keyBaz)
	f.KeysAdd(keyVesting)
	f.KeysAdd(keyFooBarBaz, "--multisig-threshold=2", fmt.Sprintf(
		"--multisig=%s,%s,%s", keyFoo, keyBar, keyBaz))
	f.KeysDelete(UserTina)
	f.KeysDelete(UserKevin)
	f.KeysDelete(UserRinah)
	f.KeysDelete(UserBrian)
	f.KeysDelete(UserEvelyn)
	f.KeysDelete(UserSam)
	f.KeysAdd(UserTina)
	f.KeysAdd(UserKevin)
	f.KeysAdd(UserRinah)
	f.KeysAdd(UserBrian)
	f.KeysAdd(UserEvelyn)
	f.KeysAdd(UserSam)
	f.LFBInit(keyFoo)
	f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins)
	f.AddGenesisAccount(
		f.KeyAddress(keyVesting), startCoins,
		fmt.Sprintf("--vesting-amount=%s", vestingCoins),
		fmt.Sprintf("--vesting-start-time=%d", time.Now().UTC().UnixNano()),
		fmt.Sprintf("--vesting-end-time=%d", time.Now().Add(60*time.Second).UTC().UnixNano()),
	)
	f.AddGenesisAccount(f.KeyAddress(UserTina), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserKevin), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserRinah), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserBrian), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserEvelyn), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserSam), defaultCoins)
	f.GenTx(keyFoo)
	f.CollectGenTxs()
	return f
}
func (f *Fixtures) Cleanup(dirs ...string) {
	clean := append(dirs, f.Home)  
	for _, d := range clean {
		_ = os.RemoveAll(d)
	}
}
func getCliCtx(f *Fixtures) client.Context {
	kb, err := keyring.New(sdk.KeyringServiceName(), "test", f.Home, os.Stdin)
	require.NoError(f.T, err)
	httpClient, err := osthttp.New(f.RPCAddr, "/websocket")
	require.NoError(f.T, err)
	encodingConfig := app.MakeEncodingConfig()
	return client.Context{}.
		WithJSONMarshaler(encodingConfig.Marshaler).
		WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
		WithTxConfig(encodingConfig.TxConfig).
		WithLegacyAmino(encodingConfig.Amino).
		WithAccountRetriever(authtypes.AccountRetriever{}).
		WithBroadcastMode("block").
		WithSkipConfirmation(true).
		WithHomeDir(f.Home).
		WithKeyringDir(f.Home).
		WithKeyring(kb).
		WithChainID(f.ChainID).
		WithNodeURI(f.RPCAddr).
		WithClient(httpClient)
}
func (f *Fixtures) UnsafeResetAll(flags ...string) {
	cmd := server.UnsafeResetAllCmd()
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags("", flags...))
	require.NoError(f.T, err)
	err = os.RemoveAll(filepath.Join(f.Home, "config", "gentx"))
	require.NoError(f.T, err)
}
func (f *Fixtures) LFBInit(moniker string, flags ...string) {
	f.Moniker = moniker
	args := fmt.Sprintf("-o %s", moniker)
	cmd := genutilcli.InitCmd(app.ModuleBasics, f.Home)
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	genesisPath := filepath.Join(f.Home, "config", "genesis.json")
	genDoc, err := osttypes.GenesisDocFromFile(genesisPath)
	require.NoError(f.T, err)
	f.ChainID = genDoc.ChainID
}
func (f *Fixtures) AddGenesisAccount(address sdk.AccAddress, coins sdk.Coins, flags ...string) {
	args := fmt.Sprintf("%s %s --keyring-backend=test", address, coins)
	cmd := lfbcmd.AddGenesisAccountCmd(f.Home)
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
}
func (f *Fixtures) GenTx(name string, flags ...string) {
	args := fmt.Sprintf("%s 100000000stake --chain-id=%s", name, f.ChainID)
	encodingConfig := app.MakeEncodingConfig()
	cmd := genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, f.Home)
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
}
func (f *Fixtures) CollectGenTxs(flags ...string) {
	cmd := genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, f.Home)
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags("", flags...))
	require.NoError(f.T, err)
}
func (f *Fixtures) LFBStart(minGasPrices string) *testnet.Network {
	cfg := newTestnetConfig(f.T, f.GenesisState(), f.ChainID, minGasPrices)
	n := testnet.NewWithoutInit(f.T, cfg, f.Home, []*testnet.Validator{newValidator(f, cfg, srvconfig.DefaultConfig(), server.NewDefaultContext())})
	err := n.WaitForNextBlock()
	require.NoError(f.T, err)
	return n
}
func (f *Fixtures) LFBOstracon(query string) string {
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), ostraconCmd, strings.Split(query, " "))
	require.NoError(f.T, err)
	return out.String()
}
func (f *Fixtures) ValidateGenesis(genFile string, flags ...string) {
	cmd := genutilcli.ValidateGenesisCmd(app.ModuleBasics)
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(genFile, flags...))
	require.NoError(f.T, err)
}
func (f *Fixtures) KeysDelete(name string, flags ...string) {
	args := fmt.Sprintf("delete --keyring-backend=test -f -y %s", name)
	cmd := clientkeys.Commands(f.Home)
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	if strings.Contains(fmt.Sprintf("%v", err), "The specified item could not be found in the keyring") {
		return
	}
	require.NoError(f.T, err)
}
func (f *Fixtures) KeysAdd(name string, flags ...string) {
	args := fmt.Sprintf("add --keyring-backend=test --output=json %s", name)
	cmd := clientkeys.Commands(f.Home)
	stdout, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, append(addFlags(args, flags...), flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, stdout)
}
func (f *Fixtures) KeysAddRecover(name, mnemonic string, flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("add --keyring-backend=test --recover %s", name)
	cmd := clientkeys.Commands(f.Home)
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, index uint32, flags ...string) {
	args := fmt.Sprintf("add --keyring-backend=test --recover %s --account=%d --index=%d", name, account, index)
	cmd := clientkeys.Commands(f.Home)
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
}
func (f *Fixtures) KeysShow(name string, flags ...string) keyring.KeyOutput {
	args := fmt.Sprintf("show --keyring-backend=test --keyring-dir=%s --output json %s", f.Home, name)
	cmd := clientkeys.Commands(f.Home)
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var ko keyring.KeyOutput
	err = clientkeys.UnmarshalJSON(out.Bytes(), &ko)
	require.NoError(f.T, err)
	return ko
}
func (f *Fixtures) KeyAddress(name string) sdk.AccAddress {
	ko := f.KeysShow(name)
	err := sdk.ValidateAccAddress(ko.Address)
	require.NoError(f.T, err)
	return sdk.AccAddress(ko.Address)
}
func (f *Fixtures) TxSend(from string, to sdk.AccAddress, amount sdk.Coin, flags ...string) (testutil.BufferWriter, error) {
	node := f.RPCAddr
	for i, flag := range flags {
		if strings.Contains(flag, "node") {
			node = strings.Split(flag, "=")[1]
			flags = append(flags[:i], flags[i+1:]...)
		}
	}
	args := fmt.Sprintf("--keyring-backend=test %s %s %s --node=%s", from, to, amount, node)
	cmd := bankcli.NewSendTxCmd()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxSign(signer, fileName string, flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("--keyring-backend=test --from=%s --chain-id=%s %v --node=%s", signer, f.ChainID, fileName, f.RPCAddr)
	cmd := authcli.GetSignCommand()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxBroadcast(fileName string, flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("%v --node=%s", fileName, f.RPCAddr)
	arr := addFlags(args, flags...)
	arr = append(arr, flags...)
	cmd := authcli.GetBroadcastCommand()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, arr)
}
func (f *Fixtures) TxEncode(fileName string, flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("%v --node=%s", fileName, f.RPCAddr)
	cmd := authcli.GetEncodeCommand()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string,
	flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("--keyring-backend=test %s %s %s --node=%s", fileName, name, strings.Join(signaturesFiles, " "), f.RPCAddr)
	cmd := authcli.GetMultiSignCommand()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxStakingCreateValidator(from, consPubKey string, amount sdk.Coin, flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("--keyring-backend=test --from=%s --pubkey=%s", from, consPubKey)
	args += fmt.Sprintf(" --amount=%v --moniker=%v --commission-rate=%v", amount, from, "0.05")
	args += fmt.Sprintf(" --commission-max-rate=%v --commission-max-change-rate=%v", "0.20", "0.10")
	args += fmt.Sprintf(" --min-self-delegation=%v", "1")
	args += fmt.Sprintf(" --node=%s", f.RPCAddr)
	cmd := stakingcli.NewCreateValidatorCmd()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxStakingUnbond(from, shares string, validator sdk.ValAddress, flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("--keyring-backend=test %s %v --from=%s --node=%s", validator, shares, from, f.RPCAddr)
	cmd := stakingcli.NewUnbondCmd()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxGovSubmitProposal(from, typ, title, description string, deposit sdk.Coin, flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("--keyring-backend=test --from=%s --type=%s", from, typ)
	args += fmt.Sprintf(" --title=%s --description=%s --deposit=%s", title, description, deposit)
	args += fmt.Sprintf(" --node=%s", f.RPCAddr)
	cmd := govcli.NewCmdSubmitProposal()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxGovDeposit(proposalID int, from string, amount sdk.Coin, flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("%d %s --keyring-backend=test --from=%s --node=%s", proposalID, amount, from, f.RPCAddr)
	cmd := govcli.NewCmdDeposit()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxGovVote(proposalID int, option gov.VoteOption, from string, flags ...string) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("%d %s --keyring-backend=test --from=%s --node=%s", proposalID, option, from, f.RPCAddr)
	cmd := govcli.NewCmdVote()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxGovSubmitParamChangeProposal(
	from, proposalPath string, flags ...string,
) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("param-change --proposal=%s --keyring-backend=test --from=%s --node=%s", proposalPath, from, f.RPCAddr)
	cmd := govcli.NewCmdSubmitProposal()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) TxGovSubmitCommunityPoolSpendProposal(
	from, proposalPath string, deposit sdk.Coin, flags ...string,
) (testutil.BufferWriter, error) {
	args := fmt.Sprintf("%s --keyring-backend=test --from=%s --node=%s", proposalPath, from, f.RPCAddr)
	cmd := govcli.NewCmdSubmitProposal()
	return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
}
func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) authtypes.BaseAccount {
	args := fmt.Sprintf("%s -o=json", address)
	cmd := authcli.GetAccountCmd()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var acc authtypes.BaseAccount
	err = legacy.Cdc.UnmarshalJSON(out.Bytes(), &acc)
	require.NoError(f.T, err)
	return acc
}
func (f *Fixtures) QueryBalances(address sdk.AccAddress, flags ...string) banktypes.QueryAllBalancesResponse {
	args := fmt.Sprintf("%s -o=json", address)
	cmd := bankcli.GetBalancesCmd()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var bal banktypes.QueryAllBalancesResponse
	cdc, _ := app.MakeCodecs()
	err = cdc.UnmarshalJSON(out.Bytes(), &bal)
	require.NoError(f.T, err)
	return bal
}
func (f *Fixtures) QueryTx(hash string, flags ...string) *sdk.TxResponse {
	args := fmt.Sprintf("%s -o=json --node=%s", hash, f.RPCAddr)
	cmd := authcli.QueryTxCmd()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var result sdk.TxResponse
	cdc, _ := app.MakeCodecs()
	err = cdc.UnmarshalJSON(out.Bytes(), &result)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return &result
}
func (f *Fixtures) QueryTxInvalid(expectedErr error, hash string, flags ...string) {
	args := fmt.Sprintf("%s -o=json --node=%s", hash, f.RPCAddr)
	cmd := authcli.QueryTxCmd()
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	errStr := ""
	if err != nil {
		errStr = err.Error()
	}
	require.EqualError(f.T, expectedErr, errStr)
}
func (f *Fixtures) QueryTxs(page, limit int, flags ...string) *sdk.SearchTxsResult {
	args := fmt.Sprintf("--page=%d --limit=%d --node=%s", page, limit, f.RPCAddr)
	cmd := authcli.QueryTxsByEventsCmd()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var result sdk.SearchTxsResult
	cdc, _ := app.MakeCodecs()
	err = cdc.UnmarshalJSON(out.Bytes(), &result)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return &result
}
func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, flags ...string) {
	args := fmt.Sprintf("--page=%d --limit=%d --node=%s", page, limit, f.RPCAddr)
	cmd := authcli.QueryTxsByEventsCmd()
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	errStr := ""
	if err != nil {
		errStr = err.Error()
	}
	require.EqualError(f.T, expectedErr, errStr)
}
func (f *Fixtures) QueryLatestBlock(flags ...string) *ostctypes.ResultBlock {
	args := fmt.Sprintf("--node=%s", f.RPCAddr)
	cmd := rpc.BlockCommand()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var result ostctypes.ResultBlock
	err = legacy.Cdc.UnmarshalJSON(out.Bytes(), &result)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return &result
}
func (f *Fixtures) QueryBlockWithHeight(height int, flags ...string) *ostctypes.ResultBlock {
	args := fmt.Sprintf("%d --node=%s", height, f.RPCAddr)
	cmd := rpc.BlockCommand()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var result ostctypes.ResultBlock
	err = legacy.Cdc.UnmarshalJSON(out.Bytes(), &result)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return &result
}
func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string) staking.Validator {
	args := fmt.Sprintf("%s --node=%s -o=json", valAddr, f.RPCAddr)
	cmd := stakingcli.GetCmdQueryValidator()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var validator staking.Validator
	cdc, _ := app.MakeCodecs()
	err = cdc.UnmarshalJSON(out.Bytes(), &validator)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return validator
}
func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, flags ...string) staking.QueryValidatorUnbondingDelegationsResponse {
	args := fmt.Sprintf("%s --node=%s -o=json", valAddr, f.RPCAddr)
	cmd := stakingcli.GetCmdQueryValidatorUnbondingDelegations()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var ubds staking.QueryValidatorUnbondingDelegationsResponse
	cdc, _ := app.MakeCodecs()
	err = cdc.UnmarshalJSON(out.Bytes(), &ubds)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return ubds
}
func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...string) staking.QueryValidatorDelegationsResponse {
	args := fmt.Sprintf("%s --node=%s -o=json", valAddr, f.RPCAddr)
	cmd := stakingcli.GetCmdQueryValidatorDelegations()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var delegations staking.QueryValidatorDelegationsResponse
	cdc, _ := app.MakeCodecs()
	err = cdc.UnmarshalJSON(out.Bytes(), &delegations)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return delegations
}
func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool {
	args := fmt.Sprintf("--node=%s", f.RPCAddr)
	cmd := stakingcli.GetCmdQueryPool()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var pool staking.Pool
	cdc, _ := app.MakeCodecs()
	err = cdc.UnmarshalJSON(out.Bytes(), &pool)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return pool
}
func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params {
	args := fmt.Sprintf("--node=%s", f.RPCAddr)
	cmd := stakingcli.GetCmdQueryParams()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var params staking.Params
	cdc, _ := app.MakeCodecs()
	err = cdc.UnmarshalJSON(out.Bytes(), &params)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return params
}
func (f *Fixtures) QueryGovParamDeposit(flags ...string) gov.DepositParams {
	args := fmt.Sprintf("deposit --node=%s -o=json", f.RPCAddr)
	cmd := govcli.GetCmdQueryParam()
	out, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...))
	require.NoError(f.T, err)
	require.NotNil(f.T, out)
	var depositParam gov.DepositParams
	err = legacy.Cdc.UnmarshalJSON(out.Bytes(), &depositParam)
	require.NoError(f.T, err, "out %v\n, err %v", out, err)
	return depositParam
}