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

imp(cli): refactor getting accounts for CLI commands #32

Merged
merged 3 commits into from
Dec 28, 2023
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: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
- Vote on the software proposal
6 changes: 0 additions & 6 deletions cmd/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions cmd/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 10 additions & 1 deletion utils/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading