| 604 | } |
| 605 | |
| 606 | RPCHelpMan getaddressinfo() |
| 607 | { |
| 608 | return RPCHelpMan{"getaddressinfo", |
| 609 | "\nReturn information about the given address.\n" |
| 610 | "Some of the information will only be present if the address is in the active wallet.\n", |
| 611 | { |
| 612 | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The address for which to get information."}, |
| 613 | }, |
| 614 | RPCResult{ |
| 615 | RPCResult::Type::OBJ, "", "", |
| 616 | { |
| 617 | {RPCResult::Type::STR, "address", "The address validated."}, |
| 618 | {RPCResult::Type::STR_HEX, "scriptPubKey", "The hex-encoded scriptPubKey generated by the address."}, |
| 619 | {RPCResult::Type::BOOL, "ismine", "If the address is yours."}, |
| 620 | {RPCResult::Type::BOOL, "iswatchonly", "If the address is watchonly."}, |
| 621 | {RPCResult::Type::BOOL, "solvable", "If we know how to spend coins sent to this address, ignoring the possible lack of private keys."}, |
| 622 | {RPCResult::Type::STR, "desc", /*optional=*/true, "A descriptor for spending coins sent to this address (only when solvable)."}, |
| 623 | {RPCResult::Type::STR, "parent_desc", /*optional=*/true, "The descriptor used to derive this address if this is a descriptor wallet"}, |
| 624 | {RPCResult::Type::BOOL, "isscript", "If the key is a script."}, |
| 625 | {RPCResult::Type::BOOL, "ischange", "If the address was used for change output."}, |
| 626 | {RPCResult::Type::BOOL, "iswitness", "If the address is a witness address."}, |
| 627 | {RPCResult::Type::NUM, "witness_version", /*optional=*/true, "The version number of the witness program."}, |
| 628 | {RPCResult::Type::STR_HEX, "witness_program", /*optional=*/true, "The hex value of the witness program."}, |
| 629 | {RPCResult::Type::STR, "script", /*optional=*/true, "The output script type. Only if isscript is true and the redeemscript is known. Possible\n" |
| 630 | "types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash,\n" |
| 631 | "witness_v0_scripthash, witness_unknown."}, |
| 632 | {RPCResult::Type::STR_HEX, "hex", /*optional=*/true, "The redeemscript for the p2sh address."}, |
| 633 | {RPCResult::Type::ARR, "pubkeys", /*optional=*/true, "Array of pubkeys associated with the known redeemscript (only if script is multisig).", |
| 634 | { |
| 635 | {RPCResult::Type::STR, "pubkey", ""}, |
| 636 | }}, |
| 637 | {RPCResult::Type::NUM, "sigsrequired", /*optional=*/true, "The number of signatures required to spend multisig output (only if script is multisig)."}, |
| 638 | {RPCResult::Type::STR_HEX, "pubkey", /*optional=*/true, "The hex value of the raw public key for single-key addresses (possibly embedded in P2SH or P2WSH)."}, |
| 639 | {RPCResult::Type::OBJ, "embedded", /*optional=*/true, "Information about the address embedded in P2SH or P2WSH, if relevant and known.", |
| 640 | { |
| 641 | {RPCResult::Type::ELISION, "", "Includes all getaddressinfo output fields for the embedded address, excluding metadata (timestamp, hdkeypath, hdseedid)\n" |
| 642 | "and relation to the wallet (ismine, iswatchonly)."}, |
| 643 | }}, |
| 644 | {RPCResult::Type::BOOL, "iscompressed", /*optional=*/true, "If the pubkey is compressed."}, |
| 645 | {RPCResult::Type::STR_HEX, "confidential_key", "the raw blinding public key for that address, if any. \"\" if none"}, |
| 646 | {RPCResult::Type::STR, "unconfidential", "The address without confidentiality key"}, |
| 647 | {RPCResult::Type::STR, "confidential", "The address with wallet-stored confidentiality key if known. Only displayed for non-confidential address inputs"}, |
| 648 | {RPCResult::Type::NUM_TIME, "timestamp", /*optional=*/true, "The creation time of the key, if available, expressed in " + UNIX_EPOCH_TIME + "."}, |
| 649 | {RPCResult::Type::STR, "hdkeypath", /*optional=*/true, "The HD keypath, if the key is HD and available."}, |
| 650 | {RPCResult::Type::STR_HEX, "hdseedid", /*optional=*/true, "The Hash160 of the HD seed."}, |
| 651 | {RPCResult::Type::STR_HEX, "hdmasterfingerprint", /*optional=*/true, "The fingerprint of the master key."}, |
| 652 | {RPCResult::Type::ARR, "labels", "Array of labels associated with the address. Currently limited to one label but returned\n" |
| 653 | "as an array to keep the API stable if multiple labels are enabled in the future.", |
| 654 | { |
| 655 | {RPCResult::Type::STR, "label name", "Label name (defaults to \"\")."}, |
| 656 | }}, |
| 657 | } |
| 658 | }, |
| 659 | RPCExamples{ |
| 660 | HelpExampleCli("getaddressinfo", "\"" + EXAMPLE_ADDRESS[0] + "\"") + |
| 661 | HelpExampleRpc("getaddressinfo", "\"" + EXAMPLE_ADDRESS[0] + "\"") |
| 662 | }, |
| 663 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
nothing calls this directly
no test coverage detected