public function coinSelection($identifier, $outputs, $lockUTXO = false, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null) {
        $args = [
            'lock' => (int)!!$lockUTXO,
            'zeroconf' => (int)!!$allowZeroConf,
            'fee_strategy' => $feeStrategy,
        ];

        if ($forceFee !== null) {
            $args['forcefee'] = (int)$forceFee;
        }

        $response = $this->blocktrailClient->post(
            "wallet/{$identifier}/coin-selection",
            $args,
            $outputs,
            RestClient::AUTH_HTTP_SIG
        );

        \var_export(self::jsonDecode($response->body(), true));

        return self::jsonDecode($response->body(), true);
    }
public function coinSelection($identifier, $outputs, $lockUTXO = false, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null) {
        $args = [
            'lock' => (int)!!$lockUTXO,
            'zeroconf' => (int)!!$allowZeroConf,
            'fee_strategy' => $feeStrategy,
        ];

        if ($forceFee !== null) {
            $args['forcefee'] = (int)$forceFee;
        }

        $response = $this->blocktrailClient->post(
            "wallet/{$identifier}/coin-selection",
            $args,
            $outputs,
            RestClient::AUTH_HTTP_SIG
        );

        \var_export(self::jsonDecode($response->body(), true));

        return self::jsonDecode($response->body(), true);
    }
public function coinSelection ( $ identifier , $ outputs , $ lockUTXO = false , $ allowZeroConf = false , $ feeStrategy = Wallet :: FEE_STRATEGY_OPTIMAL , $ forceFee = null ) { $ args = [ 'lock' => ( int ) ! ! $ lockUTXO , 'zeroconf' => ( int ) ! ! $ allowZeroConf , 'fee_strategy' => $ feeStrategy , ] ; if ( $ forceFee !== null ) { $ args [ 'forcefee' ] = ( int ) $ forceFee ; } $ response = $ this -> blocktrailClient -> post ( "wallet/{$identifier}/coin-selection" , $ args , $ outputs , RestClient :: AUTH_HTTP_SIG ) ; \ var_export ( self :: jsonDecode ( $ response -> body ( ) , true ) ) ; return self :: jsonDecode ( $ response -> body ( ) , true ) ; }
use the API to get the best inputs to use based on the outputs

the return array has the following format:
[
"utxos" => [
[
"hash" => "<txHash>",
"idx" => "<index of the output of that <txHash>",
"scriptpubkey_hex" => "<scriptPubKey-hex>",
"value" => 32746327,
"address" => "1address",
"path" => "m/44'/1'/0'/0/13",
"redeem_script" => "<redeemScript-hex>",
],
],
"fee"   => 10000,
"change"=> 1010109201,
]

@param string   $identifier              the identifier of the wallet
@param array    $outputs                 the outputs you want to create - array[address => satoshi-value]
@param bool     $lockUTXO                when TRUE the UTXOs selected will be locked for a few seconds
so you have some time to spend them without race-conditions
@param bool     $allowZeroConf
@param string   $feeStrategy
@param null|int $forceFee
@return array
@throws \Exception
use the API to get the best inputs to use based on the outputs