| 148 | } |
| 149 | |
| 150 | static RPCHelpMan getrawtransaction() |
| 151 | { |
| 152 | return RPCHelpMan{ |
| 153 | "getrawtransaction", |
| 154 | "\nReturn the raw transaction data.\n" |
| 155 | |
| 156 | "\nBy default, this call only returns a transaction if it is in the mempool. If -txindex is enabled\n" |
| 157 | "and no blockhash argument is passed, it will return the transaction if it is in the mempool or any block.\n" |
| 158 | "If a blockhash argument is passed, it will return the transaction if\n" |
| 159 | "the specified block is available and the transaction is in that block.\n" |
| 160 | "\nHint: Use gettransaction for wallet transactions.\n" |
| 161 | |
| 162 | "\nIf verbose is 'true', returns an Object with information about 'txid'.\n" |
| 163 | "If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n", |
| 164 | { |
| 165 | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"}, |
| 166 | {"verbose", RPCArg::Type::BOOL, RPCArg::Default{false}, "If false, return a string, otherwise return a json object"}, |
| 167 | {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED_NAMED_ARG, "The block in which to look for the transaction"}, |
| 168 | }, |
| 169 | { |
| 170 | RPCResult{"if verbose is not set or set to false", |
| 171 | RPCResult::Type::STR, "data", "The serialized, hex-encoded data for 'txid'" |
| 172 | }, |
| 173 | RPCResult{"if verbose is set to true", |
| 174 | RPCResult::Type::OBJ, "", "", |
| 175 | { |
| 176 | {RPCResult::Type::BOOL, "in_active_chain", /*optional=*/true, "Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)"}, |
| 177 | {RPCResult::Type::STR_HEX, "hex", "The serialized, hex-encoded data for 'txid'"}, |
| 178 | {RPCResult::Type::STR_HEX, "txid", "The transaction id (same as provided)"}, |
| 179 | {RPCResult::Type::STR_HEX, "hash", "The transaction hash (differs from txid for witness transactions)"}, |
| 180 | {RPCResult::Type::NUM, "size", "The serialized transaction size"}, |
| 181 | {RPCResult::Type::NUM, "vsize", "The virtual transaction size (differs from size for witness transactions)"}, |
| 182 | {RPCResult::Type::NUM, "weight", "The transaction's weight (between vsize*4-3 and vsize*4)"}, |
| 183 | {RPCResult::Type::NUM, "version", "The version"}, |
| 184 | {RPCResult::Type::NUM_TIME, "locktime", "The lock time"}, |
| 185 | {RPCResult::Type::ARR, "vin", "", |
| 186 | { |
| 187 | {RPCResult::Type::OBJ, "", "", |
| 188 | { |
| 189 | {RPCResult::Type::STR_HEX, "txid", "The transaction id"}, |
| 190 | {RPCResult::Type::NUM, "vout", "The output number"}, |
| 191 | {RPCResult::Type::OBJ, "scriptSig", "The script", |
| 192 | { |
| 193 | {RPCResult::Type::STR, "asm", "asm"}, |
| 194 | {RPCResult::Type::STR_HEX, "hex", "hex"}, |
| 195 | }}, |
| 196 | {RPCResult::Type::NUM, "sequence", "The script sequence number"}, |
| 197 | {RPCResult::Type::ARR, "txinwitness", /*optional=*/true, "", |
| 198 | { |
| 199 | {RPCResult::Type::STR_HEX, "hex", "hex-encoded witness data (if any)"}, |
| 200 | }}, |
| 201 | }}, |
| 202 | }}, |
| 203 | {RPCResult::Type::ARR, "vout", "", |
| 204 | { |
| 205 | {RPCResult::Type::OBJ, "", "", |
| 206 | { |
| 207 | {RPCResult::Type::NUM, "value", "The value in " + CURRENCY_UNIT}, |
nothing calls this directly
no test coverage detected