| @@ 906-925 (lines=20) @@ | ||
| 903 | * @return array |
|
| 904 | * @throws \Exception |
|
| 905 | */ |
|
| 906 | public function coinSelection($identifier, $outputs, $lockUTXO = false, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 907 | $args = [ |
|
| 908 | 'lock' => (int)!!$lockUTXO, |
|
| 909 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 910 | 'fee_strategy' => $feeStrategy, |
|
| 911 | ]; |
|
| 912 | ||
| 913 | if ($forceFee !== null) { |
|
| 914 | $args['forcefee'] = (int)$forceFee; |
|
| 915 | } |
|
| 916 | ||
| 917 | $response = $this->client->post( |
|
| 918 | "wallet/{$identifier}/coin-selection", |
|
| 919 | $args, |
|
| 920 | $outputs, |
|
| 921 | RestClient::AUTH_HTTP_SIG |
|
| 922 | ); |
|
| 923 | ||
| 924 | return self::jsonDecode($response->body(), true); |
|
| 925 | } |
|
| 926 | ||
| 927 | /** |
|
| 928 | * |
|
| @@ 937-955 (lines=19) @@ | ||
| 934 | * @return array |
|
| 935 | * @throws \Exception |
|
| 936 | */ |
|
| 937 | public function walletMaxSpendable($identifier, $allowZeroConf = false, $feeStrategy = Wallet::FEE_STRATEGY_OPTIMAL, $forceFee = null, $outputCnt = 1) { |
|
| 938 | $args = [ |
|
| 939 | 'zeroconf' => (int)!!$allowZeroConf, |
|
| 940 | 'fee_strategy' => $feeStrategy, |
|
| 941 | 'outputs' => $outputCnt, |
|
| 942 | ]; |
|
| 943 | ||
| 944 | if ($forceFee !== null) { |
|
| 945 | $args['forcefee'] = (int)$forceFee; |
|
| 946 | } |
|
| 947 | ||
| 948 | $response = $this->client->get( |
|
| 949 | "wallet/{$identifier}/max-spendable", |
|
| 950 | $args, |
|
| 951 | RestClient::AUTH_HTTP_SIG |
|
| 952 | ); |
|
| 953 | ||
| 954 | return self::jsonDecode($response->body(), true); |
|
| 955 | } |
|
| 956 | ||
| 957 | /** |
|
| 958 | * @return array ['optimal_fee' => 10000, 'low_priority_fee' => 5000] |
|