| 458 | } |
| 459 | |
| 460 | static RPCHelpMan createrawtransaction() |
| 461 | { |
| 462 | return RPCHelpMan{"createrawtransaction", |
| 463 | "\nCreate a transaction spending the given inputs and creating new outputs.\n" |
| 464 | "Outputs can be addresses or data.\n" |
| 465 | "Returns hex-encoded raw transaction.\n" |
| 466 | "Note that the transaction's inputs are not signed, and\n" |
| 467 | "it is not stored in the wallet or transmitted to the network.\n", |
| 468 | CreateTxDoc(), |
| 469 | RPCResult{ |
| 470 | RPCResult::Type::STR_HEX, "transaction", "hex string of the transaction" |
| 471 | }, |
| 472 | RPCExamples{ |
| 473 | HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"address\\\":0.01}]\"") |
| 474 | + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"") |
| 475 | + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"address\\\":0.01}]\"") |
| 476 | + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"data\\\":\\\"00010203\\\"}]\"") |
| 477 | }, |
| 478 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
| 479 | { |
| 480 | ChainstateManager& chainman = EnsureAnyChainman(request.context); |
| 481 | |
| 482 | RPCTypeCheck(request.params, { |
| 483 | UniValue::VARR, |
| 484 | UniValue::VARR, |
| 485 | UniValue::VNUM, |
| 486 | UniValue::VBOOL, |
| 487 | }, true |
| 488 | ); |
| 489 | |
| 490 | bool rbf = false; |
| 491 | if (!request.params[3].isNull()) { |
| 492 | rbf = request.params[3].isTrue(); |
| 493 | } |
| 494 | CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], rbf, chainman.ActiveChain().Tip()); |
| 495 | |
| 496 | return EncodeHexTx(CTransaction(rawTx)); |
| 497 | }, |
| 498 | }; |
| 499 | } |
| 500 | |
| 501 | static RPCHelpMan decoderawtransaction() |
| 502 | { |
nothing calls this directly
no test coverage detected