()
| 34 | } |
| 35 | |
| 36 | func GetCmdQueryPositionsForAddress() *cobra.Command { |
| 37 | cmd := &cobra.Command{ |
| 38 | Use: "positions-for-address [address]", |
| 39 | Short: "query positions for an address", |
| 40 | Args: cobra.ExactArgs(1), |
| 41 | RunE: func(cmd *cobra.Command, args []string) error { |
| 42 | clientCtx, err := client.GetClientQueryContext(cmd) |
| 43 | if err != nil { |
| 44 | return err |
| 45 | } |
| 46 | |
| 47 | addr, err := sdk.AccAddressFromBech32(args[0]) |
| 48 | if err != nil { |
| 49 | return err |
| 50 | } |
| 51 | |
| 52 | pageReq, err := client.ReadPageRequest(cmd.Flags()) |
| 53 | if err != nil { |
| 54 | return err |
| 55 | } |
| 56 | |
| 57 | queryClient := types.NewQueryClient(clientCtx) |
| 58 | res, err := queryClient.GetPositionsForAddress(context.Background(), &types.PositionsForAddressRequest{ |
| 59 | Address: addr.String(), |
| 60 | Pagination: pageReq, |
| 61 | }) |
| 62 | if err != nil { |
| 63 | return err |
| 64 | } |
| 65 | |
| 66 | return clientCtx.PrintProto(res) |
| 67 | }, |
| 68 | } |
| 69 | flags.AddQueryFlagsToCmd(cmd) |
| 70 | flags.AddPaginationFlagsToCmd(cmd, "positions-for-address") |
| 71 | return cmd |
| 72 | } |
| 73 | |
| 74 | func GetCmdQueryPositionsForPool() *cobra.Command { |
| 75 | cmd := &cobra.Command{ |
no test coverage detected