From 5d78bf616fe9f755da4e105ba194ebf33e5d95e7 Mon Sep 17 00:00:00 2001 From: "vracek@protonmail.com" Date: Sat, 26 Oct 2019 20:28:30 -0600 Subject: [PATCH] multi: required changes for help for getcontracthashes and getpaytocontracthash --- internal/rpc/jsonrpc/rpcserverhelp.go | 4 +++- internal/rpchelp/helpdescs_en_US.go | 12 ++++++++++++ internal/rpchelp/methods.go | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/rpc/jsonrpc/rpcserverhelp.go b/internal/rpc/jsonrpc/rpcserverhelp.go index 7a67d8bf6..74897fcaa 100644 --- a/internal/rpc/jsonrpc/rpcserverhelp.go +++ b/internal/rpc/jsonrpc/rpcserverhelp.go @@ -22,10 +22,12 @@ func helpDescsEnUS() map[string]string { "getbestblock": "getbestblock\n\nReturns the hash and height of the newest block in the best chain that wallet has finished syncing with.\n\nArguments:\nNone\n\nResult:\n{\n \"hash\": \"value\", (string) The hash of the block\n \"height\": n, (numeric) The blockchain height of the block\n} \n", "getblockcount": "getblockcount\n\nReturns the blockchain height of the newest block in the best chain that wallet has finished syncing with.\n\nArguments:\nNone\n\nResult:\nn.nnn (numeric) The blockchain height of the most recent synced-to block\n", "getblockhash": "getblockhash index\n\nReturns the hash of a main chain block at some height\n\nArguments:\n1. index (numeric, required) The block height\n\nResult:\n\"value\" (string) The main chain block hash\n", + "getcontracthash": "getcontracthash [\"filepath\",...]\n\nTakes contracts (files) and hashes them.\n\nArguments:\n1. filepath (array of string, required) The paths of the files to be hashed.\n\nResult:\n{\n \"contracthash\": [\"value\",...], (array of string) Returns the contracts hashed\n} \n", "getinfo": "getinfo\n\nReturns a JSON object containing various state info.\n\nArguments:\nNone\n\nResult:\n{\n \"version\": n, (numeric) The version of the server\n \"protocolversion\": n, (numeric) The latest supported protocol version\n \"walletversion\": n, (numeric) The version of the address manager database\n \"balance\": n.nnn, (numeric) The balance of all accounts calculated with one block confirmation\n \"blocks\": n, (numeric) The number of blocks processed\n \"timeoffset\": n, (numeric) The time offset\n \"connections\": n, (numeric) The number of connected peers\n \"proxy\": \"value\", (string) The proxy used by the server\n \"difficulty\": n.nnn, (numeric) The current target difficulty\n \"testnet\": true|false, (boolean) Whether or not server is using testnet\n \"keypoololdest\": n, (numeric) Unset\n \"keypoolsize\": n, (numeric) Unset\n \"unlocked_until\": n, (numeric) Unset\n \"paytxfee\": n.nnn, (numeric) The fee per kB of the serialized tx size used each time more fee is required for an authored transaction\n \"relayfee\": n.nnn, (numeric) The minimum relay fee for non-free transactions in DCR/KB\n \"errors\": \"value\", (string) Any current errors\n} \n", "getmasterpubkey": "getmasterpubkey (\"account\")\n\nRequests the master pubkey from the wallet.\n\nArguments:\n1. account (string, optional) The account to get the master pubkey for\n\nResult:\n\"value\" (string) The master pubkey for the wallet\n", "getmultisigoutinfo": "getmultisigoutinfo \"hash\" index\n\nReturns information about a multisignature output.\n\nArguments:\n1. hash (string, required) Input hash to check.\n2. index (numeric, required) Index of input.\n\nResult:\n{\n \"address\": \"value\", (string) Script address.\n \"redeemscript\": \"value\", (string) Hex of the redeeming script.\n \"m\": n, (numeric) m (in m-of-n)\n \"n\": n, (numeric) n (in m-of-n)\n \"pubkeys\": [\"value\",...], (array of string) Associated pubkeys.\n \"txhash\": \"value\", (string) txhash\n \"blockheight\": n, (numeric) Height of the containing block.\n \"blockhash\": \"value\", (string) Hash of the containing block.\n \"spent\": true|false, (boolean) If it has been spent.\n \"spentby\": \"value\", (string) Hash of spending tx.\n \"spentbyindex\": n, (numeric) Index of spending tx.\n \"amount\": n.nnn, (numeric) Amount of coins contained.\n} \n", "getnewaddress": "getnewaddress (\"account\" \"gappolicy\")\n\nGenerates and returns a new payment address.\n\nArguments:\n1. account (string, optional) Account name the new address will belong to (default=\"default\")\n2. gappolicy (string, optional) String defining the policy to use when the BIP0044 gap limit would be violated, may be \"error\", \"ignore\", or \"wrap\"\n\nResult:\n\"value\" (string) The payment address\n", + "getpaytocontractaddress": "getpaytocontractaddress [\"filepath\",...]\n\nReturns the pay to contract P2PKH of given contracts.\n\nArguments:\n1. filepath (array of string, required) The filepaths of the contracts to be used for the P2PKH\n\nResult:\n\"value\" (string) The pay to contract P2PKH\n", "getrawchangeaddress": "getrawchangeaddress (\"account\")\n\nGenerates and returns a new internal payment address for use as a change address in raw transactions.\n\nArguments:\n1. account (string, optional) Account name the new internal address will belong to (default=\"default\")\n\nResult:\n\"value\" (string) The internal payment address\n", "getreceivedbyaccount": "getreceivedbyaccount \"account\" (minconf=1)\n\nReturns the total amount received by addresses of some account, including spent outputs.\n\nArguments:\n1. account (string, required) Account name to query total received amount for\n2. minconf (numeric, optional, default=1) Minimum number of block confirmations required before an output's value is included in the total\n\nResult:\nn.nnn (numeric) The total received amount valued in decred\n", "getreceivedbyaddress": "getreceivedbyaddress \"address\" (minconf=1)\n\nReturns the total amount received by a single address, including spent outputs.\n\nArguments:\n1. address (string, required) Payment address which received outputs to include in total\n2. minconf (numeric, optional, default=1) Minimum number of block confirmations required before an output's value is included in the total\n\nResult:\nn.nnn (numeric) The total received amount valued in decred\n", @@ -87,4 +89,4 @@ var localeHelpDescs = map[string]func() map[string]string{ "en_US": helpDescsEnUS, } -var requestUsages = "abandontransaction \"hash\"\naccountaddressindex \"account\" branch\naccountsyncaddressindex \"account\" branch index\naddmultisigaddress nrequired [\"key\",...] (\"account\")\naddticket \"tickethex\"\nconsolidate inputs (\"account\" \"address\")\ncreatemultisig nrequired [\"key\",...]\ncreatenewaccount \"account\"\ndumpprivkey \"address\"\ngeneratevote \"blockhash\" height \"tickethash\" votebits \"votebitsext\"\ngetaccountaddress \"account\"\ngetaccount \"address\"\ngetaddressesbyaccount \"account\"\ngetbalance (\"account\" minconf=1)\ngetbestblockhash\ngetbestblock\ngetblockcount\ngetblockhash index\ngetinfo\ngetmasterpubkey (\"account\")\ngetmultisigoutinfo \"hash\" index\ngetnewaddress (\"account\" \"gappolicy\")\ngetrawchangeaddress (\"account\")\ngetreceivedbyaccount \"account\" (minconf=1)\ngetreceivedbyaddress \"address\" (minconf=1)\ngetstakeinfo\ngetticketfee\ngettickets includeimmature\ngettransaction \"txid\" (includewatchonly=false)\ngetunconfirmedbalance (\"account\")\ngetvotechoices\ngetwalletfee\nhelp (\"command\")\nimportprivkey \"privkey\" (\"label\" rescan=true scanfrom)\nimportscript \"hex\" (rescan=true scanfrom)\nimportxpub \"name\" \"xpub\"\nmixaccount\nmixoutput \"outpoint\"\nlistaccounts (minconf=1)\nlistaddresstransactions [\"address\",...] (\"account\")\nlistalltransactions (\"account\")\nlistlockunspent\nlistreceivedbyaccount (minconf=1 includeempty=false includewatchonly=false)\nlistreceivedbyaddress (minconf=1 includeempty=false includewatchonly=false)\nlistscripts\nlistsinceblock (\"blockhash\" targetconfirmations=1 includewatchonly=false)\nlisttransactions (\"account\" count=10 from=0 includewatchonly=false)\nlistunspent (minconf=1 maxconf=9999999 [\"address\",...])\nlockunspent unlock [{\"amount\":n.nnn,\"txid\":\"value\",\"vout\":n,\"tree\":n},...]\npurchaseticket \"fromaccount\" spendlimit (minconf=1 \"ticketaddress\" numtickets \"pooladdress\" poolfees expiry \"comment\" ticketfee)\nredeemmultisigout \"hash\" index tree (\"address\")\nredeemmultisigouts \"fromscraddress\" (\"toaddress\" number)\nrenameaccount \"oldaccount\" \"newaccount\"\nrescanwallet (beginheight=0)\nrevoketickets\nsendfrom \"fromaccount\" \"toaddress\" amount (minconf=1 \"comment\" \"commentto\")\nsendmany \"fromaccount\" {\"address\":amount,...} (minconf=1 \"comment\")\nsendtoaddress \"address\" amount (\"comment\" \"commentto\")\nsendtomultisig \"fromaccount\" amount [\"pubkey\",...] (nrequired=1 minconf=1 \"comment\")\nsetticketfee fee\nsettxfee amount\nsetvotechoice \"agendaid\" \"choiceid\"\nsignmessage \"address\" \"message\"\nsignrawtransaction \"rawtx\" ([{\"txid\":\"value\",\"vout\":n,\"tree\":n,\"scriptpubkey\":\"value\",\"redeemscript\":\"value\"},...] [\"privkey\",...] flags=\"ALL\")\nsignrawtransactions [\"rawtx\",...] (send=true)\nstakepooluserinfo \"user\"\nsweepaccount \"sourceaccount\" \"destinationaddress\" (requiredconfirmations feeperkb)\nticketsforaddress \"address\"\nvalidateaddress \"address\"\nverifymessage \"address\" \"signature\" \"message\"\nversion\nwalletinfo\nwalletislocked\nwalletlock\nwalletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\nwalletpassphrase \"passphrase\" timeout" +var requestUsages = "abandontransaction \"hash\"\naccountaddressindex \"account\" branch\naccountsyncaddressindex \"account\" branch index\naddmultisigaddress nrequired [\"key\",...] (\"account\")\naddticket \"tickethex\"\nconsolidate inputs (\"account\" \"address\")\ncreatemultisig nrequired [\"key\",...]\ncreatenewaccount \"account\"\ndumpprivkey \"address\"\ngeneratevote \"blockhash\" height \"tickethash\" votebits \"votebitsext\"\ngetaccountaddress \"account\"\ngetaccount \"address\"\ngetaddressesbyaccount \"account\"\ngetbalance (\"account\" minconf=1)\ngetbestblockhash\ngetbestblock\ngetblockcount\ngetblockhash index\ngetcontracthash [\"filepath\",...]\ngetinfo\ngetmasterpubkey (\"account\")\ngetmultisigoutinfo \"hash\" index\ngetnewaddress (\"account\" \"gappolicy\")\ngetpaytocontractaddress [\"filepath\",...]\ngetrawchangeaddress (\"account\")\ngetreceivedbyaccount \"account\" (minconf=1)\ngetreceivedbyaddress \"address\" (minconf=1)\ngetstakeinfo\ngetticketfee\ngettickets includeimmature\ngettransaction \"txid\" (includewatchonly=false)\ngetunconfirmedbalance (\"account\")\ngetvotechoices\ngetwalletfee\nhelp (\"command\")\nimportprivkey \"privkey\" (\"label\" rescan=true scanfrom)\nimportscript \"hex\" (rescan=true scanfrom)\nimportxpub \"name\" \"xpub\"\nmixaccount\nmixoutput \"outpoint\"\nlistaccounts (minconf=1)\nlistaddresstransactions [\"address\",...] (\"account\")\nlistalltransactions (\"account\")\nlistlockunspent\nlistreceivedbyaccount (minconf=1 includeempty=false includewatchonly=false)\nlistreceivedbyaddress (minconf=1 includeempty=false includewatchonly=false)\nlistscripts\nlistsinceblock (\"blockhash\" targetconfirmations=1 includewatchonly=false)\nlisttransactions (\"account\" count=10 from=0 includewatchonly=false)\nlistunspent (minconf=1 maxconf=9999999 [\"address\",...])\nlockunspent unlock [{\"amount\":n.nnn,\"txid\":\"value\",\"vout\":n,\"tree\":n},...]\npurchaseticket \"fromaccount\" spendlimit (minconf=1 \"ticketaddress\" numtickets \"pooladdress\" poolfees expiry \"comment\" ticketfee)\nredeemmultisigout \"hash\" index tree (\"address\")\nredeemmultisigouts \"fromscraddress\" (\"toaddress\" number)\nrenameaccount \"oldaccount\" \"newaccount\"\nrescanwallet (beginheight=0)\nrevoketickets\nsendfrom \"fromaccount\" \"toaddress\" amount (minconf=1 \"comment\" \"commentto\")\nsendmany \"fromaccount\" {\"address\":amount,...} (minconf=1 \"comment\")\nsendtoaddress \"address\" amount (\"comment\" \"commentto\")\nsendtomultisig \"fromaccount\" amount [\"pubkey\",...] (nrequired=1 minconf=1 \"comment\")\nsetticketfee fee\nsettxfee amount\nsetvotechoice \"agendaid\" \"choiceid\"\nsignmessage \"address\" \"message\"\nsignrawtransaction \"rawtx\" ([{\"txid\":\"value\",\"vout\":n,\"tree\":n,\"scriptpubkey\":\"value\",\"redeemscript\":\"value\"},...] [\"privkey\",...] flags=\"ALL\")\nsignrawtransactions [\"rawtx\",...] (send=true)\nstakepooluserinfo \"user\"\nsweepaccount \"sourceaccount\" \"destinationaddress\" (requiredconfirmations feeperkb)\nticketsforaddress \"address\"\nvalidateaddress \"address\"\nverifymessage \"address\" \"signature\" \"message\"\nversion\nwalletinfo\nwalletislocked\nwalletlock\nwalletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\nwalletpassphrase \"passphrase\" timeout" diff --git a/internal/rpchelp/helpdescs_en_US.go b/internal/rpchelp/helpdescs_en_US.go index a446ae373..2e993686d 100644 --- a/internal/rpchelp/helpdescs_en_US.go +++ b/internal/rpchelp/helpdescs_en_US.go @@ -576,11 +576,23 @@ var helpDescsEnUS = map[string]string{ "getbestblockresult-hash": "The hash of the block", "getbestblockresult-height": "The blockchain height of the block", + // GetContractHash help. + "getcontracthash--synopsis": "Takes contracts (files) and hashes them.", + "getcontracthash-filepath": "The paths of the files to be hashed.", + // GetContractHashResult help. + "getcontracthashresult-contracthash": "Returns the contracts hashed", + // GetUnconfirmedBalanceCmd help. "getunconfirmedbalance--synopsis": "Calculates the unspent output value of all unmined transaction outputs for an account.", "getunconfirmedbalance-account": "The account to query the unconfirmed balance for (default=\"default\")", "getunconfirmedbalance--result0": "Total amount of all unmined unspent outputs of the account valued in decred.", + "getpaytocontractaddress--synopsis": "Returns the pay to contract P2PKH of given contracts.", + "getpaytocontractaddress-filepath": "The filepaths of the contracts to be used for the P2PKH", + + // GetPayToContractAddressResultCmd help. + "getpaytocontractaddress--result0": "The pay to contract P2PKH", + // ListAddressTransactionsCmd help. "listaddresstransactions--synopsis": "Returns a JSON array of objects containing verbose details for wallet transactions pertaining some addresses.", "listaddresstransactions-addresses": "Addresses to filter transaction results by", diff --git a/internal/rpchelp/methods.go b/internal/rpchelp/methods.go index 4f02388f1..ff85079a3 100644 --- a/internal/rpchelp/methods.go +++ b/internal/rpchelp/methods.go @@ -45,10 +45,12 @@ var Methods = []struct { {"getbestblock", []interface{}{(*dcrdtypes.GetBestBlockResult)(nil)}}, {"getblockcount", returnsNumber}, {"getblockhash", returnsString}, + {"getcontracthash", []interface{}{(*types.GetContractHashResult)(nil)}}, {"getinfo", []interface{}{(*types.InfoWalletResult)(nil)}}, {"getmasterpubkey", []interface{}{(*string)(nil)}}, {"getmultisigoutinfo", []interface{}{(*types.GetMultisigOutInfoResult)(nil)}}, {"getnewaddress", returnsString}, + {"getpaytocontractaddress", returnsString}, {"getrawchangeaddress", returnsString}, {"getreceivedbyaccount", returnsNumber}, {"getreceivedbyaddress", returnsNumber},