@@ -334,3 +334,45 @@ void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const
334334 result.pushKV (" errors" , std::move (vErrors));
335335 }
336336}
337+
338+ std::vector<RPCResult> DecodeTxDoc (const std::string& txid_field_doc)
339+ {
340+ return {
341+ {RPCResult::Type::STR_HEX, " txid" , txid_field_doc},
342+ {RPCResult::Type::STR_HEX, " hash" , " The transaction hash (differs from txid for witness transactions)" },
343+ {RPCResult::Type::NUM, " size" , " The serialized transaction size" },
344+ {RPCResult::Type::NUM, " vsize" , " The virtual transaction size (differs from size for witness transactions)" },
345+ {RPCResult::Type::NUM, " weight" , " The transaction's weight (between vsize*4-3 and vsize*4)" },
346+ {RPCResult::Type::NUM, " version" , " The version" },
347+ {RPCResult::Type::NUM_TIME, " locktime" , " The lock time" },
348+ {RPCResult::Type::ARR, " vin" , " " ,
349+ {
350+ {RPCResult::Type::OBJ, " " , " " ,
351+ {
352+ {RPCResult::Type::STR_HEX, " coinbase" , /* optional=*/ true , " The coinbase value (only if coinbase transaction)" },
353+ {RPCResult::Type::STR_HEX, " txid" , /* optional=*/ true , " The transaction id (if not coinbase transaction)" },
354+ {RPCResult::Type::NUM, " vout" , /* optional=*/ true , " The output number (if not coinbase transaction)" },
355+ {RPCResult::Type::OBJ, " scriptSig" , /* optional=*/ true , " The script (if not coinbase transaction)" ,
356+ {
357+ {RPCResult::Type::STR, " asm" , " Disassembly of the signature script" },
358+ {RPCResult::Type::STR_HEX, " hex" , " The raw signature script bytes, hex-encoded" },
359+ }},
360+ {RPCResult::Type::ARR, " txinwitness" , /* optional=*/ true , " " ,
361+ {
362+ {RPCResult::Type::STR_HEX, " hex" , " hex-encoded witness data (if any)" },
363+ }},
364+ {RPCResult::Type::NUM, " sequence" , " The script sequence number" },
365+ }},
366+ }},
367+ {RPCResult::Type::ARR, " vout" , " " ,
368+ {
369+ {RPCResult::Type::OBJ, " " , " " ,
370+ {
371+ {RPCResult::Type::STR_AMOUNT, " value" , " The value in " + CURRENCY_UNIT},
372+ {RPCResult::Type::NUM, " n" , " index" },
373+ {RPCResult::Type::OBJ, " scriptPubKey" , " " , ScriptPubKeyDoc ()},
374+ {RPCResult::Type::BOOL, " ischange" , /* optional=*/ true , " Output script is change (only if wallet transaction and true for selected rpcwallet)" },
375+ }},
376+ }},
377+ };
378+ }
0 commit comments