CLI to get network version
This commit is contained in:
parent
dc3d17c9ea
commit
3737a8f3cc
30
cli/state.go
30
cli/state.go
@ -72,6 +72,7 @@ var stateCmd = &cli.Command{
|
||||
stateMinerInfo,
|
||||
stateMarketCmd,
|
||||
stateExecTraceCmd,
|
||||
stateNtwkVersionCmd,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1831,3 +1832,32 @@ var stateMarketBalanceCmd = &cli.Command{
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var stateNtwkVersionCmd = &cli.Command{
|
||||
Name: "network-version",
|
||||
Usage: "Returns the network version",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Present() {
|
||||
return ShowHelp(cctx, fmt.Errorf("doesn't expect any arguments"))
|
||||
}
|
||||
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
ts, err := LoadTipSet(ctx, cctx, api)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nv, err := api.StateNetworkVersion(ctx, ts.Key())
|
||||
|
||||
fmt.Printf("Network Version: %d\n", nv)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user