| @@ 1428-1447 (lines=20) @@ | ||
| 1425 | * @return array |
|
| 1426 | * @throws \Exception |
|
| 1427 | */ |
|
| 1428 | public function coinSelection($identifier, $outputs, $lockUTXO = false, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 1429 | $args = [ |
|
| 1430 | 'lock' => (int)!!$lockUTXO, |
|
| 1431 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1432 | 'fee_strategy' => $feeStrategy, |
|
| 1433 | ]; |
|
| 1434 | ||
| 1435 | if ($forceFee !== null) { |
|
| 1436 | $args['forcefee'] = (int)$forceFee; |
|
| 1437 | } |
|
| 1438 | ||
| 1439 | $response = $this->client->post( |
|
| 1440 | "wallet/{$identifier}/coin-selection", |
|
| 1441 | $args, |
|
| 1442 | $outputs, |
|
| 1443 | RestClient::AUTH_HTTP_SIG |
|
| 1444 | ); |
|
| 1445 | ||
| 1446 | return self::jsonDecode($response->body(), true); |
|
| 1447 | } |
|
| 1448 | ||
| 1449 | /** |
|
| 1450 | * |
|
| @@ 1459-1477 (lines=19) @@ | ||
| 1456 | * @return array |
|
| 1457 | * @throws \Exception |
|
| 1458 | */ |
|
| 1459 | public function walletMaxSpendable($identifier, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null, $outputCnt = 1) { |
|
| 1460 | $args = [ |
|
| 1461 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1462 | 'fee_strategy' => $feeStrategy, |
|
| 1463 | 'outputs' => $outputCnt, |
|
| 1464 | ]; |
|
| 1465 | ||
| 1466 | if ($forceFee !== null) { |
|
| 1467 | $args['forcefee'] = (int)$forceFee; |
|
| 1468 | } |
|
| 1469 | ||
| 1470 | $response = $this->client->get( |
|
| 1471 | "wallet/{$identifier}/max-spendable", |
|
| 1472 | $args, |
|
| 1473 | RestClient::AUTH_HTTP_SIG |
|
| 1474 | ); |
|
| 1475 | ||
| 1476 | return self::jsonDecode($response->body(), true); |
|
| 1477 | } |
|
| 1478 | ||
| 1479 | /** |
|
| 1480 | * @return array ['optimal_fee' => 10000, 'low_priority_fee' => 5000] |
|