| @@ 1438-1457 (lines=20) @@ | ||
| 1435 | * @return array |
|
| 1436 | * @throws \Exception |
|
| 1437 | */ |
|
| 1438 | public function coinSelection($identifier, $outputs, $lockUTXO = false, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 1439 | $args = [ |
|
| 1440 | 'lock' => (int)!!$lockUTXO, |
|
| 1441 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1442 | 'fee_strategy' => $feeStrategy, |
|
| 1443 | ]; |
|
| 1444 | ||
| 1445 | if ($forceFee !== null) { |
|
| 1446 | $args['forcefee'] = (int)$forceFee; |
|
| 1447 | } |
|
| 1448 | ||
| 1449 | $response = $this->client->post( |
|
| 1450 | "wallet/{$identifier}/coin-selection", |
|
| 1451 | $args, |
|
| 1452 | $outputs, |
|
| 1453 | RestClient::AUTH_HTTP_SIG |
|
| 1454 | ); |
|
| 1455 | ||
| 1456 | return self::jsonDecode($response->body(), true); |
|
| 1457 | } |
|
| 1458 | ||
| 1459 | /** |
|
| 1460 | * |
|
| @@ 1469-1487 (lines=19) @@ | ||
| 1466 | * @return array |
|
| 1467 | * @throws \Exception |
|
| 1468 | */ |
|
| 1469 | public function walletMaxSpendable($identifier, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null, $outputCnt = 1) { |
|
| 1470 | $args = [ |
|
| 1471 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1472 | 'fee_strategy' => $feeStrategy, |
|
| 1473 | 'outputs' => $outputCnt, |
|
| 1474 | ]; |
|
| 1475 | ||
| 1476 | if ($forceFee !== null) { |
|
| 1477 | $args['forcefee'] = (int)$forceFee; |
|
| 1478 | } |
|
| 1479 | ||
| 1480 | $response = $this->client->get( |
|
| 1481 | "wallet/{$identifier}/max-spendable", |
|
| 1482 | $args, |
|
| 1483 | RestClient::AUTH_HTTP_SIG |
|
| 1484 | ); |
|
| 1485 | ||
| 1486 | return self::jsonDecode($response->body(), true); |
|
| 1487 | } |
|
| 1488 | ||
| 1489 | /** |
|
| 1490 | * @return array ['optimal_fee' => 10000, 'low_priority_fee' => 5000] |
|