Skip to content

Commit

Permalink
add example for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd committed Sep 2, 2024
1 parent 2165f40 commit 2a1db4c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
36 changes: 20 additions & 16 deletions x/avs/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ func GetQueryCmd(_ string) *cobra.Command {

func QueryAVSInfo() *cobra.Command {
cmd := &cobra.Command{
Use: "AVSInfo query",
Short: "AVSInfo query",
Long: "AVSInfo query for current registered AVS",
Args: cobra.ExactArgs(1),
Use: "AVSInfo query <avsAddr>",
Short: "AVSInfo query",
Long: "AVSInfo query for current registered AVS",
Example: "exocored query avs AVSInfo 0x598ACcB5e7F83cA6B19D70592Def9E5b25B978CA",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if !common.IsHexAddress(args[0]) {
return xerrors.Errorf("invalid avs address,err:%s", types.ErrInvalidAddr)
Expand Down Expand Up @@ -96,10 +97,11 @@ func QueryAVSAddrByChainID() *cobra.Command {

func QueryTaskInfo() *cobra.Command {
cmd := &cobra.Command{
Use: "TaskInfo <task-address-in-hex> <task-id>",
Short: "Query the TaskInfo by its address and ID",
Long: "Query the currently registered tasks for an AVS by the task's address and ID",
Args: cobra.ExactArgs(2),
Use: "TaskInfo <task-address-in-hex> <task-id>",
Short: "Query the TaskInfo by its address and ID",
Long: "Query the currently registered tasks for an AVS by the task's address and ID",
Example: "exocored query avs TaskInfo 0x96949787E6a209AFb4dE035754F79DC9982D3F2a 2",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
if !common.IsHexAddress(args[0]) {
return xerrors.Errorf("invalid task address,err:%s", types.ErrInvalidAddr)
Expand Down Expand Up @@ -127,10 +129,11 @@ func QueryTaskInfo() *cobra.Command {

func QuerySubmitTaskResult() *cobra.Command {

Check failure on line 130 in x/avs/client/cli/query.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

130-161 lines are duplicate of `x/avs/client/cli/query.go:163-194` (dupl)
cmd := &cobra.Command{
Use: "SubmitTaskResult <task-address-in-hex> <task-id> <operator-addreess>",
Short: "Query the SubmitTaskResult by taskAddr taskID operatorAddr",
Long: "Query the currently submitted Task Result",
Args: cobra.ExactArgs(3),
Use: "SubmitTaskResult <task-address-in-hex> <task-id> <operator-addreess>",
Short: "Query the SubmitTaskResult by taskAddr taskID operatorAddr",
Long: "Query the currently submitted Task Result",
Example: "exocored query avs ChallengeInfo 0x96949787E6a209AFb4dE035754F79DC9982D3F2a 2 exo1mq6pj6f5tafmgkk6lehew5radfq3w20gpegzs5",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
if !common.IsHexAddress(args[0]) {
return xerrors.Errorf("invalid address,err:%s", types.ErrInvalidAddr)
Expand Down Expand Up @@ -159,10 +162,11 @@ func QuerySubmitTaskResult() *cobra.Command {

func QueryChallengeInfo() *cobra.Command {

Check failure on line 163 in x/avs/client/cli/query.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

163-194 lines are duplicate of `x/avs/client/cli/query.go:130-161` (dupl)
cmd := &cobra.Command{
Use: "ChallengeInfo <task-address-in-hex> <task-id> <operator-addreess>",
Short: "Query the ChallengeInfo by taskAddr taskID operatorAddr",
Long: "Query the currently Challenge Info ",
Args: cobra.ExactArgs(3),
Use: "ChallengeInfo <task-address-in-hex> <task-id> <operator-addreess>",
Short: "Query the ChallengeInfo by taskAddr taskID operatorAddr",
Long: "Query the currently Challenge Info ",
Example: "exocored query avs ChallengeInfo 0x96949787E6a209AFb4dE035754F79DC9982D3F2a 2 exo1mq6pj6f5tafmgkk6lehew5radfq3w20gpegzs5",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
if !common.IsHexAddress(args[0]) {
return xerrors.Errorf("invalid task address,err:%s", types.ErrInvalidAddr)
Expand Down
18 changes: 10 additions & 8 deletions x/operator/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,11 @@ func QueryOperatorSlashInfo() *cobra.Command {
// QueryAllOperatorsWithOptInAVS queries all operators
func QueryAllOperatorsWithOptInAVS() *cobra.Command {
cmd := &cobra.Command{
Use: "get-operator-list <avsAddr>",
Short: "Get list of operators by AVS",
Long: "Get the list of operators who have opted in to the specified AVS",
Args: cobra.ExactArgs(1),
Use: "get-operator-list <avsAddr>",
Short: "Get list of operators by AVS",
Long: "Get the list of operators who have opted in to the specified AVS",
Example: "exocored query operator get-operator-list 0x598ACcB5e7F83cA6B19D70592Def9E5b25B978CA",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if !common.IsHexAddress(args[0]) {
return xerrors.Errorf("invalid address,err:%s", types.ErrInvalidAddr)
Expand Down Expand Up @@ -385,10 +386,11 @@ func QueryAllOperatorsWithOptInAVS() *cobra.Command {
// QueryAllAVSsByOperator queries all avs
func QueryAllAVSsByOperator() *cobra.Command {
cmd := &cobra.Command{
Use: "get-avs-list <operatorAddr>",
Short: "Get list of AVSs by operator",
Long: "Get a list of AVSs to which an operator has opted in",
Args: cobra.ExactArgs(1),
Use: "get-avs-list <operatorAddr>",
Short: "Get list of AVSs by operator",
Long: "Get a list of AVSs to which an operator has opted in",
Example: "exocored query operator get-avs-list exo1mq6pj6f5tafmgkk6lehew5radfq3w20gpegzs5",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
addr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
Expand Down

0 comments on commit 2a1db4c

Please sign in to comment.