| @@ 1193-1212 (lines=20) @@ | ||
| 1190 | * @return array |
|
| 1191 | * @throws \Exception |
|
| 1192 | */ |
|
| 1193 | public function coinSelection($identifier, $outputs, $lockUTXO = false, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 1194 | $args = [ |
|
| 1195 | 'lock' => (int)!!$lockUTXO, |
|
| 1196 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1197 | 'fee_strategy' => $feeStrategy, |
|
| 1198 | ]; |
|
| 1199 | ||
| 1200 | if ($forceFee !== null) { |
|
| 1201 | $args['forcefee'] = (int)$forceFee; |
|
| 1202 | } |
|
| 1203 | ||
| 1204 | $response = $this->client->post( |
|
| 1205 | "wallet/{$identifier}/coin-selection", |
|
| 1206 | $args, |
|
| 1207 | $outputs, |
|
| 1208 | RestClient::AUTH_HTTP_SIG |
|
| 1209 | ); |
|
| 1210 | ||
| 1211 | return self::jsonDecode($response->body(), true); |
|
| 1212 | } |
|
| 1213 | ||
| 1214 | /** |
|
| 1215 | * |
|
| @@ 1224-1242 (lines=19) @@ | ||
| 1221 | * @return array |
|
| 1222 | * @throws \Exception |
|
| 1223 | */ |
|
| 1224 | public function walletMaxSpendable($identifier, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null, $outputCnt = 1) { |
|
| 1225 | $args = [ |
|
| 1226 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 1227 | 'fee_strategy' => $feeStrategy, |
|
| 1228 | 'outputs' => $outputCnt, |
|
| 1229 | ]; |
|
| 1230 | ||
| 1231 | if ($forceFee !== null) { |
|
| 1232 | $args['forcefee'] = (int)$forceFee; |
|
| 1233 | } |
|
| 1234 | ||
| 1235 | $response = $this->client->get( |
|
| 1236 | "wallet/{$identifier}/max-spendable", |
|
| 1237 | $args, |
|
| 1238 | RestClient::AUTH_HTTP_SIG |
|
| 1239 | ); |
|
| 1240 | ||
| 1241 | return self::jsonDecode($response->body(), true); |
|
| 1242 | } |
|
| 1243 | ||
| 1244 | /** |
|
| 1245 | * @return array ['optimal_fee' => 10000, 'low_priority_fee' => 5000] |
|