prysm-pulse/validator/accounts/v2/cmd_wallet.go
bidlocode 7c8492e83f
Add medalla flag (#7399)
* add --medalla flag for uniformity

* add enforcing testnet flag

* fix

* fix comments

* fix sufficient err msg

* fix shared method

* fix

* fix name

* fix name

* add test

* fix e2e

* fix gofmt

* fix test

* add warning

* fix warning

* fix warning test

* fix

* fix

* fix

* fix

* fix gofmt

* fix refactor to func

* add func description

* fix exported

* fix

* fix

* fix

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2020-10-07 23:04:19 +00:00

91 lines
2.7 KiB
Go

package v2
import (
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/validator/flags"
"github.com/urfave/cli/v2"
)
// WalletCommands for accounts-v2 for Prysm validators.
var WalletCommands = &cli.Command{
Name: "wallet-v2",
Category: "wallet-v2",
Usage: "defines commands for interacting with eth2 validator wallets (work in progress)",
Subcommands: []*cli.Command{
{
Name: "create",
Usage: "creates a new wallet with a desired type of keymanager: " +
"either on-disk (direct), derived, or using remote credentials",
Flags: []cli.Flag{
flags.WalletDirFlag,
flags.KeymanagerKindFlag,
flags.GrpcRemoteAddressFlag,
flags.RemoteSignerCertPathFlag,
flags.RemoteSignerKeyPathFlag,
flags.RemoteSignerCACertPathFlag,
flags.WalletPasswordFileFlag,
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.MedallaTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if _, err := CreateAndSaveWalletCli(cliCtx); err != nil {
log.Fatalf("Could not create a wallet: %v", err)
}
return nil
},
},
{
Name: "edit-config",
Usage: "edits a wallet configuration options, such as gRPC connection credentials and TLS certificates",
Flags: []cli.Flag{
flags.WalletDirFlag,
flags.GrpcRemoteAddressFlag,
flags.RemoteSignerCertPathFlag,
flags.RemoteSignerKeyPathFlag,
flags.RemoteSignerCACertPathFlag,
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.MedallaTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := EditWalletConfigurationCli(cliCtx); err != nil {
log.Fatalf("Could not edit wallet configuration: %v", err)
}
return nil
},
},
{
Name: "recover",
Usage: "uses a derived wallet seed recovery phase to recreate an existing HD wallet",
Flags: []cli.Flag{
flags.WalletDirFlag,
flags.MnemonicFileFlag,
flags.WalletPasswordFileFlag,
flags.NumAccountsFlag,
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.MedallaTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := RecoverWalletCli(cliCtx); err != nil {
log.Fatalf("Could not recover wallet: %v", err)
}
return nil
},
},
},
}