lotus/cli/chain.go

38 lines
557 B
Go
Raw Normal View History

2019-07-09 15:19:27 +00:00
package cli
import (
"fmt"
"gopkg.in/urfave/cli.v2"
)
var chainCmd = &cli.Command{
Name: "chain",
Usage: "Interact with filecoin blockchain",
Subcommands: []*cli.Command{
chainHeadCmd,
},
}
var chainHeadCmd = &cli.Command{
Name: "head",
Usage: "Print chain head",
Action: func(cctx *cli.Context) error {
2019-07-11 11:52:07 +00:00
api, err := getAPI(cctx)
2019-07-10 17:28:49 +00:00
if err != nil {
return err
}
2019-07-09 15:19:27 +00:00
ctx := reqContext(cctx)
head, err := api.ChainHead(ctx)
if err != nil {
return err
}
2019-07-11 02:36:43 +00:00
for _, c := range head.Cids() {
2019-07-09 15:19:27 +00:00
fmt.Println(c)
}
return nil
},
}