Complex classes like Wallet often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Wallet, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 28 | abstract class Wallet implements WalletInterface { |
||
| 29 | |||
| 30 | const WALLET_VERSION_V1 = 'v1'; |
||
| 31 | const WALLET_VERSION_V2 = 'v2'; |
||
| 32 | const WALLET_VERSION_V3 = 'v3'; |
||
| 33 | |||
| 34 | const CHAIN_BTC_DEFAULT = 0; |
||
| 35 | const CHAIN_BCC_DEFAULT = 1; |
||
| 36 | const CHAIN_BTC_SEGWIT = 2; |
||
| 37 | |||
| 38 | const BASE_FEE = 10000; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * development / debug setting |
||
| 42 | * when getting a new derivation from the API, |
||
| 43 | * will verify address / redeeemScript with the values the API provides |
||
| 44 | */ |
||
| 45 | const VERIFY_NEW_DERIVATION = true; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @var BlocktrailSDKInterface |
||
| 49 | */ |
||
| 50 | protected $sdk; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @var string |
||
| 54 | */ |
||
| 55 | protected $identifier; |
||
| 56 | |||
| 57 | /** |
||
| 58 | * BIP32 master primary private key (m/) |
||
| 59 | * |
||
| 60 | * @var BIP32Key |
||
| 61 | */ |
||
| 62 | protected $primaryPrivateKey; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @var BIP32Key[] |
||
| 66 | */ |
||
| 67 | protected $primaryPublicKeys; |
||
| 68 | |||
| 69 | /** |
||
| 70 | * BIP32 master backup public key (M/) |
||
| 71 | |||
| 72 | * @var BIP32Key |
||
| 73 | */ |
||
| 74 | protected $backupPublicKey; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * map of blocktrail BIP32 public keys |
||
| 78 | * keyed by key index |
||
| 79 | * path should be `M / key_index'` |
||
| 80 | * |
||
| 81 | * @var BIP32Key[] |
||
| 82 | */ |
||
| 83 | protected $blocktrailPublicKeys; |
||
| 84 | |||
| 85 | /** |
||
| 86 | * the 'Blocktrail Key Index' that is used for new addresses |
||
| 87 | * |
||
| 88 | * @var int |
||
| 89 | */ |
||
| 90 | protected $keyIndex; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * 'bitcoin' |
||
| 94 | * |
||
| 95 | * @var string |
||
| 96 | */ |
||
| 97 | protected $network; |
||
| 98 | |||
| 99 | /** |
||
| 100 | * testnet yes / no |
||
| 101 | * |
||
| 102 | * @var bool |
||
| 103 | */ |
||
| 104 | protected $testnet; |
||
| 105 | |||
| 106 | /** |
||
| 107 | * cache of public keys, by path |
||
| 108 | * |
||
| 109 | * @var BIP32Key[] |
||
| 110 | */ |
||
| 111 | protected $pubKeys = []; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * cache of address / redeemScript, by path |
||
| 115 | * |
||
| 116 | * @var string[][] [[address, redeemScript)], ] |
||
| 117 | */ |
||
| 118 | protected $derivations = []; |
||
| 119 | |||
| 120 | /** |
||
| 121 | * reverse cache of paths by address |
||
| 122 | * |
||
| 123 | * @var string[] |
||
| 124 | */ |
||
| 125 | protected $derivationsByAddress = []; |
||
| 126 | |||
| 127 | /** |
||
| 128 | * @var WalletPath |
||
| 129 | */ |
||
| 130 | protected $walletPath; |
||
| 131 | |||
| 132 | protected $checksum; |
||
| 133 | |||
| 134 | protected $locked = true; |
||
| 135 | protected $isSegwit = false; |
||
| 136 | protected $chainIndex = false; |
||
| 137 | protected $changeIndex = false; |
||
| 138 | |||
| 139 | protected $optimalFeePerKB; |
||
| 140 | protected $lowPriorityFeePerKB; |
||
| 141 | protected $feePerKBAge; |
||
| 142 | protected $allowedSignModes = [SignInfo::MODE_DONTSIGN, SignInfo::MODE_SIGN]; |
||
| 143 | |||
| 144 | /** |
||
| 145 | * @param BlocktrailSDKInterface $sdk SDK instance used to do requests |
||
| 146 | * @param string $identifier identifier of the wallet |
||
| 147 | * @param BIP32Key[] $primaryPublicKeys |
||
| 148 | * @param BIP32Key $backupPublicKey should be BIP32 master public key M/ |
||
| 149 | * @param BIP32Key[] $blocktrailPublicKeys |
||
| 150 | * @param int $keyIndex |
||
| 151 | * @param string $network |
||
| 152 | * @param bool $testnet |
||
| 153 | * @param bool $segwit |
||
| 154 | * @param string $checksum |
||
| 155 | * @throws BlocktrailSDKException |
||
| 156 | */ |
||
| 157 | 21 | public function __construct(BlocktrailSDKInterface $sdk, $identifier, array $primaryPublicKeys, $backupPublicKey, array $blocktrailPublicKeys, $keyIndex, $network, $testnet, $segwit, $checksum) { |
|
| 190 | |||
| 191 | /** |
||
| 192 | * @param null $chainIndex |
||
| 193 | * @return BIP32Path |
||
| 194 | */ |
||
| 195 | 13 | protected function getWalletPath($chainIndex = null) { |
|
| 202 | |||
| 203 | /** |
||
| 204 | * @return bool |
||
| 205 | */ |
||
| 206 | 3 | public function isSegwit() { |
|
| 209 | |||
| 210 | /** |
||
| 211 | * return the wallet identifier |
||
| 212 | * |
||
| 213 | * @return string |
||
| 214 | */ |
||
| 215 | 10 | public function getIdentifier() { |
|
| 218 | |||
| 219 | /** |
||
| 220 | * Returns the wallets backup public key |
||
| 221 | * |
||
| 222 | * @return [xpub, path] |
||
| 223 | */ |
||
| 224 | 1 | public function getBackupKey() { |
|
| 227 | |||
| 228 | /** |
||
| 229 | * return list of Blocktrail co-sign extended public keys |
||
| 230 | * |
||
| 231 | * @return array[] [ [xpub, path] ] |
||
| 232 | */ |
||
| 233 | 5 | public function getBlocktrailPublicKeys() { |
|
| 238 | |||
| 239 | /** |
||
| 240 | * check if wallet is locked |
||
| 241 | * |
||
| 242 | * @return bool |
||
| 243 | */ |
||
| 244 | 10 | public function isLocked() { |
|
| 247 | |||
| 248 | /** |
||
| 249 | * upgrade wallet to different blocktrail cosign key |
||
| 250 | * |
||
| 251 | * @param $keyIndex |
||
| 252 | * @return bool |
||
| 253 | * @throws \Exception |
||
| 254 | */ |
||
| 255 | 5 | public function upgradeKeyIndex($keyIndex) { |
|
| 283 | |||
| 284 | /** |
||
| 285 | * get a new BIP32 derivation for the next (unused) address |
||
| 286 | * by requesting it from the API |
||
| 287 | * |
||
| 288 | * @return string |
||
| 289 | * @param int|null $chainIndex |
||
| 290 | * @throws \Exception |
||
| 291 | */ |
||
| 292 | 13 | protected function getNewDerivation($chainIndex = null) { |
|
| 324 | |||
| 325 | /** |
||
| 326 | * @param string|BIP32Path $path |
||
| 327 | * @return BIP32Key|false |
||
| 328 | * @throws \Exception |
||
| 329 | * |
||
| 330 | * @TODO: hmm? |
||
| 331 | */ |
||
| 332 | 16 | protected function getParentPublicKey($path) { |
|
| 349 | |||
| 350 | /** |
||
| 351 | * get address for the specified path |
||
| 352 | * |
||
| 353 | * @param string|BIP32Path $path |
||
| 354 | * @return string |
||
| 355 | */ |
||
| 356 | 13 | public function getAddressByPath($path) { |
|
| 367 | |||
| 368 | /** |
||
| 369 | * @param string $path |
||
| 370 | * @return WalletScript |
||
| 371 | */ |
||
| 372 | 16 | public function getWalletScriptByPath($path) { |
|
| 384 | |||
| 385 | /** |
||
| 386 | * get address and redeemScript for specified path |
||
| 387 | * |
||
| 388 | * @param string $path |
||
| 389 | * @return array[string, ScriptInterface, ScriptInterface|null] [address, redeemScript, witnessScript] |
||
| 390 | */ |
||
| 391 | 15 | public function getRedeemScriptByPath($path) { |
|
| 398 | |||
| 399 | /** |
||
| 400 | * @param BIP32Key $key |
||
| 401 | * @param string|BIP32Path $path |
||
| 402 | * @return string |
||
| 403 | */ |
||
| 404 | protected function getAddressFromKey(BIP32Key $key, $path) { |
||
| 407 | |||
| 408 | /** |
||
| 409 | * @param BIP32Key $key |
||
| 410 | * @param string|BIP32Path $path |
||
| 411 | * @return WalletScript |
||
| 412 | * @throws \Exception |
||
| 413 | */ |
||
| 414 | 16 | protected function getWalletScriptFromKey(BIP32Key $key, $path) { |
|
| 441 | |||
| 442 | /** |
||
| 443 | * get the path (and redeemScript) to specified address |
||
| 444 | * |
||
| 445 | * @param string $address |
||
| 446 | * @return array |
||
| 447 | */ |
||
| 448 | 1 | public function getPathForAddress($address) { |
|
| 451 | |||
| 452 | /** |
||
| 453 | * @param string|BIP32Path $path |
||
| 454 | * @return BIP32Key |
||
| 455 | * @throws \Exception |
||
| 456 | */ |
||
| 457 | 16 | public function getBlocktrailPublicKey($path) { |
|
| 468 | |||
| 469 | /** |
||
| 470 | * generate a new derived key and return the new path and address for it |
||
| 471 | * |
||
| 472 | * @param int|null $chainIndex |
||
| 473 | * @return string[] [path, address] |
||
| 474 | */ |
||
| 475 | 13 | public function getNewAddressPair($chainIndex = null) { |
|
| 481 | |||
| 482 | /** |
||
| 483 | * generate a new derived private key and return the new address for it |
||
| 484 | * |
||
| 485 | * @param int|null $chainIndex |
||
| 486 | * @return string |
||
| 487 | */ |
||
| 488 | 8 | public function getNewAddress($chainIndex = null) { |
|
| 491 | |||
| 492 | /** |
||
| 493 | * get the balance for the wallet |
||
| 494 | * |
||
| 495 | * @return int[] [confirmed, unconfirmed] |
||
| 496 | */ |
||
| 497 | 9 | public function getBalance() { |
|
| 502 | |||
| 503 | /** |
||
| 504 | * do wallet discovery (slow) |
||
| 505 | * |
||
| 506 | * @param int $gap the gap setting to use for discovery |
||
| 507 | * @return int[] [confirmed, unconfirmed] |
||
| 508 | */ |
||
| 509 | 2 | public function doDiscovery($gap = 200) { |
|
| 514 | |||
| 515 | /** |
||
| 516 | * create, sign and send a transaction |
||
| 517 | * |
||
| 518 | * @param array $outputs [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ] coins to send |
||
| 519 | * value should be INT |
||
| 520 | * @param string $changeAddress change address to use (autogenerated if NULL) |
||
| 521 | * @param bool $allowZeroConf |
||
| 522 | * @param bool $randomizeChangeIdx randomize the location of the change (for increased privacy / anonimity) |
||
| 523 | * @param string $feeStrategy |
||
| 524 | * @param null|int $forceFee set a fixed fee instead of automatically calculating the correct fee, not recommended! |
||
| 525 | * @return string the txid / transaction hash |
||
| 526 | * @throws \Exception |
||
| 527 | */ |
||
| 528 | 9 | public function pay(array $outputs, $changeAddress = null, $allowZeroConf = false, $randomizeChangeIdx = true, $feeStrategy = self::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 550 | |||
| 551 | /** |
||
| 552 | * determine max spendable from wallet after fees |
||
| 553 | * |
||
| 554 | * @param bool $allowZeroConf |
||
| 555 | * @param string $feeStrategy |
||
| 556 | * @param null|int $forceFee set a fixed fee instead of automatically calculating the correct fee, not recommended! |
||
| 557 | * @param int $outputCnt |
||
| 558 | * @return string |
||
| 559 | * @throws BlocktrailSDKException |
||
| 560 | */ |
||
| 561 | public function getMaxSpendable($allowZeroConf = false, $feeStrategy = self::FEE_STRATEGY_OPTIMAL, $forceFee = null, $outputCnt = 1) { |
||
| 564 | |||
| 565 | /** |
||
| 566 | * parse outputs into normalized struct |
||
| 567 | * |
||
| 568 | * @param array $outputs [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ] |
||
| 569 | * @return array [['address' => address, 'value' => value], ] |
||
| 570 | */ |
||
| 571 | 10 | public static function normalizeOutputsStruct(array $outputs) { |
|
| 599 | |||
| 600 | /** |
||
| 601 | * 'fund' the txBuilder with UTXOs (modified in place) |
||
| 602 | * |
||
| 603 | * @param TransactionBuilder $txBuilder |
||
| 604 | * @param bool|true $lockUTXOs |
||
| 605 | * @param bool|false $allowZeroConf |
||
| 606 | * @param null|int $forceFee |
||
| 607 | * @return TransactionBuilder |
||
| 608 | */ |
||
| 609 | 11 | public function coinSelectionForTxBuilder(TransactionBuilder $txBuilder, $lockUTXOs = true, $allowZeroConf = false, $forceFee = null) { |
|
| 637 | |||
| 638 | /** |
||
| 639 | * build inputs and outputs lists for TransactionBuilder |
||
| 640 | * |
||
| 641 | * @param TransactionBuilder $txBuilder |
||
| 642 | * @return [TransactionInterface, SignInfo[]] |
||
| 643 | * @throws \Exception |
||
| 644 | */ |
||
| 645 | 7 | public function buildTx(TransactionBuilder $txBuilder) { |
|
| 733 | |||
| 734 | 7 | public function determineFeeAndChange(TransactionBuilder $txBuilder, $optimalFeePerKB, $lowPriorityFeePerKB) { |
|
| 790 | |||
| 791 | /** |
||
| 792 | * create, sign and send transction based on TransactionBuilder |
||
| 793 | * |
||
| 794 | * @param TransactionBuilder $txBuilder |
||
| 795 | * @param bool $apiCheckFee let the API check if the fee is correct |
||
| 796 | * @return string |
||
| 797 | * @throws \Exception |
||
| 798 | */ |
||
| 799 | 4 | public function sendTx(TransactionBuilder $txBuilder, $apiCheckFee = true) { |
|
| 804 | |||
| 805 | /** |
||
| 806 | * !! INTERNAL METHOD, public for testing purposes !! |
||
| 807 | * create, sign and send transction based on inputs and outputs |
||
| 808 | * |
||
| 809 | * @param Transaction $tx |
||
| 810 | * @param SignInfo[] $signInfo |
||
| 811 | * @param bool $apiCheckFee let the API check if the fee is correct |
||
| 812 | * @return string |
||
| 813 | * @throws \Exception |
||
| 814 | * @internal |
||
| 815 | */ |
||
| 816 | 4 | public function _sendTx(Transaction $tx, array $signInfo, $apiCheckFee = true) { |
|
| 838 | |||
| 839 | /** |
||
| 840 | * only supports estimating fee for 2of3 multsig UTXOs and P2PKH/P2SH outputs |
||
| 841 | * |
||
| 842 | * @todo: mark this as deprecated, insist on the utxo's or qualified scripts. |
||
| 843 | * @param int $utxoCnt number of unspent inputs in transaction |
||
| 844 | * @param int $outputCnt number of outputs in transaction |
||
| 845 | * @return float |
||
| 846 | * @access public reminder that people might use this! |
||
| 847 | */ |
||
| 848 | 1 | public static function estimateFee($utxoCnt, $outputCnt) { |
|
| 853 | |||
| 854 | /** |
||
| 855 | * @param int $size size in bytes |
||
| 856 | * @return int fee in satoshi |
||
| 857 | */ |
||
| 858 | 5 | public static function baseFeeForSize($size) { |
|
| 863 | |||
| 864 | /** |
||
| 865 | * @todo: variable varint |
||
| 866 | * @param int $txinSize |
||
| 867 | * @param int $txoutSize |
||
| 868 | * @return float |
||
| 869 | */ |
||
| 870 | 9 | public static function estimateSize($txinSize, $txoutSize) { |
|
| 873 | |||
| 874 | /** |
||
| 875 | * only supports estimating size for P2PKH/P2SH outputs |
||
| 876 | * |
||
| 877 | * @param int $outputCnt number of outputs in transaction |
||
| 878 | * @return float |
||
| 879 | */ |
||
| 880 | 2 | public static function estimateSizeOutputs($outputCnt) { |
|
| 883 | |||
| 884 | /** |
||
| 885 | * only supports estimating size for 2of3 multsig UTXOs |
||
| 886 | * |
||
| 887 | * @param int $utxoCnt number of unspent inputs in transaction |
||
| 888 | * @return float |
||
| 889 | */ |
||
| 890 | 3 | public static function estimateSizeUTXOs($utxoCnt) { |
|
| 926 | |||
| 927 | /** |
||
| 928 | * determine how much fee is required based on the inputs and outputs |
||
| 929 | * this is an estimation, not a proper 100% correct calculation |
||
| 930 | * |
||
| 931 | * @param UTXO[] $utxos |
||
| 932 | * @param array[] $outputs |
||
| 933 | * @param $feeStrategy |
||
| 934 | * @param $optimalFeePerKB |
||
| 935 | * @param $lowPriorityFeePerKB |
||
| 936 | * @return int |
||
| 937 | * @throws BlocktrailSDKException |
||
| 938 | */ |
||
| 939 | 7 | protected function determineFee($utxos, $outputs, $feeStrategy, $optimalFeePerKB, $lowPriorityFeePerKB) { |
|
| 957 | |||
| 958 | /** |
||
| 959 | * determine how much change is left over based on the inputs and outputs and the fee |
||
| 960 | * |
||
| 961 | * @param UTXO[] $utxos |
||
| 962 | * @param array[] $outputs |
||
| 963 | * @param int $fee |
||
| 964 | * @return int |
||
| 965 | */ |
||
| 966 | 7 | protected function determineChange($utxos, $outputs, $fee) { |
|
| 974 | |||
| 975 | /** |
||
| 976 | * sign a raw transaction with the private keys that we have |
||
| 977 | * |
||
| 978 | * @param Transaction $tx |
||
| 979 | * @param SignInfo[] $signInfo |
||
| 980 | * @return TransactionInterface |
||
| 981 | * @throws \Exception |
||
| 982 | */ |
||
| 983 | 4 | protected function signTransaction(Transaction $tx, array $signInfo) { |
|
| 1015 | |||
| 1016 | /** |
||
| 1017 | * send the transaction using the API |
||
| 1018 | * |
||
| 1019 | * @param string|array $signed |
||
| 1020 | * @param string[] $paths |
||
| 1021 | * @param bool $checkFee |
||
| 1022 | * @return string the complete raw transaction |
||
| 1023 | * @throws \Exception |
||
| 1024 | */ |
||
| 1025 | 4 | protected function sendTransaction($signed, $paths, $checkFee = false) { |
|
| 1028 | |||
| 1029 | /** |
||
| 1030 | * @param \array[] $outputs |
||
| 1031 | * @param bool $lockUTXO |
||
| 1032 | * @param bool $allowZeroConf |
||
| 1033 | * @param int|null|string $feeStrategy |
||
| 1034 | * @param null $forceFee |
||
| 1035 | * @return array |
||
| 1036 | */ |
||
| 1037 | 11 | public function coinSelection($outputs, $lockUTXO = true, $allowZeroConf = false, $feeStrategy = self::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 1046 | |||
| 1047 | 7 | public function getOptimalFeePerKB() { |
|
| 1054 | |||
| 1055 | 7 | public function getLowPriorityFeePerKB() { |
|
| 1062 | |||
| 1063 | 3 | public function updateFeePerKB() { |
|
| 1071 | |||
| 1072 | /** |
||
| 1073 | * delete the wallet |
||
| 1074 | * |
||
| 1075 | * @param bool $force ignore warnings (such as non-zero balance) |
||
| 1076 | * @return mixed |
||
| 1077 | * @throws \Exception |
||
| 1078 | */ |
||
| 1079 | 10 | public function deleteWallet($force = false) { |
|
| 1087 | |||
| 1088 | /** |
||
| 1089 | * create checksum to verify ownership of the master primary key |
||
| 1090 | * |
||
| 1091 | * @return string[] [address, signature] |
||
| 1092 | */ |
||
| 1093 | 10 | protected function createChecksumVerificationSignature() { |
|
| 1104 | |||
| 1105 | /** |
||
| 1106 | * setup a webhook for our wallet |
||
| 1107 | * |
||
| 1108 | * @param string $url URL to receive webhook events |
||
| 1109 | * @param string $identifier identifier for the webhook, defaults to WALLET-{$this->identifier} |
||
| 1110 | * @return array |
||
| 1111 | */ |
||
| 1112 | 1 | public function setupWebhook($url, $identifier = null) { |
|
| 1116 | |||
| 1117 | /** |
||
| 1118 | * @param string $identifier identifier for the webhook, defaults to WALLET-{$this->identifier} |
||
| 1119 | * @return mixed |
||
| 1120 | */ |
||
| 1121 | 1 | public function deleteWebhook($identifier = null) { |
|
| 1125 | |||
| 1126 | /** |
||
| 1127 | * lock a specific unspent output |
||
| 1128 | * |
||
| 1129 | * @param $txHash |
||
| 1130 | * @param $txIdx |
||
| 1131 | * @param int $ttl |
||
| 1132 | * @return bool |
||
| 1133 | */ |
||
| 1134 | public function lockUTXO($txHash, $txIdx, $ttl = 3) { |
||
| 1137 | |||
| 1138 | /** |
||
| 1139 | * unlock a specific unspent output |
||
| 1140 | * |
||
| 1141 | * @param $txHash |
||
| 1142 | * @param $txIdx |
||
| 1143 | * @return bool |
||
| 1144 | */ |
||
| 1145 | public function unlockUTXO($txHash, $txIdx) { |
||
| 1148 | |||
| 1149 | /** |
||
| 1150 | * get all transactions for the wallet (paginated) |
||
| 1151 | * |
||
| 1152 | * @param integer $page pagination: page number |
||
| 1153 | * @param integer $limit pagination: records per page (max 500) |
||
| 1154 | * @param string $sortDir pagination: sort direction (asc|desc) |
||
| 1155 | * @return array associative array containing the response |
||
| 1156 | */ |
||
| 1157 | 1 | public function transactions($page = 1, $limit = 20, $sortDir = 'asc') { |
|
| 1160 | |||
| 1161 | /** |
||
| 1162 | * get all addresses for the wallet (paginated) |
||
| 1163 | * |
||
| 1164 | * @param integer $page pagination: page number |
||
| 1165 | * @param integer $limit pagination: records per page (max 500) |
||
| 1166 | * @param string $sortDir pagination: sort direction (asc|desc) |
||
| 1167 | * @return array associative array containing the response |
||
| 1168 | */ |
||
| 1169 | 1 | public function addresses($page = 1, $limit = 20, $sortDir = 'asc') { |
|
| 1172 | |||
| 1173 | /** |
||
| 1174 | * get all UTXOs for the wallet (paginated) |
||
| 1175 | * |
||
| 1176 | * @param integer $page pagination: page number |
||
| 1177 | * @param integer $limit pagination: records per page (max 500) |
||
| 1178 | * @param string $sortDir pagination: sort direction (asc|desc) |
||
| 1179 | * @param boolean $zeroconf include zero confirmation transactions |
||
| 1180 | * @return array associative array containing the response |
||
| 1181 | */ |
||
| 1182 | 1 | public function utxos($page = 1, $limit = 20, $sortDir = 'asc', $zeroconf = true) { |
|
| 1185 | } |
||
| 1186 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.