Skip to content

Commit

Permalink
added get_mempool_items_by_coin_name (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
cameroncooper authored Dec 8, 2024
1 parent 62a9d91 commit ae83dc8
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions internal/cmd/coinset/get_mempool_items_by_coin_name.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
)

func init() {
rootCmd.AddCommand(getMempoolItemsByCoinName)
}

var getMempoolItemsByCoinName = &cobra.Command{
Use: "get_mempool_items_by_coin_name <coin_name>",
Args: func(cmd *cobra.Command, args []string) error {
if err := cobra.ExactArgs(1)(cmd, args); err != nil {
return err
}
if isHex(args[0]) == true {
return nil
}
return fmt.Errorf("invalid hex value specified: %s", args[0])
},
Short: "Returns mempool items by coin name",
Long: "Returns mempool items by coin name",
Run: func(cmd *cobra.Command, args []string) {
jsonData := map[string]interface{}{}
jsonData["coin_name"] = formatHex(args[0])
makeRequest("get_mempool_items_by_coin_name", jsonData)
},
}

0 comments on commit ae83dc8

Please sign in to comment.