| 1898 | } |
| 1899 | |
| 1900 | UniValue listtransactions(const JSONRPCRequest& request) |
| 1901 | { |
| 1902 | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); |
| 1903 | CWallet* const pwallet = wallet.get(); |
| 1904 | |
| 1905 | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { |
| 1906 | return NullUniValue; |
| 1907 | } |
| 1908 | |
| 1909 | std::string help_text {}; |
| 1910 | if (!IsDeprecatedRPCEnabled("accounts")) { |
| 1911 | help_text = "listtransactions (label count skip include_watchonly)\n" |
| 1912 | "\nIf a label name is provided, this will return only incoming transactions paying to addresses with the specified label.\n" |
| 1913 | "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions.\n" |
| 1914 | "Note that the \"account\" argument and \"otheraccount\" return value have been removed in V0.17. To use this RPC with an \"account\" argument, restart\n" |
| 1915 | "bgoldd with -deprecatedrpc=accounts\n" |
| 1916 | "\nArguments:\n" |
| 1917 | "1. \"label\" (string, optional) If set, should be a valid label name to return only incoming transactions\n" |
| 1918 | " with the specified label, or \"*\" to disable filtering and return all transactions.\n" |
| 1919 | "2. count (numeric, optional, default=10) The number of transactions to return\n" |
| 1920 | "3. skip (numeric, optional, default=0) The number of transactions to skip\n" |
| 1921 | "4. include_watchonly (bool, optional, default=false) Include transactions to watch-only addresses (see 'importaddress')\n" |
| 1922 | "\nResult:\n" |
| 1923 | "[\n" |
| 1924 | " {\n" |
| 1925 | " \"address\":\"address\", (string) The bitcoin address of the transaction.\n" |
| 1926 | " \"category\":\"send|receive\", (string) The transaction category.\n" |
| 1927 | " \"amount\": x.xxx, (numeric) The amount in " + CURRENCY_UNIT + ". This is negative for the 'send' category, and is positive\n" |
| 1928 | " for the 'receive' category,\n" |
| 1929 | " \"label\": \"label\", (string) A comment for the address/transaction, if any\n" |
| 1930 | " \"vout\": n, (numeric) the vout value\n" |
| 1931 | " \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n" |
| 1932 | " 'send' category of transactions.\n" |
| 1933 | " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Negative confirmations indicate the\n" |
| 1934 | " transaction conflicts with the block chain\n" |
| 1935 | " \"trusted\": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n" |
| 1936 | " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction.\n" |
| 1937 | " \"blockindex\": n, (numeric) The index of the transaction in the block that includes it.\n" |
| 1938 | " \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n" |
| 1939 | " \"txid\": \"transactionid\", (string) The transaction id.\n" |
| 1940 | " \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n" |
| 1941 | " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT).\n" |
| 1942 | " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n" |
| 1943 | " \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n" |
| 1944 | " may be unknown for unconfirmed transactions not in the mempool\n" |
| 1945 | " \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n" |
| 1946 | " 'send' category of transactions.\n" |
| 1947 | " }\n" |
| 1948 | "]\n" |
| 1949 | |
| 1950 | "\nExamples:\n" |
| 1951 | "\nList the most recent 10 transactions in the systems\n" |
| 1952 | + HelpExampleCli("listtransactions", "") + |
| 1953 | "\nList transactions 100 to 120\n" |
| 1954 | + HelpExampleCli("listtransactions", "\"*\" 20 100") + |
| 1955 | "\nAs a json rpc call\n" |
| 1956 | + HelpExampleRpc("listtransactions", "\"*\", 20, 100"); |
| 1957 | } else { |
nothing calls this directly
no test coverage detected