[#wallet-FundTransaction]
= xref:wallet.adoc[wallet]::FundTransaction
:relfileprefix: ../
:mrdocs:

Insert additional inputs into the transaction by calling CreateTransaction()&semi;

== Synopsis

Declared in `&lt;wallet&sol;spend&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:util/Result.adoc[util::Result&lt;CreatedTransactionResult&gt;]
FundTransaction(
    xref:wallet/CWallet.adoc[CWallet]& wallet,
    xref:CMutableTransaction.adoc[CMutableTransaction] const& tx,
    std::vector&lt;CRecipient&gt; const& recipients,
    std::optional&lt;unsigned int&gt; change&lowbar;pos,
    bool lockUnspents,
    xref:wallet/CCoinControl.adoc[CCoinControl] coin&lowbar;control);
----

== Return Value

If successful, the funded transaction and its fee details, otherwise an error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *wallet*
| The wallet used to fund the transaction&period;
| *tx*
| The transaction to be funded with additional inputs&period;
| *recipients*
| The recipients and amounts already present in the transaction&period;
| *change&lowbar;pos*
| The position of the change output, or std&colon;&colon;nullopt for a random position&period;
| *lockUnspents*
| Whether to lock the newly added inputs as unspent&period;
| *coin&lowbar;control*
| Coin control settings governing input selection and fees&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
