2020-10-15 22:31:52 +00:00
|
|
|
package accounts
|
2020-07-14 00:58:06 +00:00
|
|
|
|
|
|
|
import (
|
2020-10-20 20:12:49 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/cmd"
|
2020-07-24 00:43:01 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
2020-10-21 15:13:46 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/tos"
|
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-11-21 10:15:44 +00:00
|
|
|
Usage: "defines commands for interacting with eth2 validator wallets",
|
2020-07-14 00:58:06 +00:00
|
|
|
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-10-21 15:13:46 +00:00
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
2020-07-17 08:21:16 +00:00
|
|
|
flags.WalletDirFlag,
|
|
|
|
flags.KeymanagerKindFlag,
|
|
|
|
flags.GrpcRemoteAddressFlag,
|
|
|
|
flags.RemoteSignerCertPathFlag,
|
|
|
|
flags.RemoteSignerKeyPathFlag,
|
|
|
|
flags.RemoteSignerCACertPathFlag,
|
2020-07-29 01:20:13 +00:00
|
|
|
flags.WalletPasswordFileFlag,
|
2020-10-27 20:51:29 +00:00
|
|
|
flags.Mnemonic25thWordFileFlag,
|
|
|
|
flags.SkipMnemonic25thWordCheckFlag,
|
2020-11-17 03:17:08 +00:00
|
|
|
featureconfig.Mainnet,
|
2020-11-13 01:00:05 +00:00
|
|
|
featureconfig.PyrmontTestnet,
|
2020-11-17 03:17:08 +00:00
|
|
|
featureconfig.ToledoTestnet,
|
2020-10-20 20:12:49 +00:00
|
|
|
cmd.AcceptTosFlag,
|
2020-10-21 15:13:46 +00:00
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return tos.VerifyTosAcceptedOrPrompt(cliCtx)
|
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",
|
2020-10-21 15:13:46 +00:00
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
2020-07-16 05:08:16 +00:00
|
|
|
flags.WalletDirFlag,
|
|
|
|
flags.GrpcRemoteAddressFlag,
|
|
|
|
flags.RemoteSignerCertPathFlag,
|
|
|
|
flags.RemoteSignerKeyPathFlag,
|
|
|
|
flags.RemoteSignerCACertPathFlag,
|
2020-11-17 03:17:08 +00:00
|
|
|
featureconfig.Mainnet,
|
2020-11-13 01:00:05 +00:00
|
|
|
featureconfig.PyrmontTestnet,
|
2020-11-17 03:17:08 +00:00
|
|
|
featureconfig.ToledoTestnet,
|
2020-10-20 20:12:49 +00:00
|
|
|
cmd.AcceptTosFlag,
|
2020-10-21 15:13:46 +00:00
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return tos.VerifyTosAcceptedOrPrompt(cliCtx)
|
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",
|
2020-10-21 15:13:46 +00:00
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
2020-07-22 02:41:39 +00:00
|
|
|
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-10-27 20:51:29 +00:00
|
|
|
flags.Mnemonic25thWordFileFlag,
|
|
|
|
flags.SkipMnemonic25thWordCheckFlag,
|
2020-11-17 03:17:08 +00:00
|
|
|
featureconfig.Mainnet,
|
2020-11-13 01:00:05 +00:00
|
|
|
featureconfig.PyrmontTestnet,
|
2020-11-17 03:17:08 +00:00
|
|
|
featureconfig.ToledoTestnet,
|
2020-10-20 20:12:49 +00:00
|
|
|
cmd.AcceptTosFlag,
|
2020-10-21 15:13:46 +00:00
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return tos.VerifyTosAcceptedOrPrompt(cliCtx)
|
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
|
|
|
},
|
|
|
|
}
|