MCPcopy Create free account
hub / github.com/Sifchain/sifnode / GetCmdQueryPositions

Function GetCmdQueryPositions

x/margin/client/cli/query.go:109–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107}
108
109func GetCmdQueryPositions() *cobra.Command {
110 cmd := &cobra.Command{
111 Use: "positions",
112 Short: "query all positions",
113 Args: cobra.ExactArgs(0),
114 RunE: func(cmd *cobra.Command, args []string) error {
115 clientCtx, err := client.GetClientQueryContext(cmd)
116 if err != nil {
117 return err
118 }
119
120 pageReq, err := client.ReadPageRequest(cmd.Flags())
121 if err != nil {
122 return err
123 }
124
125 queryClient := types.NewQueryClient(clientCtx)
126 res, err := queryClient.GetPositions(context.Background(), &types.PositionsRequest{
127 Pagination: pageReq,
128 })
129 if err != nil {
130 return err
131 }
132
133 return clientCtx.PrintProto(res)
134 },
135 }
136 flags.AddQueryFlagsToCmd(cmd)
137 flags.AddPaginationFlagsToCmd(cmd, "positions")
138 return cmd
139}
140
141func GetCmdQueryStatus() *cobra.Command {
142 cmd := &cobra.Command{

Callers 1

GetQueryCmdFunction · 0.85

Calls 2

GetPositionsMethod · 0.95
NewQueryClientFunction · 0.92

Tested by

no test coverage detected