File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments