| 886 | |
| 887 | #ifdef ENABLE_EXTERNAL_SIGNER |
| 888 | RPCHelpMan walletdisplayaddress() |
| 889 | { |
| 890 | return RPCHelpMan{ |
| 891 | "walletdisplayaddress", |
| 892 | "Display address on an external signer for verification.", |
| 893 | { |
| 894 | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "bitcoin address to display"}, |
| 895 | }, |
| 896 | RPCResult{ |
| 897 | RPCResult::Type::OBJ,"","", |
| 898 | { |
| 899 | {RPCResult::Type::STR, "address", "The address as confirmed by the signer"}, |
| 900 | } |
| 901 | }, |
| 902 | RPCExamples{""}, |
| 903 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
| 904 | { |
| 905 | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); |
| 906 | if (!wallet) return NullUniValue; |
| 907 | CWallet* const pwallet = wallet.get(); |
| 908 | |
| 909 | LOCK(pwallet->cs_wallet); |
| 910 | |
| 911 | CTxDestination dest = DecodeDestination(request.params[0].get_str()); |
| 912 | |
| 913 | // Make sure the destination is valid |
| 914 | if (!IsValidDestination(dest)) { |
| 915 | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address"); |
| 916 | } |
| 917 | |
| 918 | if (!pwallet->DisplayAddress(dest)) { |
| 919 | throw JSONRPCError(RPC_MISC_ERROR, "Failed to display address"); |
| 920 | } |
| 921 | |
| 922 | UniValue result(UniValue::VOBJ); |
| 923 | result.pushKV("address", request.params[0].get_str()); |
| 924 | return result; |
| 925 | } |
| 926 | }; |
| 927 | } |
| 928 | #endif // ENABLE_EXTERNAL_SIGNER |
| 929 | } // namespace wallet |
nothing calls this directly
no test coverage detected