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

Select all coins from coin&lowbar;control, and if coin&lowbar;control &apos;m&lowbar;allow&lowbar;other&lowbar;inputs&equals;true&apos;, call &apos;AutomaticCoinSelection&apos; to select a set of coins such that nTargetValue &hyphen; pre&lowbar;set&lowbar;inputs&period;total&lowbar;amount is met&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;requires&lowbar;capability(0x7f94fdec3b78)&rsqb;&rsqb;
xref:util/Result.adoc[util::Result&lt;SelectionResult&gt;]
SelectCoins(
    xref:wallet/CWallet.adoc[CWallet] const& wallet,
    xref:wallet/CoinsResult.adoc[CoinsResult]& available&lowbar;coins,
    xref:wallet/CoinsResult.adoc[CoinsResult] const& pre&lowbar;set&lowbar;inputs,
    xref:CAmount.adoc[CAmount] const& nTargetValue,
    xref:wallet/CCoinControl.adoc[CCoinControl] const& coin&lowbar;control,
    xref:wallet/CoinSelectionParams.adoc[CoinSelectionParams] const& coin&lowbar;selection&lowbar;params);
----

== Return Value

If successful, a SelectionResult containing the selected coins, otherwise an error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *wallet*
| The wallet which provides data necessary to spend the selected coins&period;
| *available&lowbar;coins*
| The coins, organized by OutputType, available for automatic selection&period;
| *pre&lowbar;set&lowbar;inputs*
| Inputs already chosen through coin control that must be included&period;
| *nTargetValue*
| The target value to be met by the selected coins&period;
| *coin&lowbar;control*
| Coin control settings governing manual and automatic selection&period;
| *coin&lowbar;selection&lowbar;params*
| Parameters for this coin selection such as feerates and spend options&period;
|===


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