From 05efa5f528a0e5b54f496a7655d68378793c0505 Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Wed, 13 Dec 2023 11:54:55 -0600 Subject: [PATCH 1/2] Added in DAO module cli flags --- testutil/integration/onomy_chain.go | 19 +++++++++++++++++++ x/dao/client/cli/tx.go | 12 +++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/testutil/integration/onomy_chain.go b/testutil/integration/onomy_chain.go index d09e653d..fa77707e 100644 --- a/testutil/integration/onomy_chain.go +++ b/testutil/integration/onomy_chain.go @@ -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" @@ -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 diff --git a/x/dao/client/cli/tx.go b/x/dao/client/cli/tx.go index 023b3ef4..afb21466 100644 --- a/x/dao/client/cli/tx.go +++ b/x/dao/client/cli/tx.go @@ -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" @@ -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{ @@ -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 } From cfa177e7f887c96bf02899ac4c823b432a9d273e Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Mon, 6 May 2024 04:36:33 +0000 Subject: [PATCH 2/2] Remove markdown link check temp --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74b1947f..58b278b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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"