Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added in DAO module cli flags #159

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,3 @@ jobs:
- name: Run `cargo clippy`
run: |
cargo clippy --all --all-targets --all-features -- -D clippy::all

markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@1.0.11
with:
folder-path: "docs"
19 changes: 19 additions & 0 deletions testutil/integration/onomy_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"time"
"unsafe"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
sdkTypes "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -150,6 +151,24 @@ func (oc *OnomyChain) GetAccountBalance(address string) ([]sdkTypes.Coin, error)
return balances.Balances, nil
}

// ExecuteValidatorTx executes the chain CLI tx command from validator account.
// Example of usage:
// onomyChain.ExecuteValidatorTx("tx dao fund-account onomy1qe082nde7s9jpcw02emkz8256frd86mazg007y 1anom --title=T --deposit=1anom --description=D") .
func (oc *OnomyChain) ExecuteValidatorTx(cmd string) {
argsSlice := make([]string, 0)

argsSlice = append(argsSlice, []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, TestChainValidator1Name),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("%d%s", 1000, ChainDenom)), // nolint:gomnd //test constant
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
KeyRingFlag,
oc.homeFlag,
}...)

ExecuteChainCmd(cmd, argsSlice...)
}

// ExecuteChainCmd executes any cmd on the onomyd cli.
func ExecuteChainCmd(cmd string, args ...string) string {
oldArgs := os.Args
Expand Down
12 changes: 9 additions & 3 deletions x/dao/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
Expand All @@ -23,6 +24,11 @@ type proposalGeneric struct {
Deposit string
}

func addTxFlags(cmd *cobra.Command) *cobra.Command {
flags.AddTxFlagsToCmd(cmd)
return cmd
}

// GetTxCmd returns the transaction commands for this module.
func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Expand All @@ -33,9 +39,9 @@ func GetTxCmd() *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand(CmdFundTreasuryProposal())
cmd.AddCommand(CmdExchangeWithTreasuryProposal())
cmd.AddCommand(CmdFundAccountProposal())
cmd.AddCommand(addTxFlags(CmdFundTreasuryProposal()))
cmd.AddCommand(addTxFlags(CmdExchangeWithTreasuryProposal()))
cmd.AddCommand(addTxFlags((CmdFundAccountProposal())))

return cmd
}
Expand Down
Loading