diff --git a/CHANGELOG.md b/CHANGELOG.md index 71e9f4c..e58af30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## Unreleased + +### Improvements + +- [#32](https://github.com/MalteHerrmann/evmos-utils/pull/32) Minor refactor in CLI commands + ## [v0.4.0](https://github.com/MalteHerrmann/evmos-utils/releases/tag/v0.4.0) - 2023-12-18 ### Features @@ -74,4 +80,4 @@ Ref: https://keepachangelog.com/en/1.0.0/ - Gets current block height of local node (at `http://localhost:26657`) - Submit a software upgrade proposal to a running local Evmos node for the target version -- Vote on the software proposal \ No newline at end of file +- Vote on the software proposal diff --git a/cmd/deposit.go b/cmd/deposit.go index ee99d7a..1041cac 100644 --- a/cmd/deposit.go +++ b/cmd/deposit.go @@ -21,12 +21,6 @@ If no proposal ID is given by the user, the latest proposal is queried and depos return } - if err = bin.GetAccounts(); err != nil { - bin.Logger.Error().Msgf("error getting accounts: %v", err) - - return - } - proposalID, err := gov.Deposit(bin, args) if err != nil { bin.Logger.Error().Msgf("error depositing: %v", err) diff --git a/cmd/upgrade.go b/cmd/upgrade.go index 3e944f6..a7bd9cf 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -24,12 +24,6 @@ voting for it using all keys of in the keyring and having it pass.`, return } - if err = bin.GetAccounts(); err != nil { - bin.Logger.Error().Msgf("error getting accounts: %v", err) - - return - } - targetVersion := args[0] if matched, _ := regexp.MatchString(`v\d+\.\d+\.\d(-rc\d+)?`, targetVersion); !matched { bin.Logger.Error().Msgf("invalid target version: %s; please use the format vX.Y.Z(-rc*).", targetVersion) diff --git a/cmd/vote.go b/cmd/vote.go index 1f1b6e1..a75680f 100644 --- a/cmd/vote.go +++ b/cmd/vote.go @@ -21,12 +21,6 @@ If no proposal ID is passed, the latest proposal on chain is queried and used.`, return } - if err = bin.GetAccounts(); err != nil { - bin.Logger.Error().Msgf("error getting accounts: %v", err) - - return - } - proposalID, err := gov.SubmitAllVotes(bin, args) if err != nil { bin.Logger.Error().Msgf("error submitting votes: %v", err) diff --git a/utils/binary.go b/utils/binary.go index a8f2dd8..052c413 100644 --- a/utils/binary.go +++ b/utils/binary.go @@ -67,7 +67,16 @@ func NewEvmosTestingBinary() (*Binary, error) { defaultEvmosdHome := path.Join(userHome, ".tmp-evmosd") - return NewBinary(defaultEvmosdHome, "evmosd", logger) + bin, err := NewBinary(defaultEvmosdHome, "evmosd", logger) + if err != nil { + return nil, err + } + + if err = bin.GetAccounts(); err != nil { + return nil, err + } + + return bin, nil } // GetCodec returns the codec to be used for the client.