x/gov: remove alias.go usage (#6432)

This commit is contained in:
dauTT
2020-06-13 11:07:51 +02:00
committed by GitHub
parent c3ff8c0c06
commit 1783f5ef1e
19 changed files with 130 additions and 275 deletions
+21 -21
View File
@@ -10,17 +10,17 @@ import (
"github.com/cosmos/cosmos-sdk/tests"
"github.com/cosmos/cosmos-sdk/tests/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov"
"github.com/cosmos/cosmos-sdk/x/gov/types"
)
//___________________________________________________________________________________
// simcli query gov
// QueryGovParamDeposit is simcli query gov param deposit
func QueryGovParamDeposit(f *cli.Fixtures) gov.DepositParams {
func QueryGovParamDeposit(f *cli.Fixtures) types.DepositParams {
cmd := fmt.Sprintf("%s query gov param deposit %s", f.SimcliBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "")
var depositParam gov.DepositParams
var depositParam types.DepositParams
err := f.Cdc.UnmarshalJSON([]byte(out), &depositParam)
require.NoError(f.T, err, "out %v\n, err %v", out, err)
@@ -28,10 +28,10 @@ func QueryGovParamDeposit(f *cli.Fixtures) gov.DepositParams {
}
// QueryGovParamVoting is simcli query gov param voting
func QueryGovParamVoting(f *cli.Fixtures) gov.VotingParams {
func QueryGovParamVoting(f *cli.Fixtures) types.VotingParams {
cmd := fmt.Sprintf("%s query gov param voting %s", f.SimcliBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "")
var votingParam gov.VotingParams
var votingParam types.VotingParams
err := f.Cdc.UnmarshalJSON([]byte(out), &votingParam)
require.NoError(f.T, err, "out %v\n, err %v", out, err)
@@ -39,10 +39,10 @@ func QueryGovParamVoting(f *cli.Fixtures) gov.VotingParams {
}
// QueryGovParamTallying is simcli query gov param tallying
func QueryGovParamTallying(f *cli.Fixtures) gov.TallyParams {
func QueryGovParamTallying(f *cli.Fixtures) types.TallyParams {
cmd := fmt.Sprintf("%s query gov param tallying %s", f.SimcliBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "")
var tallyingParam gov.TallyParams
var tallyingParam types.TallyParams
err := f.Cdc.UnmarshalJSON([]byte(out), &tallyingParam)
require.NoError(f.T, err, "out %v\n, err %v", out, err)
@@ -50,10 +50,10 @@ func QueryGovParamTallying(f *cli.Fixtures) gov.TallyParams {
}
// QueryGovProposal is simcli query gov proposal
func QueryGovProposal(f *cli.Fixtures, proposalID int, flags ...string) gov.Proposal {
func QueryGovProposal(f *cli.Fixtures, proposalID int, flags ...string) types.Proposal {
cmd := fmt.Sprintf("%s query gov proposal %d %v", f.SimcliBinary, proposalID, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var proposal gov.Proposal
var proposal types.Proposal
err := f.Cdc.UnmarshalJSON([]byte(out), &proposal)
require.NoError(f.T, err, "out %v\n, err %v", out, err)
@@ -61,14 +61,14 @@ func QueryGovProposal(f *cli.Fixtures, proposalID int, flags ...string) gov.Prop
}
// QueryGovProposals is simcli query gov proposals
func QueryGovProposals(f *cli.Fixtures, flags ...string) gov.Proposals {
func QueryGovProposals(f *cli.Fixtures, flags ...string) types.Proposals {
cmd := fmt.Sprintf("%s query gov proposals %v", f.SimcliBinary, f.Flags())
stdout, stderr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
if strings.Contains(stderr, "no matching proposals found") {
return gov.Proposals{}
return types.Proposals{}
}
require.Empty(f.T, stderr)
var out gov.Proposals
var out types.Proposals
err := f.Cdc.UnmarshalJSON([]byte(stdout), &out)
require.NoError(f.T, err)
@@ -76,10 +76,10 @@ func QueryGovProposals(f *cli.Fixtures, flags ...string) gov.Proposals {
}
// QueryGovVote is simcli query gov vote
func QueryGovVote(f *cli.Fixtures, proposalID int, voter sdk.AccAddress, flags ...string) gov.Vote {
func QueryGovVote(f *cli.Fixtures, proposalID int, voter sdk.AccAddress, flags ...string) types.Vote {
cmd := fmt.Sprintf("%s query gov vote %d %s %v", f.SimcliBinary, proposalID, voter, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var vote gov.Vote
var vote types.Vote
err := f.Cdc.UnmarshalJSON([]byte(out), &vote)
require.NoError(f.T, err, "out %v\n, err %v", out, err)
@@ -87,10 +87,10 @@ func QueryGovVote(f *cli.Fixtures, proposalID int, voter sdk.AccAddress, flags .
}
// QueryGovVotes is simcli query gov votes
func QueryGovVotes(f *cli.Fixtures, proposalID int, flags ...string) []gov.Vote {
func QueryGovVotes(f *cli.Fixtures, proposalID int, flags ...string) []types.Vote {
cmd := fmt.Sprintf("%s query gov votes %d %v", f.SimcliBinary, proposalID, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var votes []gov.Vote
var votes []types.Vote
err := f.Cdc.UnmarshalJSON([]byte(out), &votes)
require.NoError(f.T, err, "out %v\n, err %v", out, err)
@@ -98,10 +98,10 @@ func QueryGovVotes(f *cli.Fixtures, proposalID int, flags ...string) []gov.Vote
}
// QueryGovDeposit is simcli query gov deposit
func QueryGovDeposit(f *cli.Fixtures, proposalID int, depositor sdk.AccAddress, flags ...string) gov.Deposit {
func QueryGovDeposit(f *cli.Fixtures, proposalID int, depositor sdk.AccAddress, flags ...string) types.Deposit {
cmd := fmt.Sprintf("%s query gov deposit %d %s %v", f.SimcliBinary, proposalID, depositor, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var deposit gov.Deposit
var deposit types.Deposit
err := f.Cdc.UnmarshalJSON([]byte(out), &deposit)
require.NoError(f.T, err, "out %v\n, err %v", out, err)
@@ -109,10 +109,10 @@ func QueryGovDeposit(f *cli.Fixtures, proposalID int, depositor sdk.AccAddress,
}
// QueryGovDeposits is simcli query gov deposits
func QueryGovDeposits(f *cli.Fixtures, propsalID int, flags ...string) []gov.Deposit {
func QueryGovDeposits(f *cli.Fixtures, propsalID int, flags ...string) []types.Deposit {
cmd := fmt.Sprintf("%s query gov deposits %d %v", f.SimcliBinary, propsalID, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var deposits []gov.Deposit
var deposits []types.Deposit
err := f.Cdc.UnmarshalJSON([]byte(out), &deposits)
require.NoError(f.T, err, "out %v\n, err %v", out, err)
@@ -138,7 +138,7 @@ func TxGovDeposit(f *cli.Fixtures, proposalID int, from string, amount sdk.Coin,
}
// TxGovVote is simcli tx gov vote
func TxGovVote(f *cli.Fixtures, proposalID int, option gov.VoteOption, from string, flags ...string) (bool, string, string) {
func TxGovVote(f *cli.Fixtures, proposalID int, option types.VoteOption, from string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx gov vote %d %s --keyring-backend=test --from=%s %v",
f.SimcliBinary, proposalID, option, from, f.Flags())
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)