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

Function listunspent

src/wallet/rpc/coins.cpp:554–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554RPCHelpMan listunspent()
555{
556 return RPCHelpMan{
557 "listunspent",
558 "\nReturns array of unspent transaction outputs\n"
559 "with between minconf and maxconf (inclusive) confirmations.\n"
560 "Optionally filter to only include txouts paid to specified addresses.\n",
561 {
562 {"minconf", RPCArg::Type::NUM, RPCArg::Default{1}, "The minimum confirmations to filter"},
563 {"maxconf", RPCArg::Type::NUM, RPCArg::Default{9999999}, "The maximum confirmations to filter"},
564 {"addresses", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "The addresses to filter",
565 {
566 {"address", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "address"},
567 },
568 },
569 {"include_unsafe", RPCArg::Type::BOOL, RPCArg::Default{true}, "Include outputs that are not safe to spend\n"
570 "See description of \"safe\" attribute below."},
571 {"query_options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "JSON with query options",
572 {
573 {"minimumAmount", RPCArg::Type::AMOUNT, RPCArg::Default{FormatMoney(0)}, "Minimum value of each UTXO in " + CURRENCY_UNIT + ""},
574 {"maximumAmount", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"unlimited"}, "Maximum value of each UTXO in " + CURRENCY_UNIT + ""},
575 {"maximumCount", RPCArg::Type::NUM, RPCArg::DefaultHint{"unlimited"}, "Maximum number of UTXOs"},
576 {"minimumSumAmount", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"unlimited"}, "Minimum sum value of all UTXOs in " + CURRENCY_UNIT + ""},
577 {"asset", RPCArg::Type::STR, RPCArg::Default{""}, "Asset to filter outputs for."},
578 },
579 "query_options"},
580 },
581 RPCResult{
582 RPCResult::Type::ARR, "", "",
583 {
584 {RPCResult::Type::OBJ, "", "",
585 {
586 {RPCResult::Type::STR_HEX, "txid", "the transaction id"},
587 {RPCResult::Type::NUM, "vout", "the vout value"},
588 {RPCResult::Type::STR, "address", /*optional=*/true, "the bitcoin address"},
589 {RPCResult::Type::STR, "label", /*optional=*/true, "The associated label, or \"\" for the default label"},
590 {RPCResult::Type::STR, "scriptPubKey", "the script key"},
591 {RPCResult::Type::STR_AMOUNT, "amount", "the transaction output amount in " + CURRENCY_UNIT},
592 {RPCResult::Type::STR_HEX, "amountcommitment", "the transaction output commitment in hex"},
593 {RPCResult::Type::STR_HEX, "asset", "the transaction output asset in hex"},
594 {RPCResult::Type::STR_HEX, "assetcommitment", "the transaction output asset commitment in hex"},
595 {RPCResult::Type::STR_HEX, "amountblinder", "the transaction output amount blinding factor in hex"},
596 {RPCResult::Type::STR_HEX, "assetblinder", "the transaction output asset blinding factor in hex"},
597 {RPCResult::Type::NUM, "confirmations", "The number of confirmations"},
598 {RPCResult::Type::NUM, "ancestorcount", /*optional=*/true, "The number of in-mempool ancestor transactions, including this one (if transaction is in the mempool)"},
599 {RPCResult::Type::NUM, "ancestorsize", /*optional=*/true, "The virtual transaction size of in-mempool ancestors, including this one (if transaction is in the mempool)"},
600 {RPCResult::Type::STR_AMOUNT, "ancestorfees", /*optional=*/true, "The total fees of in-mempool ancestors (including this one) with fee deltas used for mining priority in " + CURRENCY_ATOM + " (if transaction is in the mempool)"},
601 {RPCResult::Type::STR_HEX, "redeemScript", /*optional=*/true, "The redeemScript if scriptPubKey is P2SH"},
602 {RPCResult::Type::STR, "witnessScript", /*optional=*/true, "witnessScript if the scriptPubKey is P2WSH or P2SH-P2WSH"},
603 {RPCResult::Type::BOOL, "spendable", "Whether we have the private keys to spend this output"},
604 {RPCResult::Type::BOOL, "solvable", "Whether we know how to spend this output, ignoring the lack of keys"},
605 {RPCResult::Type::BOOL, "reused", /*optional=*/true, "(only present if avoid_reuse is set) Whether this output is reused/dirty (sent to an address that was previously spent from)"},
606 {RPCResult::Type::STR, "desc", /*optional=*/true, "(only when solvable) A descriptor for spending this output"},
607 {RPCResult::Type::BOOL, "safe", "Whether this output is considered safe to spend. Unconfirmed transactions\n"
608 "from outside keys and unconfirmed replacement transactions are considered unsafe\n"
609 "and are not eligible for spending by fundrawtransaction and sendtoaddress."},
610 }},
611 }

Callers

nothing calls this directly

Calls 15

FormatMoneyFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
RPCTypeCheckArgumentFunction · 0.85
DecodeDestinationFunction · 0.85
IsValidDestinationFunction · 0.85
JSONRPCErrorFunction · 0.85
RPCTypeCheckObjFunction · 0.85
UniValueTypeClass · 0.85
GetAssetFromStringFunction · 0.85
ExtractDestinationFunction · 0.85

Tested by

no test coverage detected