decred.org/dcrwallet/v3@v3.1.0/rpc/jsonrpc/types/methods.go (about) 1 // Copyright (c) 2014 The btcsuite developers 2 // Copyright (c) 2015-2021 The Decred developers 3 // Use of this source code is governed by an ISC 4 // license that can be found in the LICENSE file. 5 6 // NOTE: This file is intended to house the RPC commands that are supported by 7 // a wallet server. 8 9 package types 10 11 import ( 12 "github.com/decred/dcrd/dcrjson/v4" 13 dcrdtypes "github.com/decred/dcrd/rpc/jsonrpc/types/v4" 14 ) 15 16 // Method describes the exact type used when registering methods with dcrjson. 17 type Method string 18 19 // AbandonTransactionCmd describes the command and parameters for performing the 20 // abandontransaction method. 21 type AbandonTransactionCmd struct { 22 Hash string `json:"hash"` 23 } 24 25 // AccountAddressIndexCmd is a type handling custom marshaling and 26 // unmarshaling of accountaddressindex JSON wallet extension 27 // commands. 28 type AccountAddressIndexCmd struct { 29 Account string `json:"account"` 30 Branch int `json:"branch"` 31 } 32 33 // NewAccountAddressIndexCmd creates a new AccountAddressIndexCmd. 34 func NewAccountAddressIndexCmd(acct string, branch int) *AccountAddressIndexCmd { 35 return &AccountAddressIndexCmd{ 36 Account: acct, 37 Branch: branch, 38 } 39 } 40 41 // AccountSyncAddressIndexCmd is a type handling custom marshaling and 42 // unmarshaling of accountsyncaddressindex JSON wallet extension 43 // commands. 44 type AccountSyncAddressIndexCmd struct { 45 Account string `json:"account"` 46 Branch int `json:"branch"` 47 Index int `json:"index"` 48 } 49 50 // NewAccountSyncAddressIndexCmd creates a new AccountSyncAddressIndexCmd. 51 func NewAccountSyncAddressIndexCmd(acct string, branch int, 52 idx int) *AccountSyncAddressIndexCmd { 53 return &AccountSyncAddressIndexCmd{ 54 Account: acct, 55 Branch: branch, 56 Index: idx, 57 } 58 } 59 60 // AddMultisigAddressCmd defines the addmutisigaddress JSON-RPC command. 61 type AddMultisigAddressCmd struct { 62 NRequired int 63 Keys []string 64 Account *string 65 } 66 67 // NewAddMultisigAddressCmd returns a new instance which can be used to issue a 68 // addmultisigaddress JSON-RPC command. 69 // 70 // The parameters which are pointers indicate they are optional. Passing nil 71 // for optional parameters will use the default value. 72 func NewAddMultisigAddressCmd(nRequired int, keys []string, account *string) *AddMultisigAddressCmd { 73 return &AddMultisigAddressCmd{ 74 NRequired: nRequired, 75 Keys: keys, 76 Account: account, 77 } 78 } 79 80 // AddTransactionCmd manually adds a single mined transaction to the wallet, 81 // which may be useful to add a transaction which was mined before a private 82 // key was imported. 83 // There is currently no validation that the transaction is indeed mined in 84 // this block. 85 type AddTransactionCmd struct { 86 BlockHash string `json:"blockhash"` 87 Transaction string `json:"transaction"` 88 } 89 90 // AuditReuseCmd defines the auditreuse JSON-RPC command. 91 // 92 // This method returns an object keying reused addresses to two or more outputs 93 // referencing them, optionally filtering results of address reusage since a 94 // particular block height. 95 type AuditReuseCmd struct { 96 Since *int32 `json:"since"` 97 } 98 99 // ConsolidateCmd is a type handling custom marshaling and 100 // unmarshaling of consolidate JSON wallet extension 101 // commands. 102 type ConsolidateCmd struct { 103 Inputs int `json:"inputs"` 104 Account *string 105 Address *string 106 } 107 108 // NewConsolidateCmd creates a new ConsolidateCmd. 109 func NewConsolidateCmd(inputs int, acct *string, addr *string) *ConsolidateCmd { 110 return &ConsolidateCmd{Inputs: inputs, Account: acct, Address: addr} 111 } 112 113 // CreateMultisigCmd defines the createmultisig JSON-RPC command. 114 type CreateMultisigCmd struct { 115 NRequired int 116 Keys []string 117 } 118 119 // NewCreateMultisigCmd returns a new instance which can be used to issue a 120 // createmultisig JSON-RPC command. 121 func NewCreateMultisigCmd(nRequired int, keys []string) *CreateMultisigCmd { 122 return &CreateMultisigCmd{ 123 NRequired: nRequired, 124 Keys: keys, 125 } 126 } 127 128 // CreateSignatureCmd defines the createsignature JSON-RPC command. 129 type CreateSignatureCmd struct { 130 Address string 131 InputIndex int 132 HashType int 133 PreviousPkScript string 134 SerializedTransaction string 135 } 136 137 // CreateNewAccountCmd defines the createnewaccount JSON-RPC command. 138 type CreateNewAccountCmd struct { 139 Account string 140 } 141 142 // NewCreateNewAccountCmd returns a new instance which can be used to issue a 143 // createnewaccount JSON-RPC command. 144 func NewCreateNewAccountCmd(account string) *CreateNewAccountCmd { 145 return &CreateNewAccountCmd{ 146 Account: account, 147 } 148 } 149 150 // CreateVotingAccountCmd is a type for handling custom marshaling and 151 // unmarshalling of createvotingaccount JSON-RPC command. 152 type CreateVotingAccountCmd struct { 153 Name string 154 PubKey string 155 ChildIndex *uint32 `jsonrpcdefault:"0"` 156 } 157 158 // NewCreateVotingAccountCmd creates a new CreateVotingAccountCmd. 159 func NewCreateVotingAccountCmd(name, pubKey string, childIndex *uint32) *CreateVotingAccountCmd { 160 return &CreateVotingAccountCmd{name, pubKey, childIndex} 161 } 162 163 // DumpPrivKeyCmd defines the dumpprivkey JSON-RPC command. 164 type DumpPrivKeyCmd struct { 165 Address string 166 } 167 168 // NewDumpPrivKeyCmd returns a new instance which can be used to issue a 169 // dumpprivkey JSON-RPC command. 170 func NewDumpPrivKeyCmd(address string) *DumpPrivKeyCmd { 171 return &DumpPrivKeyCmd{ 172 Address: address, 173 } 174 } 175 176 // FundRawTransactionOptions represents the optional inputs to fund 177 // a raw transaction. 178 type FundRawTransactionOptions struct { 179 ChangeAddress *string `json:"changeaddress"` 180 FeeRate *float64 `json:"feerate"` 181 ConfTarget *int32 `json:"conf_target"` 182 } 183 184 // FundRawTransactionCmd is a type handling custom marshaling and 185 // unmarshaling of fundrawtransaction JSON wallet extension commands. 186 type FundRawTransactionCmd struct { 187 HexString string 188 FundAccount string 189 Options *FundRawTransactionOptions 190 } 191 192 // NewFundRawTransactionCmd returns a new instance which can be used to issue a 193 // fundrawtransaction JSON-RPC command. 194 func NewFundRawTransactionCmd(hexString string, fundAccount string, options *FundRawTransactionOptions) *FundRawTransactionCmd { 195 return &FundRawTransactionCmd{ 196 HexString: hexString, 197 FundAccount: fundAccount, 198 Options: options, 199 } 200 } 201 202 // GetAccountCmd defines the getaccount JSON-RPC command. 203 type GetAccountCmd struct { 204 Address string 205 } 206 207 // NewGetAccountCmd returns a new instance which can be used to issue a 208 // getaccount JSON-RPC command. 209 func NewGetAccountCmd(address string) *GetAccountCmd { 210 return &GetAccountCmd{ 211 Address: address, 212 } 213 } 214 215 // GetAccountAddressCmd defines the getaccountaddress JSON-RPC command. 216 type GetAccountAddressCmd struct { 217 Account string 218 } 219 220 // NewGetAccountAddressCmd returns a new instance which can be used to issue a 221 // getaccountaddress JSON-RPC command. 222 func NewGetAccountAddressCmd(account string) *GetAccountAddressCmd { 223 return &GetAccountAddressCmd{ 224 Account: account, 225 } 226 } 227 228 // GetAddressesByAccountCmd defines the getaddressesbyaccount JSON-RPC command. 229 type GetAddressesByAccountCmd struct { 230 Account string 231 } 232 233 // NewGetAddressesByAccountCmd returns a new instance which can be used to issue 234 // a getaddressesbyaccount JSON-RPC command. 235 func NewGetAddressesByAccountCmd(account string) *GetAddressesByAccountCmd { 236 return &GetAddressesByAccountCmd{ 237 Account: account, 238 } 239 } 240 241 // GetBalanceCmd defines the getbalance JSON-RPC command. 242 type GetBalanceCmd struct { 243 Account *string 244 MinConf *int `jsonrpcdefault:"1"` 245 } 246 247 // NewGetBalanceCmd returns a new instance which can be used to issue a 248 // getbalance JSON-RPC command. 249 // 250 // The parameters which are pointers indicate they are optional. Passing nil 251 // for optional parameters will use the default value. 252 func NewGetBalanceCmd(account *string, minConf *int) *GetBalanceCmd { 253 return &GetBalanceCmd{ 254 Account: account, 255 MinConf: minConf, 256 } 257 } 258 259 // GetMasterPubkeyCmd is a type handling custom marshaling and unmarshaling of 260 // getmasterpubkey JSON wallet extension commands. 261 type GetMasterPubkeyCmd struct { 262 Account *string 263 } 264 265 // NewGetMasterPubkeyCmd creates a new GetMasterPubkeyCmd. 266 func NewGetMasterPubkeyCmd(acct *string) *GetMasterPubkeyCmd { 267 return &GetMasterPubkeyCmd{Account: acct} 268 } 269 270 // GetMultisigOutInfoCmd is a type handling custom marshaling and 271 // unmarshaling of getmultisigoutinfo JSON websocket extension 272 // commands. 273 type GetMultisigOutInfoCmd struct { 274 Hash string 275 Index uint32 276 } 277 278 // NewGetMultisigOutInfoCmd creates a new GetMultisigOutInfoCmd. 279 func NewGetMultisigOutInfoCmd(hash string, index uint32) *GetMultisigOutInfoCmd { 280 return &GetMultisigOutInfoCmd{hash, index} 281 } 282 283 // GetNewAddressCmd defines the getnewaddress JSON-RPC command. 284 type GetNewAddressCmd struct { 285 Account *string 286 GapPolicy *string 287 } 288 289 // NewGetNewAddressCmd returns a new instance which can be used to issue a 290 // getnewaddress JSON-RPC command. 291 // 292 // The parameters which are pointers indicate they are optional. Passing nil 293 // for optional parameters will use the default value. 294 func NewGetNewAddressCmd(account *string, gapPolicy *string) *GetNewAddressCmd { 295 return &GetNewAddressCmd{ 296 Account: account, 297 GapPolicy: gapPolicy, 298 } 299 } 300 301 // GetRawChangeAddressCmd defines the getrawchangeaddress JSON-RPC command. 302 type GetRawChangeAddressCmd struct { 303 Account *string 304 } 305 306 // NewGetRawChangeAddressCmd returns a new instance which can be used to issue a 307 // getrawchangeaddress JSON-RPC command. 308 // 309 // The parameters which are pointers indicate they are optional. Passing nil 310 // for optional parameters will use the default value. 311 func NewGetRawChangeAddressCmd(account *string) *GetRawChangeAddressCmd { 312 return &GetRawChangeAddressCmd{ 313 Account: account, 314 } 315 } 316 317 // GetReceivedByAccountCmd defines the getreceivedbyaccount JSON-RPC command. 318 type GetReceivedByAccountCmd struct { 319 Account string 320 MinConf *int `jsonrpcdefault:"1"` 321 } 322 323 // NewGetReceivedByAccountCmd returns a new instance which can be used to issue 324 // a getreceivedbyaccount JSON-RPC command. 325 // 326 // The parameters which are pointers indicate they are optional. Passing nil 327 // for optional parameters will use the default value. 328 func NewGetReceivedByAccountCmd(account string, minConf *int) *GetReceivedByAccountCmd { 329 return &GetReceivedByAccountCmd{ 330 Account: account, 331 MinConf: minConf, 332 } 333 } 334 335 // GetReceivedByAddressCmd defines the getreceivedbyaddress JSON-RPC command. 336 type GetReceivedByAddressCmd struct { 337 Address string 338 MinConf *int `jsonrpcdefault:"1"` 339 } 340 341 // NewGetReceivedByAddressCmd returns a new instance which can be used to issue 342 // a getreceivedbyaddress JSON-RPC command. 343 // 344 // The parameters which are pointers indicate they are optional. Passing nil 345 // for optional parameters will use the default value. 346 func NewGetReceivedByAddressCmd(address string, minConf *int) *GetReceivedByAddressCmd { 347 return &GetReceivedByAddressCmd{ 348 Address: address, 349 MinConf: minConf, 350 } 351 } 352 353 // GetStakeInfoCmd is a type handling custom marshaling and 354 // unmarshaling of getstakeinfo JSON wallet extension commands. 355 type GetStakeInfoCmd struct { 356 } 357 358 // NewGetStakeInfoCmd creates a new GetStakeInfoCmd. 359 func NewGetStakeInfoCmd() *GetStakeInfoCmd { 360 return &GetStakeInfoCmd{} 361 } 362 363 // GetTicketsCmd is a type handling custom marshaling and 364 // unmarshaling of gettickets JSON wallet extension 365 // commands. 366 type GetTicketsCmd struct { 367 IncludeImmature bool 368 } 369 370 // NewGetTicketsCmd returns a new instance which can be used to issue a 371 // gettickets JSON-RPC command. 372 func NewGetTicketsCmd(includeImmature bool) *GetTicketsCmd { 373 return &GetTicketsCmd{includeImmature} 374 } 375 376 // GetTransactionCmd defines the gettransaction JSON-RPC command. 377 type GetTransactionCmd struct { 378 Txid string 379 IncludeWatchOnly *bool `jsonrpcdefault:"false"` 380 } 381 382 // NewGetTransactionCmd returns a new instance which can be used to issue a 383 // gettransaction JSON-RPC command. 384 // 385 // The parameters which are pointers indicate they are optional. Passing nil 386 // for optional parameters will use the default value. 387 func NewGetTransactionCmd(txHash string, includeWatchOnly *bool) *GetTransactionCmd { 388 return &GetTransactionCmd{ 389 Txid: txHash, 390 IncludeWatchOnly: includeWatchOnly, 391 } 392 } 393 394 // GetUnconfirmedBalanceCmd defines the getunconfirmedbalance JSON-RPC command. 395 type GetUnconfirmedBalanceCmd struct { 396 Account *string 397 } 398 399 // NewGetUnconfirmedBalanceCmd returns a new instance which can be used to issue 400 // a getunconfirmedbalance JSON-RPC command. 401 // 402 // The parameters which are pointers indicate they are optional. Passing nil 403 // for optional parameters will use the default value. 404 func NewGetUnconfirmedBalanceCmd(account *string) *GetUnconfirmedBalanceCmd { 405 return &GetUnconfirmedBalanceCmd{ 406 Account: account, 407 } 408 } 409 410 // GetVoteChoicesCmd returns a new instance which can be used to issue a 411 // getvotechoices JSON-RPC command. 412 type GetVoteChoicesCmd struct { 413 TicketHash *string 414 } 415 416 // NewGetVoteChoicesCmd returns a new instance which can be used to 417 // issue a JSON-RPC getvotechoices command. 418 func NewGetVoteChoicesCmd(tickethash *string) *GetVoteChoicesCmd { 419 return &GetVoteChoicesCmd{ 420 TicketHash: tickethash, 421 } 422 } 423 424 // GetWalletFeeCmd defines the getwalletfee JSON-RPC command. 425 type GetWalletFeeCmd struct{} 426 427 // NewGetWalletFeeCmd returns a new instance which can be used to issue a 428 // getwalletfee JSON-RPC command. 429 func NewGetWalletFeeCmd() *GetWalletFeeCmd { 430 return &GetWalletFeeCmd{} 431 } 432 433 // ImportPrivKeyCmd defines the importprivkey JSON-RPC command. 434 type ImportPrivKeyCmd struct { 435 PrivKey string 436 Label *string 437 Rescan *bool `jsonrpcdefault:"true"` 438 ScanFrom *int 439 } 440 441 // NewImportPrivKeyCmd returns a new instance which can be used to issue a 442 // importprivkey JSON-RPC command. 443 // 444 // The parameters which are pointers indicate they are optional. Passing nil 445 // for optional parameters will use the default value. 446 func NewImportPrivKeyCmd(privKey string, label *string, rescan *bool, scanFrom *int) *ImportPrivKeyCmd { 447 return &ImportPrivKeyCmd{ 448 PrivKey: privKey, 449 Label: label, 450 Rescan: rescan, 451 ScanFrom: scanFrom, 452 } 453 } 454 455 // ImportPrivKeyCmd defines the importprivkey JSON-RPC command. 456 type ImportPubKeyCmd struct { 457 PubKey string 458 Label *string 459 Rescan *bool `jsonrpcdefault:"true"` 460 ScanFrom *int 461 } 462 463 // NewImportPubKeyCmd returns a new instance which can be used to issue a 464 // importpubkey JSON-RPC command. 465 // 466 // The parameters which are pointers indicate they are optional. Passing nil 467 // for optional parameters will use the default value. 468 func NewImportPubKeyCmd(pubKey string, label *string, rescan *bool, scanFrom *int) *ImportPubKeyCmd { 469 return &ImportPubKeyCmd{ 470 PubKey: pubKey, 471 Label: label, 472 Rescan: rescan, 473 ScanFrom: scanFrom, 474 } 475 } 476 477 // ImportScriptCmd is a type for handling custom marshaling and 478 // unmarshaling of importscript JSON wallet extension commands. 479 type ImportScriptCmd struct { 480 Hex string 481 Rescan *bool `jsonrpcdefault:"true"` 482 ScanFrom *int 483 } 484 485 // NewImportScriptCmd creates a new GetImportScriptCmd. 486 func NewImportScriptCmd(hex string, rescan *bool, scanFrom *int) *ImportScriptCmd { 487 return &ImportScriptCmd{hex, rescan, scanFrom} 488 } 489 490 // ImportXpubCmd is a type for handling custom marshaling and unmarshaling of 491 // importxpub JSON-RPC commands. 492 type ImportXpubCmd struct { 493 Name string `json:"name"` 494 Xpub string `json:"xpub"` 495 } 496 497 // ListAccountsCmd defines the listaccounts JSON-RPC command. 498 type ListAccountsCmd struct { 499 MinConf *int `jsonrpcdefault:"1"` 500 } 501 502 // NewListAccountsCmd returns a new instance which can be used to issue a 503 // listaccounts JSON-RPC command. 504 // 505 // The parameters which are pointers indicate they are optional. Passing nil 506 // for optional parameters will use the default value. 507 func NewListAccountsCmd(minConf *int) *ListAccountsCmd { 508 return &ListAccountsCmd{ 509 MinConf: minConf, 510 } 511 } 512 513 // ListLockUnspentCmd defines the listlockunspent JSON-RPC command. 514 type ListLockUnspentCmd struct { 515 Account *string 516 } 517 518 // NewListLockUnspentCmd returns a new instance which can be used to issue a 519 // listlockunspent JSON-RPC command. 520 func NewListLockUnspentCmd() *ListLockUnspentCmd { 521 return &ListLockUnspentCmd{} 522 } 523 524 // ListReceivedByAccountCmd defines the listreceivedbyaccount JSON-RPC command. 525 type ListReceivedByAccountCmd struct { 526 MinConf *int `jsonrpcdefault:"1"` 527 IncludeEmpty *bool `jsonrpcdefault:"false"` 528 IncludeWatchOnly *bool `jsonrpcdefault:"false"` 529 } 530 531 // NewListReceivedByAccountCmd returns a new instance which can be used to issue 532 // a listreceivedbyaccount JSON-RPC command. 533 // 534 // The parameters which are pointers indicate they are optional. Passing nil 535 // for optional parameters will use the default value. 536 func NewListReceivedByAccountCmd(minConf *int, includeEmpty, includeWatchOnly *bool) *ListReceivedByAccountCmd { 537 return &ListReceivedByAccountCmd{ 538 MinConf: minConf, 539 IncludeEmpty: includeEmpty, 540 IncludeWatchOnly: includeWatchOnly, 541 } 542 } 543 544 // ListReceivedByAddressCmd defines the listreceivedbyaddress JSON-RPC command. 545 type ListReceivedByAddressCmd struct { 546 MinConf *int `jsonrpcdefault:"1"` 547 IncludeEmpty *bool `jsonrpcdefault:"false"` 548 IncludeWatchOnly *bool `jsonrpcdefault:"false"` 549 } 550 551 // NewListReceivedByAddressCmd returns a new instance which can be used to issue 552 // a listreceivedbyaddress JSON-RPC command. 553 // 554 // The parameters which are pointers indicate they are optional. Passing nil 555 // for optional parameters will use the default value. 556 func NewListReceivedByAddressCmd(minConf *int, includeEmpty, includeWatchOnly *bool) *ListReceivedByAddressCmd { 557 return &ListReceivedByAddressCmd{ 558 MinConf: minConf, 559 IncludeEmpty: includeEmpty, 560 IncludeWatchOnly: includeWatchOnly, 561 } 562 } 563 564 // ListAddressTransactionsCmd defines the listaddresstransactions JSON-RPC 565 // command. 566 type ListAddressTransactionsCmd struct { 567 Addresses []string 568 Account *string 569 } 570 571 // NewListAddressTransactionsCmd returns a new instance which can be used to 572 // issue a listaddresstransactions JSON-RPC command. 573 // 574 // The parameters which are pointers indicate they are optional. Passing nil 575 // for optional parameters will use the default value. 576 func NewListAddressTransactionsCmd(addresses []string, account *string) *ListAddressTransactionsCmd { 577 return &ListAddressTransactionsCmd{ 578 Addresses: addresses, 579 Account: account, 580 } 581 } 582 583 // ListAllTransactionsCmd defines the listalltransactions JSON-RPC command. 584 type ListAllTransactionsCmd struct { 585 Account *string 586 } 587 588 // NewListAllTransactionsCmd returns a new instance which can be used to issue a 589 // listalltransactions JSON-RPC command. 590 // 591 // The parameters which are pointers indicate they are optional. Passing nil 592 // for optional parameters will use the default value. 593 func NewListAllTransactionsCmd(account *string) *ListAllTransactionsCmd { 594 return &ListAllTransactionsCmd{ 595 Account: account, 596 } 597 } 598 599 // ListSinceBlockCmd defines the listsinceblock JSON-RPC command. 600 type ListSinceBlockCmd struct { 601 BlockHash *string 602 TargetConfirmations *int `jsonrpcdefault:"1"` 603 IncludeWatchOnly *bool `jsonrpcdefault:"false"` 604 } 605 606 // NewListSinceBlockCmd returns a new instance which can be used to issue a 607 // listsinceblock JSON-RPC command. 608 // 609 // The parameters which are pointers indicate they are optional. Passing nil 610 // for optional parameters will use the default value. 611 func NewListSinceBlockCmd(blockHash *string, targetConfirms *int, includeWatchOnly *bool) *ListSinceBlockCmd { 612 return &ListSinceBlockCmd{ 613 BlockHash: blockHash, 614 TargetConfirmations: targetConfirms, 615 IncludeWatchOnly: includeWatchOnly, 616 } 617 } 618 619 // ListTransactionsCmd defines the listtransactions JSON-RPC command. 620 type ListTransactionsCmd struct { 621 Account *string 622 Count *int `jsonrpcdefault:"10"` 623 From *int `jsonrpcdefault:"0"` 624 IncludeWatchOnly *bool `jsonrpcdefault:"false"` 625 } 626 627 // NewListTransactionsCmd returns a new instance which can be used to issue a 628 // listtransactions JSON-RPC command. 629 // 630 // The parameters which are pointers indicate they are optional. Passing nil 631 // for optional parameters will use the default value. 632 func NewListTransactionsCmd(account *string, count, from *int, includeWatchOnly *bool) *ListTransactionsCmd { 633 return &ListTransactionsCmd{ 634 Account: account, 635 Count: count, 636 From: from, 637 IncludeWatchOnly: includeWatchOnly, 638 } 639 } 640 641 // ListUnspentCmd defines the listunspent JSON-RPC command. 642 type ListUnspentCmd struct { 643 MinConf *int `jsonrpcdefault:"1"` 644 MaxConf *int `jsonrpcdefault:"9999999"` 645 Addresses *[]string 646 Account *string 647 } 648 649 // NewListUnspentCmd returns a new instance which can be used to issue a 650 // listunspent JSON-RPC command. 651 // 652 // The parameters which are pointers indicate they are optional. Passing nil 653 // for optional parameters will use the default value. 654 func NewListUnspentCmd(minConf, maxConf *int, addresses *[]string) *ListUnspentCmd { 655 return &ListUnspentCmd{ 656 MinConf: minConf, 657 MaxConf: maxConf, 658 Addresses: addresses, 659 } 660 } 661 662 // LockUnspentCmd defines the lockunspent JSON-RPC command. 663 type LockUnspentCmd struct { 664 Unlock bool 665 Transactions []dcrdtypes.TransactionInput 666 } 667 668 // NewLockUnspentCmd returns a new instance which can be used to issue a 669 // lockunspent JSON-RPC command. 670 func NewLockUnspentCmd(unlock bool, transactions []dcrdtypes.TransactionInput) *LockUnspentCmd { 671 return &LockUnspentCmd{ 672 Unlock: unlock, 673 Transactions: transactions, 674 } 675 } 676 677 // PurchaseTicketCmd is a type handling custom marshaling and 678 // unmarshaling of purchaseticket JSON RPC commands. 679 type PurchaseTicketCmd struct { 680 FromAccount string 681 SpendLimit float64 // In Coins 682 MinConf *int `jsonrpcdefault:"1"` 683 TicketAddress *string 684 NumTickets *int `jsonrpcdefault:"1"` 685 PoolAddress *string 686 PoolFees *float64 687 Expiry *int 688 Comment *string 689 DontSignTx *bool 690 } 691 692 // NewPurchaseTicketCmd creates a new PurchaseTicketCmd. 693 func NewPurchaseTicketCmd(fromAccount string, spendLimit float64, minConf *int, 694 ticketAddress *string, numTickets *int, poolAddress *string, poolFees *float64, 695 expiry *int, comment *string) *PurchaseTicketCmd { 696 return &PurchaseTicketCmd{ 697 FromAccount: fromAccount, 698 SpendLimit: spendLimit, 699 MinConf: minConf, 700 TicketAddress: ticketAddress, 701 NumTickets: numTickets, 702 PoolAddress: poolAddress, 703 PoolFees: poolFees, 704 Expiry: expiry, 705 Comment: comment, 706 } 707 } 708 709 // CreateUnsignedTicketResult is returned from PurchaseTicketCmd 710 // when dontSignTx is true. 711 type CreateUnsignedTicketResult struct { 712 UnsignedTickets []string `json:"unsignedtickets"` 713 SplitTx string `json:"splittx"` 714 } 715 716 // RedeemMultiSigOutCmd is a type handling custom marshaling and 717 // unmarshaling of redeemmultisigout JSON RPC commands. 718 type RedeemMultiSigOutCmd struct { 719 Hash string 720 Index uint32 721 Tree int8 722 Address *string 723 } 724 725 // NewRedeemMultiSigOutCmd creates a new RedeemMultiSigOutCmd. 726 func NewRedeemMultiSigOutCmd(hash string, index uint32, tree int8, 727 address *string) *RedeemMultiSigOutCmd { 728 return &RedeemMultiSigOutCmd{ 729 Hash: hash, 730 Index: index, 731 Tree: tree, 732 Address: address, 733 } 734 } 735 736 // RedeemMultiSigOutsCmd is a type handling custom marshaling and 737 // unmarshaling of redeemmultisigout JSON RPC commands. 738 type RedeemMultiSigOutsCmd struct { 739 FromScrAddress string 740 ToAddress *string 741 Number *int 742 } 743 744 // NewRedeemMultiSigOutsCmd creates a new RedeemMultiSigOutsCmd. 745 func NewRedeemMultiSigOutsCmd(from string, to *string, 746 number *int) *RedeemMultiSigOutsCmd { 747 return &RedeemMultiSigOutsCmd{ 748 FromScrAddress: from, 749 ToAddress: to, 750 Number: number, 751 } 752 } 753 754 // RenameAccountCmd defines the renameaccount JSON-RPC command. 755 type RenameAccountCmd struct { 756 OldAccount string 757 NewAccount string 758 } 759 760 // NewRenameAccountCmd returns a new instance which can be used to issue a 761 // renameaccount JSON-RPC command. 762 func NewRenameAccountCmd(oldAccount, newAccount string) *RenameAccountCmd { 763 return &RenameAccountCmd{ 764 OldAccount: oldAccount, 765 NewAccount: newAccount, 766 } 767 } 768 769 // RescanWalletCmd describes the rescanwallet JSON-RPC request and parameters. 770 type RescanWalletCmd struct { 771 BeginHeight *int `jsonrpcdefault:"0"` 772 } 773 774 // RevokeTicketsCmd describes the revoketickets JSON-RPC request and parameters. 775 type RevokeTicketsCmd struct { 776 } 777 778 // NewRevokeTicketsCmd creates a new RevokeTicketsCmd. 779 func NewRevokeTicketsCmd() *RevokeTicketsCmd { 780 return &RevokeTicketsCmd{} 781 } 782 783 // SendFromCmd defines the sendfrom JSON-RPC command. 784 type SendFromCmd struct { 785 FromAccount string 786 ToAddress string 787 Amount float64 // In DCR 788 MinConf *int `jsonrpcdefault:"1"` 789 Comment *string 790 CommentTo *string 791 } 792 793 // NewSendFromCmd returns a new instance which can be used to issue a sendfrom 794 // JSON-RPC command. 795 // 796 // The parameters which are pointers indicate they are optional. Passing nil 797 // for optional parameters will use the default value. 798 func NewSendFromCmd(fromAccount, toAddress string, amount float64, minConf *int, comment, commentTo *string) *SendFromCmd { 799 return &SendFromCmd{ 800 FromAccount: fromAccount, 801 ToAddress: toAddress, 802 Amount: amount, 803 MinConf: minConf, 804 Comment: comment, 805 CommentTo: commentTo, 806 } 807 } 808 809 // SendManyCmd defines the sendmany JSON-RPC command. 810 type SendManyCmd struct { 811 FromAccount string 812 Amounts map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In DCR 813 MinConf *int `jsonrpcdefault:"1"` 814 Comment *string 815 } 816 817 // NewSendManyCmd returns a new instance which can be used to issue a sendmany 818 // JSON-RPC command. 819 // 820 // The parameters which are pointers indicate they are optional. Passing nil 821 // for optional parameters will use the default value. 822 func NewSendManyCmd(fromAccount string, amounts map[string]float64, minConf *int, comment *string) *SendManyCmd { 823 return &SendManyCmd{ 824 FromAccount: fromAccount, 825 Amounts: amounts, 826 MinConf: minConf, 827 Comment: comment, 828 } 829 } 830 831 // SendToAddressCmd defines the sendtoaddress JSON-RPC command. 832 type SendToAddressCmd struct { 833 Address string 834 Amount float64 835 Comment *string 836 CommentTo *string 837 } 838 839 // NewSendToAddressCmd returns a new instance which can be used to issue a 840 // sendtoaddress JSON-RPC command. 841 // 842 // The parameters which are pointers indicate they are optional. Passing nil 843 // for optional parameters will use the default value. 844 func NewSendToAddressCmd(address string, amount float64, comment, commentTo *string) *SendToAddressCmd { 845 return &SendToAddressCmd{ 846 Address: address, 847 Amount: amount, 848 Comment: comment, 849 CommentTo: commentTo, 850 } 851 } 852 853 // SendToMultiSigCmd is a type handling custom marshaling and 854 // unmarshaling of sendtomultisig JSON RPC commands. 855 type SendToMultiSigCmd struct { 856 FromAccount string 857 Amount float64 858 Pubkeys []string 859 NRequired *int `jsonrpcdefault:"1"` 860 MinConf *int `jsonrpcdefault:"1"` 861 Comment *string 862 } 863 864 // NewSendToMultiSigCmd creates a new SendToMultiSigCmd. 865 func NewSendToMultiSigCmd(fromaccount string, amount float64, pubkeys []string, 866 nrequired *int, minConf *int, comment *string) *SendToMultiSigCmd { 867 return &SendToMultiSigCmd{ 868 FromAccount: fromaccount, 869 Amount: amount, 870 Pubkeys: pubkeys, 871 NRequired: nrequired, 872 MinConf: minConf, 873 Comment: comment, 874 } 875 } 876 877 // SendToTreasuryCmd defines the sendtotreasury JSON-RPC command. 878 type SendToTreasuryCmd struct { 879 Amount float64 880 } 881 882 // NewSendToTreasurymd returns a new instance which can be used to issue a 883 // sendtotreasury JSON-RPC command. 884 func NewSendToTreasuryCmd(amount float64, comment, commentTo *string) *SendToTreasuryCmd { 885 return &SendToTreasuryCmd{ 886 Amount: amount, 887 } 888 } 889 890 // SendFromTreasuryCmd defines the sendfromtreasury JSON-RPC command. 891 type SendFromTreasuryCmd struct { 892 Key string 893 Amounts map[string]float64 894 } 895 896 // NewSendFromTreasurymd returns a new instance which can be used to issue a 897 // sendfromtreasury JSON-RPC command. 898 func NewSendFromTreasuryCmd(pubkey string, amounts map[string]float64) *SendFromTreasuryCmd { 899 return &SendFromTreasuryCmd{ 900 Key: pubkey, 901 Amounts: amounts, 902 } 903 } 904 905 // DisapprovePercentCmd defines the parameters for the disapprovepercent 906 // JSON-RPC command. 907 type DisapprovePercentCmd struct{} 908 909 // SetDisapprovePercentCmd defines the parameters for the setdisapprovepercent 910 // JSON-RPC command. 911 type SetDisapprovePercentCmd struct { 912 Percent uint32 913 } 914 915 // TreasuryPolicyCmd defines the parameters for the treasurypolicy JSON-RPC 916 // command. 917 type TreasuryPolicyCmd struct { 918 Key *string 919 Ticket *string 920 } 921 922 // SetTreasuryPolicyCmd defines the parameters for the settreasurypolicy 923 // JSON-RPC command. 924 type SetTreasuryPolicyCmd struct { 925 Key string 926 Policy string 927 Ticket *string 928 } 929 930 // NewSetTreasuryPolicyCmd returns a new instance which can be used to issue a settreasurypolicy 931 // JSON-RPC command. 932 func NewSetTreasuryPolicyCmd(key string, policy string, ticket *string) *SetTreasuryPolicyCmd { 933 return &SetTreasuryPolicyCmd{ 934 Key: key, 935 Policy: policy, 936 Ticket: ticket, 937 } 938 } 939 940 // TSpendPolicyCmd defines the parameters for the tspendpolicy JSON-RPC 941 // command. 942 type TSpendPolicyCmd struct { 943 Hash *string 944 Ticket *string 945 } 946 947 // SetTSpendPolicyCmd defines the parameters for the settspendpolicy 948 // JSON-RPC command. 949 type SetTSpendPolicyCmd struct { 950 Hash string 951 Policy string 952 Ticket *string 953 } 954 955 // NewSetTSpendPolicyCmd returns a new instance which can be used to issue a settspendpolicy 956 // JSON-RPC command. 957 func NewSetTSpendPolicyCmd(hash string, policy string, ticket *string) *SetTSpendPolicyCmd { 958 return &SetTSpendPolicyCmd{ 959 Hash: hash, 960 Policy: policy, 961 Ticket: ticket, 962 } 963 } 964 965 // SetTxFeeCmd defines the settxfee JSON-RPC command. 966 type SetTxFeeCmd struct { 967 Amount float64 // In DCR 968 } 969 970 // NewSetTxFeeCmd returns a new instance which can be used to issue a settxfee 971 // JSON-RPC command. 972 func NewSetTxFeeCmd(amount float64) *SetTxFeeCmd { 973 return &SetTxFeeCmd{ 974 Amount: amount, 975 } 976 } 977 978 // SetVoteChoiceCmd defines the parameters to the setvotechoice method. 979 type SetVoteChoiceCmd struct { 980 AgendaID string 981 ChoiceID string 982 TicketHash *string 983 } 984 985 // NewSetVoteChoiceCmd returns a new instance which can be used to issue a 986 // setvotechoice JSON-RPC command. 987 func NewSetVoteChoiceCmd(agendaID, choiceID string, tickethash *string) *SetVoteChoiceCmd { 988 return &SetVoteChoiceCmd{AgendaID: agendaID, ChoiceID: choiceID, TicketHash: tickethash} 989 } 990 991 // SignMessageCmd defines the signmessage JSON-RPC command. 992 type SignMessageCmd struct { 993 Address string 994 Message string 995 } 996 997 // NewSignMessageCmd returns a new instance which can be used to issue a 998 // signmessage JSON-RPC command. 999 func NewSignMessageCmd(address, message string) *SignMessageCmd { 1000 return &SignMessageCmd{ 1001 Address: address, 1002 Message: message, 1003 } 1004 } 1005 1006 // RawTxInput models the data needed for raw transaction input that is used in 1007 // the SignRawTransactionCmd struct. Contains Decred additions. 1008 type RawTxInput struct { 1009 Txid string `json:"txid"` 1010 Vout uint32 `json:"vout"` 1011 Tree int8 `json:"tree"` 1012 ScriptPubKey string `json:"scriptPubKey"` 1013 RedeemScript string `json:"redeemScript"` 1014 } 1015 1016 // SignRawTransactionCmd defines the signrawtransaction JSON-RPC command. 1017 type SignRawTransactionCmd struct { 1018 RawTx string 1019 Inputs *[]RawTxInput 1020 PrivKeys *[]string 1021 Flags *string `jsonrpcdefault:"\"ALL\""` 1022 } 1023 1024 // NewSignRawTransactionCmd returns a new instance which can be used to issue a 1025 // signrawtransaction JSON-RPC command. 1026 // 1027 // The parameters which are pointers indicate they are optional. Passing nil 1028 // for optional parameters will use the default value. 1029 func NewSignRawTransactionCmd(hexEncodedTx string, inputs *[]RawTxInput, privKeys *[]string, flags *string) *SignRawTransactionCmd { 1030 return &SignRawTransactionCmd{ 1031 RawTx: hexEncodedTx, 1032 Inputs: inputs, 1033 PrivKeys: privKeys, 1034 Flags: flags, 1035 } 1036 } 1037 1038 // SignRawTransactionsCmd defines the signrawtransactions JSON-RPC command. 1039 type SignRawTransactionsCmd struct { 1040 RawTxs []string 1041 Send *bool `jsonrpcdefault:"true"` 1042 } 1043 1044 // NewSignRawTransactionsCmd returns a new instance which can be used to issue a 1045 // signrawtransactions JSON-RPC command. 1046 func NewSignRawTransactionsCmd(hexEncodedTxs []string, 1047 send *bool) *SignRawTransactionsCmd { 1048 return &SignRawTransactionsCmd{ 1049 RawTxs: hexEncodedTxs, 1050 Send: send, 1051 } 1052 } 1053 1054 // StakePoolUserInfoCmd defines the stakepooluserinfo JSON-RPC command. 1055 type StakePoolUserInfoCmd struct { 1056 User string 1057 } 1058 1059 // NewStakePoolUserInfoCmd returns a new instance which can be used to issue a 1060 // signrawtransactions JSON-RPC command. 1061 func NewStakePoolUserInfoCmd(user string) *StakePoolUserInfoCmd { 1062 return &StakePoolUserInfoCmd{ 1063 User: user, 1064 } 1065 } 1066 1067 // SweepAccountCmd defines the sweep account JSON-RPC command. 1068 type SweepAccountCmd struct { 1069 SourceAccount string 1070 DestinationAddress string 1071 RequiredConfirmations *uint32 1072 FeePerKb *float64 1073 } 1074 1075 // NewSweepAccountCmd returns a new instance which can be used to issue a JSON-RPC SweepAccountCmd command. 1076 func NewSweepAccountCmd(sourceAccount string, destinationAddress string, requiredConfs *uint32, feePerKb *float64) *SweepAccountCmd { 1077 return &SweepAccountCmd{ 1078 SourceAccount: sourceAccount, 1079 DestinationAddress: destinationAddress, 1080 RequiredConfirmations: requiredConfs, 1081 FeePerKb: feePerKb, 1082 } 1083 } 1084 1085 // SyncStatusCmd defines the syncstatus JSON-RPC command. 1086 type SyncStatusCmd struct{} 1087 1088 // WalletInfoCmd defines the walletinfo JSON-RPC command. 1089 type WalletInfoCmd struct { 1090 } 1091 1092 // NewWalletInfoCmd returns a new instance which can be used to issue a 1093 // walletinfo JSON-RPC command. 1094 func NewWalletInfoCmd() *WalletInfoCmd { 1095 return &WalletInfoCmd{} 1096 } 1097 1098 // WalletIsLockedCmd defines the walletislocked JSON-RPC command. 1099 type WalletIsLockedCmd struct{} 1100 1101 // NewWalletIsLockedCmd returns a new instance which can be used to issue a 1102 // walletislocked JSON-RPC command. 1103 func NewWalletIsLockedCmd() *WalletIsLockedCmd { 1104 return &WalletIsLockedCmd{} 1105 } 1106 1107 // WalletLockCmd defines the walletlock JSON-RPC command. 1108 type WalletLockCmd struct{} 1109 1110 // NewWalletLockCmd returns a new instance which can be used to issue a 1111 // walletlock JSON-RPC command. 1112 func NewWalletLockCmd() *WalletLockCmd { 1113 return &WalletLockCmd{} 1114 } 1115 1116 // WalletPassphraseCmd defines the walletpassphrase JSON-RPC command. 1117 type WalletPassphraseCmd struct { 1118 Passphrase string 1119 Timeout int64 1120 } 1121 1122 // NewWalletPassphraseCmd returns a new instance which can be used to issue a 1123 // walletpassphrase JSON-RPC command. 1124 func NewWalletPassphraseCmd(passphrase string, timeout int64) *WalletPassphraseCmd { 1125 return &WalletPassphraseCmd{ 1126 Passphrase: passphrase, 1127 Timeout: timeout, 1128 } 1129 } 1130 1131 // WalletPassphraseChangeCmd defines the walletpassphrase JSON-RPC command. 1132 type WalletPassphraseChangeCmd struct { 1133 OldPassphrase string 1134 NewPassphrase string 1135 } 1136 1137 // NewWalletPassphraseChangeCmd returns a new instance which can be used to 1138 // issue a walletpassphrasechange JSON-RPC command. 1139 func NewWalletPassphraseChangeCmd(oldPassphrase, newPassphrase string) *WalletPassphraseChangeCmd { 1140 return &WalletPassphraseChangeCmd{ 1141 OldPassphrase: oldPassphrase, 1142 NewPassphrase: newPassphrase, 1143 } 1144 } 1145 1146 // MixAccountCmd defines the mixaccount JSON-RPC command. 1147 type MixAccountCmd struct{} 1148 1149 // MixOutputCmd defines the mixoutput JSON-RPC command. 1150 type MixOutputCmd struct { 1151 Outpoint string `json:"outpoint"` 1152 } 1153 1154 // DiscoverUsageCmd defines the discoverusage JSON-RPC command. 1155 type DiscoverUsageCmd struct { 1156 StartBlock *string `json:"startblock"` 1157 DiscoverAccounts *bool `json:"discoveraccounts"` 1158 GapLimit *uint32 `json:"gaplimit"` 1159 } 1160 1161 // ValidatePreDCP0005CFCmd defines the validatepredcp0005cf JSON-RPC command. 1162 type ValidatePreDCP0005CFCmd struct{} 1163 1164 // ImportCfiltersV2Cmd defines the importcfiltersv2 JSON-RPC command. 1165 type ImportCFiltersV2Cmd struct { 1166 StartHeight int32 `json:"startheight"` 1167 Filters []string `json:"filters"` 1168 } 1169 1170 // TicketInfoCmd defines the ticketinfo JSON-RPC command. 1171 type TicketInfoCmd struct { 1172 StartHeight *int32 `json:"startheight" jsonrpcdefault:"0"` 1173 } 1174 1175 // WalletPubPassphraseChangeCmd defines the walletpubpassphrasechange JSON-RPC command. 1176 type WalletPubPassphraseChangeCmd struct { 1177 OldPassphrase string 1178 NewPassphrase string 1179 } 1180 1181 // SetAccountPassphraseCmd defines the setaccountpassphrase JSON-RPC command 1182 // arguments. 1183 type SetAccountPassphraseCmd struct { 1184 Account string 1185 Passphrase string 1186 } 1187 1188 // UnlockAccountCmd defines the unlockaccount JSON-RPC command arguments. 1189 type UnlockAccountCmd struct { 1190 Account string 1191 Passphrase string 1192 } 1193 1194 // LockAccountCmd defines the lockaccount JSON-RPC command arguments. 1195 type LockAccountCmd struct { 1196 Account string 1197 } 1198 1199 // AccountUnlockedCmd defines the accountunlocked JSON-RPC command arguments. 1200 type AccountUnlockedCmd struct { 1201 Account string 1202 } 1203 1204 // ProcessUnmanagedTicket defines the processunmanagedticket JSON-RPC command arguments. 1205 type ProcessUnmanagedTicketCmd struct { 1206 TicketHash *string 1207 } 1208 1209 type registeredMethod struct { 1210 method string 1211 cmd interface{} 1212 } 1213 1214 type GetCoinjoinsByAcctCmd struct{} 1215 1216 func init() { 1217 // Wallet-specific methods 1218 register := []registeredMethod{ 1219 {"abandontransaction", (*AbandonTransactionCmd)(nil)}, 1220 {"accountaddressindex", (*AccountAddressIndexCmd)(nil)}, 1221 {"accountsyncaddressindex", (*AccountSyncAddressIndexCmd)(nil)}, 1222 {"accountunlocked", (*AccountUnlockedCmd)(nil)}, 1223 {"addmultisigaddress", (*AddMultisigAddressCmd)(nil)}, 1224 {"addtransaction", (*AddTransactionCmd)(nil)}, 1225 {"auditreuse", (*AuditReuseCmd)(nil)}, 1226 {"consolidate", (*ConsolidateCmd)(nil)}, 1227 {"createmultisig", (*CreateMultisigCmd)(nil)}, 1228 {"createnewaccount", (*CreateNewAccountCmd)(nil)}, 1229 {"createsignature", (*CreateSignatureCmd)(nil)}, 1230 {"createvotingaccount", (*CreateVotingAccountCmd)(nil)}, 1231 {"disapprovepercent", (*DisapprovePercentCmd)(nil)}, 1232 {"discoverusage", (*DiscoverUsageCmd)(nil)}, 1233 {"dumpprivkey", (*DumpPrivKeyCmd)(nil)}, 1234 {"fundrawtransaction", (*FundRawTransactionCmd)(nil)}, 1235 {"getaccount", (*GetAccountCmd)(nil)}, 1236 {"getaccountaddress", (*GetAccountAddressCmd)(nil)}, 1237 {"getaddressesbyaccount", (*GetAddressesByAccountCmd)(nil)}, 1238 {"getbalance", (*GetBalanceCmd)(nil)}, 1239 {"getcoinjoinsbyacct", (*GetCoinjoinsByAcctCmd)(nil)}, 1240 {"getmasterpubkey", (*GetMasterPubkeyCmd)(nil)}, 1241 {"getmultisigoutinfo", (*GetMultisigOutInfoCmd)(nil)}, 1242 {"getnewaddress", (*GetNewAddressCmd)(nil)}, 1243 {"getrawchangeaddress", (*GetRawChangeAddressCmd)(nil)}, 1244 {"getreceivedbyaccount", (*GetReceivedByAccountCmd)(nil)}, 1245 {"getreceivedbyaddress", (*GetReceivedByAddressCmd)(nil)}, 1246 {"getstakeinfo", (*GetStakeInfoCmd)(nil)}, 1247 {"gettickets", (*GetTicketsCmd)(nil)}, 1248 {"gettransaction", (*GetTransactionCmd)(nil)}, 1249 {"getunconfirmedbalance", (*GetUnconfirmedBalanceCmd)(nil)}, 1250 {"getvotechoices", (*GetVoteChoicesCmd)(nil)}, 1251 {"getwalletfee", (*GetWalletFeeCmd)(nil)}, 1252 {"importcfiltersv2", (*ImportCFiltersV2Cmd)(nil)}, 1253 {"importprivkey", (*ImportPrivKeyCmd)(nil)}, 1254 {"importpubkey", (*ImportPubKeyCmd)(nil)}, 1255 {"importscript", (*ImportScriptCmd)(nil)}, 1256 {"importxpub", (*ImportXpubCmd)(nil)}, 1257 {"listaccounts", (*ListAccountsCmd)(nil)}, 1258 {"listaddresstransactions", (*ListAddressTransactionsCmd)(nil)}, 1259 {"listalltransactions", (*ListAllTransactionsCmd)(nil)}, 1260 {"listlockunspent", (*ListLockUnspentCmd)(nil)}, 1261 {"listreceivedbyaccount", (*ListReceivedByAccountCmd)(nil)}, 1262 {"listreceivedbyaddress", (*ListReceivedByAddressCmd)(nil)}, 1263 {"listsinceblock", (*ListSinceBlockCmd)(nil)}, 1264 {"listtransactions", (*ListTransactionsCmd)(nil)}, 1265 {"listunspent", (*ListUnspentCmd)(nil)}, 1266 {"lockaccount", (*LockAccountCmd)(nil)}, 1267 {"lockunspent", (*LockUnspentCmd)(nil)}, 1268 {"mixaccount", (*MixAccountCmd)(nil)}, 1269 {"mixoutput", (*MixOutputCmd)(nil)}, 1270 {"purchaseticket", (*PurchaseTicketCmd)(nil)}, 1271 {"processunmanagedticket", (*ProcessUnmanagedTicketCmd)(nil)}, 1272 {"redeemmultisigout", (*RedeemMultiSigOutCmd)(nil)}, 1273 {"redeemmultisigouts", (*RedeemMultiSigOutsCmd)(nil)}, 1274 {"renameaccount", (*RenameAccountCmd)(nil)}, 1275 {"rescanwallet", (*RescanWalletCmd)(nil)}, 1276 {"revoketickets", (*RevokeTicketsCmd)(nil)}, 1277 {"sendfrom", (*SendFromCmd)(nil)}, 1278 {"sendfromtreasury", (*SendFromTreasuryCmd)(nil)}, 1279 {"sendmany", (*SendManyCmd)(nil)}, 1280 {"sendtoaddress", (*SendToAddressCmd)(nil)}, 1281 {"sendtomultisig", (*SendToMultiSigCmd)(nil)}, 1282 {"sendtotreasury", (*SendToTreasuryCmd)(nil)}, 1283 {"setaccountpassphrase", (*SetAccountPassphraseCmd)(nil)}, 1284 {"setdisapprovepercent", (*SetDisapprovePercentCmd)(nil)}, 1285 {"settreasurypolicy", (*SetTreasuryPolicyCmd)(nil)}, 1286 {"settspendpolicy", (*SetTSpendPolicyCmd)(nil)}, 1287 {"settxfee", (*SetTxFeeCmd)(nil)}, 1288 {"setvotechoice", (*SetVoteChoiceCmd)(nil)}, 1289 {"signmessage", (*SignMessageCmd)(nil)}, 1290 {"signrawtransaction", (*SignRawTransactionCmd)(nil)}, 1291 {"signrawtransactions", (*SignRawTransactionsCmd)(nil)}, 1292 {"stakepooluserinfo", (*StakePoolUserInfoCmd)(nil)}, 1293 {"sweepaccount", (*SweepAccountCmd)(nil)}, 1294 {"syncstatus", (*SyncStatusCmd)(nil)}, 1295 {"ticketinfo", (*TicketInfoCmd)(nil)}, 1296 {"treasurypolicy", (*TreasuryPolicyCmd)(nil)}, 1297 {"tspendpolicy", (*TSpendPolicyCmd)(nil)}, 1298 {"unlockaccount", (*UnlockAccountCmd)(nil)}, 1299 {"validatepredcp0005cf", (*ValidatePreDCP0005CFCmd)(nil)}, 1300 {"walletinfo", (*WalletInfoCmd)(nil)}, 1301 {"walletislocked", (*WalletIsLockedCmd)(nil)}, 1302 {"walletlock", (*WalletLockCmd)(nil)}, 1303 {"walletpassphrase", (*WalletPassphraseCmd)(nil)}, 1304 {"walletpassphrasechange", (*WalletPassphraseChangeCmd)(nil)}, 1305 {"walletpubpassphrasechange", (*WalletPubPassphraseChangeCmd)(nil)}, 1306 } 1307 for i := range register { 1308 dcrjson.MustRegister(Method(register[i].method), register[i].cmd, 0) 1309 } 1310 1311 // dcrd methods also implemented by dcrwallet 1312 register = []registeredMethod{ 1313 {"createrawtransaction", (*CreateRawTransactionCmd)(nil)}, 1314 {"getbestblock", (*GetBestBlockCmd)(nil)}, 1315 {"getbestblockhash", (*GetBestBlockHashCmd)(nil)}, 1316 {"getblockcount", (*GetBlockCountCmd)(nil)}, 1317 {"getblockhash", (*GetBlockHashCmd)(nil)}, 1318 {"getblockheader", (*GetBlockHeaderCmd)(nil)}, 1319 {"getblock", (*GetBlockCmd)(nil)}, 1320 {"getcfilterv2", (*GetCFilterV2Cmd)(nil)}, 1321 {"getcurrentnet", (*GetCurrentNetCmd)(nil)}, 1322 {"getinfo", (*GetInfoCmd)(nil)}, 1323 {"getpeerinfo", (*GetPeerInfoCmd)(nil)}, 1324 {"gettxout", (*GetTxOutCmd)(nil)}, 1325 {"help", (*HelpCmd)(nil)}, 1326 {"sendrawtransaction", (*SendRawTransactionCmd)(nil)}, 1327 {"ticketsforaddress", (*TicketsForAddressCmd)(nil)}, 1328 {"validateaddress", (*ValidateAddressCmd)(nil)}, 1329 {"verifymessage", (*VerifyMessageCmd)(nil)}, 1330 {"version", (*VersionCmd)(nil)}, 1331 } 1332 for i := range register { 1333 dcrjson.MustRegister(Method(register[i].method), register[i].cmd, 0) 1334 } 1335 1336 // Websocket-specific methods implemented by dcrwallet 1337 register = []registeredMethod{ 1338 {"authenticate", (*AuthenticateCmd)(nil)}, 1339 } 1340 for i := range register { 1341 dcrjson.MustRegister(Method(register[i].method), register[i].cmd, 1342 dcrjson.UFWebsocketOnly) 1343 } 1344 } 1345 1346 // newtype definitions of dcrd commands we implement. 1347 type ( 1348 AuthenticateCmd dcrdtypes.AuthenticateCmd 1349 CreateRawTransactionCmd dcrdtypes.CreateRawTransactionCmd 1350 GetBestBlockCmd dcrdtypes.GetBestBlockCmd 1351 GetBestBlockHashCmd dcrdtypes.GetBestBlockHashCmd 1352 GetBlockCountCmd dcrdtypes.GetBlockCountCmd 1353 GetBlockHashCmd dcrdtypes.GetBlockHashCmd 1354 GetBlockHeaderCmd dcrdtypes.GetBlockHeaderCmd 1355 GetBlockCmd dcrdtypes.GetBlockCmd 1356 GetCFilterV2Cmd dcrdtypes.GetCFilterV2Cmd 1357 GetCurrentNetCmd dcrdtypes.GetCurrentNetCmd 1358 GetInfoCmd dcrdtypes.GetInfoCmd 1359 GetPeerInfoCmd dcrdtypes.GetPeerInfoCmd 1360 GetTxOutCmd dcrdtypes.GetTxOutCmd 1361 HelpCmd dcrdtypes.HelpCmd 1362 SendRawTransactionCmd dcrdtypes.SendRawTransactionCmd 1363 TicketsForAddressCmd dcrdtypes.TicketsForAddressCmd 1364 ValidateAddressCmd dcrdtypes.ValidateAddressCmd 1365 VerifyMessageCmd dcrdtypes.VerifyMessageCmd 1366 VersionCmd dcrdtypes.VersionCmd 1367 )