MCPcopy Create free account
hub / github.com/ElementsProject/elements / listsinceblock

Function listsinceblock

src/wallet/rpc/transactions.cpp:596–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

594}
595
596RPCHelpMan listsinceblock()
597{
598 return RPCHelpMan{"listsinceblock",
599 "\nGet all transactions in blocks since block [blockhash], or all transactions if omitted.\n"
600 "If \"blockhash\" is no longer a part of the main chain, transactions from the fork point onward are included.\n"
601 "Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the \"removed\" array.\n",
602 {
603 {"blockhash", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "If set, the block hash to list transactions since, otherwise list all transactions."},
604 {"target_confirmations", RPCArg::Type::NUM, RPCArg::Default{1}, "Return the nth block hash from the main chain. e.g. 1 would mean the best block hash. Note: this is not used as a filter, but only affects [lastblock] in the return value"},
605 {"include_watchonly", RPCArg::Type::BOOL, RPCArg::DefaultHint{"true for watch-only wallets, otherwise false"}, "Include transactions to watch-only addresses (see 'importaddress')"},
606 {"include_removed", RPCArg::Type::BOOL, RPCArg::Default{true}, "Show transactions that were removed due to a reorg in the \"removed\" array\n"
607 "(not guaranteed to work on pruned nodes)"},
608 },
609 RPCResult{
610 RPCResult::Type::OBJ, "", "",
611 {
612 {RPCResult::Type::ARR, "transactions", "",
613 {
614 {RPCResult::Type::OBJ, "", "", Cat(Cat<std::vector<RPCResult>>(
615 {
616 {RPCResult::Type::BOOL, "involvesWatchonly", /*optional=*/true, "Only returns true if imported addresses were involved in transaction."},
617 {RPCResult::Type::STR, "address", "The bitcoin address of the transaction."},
618 {RPCResult::Type::STR, "category", "The transaction category.\n"
619 "\"send\" Transactions sent.\n"
620 "\"receive\" Non-coinbase transactions received.\n"
621 "\"generate\" Coinbase transactions received with more than 100 confirmations.\n"
622 "\"immature\" Coinbase transactions received with 100 or fewer confirmations.\n"
623 "\"orphan\" Orphaned coinbase transactions received."},
624 {RPCResult::Type::STR_AMOUNT, "amount", "The amount in " + CURRENCY_UNIT + ". This is negative for the 'send' category, and is positive\n"
625 "for all other categories"},
626 {RPCResult::Type::NUM, "vout", "the vout value"},
627 {RPCResult::Type::STR_AMOUNT, "fee", /*optional=*/true, "The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the\n"
628 "'send' category of transactions."},
629 },
630 TransactionDescriptionString()),
631 {
632 {RPCResult::Type::BOOL, "abandoned", /*optional=*/true, "'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n"
633 "'send' category of transactions."},
634 {RPCResult::Type::STR, "label", /*optional=*/true, "A comment for the address/transaction, if any"},
635 })},
636 }},
637 {RPCResult::Type::ARR, "removed", /*optional=*/true, "<structure is the same as \"transactions\" above, only present if include_removed=true>\n"
638 "Note: transactions that were re-added in the active chain will appear as-is in this array, and may thus have a positive confirmation count."
639 , {{RPCResult::Type::ELISION, "", ""},}},
640 {RPCResult::Type::STR_HEX, "lastblock", "The hash of the block (target_confirmations-1) from the best block on the main chain, or the genesis hash if the referenced block does not exist yet. This is typically used to feed back into listsinceblock the next time you call it. So you would generally use a target_confirmations of say 6, so you will be continually re-notified of transactions until they've reached 6 confirmations plus any new ones"},
641 }
642 },
643 RPCExamples{
644 HelpExampleCli("listsinceblock", "")
645 + HelpExampleCli("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6")
646 + HelpExampleRpc("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6")
647 },
648 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
649{
650 const std::shared_ptr<const CWallet> pwallet = GetWalletForJSONRPCRequest(request);
651 if (!pwallet) return NullUniValue;
652
653 const CWallet& wallet = *pwallet;

Callers

nothing calls this directly

Calls 15

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
ParseHashVFunction · 0.85
FoundBlockClass · 0.85
JSONRPCErrorFunction · 0.85
ParseIncludeWatchonlyFunction · 0.85
findCommonAncestorMethod · 0.80
get_intMethod · 0.80
get_boolMethod · 0.80
GetTxDepthInMainChainMethod · 0.80

Tested by

no test coverage detected