2021-03-03 17:05:37 +00:00
|
|
|
package wallet
|
2020-07-14 00:58:06 +00:00
|
|
|
|
|
|
|
import (
|
2024-02-15 05:46:47 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v5/cmd"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/cmd/validator/flags"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/config/features"
|
2021-03-03 17:05:37 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2020-07-14 00:58:06 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
2021-03-03 17:05:37 +00:00
|
|
|
var log = logrus.WithField("prefix", "wallet")
|
|
|
|
|
|
|
|
// Commands for wallets for Prysm validators.
|
|
|
|
var Commands = &cli.Command{
|
2020-10-15 22:31:52 +00:00
|
|
|
Name: "wallet",
|
|
|
|
Category: "wallet",
|
2024-01-02 18:02:28 +00:00
|
|
|
Usage: "Defines commands for interacting with Ethereum 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.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,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.Mainnet,
|
2023-01-31 01:09:40 +00:00
|
|
|
features.PulseChain,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.PraterTestnet,
|
2023-04-19 18:36:39 +00:00
|
|
|
features.PulseChainTestnetV4,
|
2022-06-15 15:05:44 +00:00
|
|
|
features.SepoliaTestnet,
|
2023-08-29 14:27:50 +00:00
|
|
|
features.HoleskyTestnet,
|
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
|
|
|
|
}
|
2022-09-02 14:56:47 +00:00
|
|
|
return features.ConfigureValidator(cliCtx)
|
|
|
|
},
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
|
|
|
if err := walletCreate(cliCtx); err != nil {
|
2022-08-05 10:52:02 +00:00
|
|
|
log.WithError(err).Fatal("Could not create a wallet")
|
2020-07-22 02:04:08 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-14 00:58:06 +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,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.Mainnet,
|
2023-01-31 01:09:40 +00:00
|
|
|
features.PulseChain,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.PraterTestnet,
|
2023-04-19 18:36:39 +00:00
|
|
|
features.PulseChainTestnetV4,
|
2022-06-15 15:05:44 +00:00
|
|
|
features.SepoliaTestnet,
|
2023-08-29 14:27:50 +00:00
|
|
|
features.HoleskyTestnet,
|
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
|
|
|
|
}
|
2022-08-24 16:57:03 +00:00
|
|
|
return features.ConfigureBeaconChain(cliCtx)
|
|
|
|
},
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
|
|
|
if err := walletRecover(cliCtx); err != nil {
|
2022-08-05 10:52:02 +00:00
|
|
|
log.WithError(err).Fatal("Could not recover wallet")
|
2020-07-23 00:11:00 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-22 02:41:39 +00:00
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
|
|
|
}
|