| @@ 1452-1471 (lines=20) @@ | ||
| 1449 | * @return array |
|
| 1450 | * @throws \Exception |
|
| 1451 | */ |
|
| 1452 | public function coinSelection($identifier, $outputs, $lockUTXO = false, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 1453 | $args = [ |
|
| 1454 | 'lock' => (int)!!$lockUTXO, |
|
| 1455 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1456 | 'fee_strategy' => $feeStrategy, |
|
| 1457 | ]; |
|
| 1458 | ||
| 1459 | if ($forceFee !== null) { |
|
| 1460 | $args['forcefee'] = (int)$forceFee; |
|
| 1461 | } |
|
| 1462 | ||
| 1463 | $response = $this->client->post( |
|
| 1464 | "wallet/{$identifier}/coin-selection", |
|
| 1465 | $args, |
|
| 1466 | $outputs, |
|
| 1467 | RestClient::AUTH_HTTP_SIG |
|
| 1468 | ); |
|
| 1469 | ||
| 1470 | return self::jsonDecode($response->body(), true); |
|
| 1471 | } |
|
| 1472 | ||
| 1473 | /** |
|
| 1474 | * |
|
| @@ 1483-1501 (lines=19) @@ | ||
| 1480 | * @return array |
|
| 1481 | * @throws \Exception |
|
| 1482 | */ |
|
| 1483 | public function walletMaxSpendable($identifier, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null, $outputCnt = 1) { |
|
| 1484 | $args = [ |
|
| 1485 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1486 | 'fee_strategy' => $feeStrategy, |
|
| 1487 | 'outputs' => $outputCnt, |
|
| 1488 | ]; |
|
| 1489 | ||
| 1490 | if ($forceFee !== null) { |
|
| 1491 | $args['forcefee'] = (int)$forceFee; |
|
| 1492 | } |
|
| 1493 | ||
| 1494 | $response = $this->client->get( |
|
| 1495 | "wallet/{$identifier}/max-spendable", |
|
| 1496 | $args, |
|
| 1497 | RestClient::AUTH_HTTP_SIG |
|
| 1498 | ); |
|
| 1499 | ||
| 1500 | return self::jsonDecode($response->body(), true); |
|
| 1501 | } |
|
| 1502 | ||
| 1503 | /** |
|
| 1504 | * @return array ['optimal_fee' => 10000, 'low_priority_fee' => 5000] |
|