diff --git a/internal/cmd/coinset/get_address_by_puzzle_hash.go b/internal/cmd/coinset/get_address_by_puzzle_hash.go index b8f15d4..a39369d 100644 --- a/internal/cmd/coinset/get_address_by_puzzle_hash.go +++ b/internal/cmd/coinset/get_address_by_puzzle_hash.go @@ -45,7 +45,7 @@ var getAddressByPuzzleHashCmd = &cobra.Command{ jsonData := map[string]interface{}{} jsonData["puzzle_hash"] = formatHex(args[0]) - hexBytes, err := hex.DecodeString(args[0]) + hexBytes, err := hex.DecodeString(cleanHex(args[0])) if err != nil { fmt.Println(err) return diff --git a/internal/cmd/coinset/util.go b/internal/cmd/coinset/util.go index 86bddcb..8c788ec 100644 --- a/internal/cmd/coinset/util.go +++ b/internal/cmd/coinset/util.go @@ -31,6 +31,13 @@ func formatHex(str string) string { return "0x" + str } +func cleanHex(str string) string { + if str[:2] == "0x" { + return str[2:] + } + return str +} + func apiRoot() string { if api != "" { return api