| @@ 1400-1419 (lines=20) @@ | ||
| 1397 | * @return array |
|
| 1398 | * @throws \Exception |
|
| 1399 | */ |
|
| 1400 | public function coinSelection($identifier, $outputs, $lockUTXO = false, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 1401 | $args = [ |
|
| 1402 | 'lock' => (int)!!$lockUTXO, |
|
| 1403 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1404 | 'fee_strategy' => $feeStrategy, |
|
| 1405 | ]; |
|
| 1406 | ||
| 1407 | if ($forceFee !== null) { |
|
| 1408 | $args['forcefee'] = (int)$forceFee; |
|
| 1409 | } |
|
| 1410 | ||
| 1411 | $response = $this->client->post( |
|
| 1412 | "wallet/{$identifier}/coin-selection", |
|
| 1413 | $args, |
|
| 1414 | $outputs, |
|
| 1415 | RestClient::AUTH_HTTP_SIG |
|
| 1416 | ); |
|
| 1417 | ||
| 1418 | return self::jsonDecode($response->body(), true); |
|
| 1419 | } |
|
| 1420 | ||
| 1421 | /** |
|
| 1422 | * |
|
| @@ 1431-1449 (lines=19) @@ | ||
| 1428 | * @return array |
|
| 1429 | * @throws \Exception |
|
| 1430 | */ |
|
| 1431 | public function walletMaxSpendable($identifier, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null, $outputCnt = 1) { |
|
| 1432 | $args = [ |
|
| 1433 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1434 | 'fee_strategy' => $feeStrategy, |
|
| 1435 | 'outputs' => $outputCnt, |
|
| 1436 | ]; |
|
| 1437 | ||
| 1438 | if ($forceFee !== null) { |
|
| 1439 | $args['forcefee'] = (int)$forceFee; |
|
| 1440 | } |
|
| 1441 | ||
| 1442 | $response = $this->client->get( |
|
| 1443 | "wallet/{$identifier}/max-spendable", |
|
| 1444 | $args, |
|
| 1445 | RestClient::AUTH_HTTP_SIG |
|
| 1446 | ); |
|
| 1447 | ||
| 1448 | return self::jsonDecode($response->body(), true); |
|
| 1449 | } |
|
| 1450 | ||
| 1451 | /** |
|
| 1452 | * @return array ['optimal_fee' => 10000, 'low_priority_fee' => 5000] |
|