Cosmos PR changes (#158)

* Changes necessary for enforced custom account encoding/decoding and keyring keybase changes

* updates cosmos dependency and fixes inconsistency in gas usage for simulated/real txs

* Update PR changes

* Remove unused password prompt when using OS keyring

* Update from changes to sdk

* Update to merged PR commit :the_horns:

* updated code to handle keyring backend options

* update documentation and replace cosmos-sdk with fork (temporarily)

* update cosmos dependency from fork

* update documentation
This commit is contained in:
Austin Abell
2019-12-13 14:50:19 -05:00
committed by GitHub
parent c2646c7b18
commit ce8a94a98e
13 changed files with 342 additions and 76 deletions
+7 -6
View File
@@ -1,6 +1,7 @@
package genaccounts
import (
"bufio"
"errors"
"fmt"
@@ -42,14 +43,15 @@ the address will be looked up in the local Keybase. The list of initial tokens m
contain valid denominations. Accounts may optionally be supplied with vesting parameters.
`,
Args: cobra.ExactArgs(2),
RunE: func(_ *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, args []string) error {
config := ctx.Config
config.SetRoot(viper.GetString(cli.HomeFlag))
addr, err := sdk.AccAddressFromBech32(args[0])
inBuf := bufio.NewReader(cmd.InOrStdin())
if err != nil {
// attempt to lookup address from Keybase if no address was provided
kb, err := keys.NewKeyBaseFromDir(viper.GetString(flagClientHome))
kb, err := keys.NewKeyringFromDir(viper.GetString(flagClientHome), inBuf)
if err != nil {
return err
}
@@ -77,9 +79,9 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
// create concrete account type based on input parameters
var genAccount authexported.GenesisAccount
baseAcc := auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0)
baseAccount := auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0)
if !vestingAmt.IsZero() {
baseVestingAccount, err := authvesting.NewBaseVestingAccount(baseAcc, vestingAmt.Sort(), vestingEnd)
baseVestingAccount, err := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd)
if err != nil {
return fmt.Errorf("failed to create base vesting account: %w", err)
}
@@ -95,8 +97,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
return errors.New("invalid vesting parameters; must supply start and end time or end time")
}
} else {
// Genesis account is created with Ethermint account type
genAccount = &ethermint.Account{BaseAccount: baseAcc}
genAccount = ethermint.Account{BaseAccount: baseAccount}
}
if err := genAccount.Validate(); err != nil {