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 | * @deprecated |
||
| 130 | */ |
||
| 131 | protected $walletPath; |
||
| 132 | |||
| 133 | protected $checksum; |
||
| 134 | |||
| 135 | protected $locked = true; |
||
| 136 | protected $isSegwit = false; |
||
| 137 | protected $chainIndex = false; |
||
| 138 | protected $changeIndex = false; |
||
| 139 | |||
| 140 | protected $optimalFeePerKB; |
||
| 141 | protected $lowPriorityFeePerKB; |
||
| 142 | protected $feePerKBAge; |
||
| 143 | protected $allowedSignModes = [SignInfo::MODE_DONTSIGN, SignInfo::MODE_SIGN]; |
||
| 144 | |||
| 145 | /** |
||
| 146 | * @param BlocktrailSDKInterface $sdk SDK instance used to do requests |
||
| 147 | * @param string $identifier identifier of the wallet |
||
| 148 | * @param BIP32Key[] $primaryPublicKeys |
||
| 149 | * @param BIP32Key $backupPublicKey should be BIP32 master public key M/ |
||
| 150 | * @param BIP32Key[] $blocktrailPublicKeys |
||
| 151 | * @param int $keyIndex |
||
| 152 | * @param string $network |
||
| 153 | * @param bool $testnet |
||
| 154 | * @param bool $segwit |
||
| 155 | * @param string $checksum |
||
| 156 | * @throws BlocktrailSDKException |
||
| 157 | */ |
||
| 158 | 21 | public function __construct(BlocktrailSDKInterface $sdk, $identifier, array $primaryPublicKeys, $backupPublicKey, array $blocktrailPublicKeys, $keyIndex, $network, $testnet, $segwit, $checksum) { |
|
| 192 | |||
| 193 | /** |
||
| 194 | * @param null $chainIndex |
||
| 195 | * @return BIP32Path |
||
| 196 | */ |
||
| 197 | 21 | protected function getWalletPath($chainIndex = null) { |
|
| 204 | |||
| 205 | /** |
||
| 206 | * @return bool |
||
| 207 | */ |
||
| 208 | 3 | public function isSegwit() { |
|
| 211 | |||
| 212 | /** |
||
| 213 | * return the wallet identifier |
||
| 214 | * |
||
| 215 | * @return string |
||
| 216 | */ |
||
| 217 | 10 | public function getIdentifier() { |
|
| 220 | |||
| 221 | /** |
||
| 222 | * Returns the wallets backup public key |
||
| 223 | * |
||
| 224 | * @return [xpub, path] |
||
| 225 | */ |
||
| 226 | 1 | public function getBackupKey() { |
|
| 229 | |||
| 230 | /** |
||
| 231 | * return list of Blocktrail co-sign extended public keys |
||
| 232 | * |
||
| 233 | * @return array[] [ [xpub, path] ] |
||
| 234 | */ |
||
| 235 | 5 | public function getBlocktrailPublicKeys() { |
|
| 240 | |||
| 241 | /** |
||
| 242 | * check if wallet is locked |
||
| 243 | * |
||
| 244 | * @return bool |
||
| 245 | */ |
||
| 246 | 10 | public function isLocked() { |
|
| 249 | |||
| 250 | /** |
||
| 251 | * upgrade wallet to different blocktrail cosign key |
||
| 252 | * |
||
| 253 | * @param $keyIndex |
||
| 254 | * @return bool |
||
| 255 | * @throws \Exception |
||
| 256 | */ |
||
| 257 | 5 | public function upgradeKeyIndex($keyIndex) { |
|
| 287 | |||
| 288 | /** |
||
| 289 | * get a new BIP32 derivation for the next (unused) address |
||
| 290 | * by requesting it from the API |
||
| 291 | * |
||
| 292 | * @return string |
||
| 293 | * @param int|null $chainIndex |
||
| 294 | * @throws \Exception |
||
| 295 | */ |
||
| 296 | 14 | protected function getNewDerivation($chainIndex = null) { |
|
| 328 | |||
| 329 | /** |
||
| 330 | * @param string|BIP32Path $path |
||
| 331 | * @return BIP32Key|false |
||
| 332 | * @throws \Exception |
||
| 333 | * |
||
| 334 | * @TODO: hmm? |
||
| 335 | */ |
||
| 336 | 16 | protected function getParentPublicKey($path) { |
|
| 353 | |||
| 354 | /** |
||
| 355 | * get address for the specified path |
||
| 356 | * |
||
| 357 | * @param string|BIP32Path $path |
||
| 358 | * @return string |
||
| 359 | */ |
||
| 360 | 14 | public function getAddressByPath($path) { |
|
| 371 | |||
| 372 | /** |
||
| 373 | * @param string $path |
||
| 374 | * @return WalletScript |
||
| 375 | */ |
||
| 376 | 16 | public function getWalletScriptByPath($path) { |
|
| 388 | |||
| 389 | /** |
||
| 390 | * get address and redeemScript for specified path |
||
| 391 | * |
||
| 392 | * @param string $path |
||
| 393 | * @return array[string, ScriptInterface, ScriptInterface|null] [address, redeemScript, witnessScript] |
||
| 394 | */ |
||
| 395 | 15 | public function getRedeemScriptByPath($path) { |
|
| 402 | |||
| 403 | /** |
||
| 404 | * @param BIP32Key $key |
||
| 405 | * @param string|BIP32Path $path |
||
| 406 | * @return string |
||
| 407 | */ |
||
| 408 | protected function getAddressFromKey(BIP32Key $key, $path) { |
||
| 411 | |||
| 412 | /** |
||
| 413 | * @param BIP32Key $key |
||
| 414 | * @param string|BIP32Path $path |
||
| 415 | * @return WalletScript |
||
| 416 | * @throws \Exception |
||
| 417 | */ |
||
| 418 | 16 | protected function getWalletScriptFromKey(BIP32Key $key, $path) { |
|
| 445 | |||
| 446 | /** |
||
| 447 | * get the path (and redeemScript) to specified address |
||
| 448 | * |
||
| 449 | * @param string $address |
||
| 450 | * @return array |
||
| 451 | */ |
||
| 452 | 1 | public function getPathForAddress($address) { |
|
| 455 | |||
| 456 | /** |
||
| 457 | * @param string|BIP32Path $path |
||
| 458 | * @return BIP32Key |
||
| 459 | * @throws \Exception |
||
| 460 | */ |
||
| 461 | 16 | public function getBlocktrailPublicKey($path) { |
|
| 472 | |||
| 473 | /** |
||
| 474 | * generate a new derived key and return the new path and address for it |
||
| 475 | * |
||
| 476 | * @param int|null $chainIndex |
||
| 477 | * @return string[] [path, address] |
||
| 478 | */ |
||
| 479 | 14 | public function getNewAddressPair($chainIndex = null) { |
|
| 485 | |||
| 486 | /** |
||
| 487 | * generate a new derived private key and return the new address for it |
||
| 488 | * |
||
| 489 | * @param int|null $chainIndex |
||
| 490 | * @return string |
||
| 491 | */ |
||
| 492 | 10 | public function getNewAddress($chainIndex = null) { |
|
| 495 | |||
| 496 | /** |
||
| 497 | * get the balance for the wallet |
||
| 498 | * |
||
| 499 | * @return int[] [confirmed, unconfirmed] |
||
| 500 | */ |
||
| 501 | 9 | public function getBalance() { |
|
| 506 | |||
| 507 | /** |
||
| 508 | * do wallet discovery (slow) |
||
| 509 | * |
||
| 510 | * @param int $gap the gap setting to use for discovery |
||
| 511 | * @return int[] [confirmed, unconfirmed] |
||
| 512 | */ |
||
| 513 | 2 | public function doDiscovery($gap = 200) { |
|
| 518 | |||
| 519 | /** |
||
| 520 | * create, sign and send a transaction |
||
| 521 | * |
||
| 522 | * @param array $outputs [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ] coins to send |
||
| 523 | * value should be INT |
||
| 524 | * @param string $changeAddress change address to use (autogenerated if NULL) |
||
| 525 | * @param bool $allowZeroConf |
||
| 526 | * @param bool $randomizeChangeIdx randomize the location of the change (for increased privacy / anonimity) |
||
| 527 | * @param string $feeStrategy |
||
| 528 | * @param null|int $forceFee set a fixed fee instead of automatically calculating the correct fee, not recommended! |
||
| 529 | * @return string the txid / transaction hash |
||
| 530 | * @throws \Exception |
||
| 531 | */ |
||
| 532 | 9 | public function pay(array $outputs, $changeAddress = null, $allowZeroConf = false, $randomizeChangeIdx = true, $feeStrategy = self::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 554 | |||
| 555 | /** |
||
| 556 | * determine max spendable from wallet after fees |
||
| 557 | * |
||
| 558 | * @param bool $allowZeroConf |
||
| 559 | * @param string $feeStrategy |
||
| 560 | * @param null|int $forceFee set a fixed fee instead of automatically calculating the correct fee, not recommended! |
||
| 561 | * @param int $outputCnt |
||
| 562 | * @return string |
||
| 563 | * @throws BlocktrailSDKException |
||
| 564 | */ |
||
| 565 | public function getMaxSpendable($allowZeroConf = false, $feeStrategy = self::FEE_STRATEGY_OPTIMAL, $forceFee = null, $outputCnt = 1) { |
||
| 568 | |||
| 569 | /** |
||
| 570 | * parse outputs into normalized struct |
||
| 571 | * |
||
| 572 | * @param array $outputs [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ] |
||
| 573 | * @return array [['address' => address, 'value' => value], ] |
||
| 574 | */ |
||
| 575 | 10 | public static function normalizeOutputsStruct(array $outputs) { |
|
| 603 | |||
| 604 | /** |
||
| 605 | * 'fund' the txBuilder with UTXOs (modified in place) |
||
| 606 | * |
||
| 607 | * @param TransactionBuilder $txBuilder |
||
| 608 | * @param bool|true $lockUTXOs |
||
| 609 | * @param bool|false $allowZeroConf |
||
| 610 | * @param null|int $forceFee |
||
| 611 | * @return TransactionBuilder |
||
| 612 | */ |
||
| 613 | 11 | public function coinSelectionForTxBuilder(TransactionBuilder $txBuilder, $lockUTXOs = true, $allowZeroConf = false, $forceFee = null) { |
|
| 641 | |||
| 642 | /** |
||
| 643 | * build inputs and outputs lists for TransactionBuilder |
||
| 644 | * |
||
| 645 | * @param TransactionBuilder $txBuilder |
||
| 646 | * @return [TransactionInterface, SignInfo[]] |
||
| 647 | * @throws \Exception |
||
| 648 | */ |
||
| 649 | 7 | public function buildTx(TransactionBuilder $txBuilder) { |
|
| 737 | |||
| 738 | 7 | public function determineFeeAndChange(TransactionBuilder $txBuilder, $optimalFeePerKB, $lowPriorityFeePerKB) { |
|
| 794 | |||
| 795 | /** |
||
| 796 | * create, sign and send transction based on TransactionBuilder |
||
| 797 | * |
||
| 798 | * @param TransactionBuilder $txBuilder |
||
| 799 | * @param bool $apiCheckFee let the API check if the fee is correct |
||
| 800 | * @return string |
||
| 801 | * @throws \Exception |
||
| 802 | */ |
||
| 803 | 4 | public function sendTx(TransactionBuilder $txBuilder, $apiCheckFee = true) { |
|
| 808 | |||
| 809 | /** |
||
| 810 | * !! INTERNAL METHOD, public for testing purposes !! |
||
| 811 | * create, sign and send transction based on inputs and outputs |
||
| 812 | * |
||
| 813 | * @param Transaction $tx |
||
| 814 | * @param SignInfo[] $signInfo |
||
| 815 | * @param bool $apiCheckFee let the API check if the fee is correct |
||
| 816 | * @return string |
||
| 817 | * @throws \Exception |
||
| 818 | * @internal |
||
| 819 | */ |
||
| 820 | 4 | public function _sendTx(Transaction $tx, array $signInfo, $apiCheckFee = true) { |
|
| 842 | |||
| 843 | /** |
||
| 844 | * only supports estimating fee for 2of3 multsig UTXOs and P2PKH/P2SH outputs |
||
| 845 | * |
||
| 846 | * @todo: mark this as deprecated, insist on the utxo's or qualified scripts. |
||
| 847 | * @param int $utxoCnt number of unspent inputs in transaction |
||
| 848 | * @param int $outputCnt number of outputs in transaction |
||
| 849 | * @return float |
||
| 850 | * @access public reminder that people might use this! |
||
| 851 | */ |
||
| 852 | 1 | public static function estimateFee($utxoCnt, $outputCnt) { |
|
| 857 | |||
| 858 | /** |
||
| 859 | * @param int $size size in bytes |
||
| 860 | * @return int fee in satoshi |
||
| 861 | */ |
||
| 862 | 5 | public static function baseFeeForSize($size) { |
|
| 867 | |||
| 868 | /** |
||
| 869 | * @todo: variable varint |
||
| 870 | * @param int $txinSize |
||
| 871 | * @param int $txoutSize |
||
| 872 | * @return float |
||
| 873 | */ |
||
| 874 | 9 | public static function estimateSize($txinSize, $txoutSize) { |
|
| 877 | |||
| 878 | /** |
||
| 879 | * only supports estimating size for P2PKH/P2SH outputs |
||
| 880 | * |
||
| 881 | * @param int $outputCnt number of outputs in transaction |
||
| 882 | * @return float |
||
| 883 | */ |
||
| 884 | 2 | public static function estimateSizeOutputs($outputCnt) { |
|
| 887 | |||
| 888 | /** |
||
| 889 | * only supports estimating size for 2of3 multsig UTXOs |
||
| 890 | * |
||
| 891 | * @param int $utxoCnt number of unspent inputs in transaction |
||
| 892 | * @return float |
||
| 893 | */ |
||
| 894 | 3 | public static function estimateSizeUTXOs($utxoCnt) { |
|
| 930 | |||
| 931 | /** |
||
| 932 | * determine how much fee is required based on the inputs and outputs |
||
| 933 | * this is an estimation, not a proper 100% correct calculation |
||
| 934 | * |
||
| 935 | * @param UTXO[] $utxos |
||
| 936 | * @param array[] $outputs |
||
| 937 | * @param $feeStrategy |
||
| 938 | * @param $optimalFeePerKB |
||
| 939 | * @param $lowPriorityFeePerKB |
||
| 940 | * @return int |
||
| 941 | * @throws BlocktrailSDKException |
||
| 942 | */ |
||
| 943 | 7 | protected function determineFee($utxos, $outputs, $feeStrategy, $optimalFeePerKB, $lowPriorityFeePerKB) { |
|
| 961 | |||
| 962 | /** |
||
| 963 | * determine how much change is left over based on the inputs and outputs and the fee |
||
| 964 | * |
||
| 965 | * @param UTXO[] $utxos |
||
| 966 | * @param array[] $outputs |
||
| 967 | * @param int $fee |
||
| 968 | * @return int |
||
| 969 | */ |
||
| 970 | 7 | protected function determineChange($utxos, $outputs, $fee) { |
|
| 978 | |||
| 979 | /** |
||
| 980 | * sign a raw transaction with the private keys that we have |
||
| 981 | * |
||
| 982 | * @param Transaction $tx |
||
| 983 | * @param SignInfo[] $signInfo |
||
| 984 | * @return TransactionInterface |
||
| 985 | * @throws \Exception |
||
| 986 | */ |
||
| 987 | 4 | protected function signTransaction(Transaction $tx, array $signInfo) { |
|
| 1019 | |||
| 1020 | /** |
||
| 1021 | * send the transaction using the API |
||
| 1022 | * |
||
| 1023 | * @param string|array $signed |
||
| 1024 | * @param string[] $paths |
||
| 1025 | * @param bool $checkFee |
||
| 1026 | * @return string the complete raw transaction |
||
| 1027 | * @throws \Exception |
||
| 1028 | */ |
||
| 1029 | 4 | protected function sendTransaction($signed, $paths, $checkFee = false) { |
|
| 1032 | |||
| 1033 | /** |
||
| 1034 | * @param \array[] $outputs |
||
| 1035 | * @param bool $lockUTXO |
||
| 1036 | * @param bool $allowZeroConf |
||
| 1037 | * @param int|null|string $feeStrategy |
||
| 1038 | * @param null $forceFee |
||
| 1039 | * @return array |
||
| 1040 | */ |
||
| 1041 | 11 | public function coinSelection($outputs, $lockUTXO = true, $allowZeroConf = false, $feeStrategy = self::FEE_STRATEGY_OPTIMAL, $forceFee = null) { |
|
| 1050 | |||
| 1051 | 7 | public function getOptimalFeePerKB() { |
|
| 1058 | |||
| 1059 | 7 | public function getLowPriorityFeePerKB() { |
|
| 1066 | |||
| 1067 | 3 | public function updateFeePerKB() { |
|
| 1075 | |||
| 1076 | /** |
||
| 1077 | * delete the wallet |
||
| 1078 | * |
||
| 1079 | * @param bool $force ignore warnings (such as non-zero balance) |
||
| 1080 | * @return mixed |
||
| 1081 | * @throws \Exception |
||
| 1082 | */ |
||
| 1083 | 10 | public function deleteWallet($force = false) { |
|
| 1091 | |||
| 1092 | /** |
||
| 1093 | * create checksum to verify ownership of the master primary key |
||
| 1094 | * |
||
| 1095 | * @return string[] [address, signature] |
||
| 1096 | */ |
||
| 1097 | 10 | protected function createChecksumVerificationSignature() { |
|
| 1108 | |||
| 1109 | /** |
||
| 1110 | * setup a webhook for our wallet |
||
| 1111 | * |
||
| 1112 | * @param string $url URL to receive webhook events |
||
| 1113 | * @param string $identifier identifier for the webhook, defaults to WALLET-{$this->identifier} |
||
| 1114 | * @return array |
||
| 1115 | */ |
||
| 1116 | 1 | public function setupWebhook($url, $identifier = null) { |
|
| 1120 | |||
| 1121 | /** |
||
| 1122 | * @param string $identifier identifier for the webhook, defaults to WALLET-{$this->identifier} |
||
| 1123 | * @return mixed |
||
| 1124 | */ |
||
| 1125 | 1 | public function deleteWebhook($identifier = null) { |
|
| 1129 | |||
| 1130 | /** |
||
| 1131 | * lock a specific unspent output |
||
| 1132 | * |
||
| 1133 | * @param $txHash |
||
| 1134 | * @param $txIdx |
||
| 1135 | * @param int $ttl |
||
| 1136 | * @return bool |
||
| 1137 | */ |
||
| 1138 | public function lockUTXO($txHash, $txIdx, $ttl = 3) { |
||
| 1141 | |||
| 1142 | /** |
||
| 1143 | * unlock a specific unspent output |
||
| 1144 | * |
||
| 1145 | * @param $txHash |
||
| 1146 | * @param $txIdx |
||
| 1147 | * @return bool |
||
| 1148 | */ |
||
| 1149 | public function unlockUTXO($txHash, $txIdx) { |
||
| 1152 | |||
| 1153 | /** |
||
| 1154 | * get all transactions for the wallet (paginated) |
||
| 1155 | * |
||
| 1156 | * @param integer $page pagination: page number |
||
| 1157 | * @param integer $limit pagination: records per page (max 500) |
||
| 1158 | * @param string $sortDir pagination: sort direction (asc|desc) |
||
| 1159 | * @return array associative array containing the response |
||
| 1160 | */ |
||
| 1161 | 1 | public function transactions($page = 1, $limit = 20, $sortDir = 'asc') { |
|
| 1164 | |||
| 1165 | /** |
||
| 1166 | * get all addresses for the wallet (paginated) |
||
| 1167 | * |
||
| 1168 | * @param integer $page pagination: page number |
||
| 1169 | * @param integer $limit pagination: records per page (max 500) |
||
| 1170 | * @param string $sortDir pagination: sort direction (asc|desc) |
||
| 1171 | * @return array associative array containing the response |
||
| 1172 | */ |
||
| 1173 | 1 | public function addresses($page = 1, $limit = 20, $sortDir = 'asc') { |
|
| 1176 | |||
| 1177 | /** |
||
| 1178 | * get all UTXOs for the wallet (paginated) |
||
| 1179 | * |
||
| 1180 | * @param integer $page pagination: page number |
||
| 1181 | * @param integer $limit pagination: records per page (max 500) |
||
| 1182 | * @param string $sortDir pagination: sort direction (asc|desc) |
||
| 1183 | * @param boolean $zeroconf include zero confirmation transactions |
||
| 1184 | * @return array associative array containing the response |
||
| 1185 | */ |
||
| 1186 | 1 | public function utxos($page = 1, $limit = 20, $sortDir = 'asc', $zeroconf = true) { |
|
| 1189 | } |
||
| 1190 |
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.