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

Function walletdisplayaddress

src/wallet/rpc/addresses.cpp:888–927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

886
887#ifdef ENABLE_EXTERNAL_SIGNER
888RPCHelpMan 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

Callers

nothing calls this directly

Calls 7

DecodeDestinationFunction · 0.85
IsValidDestinationFunction · 0.85
JSONRPCErrorFunction · 0.85
getMethod · 0.45
DisplayAddressMethod · 0.45
pushKVMethod · 0.45

Tested by

no test coverage detected