-
Notifications
You must be signed in to change notification settings - Fork 889
/
das.go
34 lines (28 loc) · 802 Bytes
/
das.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cmd
import (
"github.com/spf13/cobra"
cmdnode "github.com/celestiaorg/celestia-node/cmd"
)
func init() {
Cmd.AddCommand(samplingStatsCmd)
}
var Cmd = &cobra.Command{
Use: "das [command]",
Short: "Allows to interact with the Daser via JSON-RPC",
Args: cobra.NoArgs,
PersistentPreRunE: cmdnode.InitClient,
}
var samplingStatsCmd = &cobra.Command{
Use: "sampling-stats",
Short: "Returns the current statistics over the DA sampling process",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
client, err := cmdnode.ParseClientFromCtx(cmd.Context())
if err != nil {
return err
}
defer client.Close()
stats, err := client.DAS.SamplingStats(cmd.Context())
return cmdnode.PrintOutput(stats, err, nil)
},
}