Skip to content

Commit 8134a6b

Browse files
committed
rpc: add cli example for walletcreatefundedpsbt RPC
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.
1 parent 6876e50 commit 8134a6b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/wallet/rpc/spend.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,8 +1729,10 @@ RPCHelpMan walletcreatefundedpsbt()
17291729
}
17301730
},
17311731
RPCExamples{
1732-
"\nCreate a transaction with no inputs\n"
1733-
+ HelpExampleCli("walletcreatefundedpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
1732+
"\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"
1733+
+ HelpExampleCli("walletcreatefundedpsbt", "\"[]\" \"[{\\\"" + EXAMPLE_ADDRESS[0] + "\\\":0.5}]\" 0 \"{\\\"add_inputs\\\":true,\\\"fee_rate\\\":2}\"")
1734+
+ "\nCreate the same PSBT as the above one instead using named arguments:\n"
1735+
+ HelpExampleCli("-named walletcreatefundedpsbt", "outputs=\"[{\\\"" + EXAMPLE_ADDRESS[0] + "\\\":0.5}]\" add_inputs=true fee_rate=2")
17341736
},
17351737
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
17361738
{

0 commit comments

Comments
 (0)