Skip to content

Commit 1155ea6

Browse files
committed
add stream_list
1 parent 6918a24 commit 1155ea6

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

extras/jsonrpc/daemon.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,18 @@ func (d *Client) AddressList(account *string, address *string) (*AddressListResp
429429
return response, d.call(response, "address_list", structs.Map(args))
430430
}
431431

432+
func (d *Client) StreamList(account *string) (*StreamListResponse, error) {
433+
response := new(StreamListResponse)
434+
err := d.call(response, "stream_list", map[string]interface{}{
435+
"account_id": account,
436+
"include_protobuf": true,
437+
})
438+
if err != nil {
439+
return nil, err
440+
}
441+
return response, nil
442+
}
443+
432444
func (d *Client) ClaimList(account *string, page uint64, pageSize uint64) (*ClaimListResponse, error) {
433445
if page == 0 {
434446
return nil, errors.Err("pages start from 1")

extras/jsonrpc/daemon_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ func TestClient_ClaimList(t *testing.T) {
280280
prettyPrint(*got)
281281
}
282282

283+
func TestClient_StreamList(t *testing.T) {
284+
_ = os.Setenv("BLOCKCHAIN_NAME", "lbrycrd_regtest")
285+
d := NewClient("")
286+
got, err := d.StreamList(nil)
287+
if err != nil {
288+
t.Error(err)
289+
return
290+
}
291+
prettyPrint(*got)
292+
}
293+
283294
func TestClient_TransactionList(t *testing.T) {
284295
_ = os.Setenv("BLOCKCHAIN_NAME", "lbrycrd_regtest")
285296
d := NewClient("")

extras/jsonrpc/daemon_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ func (c *Claim) GetStreamSizeByMagic() (streamSize uint64, e error) {
396396
return streamSize, nil
397397
}
398398

399+
type StreamListResponse []Claim
400+
399401
type ClaimListResponse struct {
400402
Claims []Claim `json:"items"`
401403
Page uint64 `json:"page"`

0 commit comments

Comments
 (0)