rpc: move-only: move ScriptPubKeyDoc to utils

This commit is contained in:
James O'Beirne 2024-11-15 13:58:53 -05:00
parent 25dacae9c7
commit 25fe087de5
3 changed files with 13 additions and 11 deletions

View file

@ -82,17 +82,6 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
}
}
static std::vector<RPCResult> ScriptPubKeyDoc() {
return
{
{RPCResult::Type::STR, "asm", "Disassembly of the output script"},
{RPCResult::Type::STR, "desc", "Inferred descriptor for the output"},
{RPCResult::Type::STR_HEX, "hex", "The raw output script bytes, hex-encoded"},
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
{RPCResult::Type::STR, "type", "The type (one of: " + GetAllOutputTypes() + ")"},
};
}
static std::vector<RPCResult> DecodeTxDoc(const std::string& txid_field_doc)
{
return {

View file

@ -1404,3 +1404,14 @@ void PushWarnings(const std::vector<bilingual_str>& warnings, UniValue& obj)
if (warnings.empty()) return;
obj.pushKV("warnings", BilingualStringsToUniValue(warnings));
}
std::vector<RPCResult> ScriptPubKeyDoc() {
return
{
{RPCResult::Type::STR, "asm", "Disassembly of the output script"},
{RPCResult::Type::STR, "desc", "Inferred descriptor for the output"},
{RPCResult::Type::STR_HEX, "hex", "The raw output script bytes, hex-encoded"},
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
{RPCResult::Type::STR, "type", "The type (one of: " + GetAllOutputTypes() + ")"},
};
}

View file

@ -512,4 +512,6 @@ private:
void PushWarnings(const UniValue& warnings, UniValue& obj);
void PushWarnings(const std::vector<bilingual_str>& warnings, UniValue& obj);
std::vector<RPCResult> ScriptPubKeyDoc();
#endif // BITCOIN_RPC_UTIL_H