2020-10-15 22:31:52 +00:00
|
|
|
package accounts
|
2020-07-14 00:58:06 +00:00
|
|
|
|
|
|
|
import (
|
2020-07-24 00:43:01 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
2020-07-16 05:08:16 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/validator/flags"
|
2020-07-14 00:58:06 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
2020-10-15 22:31:52 +00:00
|
|
|
// WalletCommands for accounts for Prysm validators.
|
2020-07-15 04:05:21 +00:00
|
|
|
var WalletCommands = &cli.Command{
|
2020-10-15 22:31:52 +00:00
|
|
|
Name: "wallet",
|
|
|
|
Category: "wallet",
|
2020-07-14 00:58:06 +00:00
|
|
|
Usage: "defines commands for interacting with eth2 validator wallets (work in progress)",
|
|
|
|
Subcommands: []*cli.Command{
|
|
|
|
{
|
2020-07-15 04:05:21 +00:00
|
|
|
Name: "create",
|
|
|
|
Usage: "creates a new wallet with a desired type of keymanager: " +
|
2020-10-16 18:45:14 +00:00
|
|
|
"either on-disk (imported), derived, or using remote credentials",
|
2020-07-17 08:21:16 +00:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
flags.WalletDirFlag,
|
|
|
|
flags.KeymanagerKindFlag,
|
|
|
|
flags.GrpcRemoteAddressFlag,
|
|
|
|
flags.RemoteSignerCertPathFlag,
|
|
|
|
flags.RemoteSignerKeyPathFlag,
|
|
|
|
flags.RemoteSignerCACertPathFlag,
|
2020-07-29 01:20:13 +00:00
|
|
|
flags.WalletPasswordFileFlag,
|
2020-07-24 00:43:01 +00:00
|
|
|
featureconfig.AltonaTestnet,
|
2020-07-31 01:23:37 +00:00
|
|
|
featureconfig.OnyxTestnet,
|
2020-10-07 23:04:19 +00:00
|
|
|
featureconfig.MedallaTestnet,
|
2020-09-23 08:03:13 +00:00
|
|
|
featureconfig.SpadinaTestnet,
|
2020-09-30 18:19:05 +00:00
|
|
|
featureconfig.ZinkenTestnet,
|
2020-07-17 08:21:16 +00:00
|
|
|
},
|
2020-07-22 02:04:08 +00:00
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2020-09-23 08:03:13 +00:00
|
|
|
featureconfig.ConfigureValidator(cliCtx)
|
2020-08-31 19:46:45 +00:00
|
|
|
if _, err := CreateAndSaveWalletCli(cliCtx); err != nil {
|
2020-07-23 00:11:00 +00:00
|
|
|
log.Fatalf("Could not create a wallet: %v", err)
|
2020-07-22 02:04:08 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
2020-07-16 05:08:16 +00:00
|
|
|
{
|
|
|
|
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,
|
2020-07-24 00:43:01 +00:00
|
|
|
featureconfig.AltonaTestnet,
|
2020-07-31 01:23:37 +00:00
|
|
|
featureconfig.OnyxTestnet,
|
2020-10-07 23:04:19 +00:00
|
|
|
featureconfig.MedallaTestnet,
|
2020-09-23 08:03:13 +00:00
|
|
|
featureconfig.SpadinaTestnet,
|
2020-09-30 18:19:05 +00:00
|
|
|
featureconfig.ZinkenTestnet,
|
2020-07-16 05:08:16 +00:00
|
|
|
},
|
2020-07-22 02:04:08 +00:00
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2020-09-23 08:03:13 +00:00
|
|
|
featureconfig.ConfigureValidator(cliCtx)
|
2020-08-31 19:46:45 +00:00
|
|
|
if err := EditWalletConfigurationCli(cliCtx); err != nil {
|
2020-07-23 00:11:00 +00:00
|
|
|
log.Fatalf("Could not edit wallet configuration: %v", err)
|
2020-07-22 02:04:08 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-16 05:08:16 +00:00
|
|
|
},
|
2020-07-22 02:41:39 +00:00
|
|
|
{
|
|
|
|
Name: "recover",
|
|
|
|
Usage: "uses a derived wallet seed recovery phase to recreate an existing HD wallet",
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
flags.WalletDirFlag,
|
|
|
|
flags.MnemonicFileFlag,
|
2020-07-29 01:20:13 +00:00
|
|
|
flags.WalletPasswordFileFlag,
|
2020-07-27 14:03:30 +00:00
|
|
|
flags.NumAccountsFlag,
|
2020-07-24 00:43:01 +00:00
|
|
|
featureconfig.AltonaTestnet,
|
2020-07-31 01:23:37 +00:00
|
|
|
featureconfig.OnyxTestnet,
|
2020-10-07 23:04:19 +00:00
|
|
|
featureconfig.MedallaTestnet,
|
2020-09-23 08:03:13 +00:00
|
|
|
featureconfig.SpadinaTestnet,
|
2020-09-30 18:19:05 +00:00
|
|
|
featureconfig.ZinkenTestnet,
|
2020-07-22 02:41:39 +00:00
|
|
|
},
|
2020-07-23 00:11:00 +00:00
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2020-09-23 08:03:13 +00:00
|
|
|
featureconfig.ConfigureValidator(cliCtx)
|
2020-08-31 19:46:45 +00:00
|
|
|
if err := RecoverWalletCli(cliCtx); err != nil {
|
2020-07-23 00:11:00 +00:00
|
|
|
log.Fatalf("Could not recover wallet: %v", err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-22 02:41:39 +00:00
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
|
|
|
}
|