mirror of
https://github.com/FlipsideCrypto/dcrd.git
synced 2026-02-06 10:56:47 +00:00
dcrjson: Add listtickets command.
This adds an RPC to list all tickets belonging to current wallet with ticket, spender transactions' info and status.
This commit is contained in:
parent
5b8450a6e6
commit
e2effe836b
@ -606,6 +606,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{}
|
||||
|
||||
@ -1228,6 +1238,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)
|
||||
|
||||
@ -185,6 +185,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
|
||||
|
||||
@ -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=
|
||||
|
||||
@ -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=
|
||||
|
||||
Loading…
Reference in New Issue
Block a user