diff --git a/internal/cmd/coinset/get_block_record_by_height.go b/internal/cmd/coinset/get_block_record_by_height.go index df3d33b..98e36da 100644 --- a/internal/cmd/coinset/get_block_record_by_height.go +++ b/internal/cmd/coinset/get_block_record_by_height.go @@ -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{}{} diff --git a/internal/cmd/coinset/get_block_spends_with_conditions.go b/internal/cmd/coinset/get_block_spends_with_conditions.go new file mode 100644 index 0000000..d6c7511 --- /dev/null +++ b/internal/cmd/coinset/get_block_spends_with_conditions.go @@ -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 ", + 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) + }, +} \ No newline at end of file