Skip to content

Commit a3f38ac

Browse files
committed
fix claim_search
1 parent a17fa3a commit a3f38ac

File tree

1 file changed

+13
-32
lines changed

1 file changed

+13
-32
lines changed

extras/jsonrpc/daemon.go

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -470,40 +470,21 @@ func (d *Client) Resolve(urls string) (*ResolveResponse, error) {
470470
})
471471
}
472472

473-
/*
474-
// use resolve?
475-
func (d *Client) NumClaimsInChannel(channelClaimID string) (uint64, error) {
476-
response := new(NumClaimsInChannelResponse)
477-
err := d.call(response, "claim_search", map[string]interface{}{
478-
"channel_id": channelClaimID,
479-
})
480-
if err != nil {
481-
return 0, err
482-
} else if response == nil {
483-
return 0, errors.Err("no response")
484-
}
485-
486-
channel, ok := (*response)[uri]
487-
if !ok {
488-
return 0, errors.Err("url not in response")
489-
}
490-
if channel.Error != nil {
491-
if strings.Contains(*channel.Error, "cannot be resolved") {
492-
return 0, nil
493-
}
494-
return 0, errors.Err(*channel.Error)
495-
}
496-
return *channel.ClaimsInChannel, nil
497-
}
498-
*/
499473
func (d *Client) ClaimSearch(claimName, claimID, txid *string, nout *uint) (*ClaimSearchResponse, error) {
500474
response := new(ClaimSearchResponse)
501-
return response, d.call(response, "claim_search", map[string]interface{}{
502-
"claim_id": claimID,
503-
"txid": txid,
504-
"nout": nout,
505-
"name": claimName,
506-
})
475+
args := struct {
476+
ClaimID *string `json:"claim_id,omitempty"`
477+
TXID *string `json:"txid,omitempty"`
478+
Nout *uint `json:"nout,omitempty"`
479+
Name *string `json:"name,omitempty"`
480+
}{
481+
ClaimID: claimID,
482+
TXID: txid,
483+
Nout: nout,
484+
Name: claimName,
485+
}
486+
structs.DefaultTagName = "json"
487+
return response, d.call(response, "claim_search", structs.Map(args))
507488
}
508489

509490
func (d *Client) ChannelExport(channelClaimID string, channelName, accountID *string) (*ChannelExportResponse, error) {

0 commit comments

Comments
 (0)