mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Merge bitcoin/bitcoin#31958: rpc: add cli examples, update docs
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Windows native, VS 2022 (push) Waiting to run
CI / Windows native, fuzz, VS 2022 (push) Waiting to run
CI / Linux->Windows cross, no tests (push) Waiting to run
CI / Windows, test cross-built (push) Blocked by required conditions
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Windows native, VS 2022 (push) Waiting to run
CI / Windows native, fuzz, VS 2022 (push) Waiting to run
CI / Linux->Windows cross, no tests (push) Waiting to run
CI / Windows, test cross-built (push) Blocked by required conditions
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
32dcec269b
rpc: update RPC help of `createpsbt` (rkrux)931117a46f
rpc: update the doc for `data` field in `outputs` argument (rkrux)8134a6b5d4
rpc: add cli example for `walletcreatefundedpsbt` RPC (rkrux) Pull request description: ### add cli example for `walletcreatefundedpsbt` and `createpsbt` RPCs The only example present earlier was one that creates an OP_RETURN output. This lack of examples has discouraged me earlier to use this RPC. Adding an example that creates PSBT sending bitcoin to address, a scenario that is much more common. ### rpc: update the doc for `data` field in `outputs` argument It was not evident to me that this field creates an `OP_RETURN` output until I read the code and tried it out. Thus, making the doc explicitly mention it. This affects docs of the following RPCs: `bumpfee`, `psbtbumpfee`, `send`, `walletcreatefundedpsbt`, `createpsbt`, and `createrawtransaction` ACKs for top commit: sipa: utACK32dcec269b
1440000bytes: utACK32dcec269b
achow101: ACK32dcec269b
ryanofsky: Concept ACK32dcec269b
. These seem like helpful clarifications, but I did not look into the details Tree-SHA512: f994488ba7d52d00960fc52064bb419cf548e29822fe23d6ee0452fdf514dd93f089145eddb32b8086a7918cf8cf33a4c3f16bfcb7948f3c9d5afd95e8d3a1cb
This commit is contained in:
commit
679bb2aac2
2 changed files with 10 additions and 6 deletions
|
@ -150,7 +150,7 @@ static std::vector<RPCArg> CreateTxDoc()
|
|||
},
|
||||
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
|
||||
{
|
||||
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
|
||||
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data that becomes a part of an OP_RETURN output"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1550,13 +1550,15 @@ static RPCHelpMan createpsbt()
|
|||
{
|
||||
return RPCHelpMan{"createpsbt",
|
||||
"\nCreates a transaction in the Partially Signed Transaction format.\n"
|
||||
"Implements the Creator role.\n",
|
||||
"Implements the Creator role.\n"
|
||||
"Note that the transaction's inputs are not signed, and\n"
|
||||
"it is not stored in the wallet or transmitted to the network.\n",
|
||||
CreateTxDoc(),
|
||||
RPCResult{
|
||||
RPCResult::Type::STR, "", "The resulting raw transaction (base64-encoded string)"
|
||||
},
|
||||
RPCExamples{
|
||||
HelpExampleCli("createpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
|
||||
HelpExampleCli("createpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"address\\\":0.01}]\"")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
|
|
|
@ -983,7 +983,7 @@ static std::vector<RPCArg> OutputsDoc()
|
|||
},
|
||||
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
|
||||
{
|
||||
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
|
||||
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data that becomes a part of an OP_RETURN output"},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -1734,8 +1734,10 @@ RPCHelpMan walletcreatefundedpsbt()
|
|||
}
|
||||
},
|
||||
RPCExamples{
|
||||
"\nCreate a transaction with no inputs\n"
|
||||
+ HelpExampleCli("walletcreatefundedpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
|
||||
"\nCreate a PSBT with automatically picked inputs that sends 0.5 BTC to an address and has a fee rate of 2 sat/vB:\n"
|
||||
+ HelpExampleCli("walletcreatefundedpsbt", "\"[]\" \"[{\\\"" + EXAMPLE_ADDRESS[0] + "\\\":0.5}]\" 0 \"{\\\"add_inputs\\\":true,\\\"fee_rate\\\":2}\"")
|
||||
+ "\nCreate the same PSBT as the above one instead using named arguments:\n"
|
||||
+ HelpExampleCli("-named walletcreatefundedpsbt", "outputs=\"[{\\\"" + EXAMPLE_ADDRESS[0] + "\\\":0.5}]\" add_inputs=true fee_rate=2")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue