- Query
- QueryProposal --QueryProposal
- QueryProposals --QueryProposals
- QueryVote --QueryVote
- QueryVotes --QueryVotes
- QueryParams --QueryParams
- QueryDeposit --QueryDeposit
- QueryDeposits --QueryDeposits
- QueryTallyResult --QueryTallyResult
- TX
- SubmitProposal --SubmitProposal
- Deposit --Deposit
- Vote --Vote
Detailed information on a single proposal
rep, err := client.Gov.QueryProposal(6)
Filter proposals by status. If not filled in, all proposals will be filtered
pro, err := client.Gov.QueryProposals("") //PROPOSAL_STATUS_DEPOSIT_PERIOD
Query the details of a vote
vote, err := client.Gov.QueryVote(5, "gx1yhf7w0sq8yn6gqre2pulnqwyy30tjfc4v08f3x")
Query proposal vote
vote, err := client.Gov.QueryVotes(5)
Query the parameters of the governance process
vote, err := client.Gov.QueryParams("voting")
Mortgage information from a mortgager in the proposal by proposing ID query
resp, err := client.Gov.QueryDeposit(2, "gx1yhf7w0sq8yn6gqre2pulnqwyy30tjfc4v08f3x")
Query all mortgage information in the proposal
resp, err := client.Gov.QueryDeposits(2)
Query the vote counting result of the proposal
vote, err := client.Gov.QueryTallyResult(5)
Submit proposals with initial delegation. The title, description, type and mortgage of the proposal can be provided directly You need to import the private key before you can operate,Please see the key package for importing the private key
baseTx := types.BaseTx{
From: "demo", //Account name
Password: "123123123",
Gas: 200000,
Mode: types.Commit,
Memo: "test",
}
baseTx.Fee, err = types.ParseDecCoins("2000uplugcn") //Fee
proposalId, res, err := client.Gov.SubmitProposal(gov.SubmitProposalRequest{
Title: "Community Pool Spend",
Description: "Pay me some Atoms!",
Type: "Text",
InitialDeposit: types.NewDecCoins(types.NewDecCoin("uplugcn", types.NewInt(1000))),
}, baseTx)
Pledge tokens for a proposal You need to import the private key before you can operate,Please see the key package for importing the private key
baseTx := types.BaseTx{
From: "demo", //Account name
Password: "123123123",
Gas: 200000,
Mode: types.Commit,
Memo: "test",
}
baseTx.Fee, err = types.ParseDecCoins("2000uplugcn") //Fee
amount, err := types.ParseDecCoins("2000uplugcn")
res, err := client.Gov.Deposit(gov.DepositRequest{
ProposalId: 3,
Amount: amount,
}, baseTx)
Proposal voting You need to import the private key before you can operate,Please see the key package for importing the private key
baseTx := types.BaseTx{
From: "demo", //Account name
Password: "123123123",
Gas: 200000,
Mode: types.Commit,
Memo: "test",
}
baseTx.Fee, err = types.ParseDecCoins("2000uplugcn") //Fee
voteReq := gov.VoteRequest{
ProposalId: 5,
Option: "VOTE_OPTION_YES",
}
res, err := client.Gov.Vote(voteReq, baseTx)