Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dcrjson: add listtickets command #1267

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions dcrjson/walletsvrcmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,16 @@ func NewListAccountsCmd(minConf *int) *ListAccountsCmd {
}
}

// ListTicketsCmd defines the listtickets JSON-RPC command.
type ListTicketsCmd struct {
}

// NewListTicketsCmd returns a new instance which can be used to issue a
// listtickets JSON-RPC command.
func NewListTicketsCmd() *ListTicketsCmd {
return &ListTicketsCmd{}
}

// ListLockUnspentCmd defines the listlockunspent JSON-RPC command.
type ListLockUnspentCmd struct{}

Expand Down Expand Up @@ -1331,6 +1341,7 @@ func init() {
MustRegisterCmd("listreceivedbyaddress", (*ListReceivedByAddressCmd)(nil), flags)
MustRegisterCmd("listscripts", (*ListScriptsCmd)(nil), flags)
MustRegisterCmd("listsinceblock", (*ListSinceBlockCmd)(nil), flags)
MustRegisterCmd("listtickets", (*ListTicketsCmd)(nil), flags)
MustRegisterCmd("listtransactions", (*ListTransactionsCmd)(nil), flags)
MustRegisterCmd("listunspent", (*ListUnspentCmd)(nil), flags)
MustRegisterCmd("lockunspent", (*LockUnspentCmd)(nil), flags)
Expand Down
38 changes: 38 additions & 0 deletions dcrjson/walletsvrresults.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,44 @@ type ListScriptsResult struct {
Scripts []ScriptInfo `json:"scripts"`
}

// ListTicketsTransactionSummaryInput defines the type used in the listtickets JSON-RPC
// result for the MyInputs field of Ticket and Spender command field.
type ListTicketsTransactionSummaryInput struct {
Index uint32 `json:"index"`
PreviousAccount string `json:"previousaccount"`
PreviousAmount float64 `json:"previousamount"`
}

// ListTicketsTransactionSummaryOutput defines the type used in the listtickets JSON-RPC
// result for the MyOutputs field of Ticket and Spender command field.
type ListTicketsTransactionSummaryOutput struct {
Index uint32 `json:"index"`
Account string `json:"account"`
Internal bool `json:"internal"`
Amount float64 `json:"amount"`
Address string `json:"address"`
OutputScript string `json:"outputscript"`
}

// ListTicketsTransactionSummary defines the type used in the listtickets JSON-RPC
// result for the Ticket and Spender command fields.
type ListTicketsTransactionSummary struct {
Hash string `json:"hash"`
Transaction string `json:"transaction"`
MyInputs []ListTicketsTransactionSummaryInput `json:"myinputs"`
MyOutputs []ListTicketsTransactionSummaryOutput `json:"myoutputs"`
Fee float64 `json:"fee"`
Timestamp int64 `json:"timestamp"`
Type string `json:"type"`
}

// ListTicketsResult models the data from the listtickets command.
type ListTicketsResult struct {
Ticket *ListTicketsTransactionSummary `json:"ticket"`
Spender *ListTicketsTransactionSummary `json:"spender"`
Status string `json:"status"`
}

// ListTransactionsTxType defines the type used in the listtransactions JSON-RPC
// result for the TxType command field.
type ListTransactionsTxType string
Expand Down
1 change: 1 addition & 0 deletions mining/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/blake256 v1.0.0 h1:6gUgI5MHdz9g0TdrgKqXsoDX+Zjxmm1Sc6OsoGru50I=
github.com/dchest/blake256 v1.0.0/go.mod h1:xXNWCE1jsAP8DAjP+rKw2MbeqLczjI3TRx2VK+9OEYY=
github.com/dchest/siphash v1.2.0/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4=
github.com/decred/base58 v1.0.0 h1:BVi1FQCThIjZ0ehG+I99NJ51o0xcc9A/fDKhmJxY6+w=
github.com/decred/base58 v1.0.0/go.mod h1:LLY1p5e3g91byL/UO1eiZaYd+uRoVRarybgcoymu9Ks=
github.com/decred/dcrd/blockchain v1.0.1 h1:7cviDS26sZ9ZyTFka3aC9C/EChXBslmAvse+4nF5d60=
Expand Down
1 change: 1 addition & 0 deletions peer/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/blake256 v1.0.0 h1:6gUgI5MHdz9g0TdrgKqXsoDX+Zjxmm1Sc6OsoGru50I=
github.com/dchest/blake256 v1.0.0/go.mod h1:xXNWCE1jsAP8DAjP+rKw2MbeqLczjI3TRx2VK+9OEYY=
github.com/dchest/siphash v1.2.0/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4=
github.com/decred/base58 v1.0.0 h1:BVi1FQCThIjZ0ehG+I99NJ51o0xcc9A/fDKhmJxY6+w=
github.com/decred/base58 v1.0.0/go.mod h1:LLY1p5e3g91byL/UO1eiZaYd+uRoVRarybgcoymu9Ks=
github.com/decred/dcrd/blockchain v1.0.1 h1:7cviDS26sZ9ZyTFka3aC9C/EChXBslmAvse+4nF5d60=
Expand Down