From f827da4c61e709719e668682dd99a1266d36897a Mon Sep 17 00:00:00 2001
From: Niko Storni <niko@lbry.io>
Date: Thu, 18 Apr 2019 13:07:47 -0400
Subject: [PATCH] reinstate claim type

fix bug

adjust types

add temporary video_duration until the SDK patches it
---
 extras/jsonrpc/daemon.go       | 17 ++++++------
 extras/jsonrpc/daemon_test.go  |  4 +--
 extras/jsonrpc/daemon_types.go | 48 ++++++++++++++++------------------
 3 files changed, 33 insertions(+), 36 deletions(-)

diff --git a/extras/jsonrpc/daemon.go b/extras/jsonrpc/daemon.go
index a63ede9..393abe8 100644
--- a/extras/jsonrpc/daemon.go
+++ b/extras/jsonrpc/daemon.go
@@ -238,8 +238,8 @@ type ChannelCreateOptions struct {
 	CoverURL           *string `json:"cover_url,omitempty"`
 }
 
-func (d *Client) ChannelCreate(name string, bid float64, options ChannelCreateOptions) (*PublishResponse, error) {
-	response := new(PublishResponse)
+func (d *Client) ChannelCreate(name string, bid float64, options ChannelCreateOptions) (*TransactionSummary, error) {
+	response := new(TransactionSummary)
 	args := struct {
 		Name                 string `json:"name"`
 		Bid                  string `json:"bid"`
@@ -261,12 +261,13 @@ type StreamCreateOptions struct {
 	License            *string     `json:"license,omitempty"`
 	LicenseURL         *string     `json:"license_url,omitempty"`
 	StreamType         *streamType `json:"stream_type,omitempty"`
-	ReleaseTime        *int        `json:"release_time,omitempty"`
-	Duration           *int        `json:"duration,omitempty"`
-	ImageWidth         *int        `json:"image_width,omitempty"`
-	ImageHeight        *int        `json:"image_height,omitempty"`
-	VideoWidth         *int        `json:"video_width,omitempty"`
-	VideoHeight        *int        `json:"video_height,omitempty"`
+	ReleaseTime        *int64      `json:"release_time,omitempty"`
+	Duration           *uint64     `json:"duration,omitempty"`
+	VideoDuration      *uint64     `json:"video_duration,omitempty"` //TODO: this shouldn't exist
+	ImageWidth         *uint       `json:"image_width,omitempty"`
+	ImageHeight        *uint       `json:"image_height,omitempty"`
+	VideoWidth         *uint       `json:"video_width,omitempty"`
+	VideoHeight        *uint       `json:"video_height,omitempty"`
 	Preview            *string     `json:"preview,omitempty"`
 	AllowDuplicateName *bool       `json:"allow_duplicate_name,omitempty"`
 	ChannelName        *string     `json:"channel_name,omitempty"`
diff --git a/extras/jsonrpc/daemon_test.go b/extras/jsonrpc/daemon_test.go
index 3137731..644df25 100644
--- a/extras/jsonrpc/daemon_test.go
+++ b/extras/jsonrpc/daemon_test.go
@@ -150,8 +150,8 @@ func TestClient_ChannelAbandon(t *testing.T) {
 	if err != nil {
 		t.Error(err)
 	}
-	txID := channelResponse.Output.Txid
-	nout := channelResponse.Output.Nout
+	txID := channelResponse.Outputs[0].Txid
+	nout := channelResponse.Outputs[0].Nout
 	time.Sleep(10 * time.Second)
 	got, err := d.ChannelAbandon(txID, nout, nil, false)
 	if err != nil {
diff --git a/extras/jsonrpc/daemon_types.go b/extras/jsonrpc/daemon_types.go
index 2f08dc6..e70649e 100644
--- a/extras/jsonrpc/daemon_types.go
+++ b/extras/jsonrpc/daemon_types.go
@@ -262,34 +262,30 @@ type Support struct {
 }
 
 type Claim struct {
-	Address          string    `json:"address"`
-	Amount           string    `json:"amount"`
-	ChannelName      *string   `json:"channel_name,omitempty"`
-	ClaimID          string    `json:"claim_id"`
-	ClaimSequence    int64     `json:"claim_sequence"`
-	DecodedClaim     bool      `json:"decoded_claim"`
-	Depth            int64     `json:"depth"`
-	EffectiveAmount  string    `json:"effective_amount"`
-	HasSignature     *bool     `json:"has_signature,omitempty"`
-	Height           int       `json:"height"`
-	Hex              string    `json:"hex"`
-	Name             string    `json:"name"`
-	NormalizedName   string    `json:"normalized_name"`
-	Nout             uint64    `json:"nout"`
-	PermanentUrl     string    `json:"permanent_url"`
-	SignatureIsValid *bool     `json:"signature_is_valid,omitempty"`
-	Supports         []Support `json:"supports"`
-	Txid             string    `json:"txid"`
-	//Type             string           `json:"type"`
-	ValidAtHeight int              `json:"valid_at_height"`
-	Value         lbryschema.Claim `json:"value"`
+	Address          string           `json:"address"`
+	Amount           string           `json:"amount"`
+	ChannelName      *string          `json:"channel_name,omitempty"`
+	ClaimID          string           `json:"claim_id"`
+	ClaimSequence    int64            `json:"claim_sequence"`
+	DecodedClaim     bool             `json:"decoded_claim"`
+	Depth            int64            `json:"depth"`
+	EffectiveAmount  string           `json:"effective_amount"`
+	HasSignature     *bool            `json:"has_signature,omitempty"`
+	Height           int              `json:"height"`
+	Hex              string           `json:"hex"`
+	Name             string           `json:"name"`
+	NormalizedName   string           `json:"normalized_name"`
+	Nout             uint64           `json:"nout"`
+	PermanentUrl     string           `json:"permanent_url"`
+	SignatureIsValid *bool            `json:"signature_is_valid,omitempty"`
+	Supports         []Support        `json:"supports"`
+	Txid             string           `json:"txid"`
+	Type             string           `json:"type"`
+	ValidAtHeight    int              `json:"valid_at_height"`
+	Value            lbryschema.Claim `json:"value"`
 }
 
-type ClaimListResponse []Claim /* {
-	Claims                []Claim   `json:"claims"`
-	LastTakeoverHeight    int       `json:"last_takeover_height"`
-	SupportsWithoutClaims []Support `json:"supports_without_claims"`
-}*/
+type ClaimListResponse []Claim
 
 type ClaimListMineResponse struct {
 	Claims     []Claim `json:"items"`