allow wallet import to set default address
This commit is contained in:
parent
035fcad3d4
commit
3042183825
@ -215,6 +215,10 @@ var walletImport = &cli.Command{
|
|||||||
Usage: "specify input format for key",
|
Usage: "specify input format for key",
|
||||||
Value: "hex-lotus",
|
Value: "hex-lotus",
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "as-default",
|
||||||
|
Usage: "import the given key as your new default key",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
api, closer, err := GetFullNodeAPI(cctx)
|
api, closer, err := GetFullNodeAPI(cctx)
|
||||||
@ -287,6 +291,12 @@ var walletImport = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cctx.Bool("as-default") {
|
||||||
|
if err := api.WalletSetDefault(ctx, addr); err != nil {
|
||||||
|
return fmt.Errorf("failed to set default key: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Printf("imported key %s successfully!\n", addr)
|
fmt.Printf("imported key %s successfully!\n", addr)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@ Create the genesis block and start up the first node:
|
|||||||
Then, in another console, import the genesis miner key:
|
Then, in another console, import the genesis miner key:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./lotus wallet import ~/.genesis-sectors/pre-seal-t01000.key
|
./lotus wallet import --as-default ~/.genesis-sectors/pre-seal-t01000.key
|
||||||
```
|
```
|
||||||
|
|
||||||
Set up the genesis miner:
|
Set up the genesis miner:
|
||||||
|
Loading…
Reference in New Issue
Block a user