Skip to content

Commit

Permalink
added get_block_spends_with_conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
cameroncooper committed Feb 15, 2024
1 parent 2446c61 commit b482bc7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/cmd/coinset/get_block_record_by_height.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ var getBlockRecordByHeightCmd = &cobra.Command{
}
return fmt.Errorf("invalid height specified: %s", args[0])
},
Short: "Retrieves a summary of the current state of the blockchain and full node",
Long: `Retrieves a summary of the current state of the blockchain and full node`,
Short: "etrieves a block record by height",
Long: `etrieves a block record by height`,
Run: func(cmd *cobra.Command, args []string) {
height, _ := strconv.Atoi(args[0])
jsonData := map[string]interface{}{}
Expand Down
31 changes: 31 additions & 0 deletions internal/cmd/coinset/get_block_spends_with_conditions.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(getBlockSpendsWithConditionsCmd)
}

var getBlockSpendsWithConditionsCmd = &cobra.Command{
Use: "get_block_spends_with_conditions <header_hash>",
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: "Retrieves every coin that was spent in a block with the returned conditions",
Long: `Retrieves every coin that was spent in a block with the returned conditions`,
Run: func(cmd *cobra.Command, args []string) {
jsonData := map[string]interface{}{}
jsonData["header_hash"] = formatHex(args[0])
makeRequest("get_block_spends_with_conditions", jsonData)
},
}

0 comments on commit b482bc7

Please sign in to comment.