prysm-pulse/validator/accounts/wallet_edit.go
Mike Neuder 8aa6057b60
Wallet edit CLI Manager migration (#11136)
* Wallet edit CLI Manager migration

* TODO for code deduplication

* s/walletEdit/remoteWalletEdit/g

* s/walletEdit/remoteWalletEdit/g

* remove unused struct field

Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
2022-08-03 19:44:37 +00:00

22 lines
654 B
Go

package accounts
import (
"context"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/validator/keymanager/remote"
)
// WalletEdit changes a user's on-disk wallet configuration: remote gRPC
// credentials for remote signing, derivation paths for HD wallets, etc.
func (acm *AccountsCLIManager) WalletEdit(ctx context.Context) error {
encodedCfg, err := remote.MarshalOptionsFile(ctx, acm.keymanagerOpts)
if err != nil {
return errors.Wrap(err, "could not marshal config file")
}
if err := acm.wallet.WriteKeymanagerConfigToDisk(ctx, encodedCfg); err != nil {
return errors.Wrap(err, "could not write config to disk")
}
return nil
}