@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $contentMD5Mode = !is_null($body) ? 'body' : 'url'; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $request = new Request($method, $this->apiEndpoint . $endpointUrl); |
|
| 168 | + $request = new Request($method, $this->apiEndpoint.$endpointUrl); |
|
| 169 | 169 | $uri = $request->getUri(); |
| 170 | 170 | |
| 171 | 171 | if ($queryString) { |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | throw new ObjectNotFound($this->verboseErrors ? $body : Blocktrail::EXCEPTION_OBJECT_NOT_FOUND, $httpResponseCode); |
| 254 | 254 | } |
| 255 | 255 | } elseif ($httpResponseCode == 500) { |
| 256 | - throw new GenericServerError(Blocktrail::EXCEPTION_GENERIC_SERVER_ERROR . "\nServer Response: " . $body, $httpResponseCode); |
|
| 256 | + throw new GenericServerError(Blocktrail::EXCEPTION_GENERIC_SERVER_ERROR."\nServer Response: ".$body, $httpResponseCode); |
|
| 257 | 257 | } else { |
| 258 | - throw new GenericHTTPError(Blocktrail::EXCEPTION_GENERIC_HTTP_ERROR . "\nServer Response: " . $body, $httpResponseCode); |
|
| 258 | + throw new GenericHTTPError(Blocktrail::EXCEPTION_GENERIC_HTTP_ERROR."\nServer Response: ".$body, $httpResponseCode); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | 'handler' => $handler, |
| 62 | 62 | 'base_uri' => $this->apiEndpoint, |
| 63 | 63 | 'headers' => array( |
| 64 | - 'User-Agent' => Blocktrail::SDK_USER_AGENT . '/' . Blocktrail::SDK_VERSION, |
|
| 64 | + 'User-Agent' => Blocktrail::SDK_USER_AGENT.'/'.Blocktrail::SDK_VERSION, |
|
| 65 | 65 | ), |
| 66 | 66 | 'http_errors' => false, |
| 67 | 67 | 'connect_timeout' => 3, |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * @return array[] array containing the response |
| 311 | 311 | */ |
| 312 | 312 | public function transactions($txhashes) { |
| 313 | - $response = $this->client->get("transactions/" . implode(",", $txhashes)); |
|
| 313 | + $response = $this->client->get("transactions/".implode(",", $txhashes)); |
|
| 314 | 314 | return self::jsonDecode($response->body(), true); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | } else { |
| 578 | 578 | // create new primary seed |
| 579 | 579 | /** @var HierarchicalKey $primaryPrivateKey */ |
| 580 | - list($primaryMnemonic, , $primaryPrivateKey) = $this->newPrimarySeed($options['passphrase']); |
|
| 580 | + list($primaryMnemonic,, $primaryPrivateKey) = $this->newPrimarySeed($options['passphrase']); |
|
| 581 | 581 | if ($storePrimaryMnemonic !== false) { |
| 582 | 582 | $storePrimaryMnemonic = true; |
| 583 | 583 | } |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $backupPublicKey = null; |
| 617 | 617 | if (!isset($options['backup_mnemonic']) && !isset($options['backup_public_key'])) { |
| 618 | 618 | /** @var HierarchicalKey $backupPrivateKey */ |
| 619 | - list($backupMnemonic, , ) = $this->newBackupSeed(); |
|
| 619 | + list($backupMnemonic,,) = $this->newBackupSeed(); |
|
| 620 | 620 | } else if (isset($options['backup_mnemonic'])) { |
| 621 | 621 | $backupMnemonic = $options['backup_mnemonic']; |
| 622 | 622 | } elseif (isset($options['backup_public_key'])) { |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | ); |
| 649 | 649 | |
| 650 | 650 | // received the blocktrail public keys |
| 651 | - $blocktrailPublicKeys = Util::arrayMapWithIndex(function ($keyIndex, $pubKeyTuple) { |
|
| 651 | + $blocktrailPublicKeys = Util::arrayMapWithIndex(function($keyIndex, $pubKeyTuple) { |
|
| 652 | 652 | return [$keyIndex, BIP32Key::create(HierarchicalKeyFactory::fromExtended($pubKeyTuple[0]), $pubKeyTuple[1])]; |
| 653 | 653 | }, $data['blocktrail_public_keys']); |
| 654 | 654 | |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | ); |
| 769 | 769 | |
| 770 | 770 | // received the blocktrail public keys |
| 771 | - $blocktrailPublicKeys = Util::arrayMapWithIndex(function ($keyIndex, $pubKeyTuple) { |
|
| 771 | + $blocktrailPublicKeys = Util::arrayMapWithIndex(function($keyIndex, $pubKeyTuple) { |
|
| 772 | 772 | return [$keyIndex, BIP32Key::create(HierarchicalKeyFactory::fromExtended($pubKeyTuple[0]), $pubKeyTuple[1])]; |
| 773 | 773 | }, $data['blocktrail_public_keys']); |
| 774 | 774 | |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | 'backup_seed' => $backupSeed ? MnemonicFactory::bip39()->entropyToMnemonic(new Buffer($backupSeed)) : null, |
| 803 | 803 | 'recovery_encrypted_secret' => $recoveryEncryptedSecret ? MnemonicFactory::bip39()->entropyToMnemonic(new Buffer(base64_decode($recoveryEncryptedSecret))) : null, |
| 804 | 804 | 'encrypted_secret' => $encryptedSecret ? MnemonicFactory::bip39()->entropyToMnemonic(new Buffer(base64_decode($encryptedSecret))) : null, |
| 805 | - 'blocktrail_public_keys' => Util::arrayMapWithIndex(function ($keyIndex, BIP32Key $pubKey) { |
|
| 805 | + 'blocktrail_public_keys' => Util::arrayMapWithIndex(function($keyIndex, BIP32Key $pubKey) { |
|
| 806 | 806 | return [$keyIndex, $pubKey->tuple()]; |
| 807 | 807 | }, $blocktrailPublicKeys), |
| 808 | 808 | ], |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | ); |
| 909 | 909 | |
| 910 | 910 | // received the blocktrail public keys |
| 911 | - $blocktrailPublicKeys = Util::arrayMapWithIndex(function ($keyIndex, $pubKeyTuple) { |
|
| 911 | + $blocktrailPublicKeys = Util::arrayMapWithIndex(function($keyIndex, $pubKeyTuple) { |
|
| 912 | 912 | return [$keyIndex, BIP32Key::create(HierarchicalKeyFactory::fromExtended($pubKeyTuple[0]), $pubKeyTuple[1])]; |
| 913 | 913 | }, $data['blocktrail_public_keys']); |
| 914 | 914 | |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | 'backup_seed' => $backupSeed ? MnemonicFactory::bip39()->entropyToMnemonic($backupSeed) : null, |
| 943 | 943 | 'recovery_encrypted_secret' => $recoveryEncryptedSecret ? EncryptionMnemonic::encode($recoveryEncryptedSecret) : null, |
| 944 | 944 | 'encrypted_secret' => $encryptedSecret ? EncryptionMnemonic::encode($encryptedSecret) : null, |
| 945 | - 'blocktrail_public_keys' => Util::arrayMapWithIndex(function ($keyIndex, BIP32Key $pubKey) { |
|
| 945 | + 'blocktrail_public_keys' => Util::arrayMapWithIndex(function($keyIndex, BIP32Key $pubKey) { |
|
| 946 | 946 | return [$keyIndex, $pubKey->tuple()]; |
| 947 | 947 | }, $blocktrailPublicKeys), |
| 948 | 948 | ] |
@@ -1120,10 +1120,7 @@ discard block |
||
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | 1122 | $identifier = $options['identifier']; |
| 1123 | - $readonly = isset($options['readonly']) ? $options['readonly'] : |
|
| 1124 | - (isset($options['readOnly']) ? $options['readOnly'] : |
|
| 1125 | - (isset($options['read-only']) ? $options['read-only'] : |
|
| 1126 | - false)); |
|
| 1123 | + $readonly = isset($options['readonly']) ? $options['readonly'] : (isset($options['readOnly']) ? $options['readOnly'] : (isset($options['read-only']) ? $options['read-only'] : false)); |
|
| 1127 | 1124 | |
| 1128 | 1125 | // get the wallet data from the server |
| 1129 | 1126 | $data = $this->getWallet($identifier); |
@@ -1806,7 +1803,7 @@ discard block |
||
| 1806 | 1803 | */ |
| 1807 | 1804 | public static function sortMultisigKeys(array $pubKeys) { |
| 1808 | 1805 | $result = array_values($pubKeys); |
| 1809 | - usort($result, function (PublicKeyInterface $a, PublicKeyInterface $b) { |
|
| 1806 | + usort($result, function(PublicKeyInterface $a, PublicKeyInterface $b) { |
|
| 1810 | 1807 | $av = $a->getHex(); |
| 1811 | 1808 | $bv = $b->getHex(); |
| 1812 | 1809 | return $av == $bv ? 0 : $av > $bv ? 1 : -1; |
@@ -1832,7 +1829,7 @@ discard block |
||
| 1832 | 1829 | } |
| 1833 | 1830 | |
| 1834 | 1831 | public static function normalizeBIP32KeyArray($keys) { |
| 1835 | - return Util::arrayMapWithIndex(function ($idx, $key) { |
|
| 1832 | + return Util::arrayMapWithIndex(function($idx, $key) { |
|
| 1836 | 1833 | return [$idx, self::normalizeBIP32Key($key)]; |
| 1837 | 1834 | }, $keys); |
| 1838 | 1835 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $this->getBlocktrailPublicKey($path)->buildKey($path)->publicKey() |
| 202 | 202 | ]), false); |
| 203 | 203 | |
| 204 | - if ($this->network !== "bitcoincash" && (int) $path[2] === 2) { |
|
| 204 | + if ($this->network !== "bitcoincash" && (int)$path[2] === 2) { |
|
| 205 | 205 | $witnessScript = new WitnessScript($multisig); |
| 206 | 206 | $redeemScript = new P2shScript($witnessScript); |
| 207 | 207 | $address = $this->addressReader->fromOutputScript($redeemScript->getOutputScript())->getAddress(); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | for ($i = 0; $i < $count; $i++) { |
| 229 | 229 | //create a path subsequent address |
| 230 | - $path = (string)WalletPath::create($keyIndex, $_chain = 0, $start+$i)->path()->publicPath(); |
|
| 230 | + $path = (string)WalletPath::create($keyIndex, $_chain = 0, $start + $i)->path()->publicPath(); |
|
| 231 | 231 | list($address, $redeem, $witness) = $this->createAddress($path); |
| 232 | 232 | $addresses[$address] = array( |
| 233 | 233 | //'address' => $address, |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $totalUTXOs = 0; |
| 277 | 277 | $totalAddressesGenerated = 0; |
| 278 | 278 | |
| 279 | - $addressUTXOs = array(); //addresses and their utxos, paths and redeem scripts |
|
| 279 | + $addressUTXOs = array(); //addresses and their utxos, paths and redeem scripts |
|
| 280 | 280 | |
| 281 | 281 | //for each blocktrail pub key, do fund discovery on batches of addresses |
| 282 | 282 | foreach ($this->blocktrailPublicKeys as $keyIndex => $blocktrailPubKey) { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $addressUTXOs[$address]['utxos'][] = $utxo; |
| 315 | - $totalUTXOs ++; |
|
| 315 | + $totalUTXOs++; |
|
| 316 | 316 | |
| 317 | 317 | //add up the total utxo value for all addresses |
| 318 | 318 | $totalBalance += $utxo['value']; |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $signer->redeemBitcoinCash(true); |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - assert(Util::all(function ($signInfo) { |
|
| 442 | + assert(Util::all(function($signInfo) { |
|
| 443 | 443 | return $signInfo instanceof SignInfo; |
| 444 | 444 | }, $signInfo), '$signInfo should be SignInfo[]'); |
| 445 | 445 | |