Skip to content

Commit ae83dc8

Browse files
added get_mempool_items_by_coin_name (#12)
1 parent 62a9d91 commit ae83dc8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
func init() {
10+
rootCmd.AddCommand(getMempoolItemsByCoinName)
11+
}
12+
13+
var getMempoolItemsByCoinName = &cobra.Command{
14+
Use: "get_mempool_items_by_coin_name <coin_name>",
15+
Args: func(cmd *cobra.Command, args []string) error {
16+
if err := cobra.ExactArgs(1)(cmd, args); err != nil {
17+
return err
18+
}
19+
if isHex(args[0]) == true {
20+
return nil
21+
}
22+
return fmt.Errorf("invalid hex value specified: %s", args[0])
23+
},
24+
Short: "Returns mempool items by coin name",
25+
Long: "Returns mempool items by coin name",
26+
Run: func(cmd *cobra.Command, args []string) {
27+
jsonData := map[string]interface{}{}
28+
jsonData["coin_name"] = formatHex(args[0])
29+
makeRequest("get_mempool_items_by_coin_name", jsonData)
30+
},
31+
}

0 commit comments

Comments
 (0)