|
@@ -90,7 +90,7 @@ discard block |
|
|
block discarded – undo |
|
90
|
90
|
|
|
91
|
91
|
$btccomEndpoint = getenv('BLOCKTRAIL_SDK_BTCCOM_API_ENDPOINT'); |
|
92
|
92
|
if (!$btccomEndpoint) { |
|
93
|
|
- $btccomEndpoint = "https://" . ($this->network === "BCC" ? "bch-chain" : "chain") . ".api.btc.com"; |
|
|
93
|
+ $btccomEndpoint = "https://".($this->network === "BCC" ? "bch-chain" : "chain").".api.btc.com"; |
|
94
|
94
|
} |
|
95
|
95
|
$btccomEndpoint = "{$btccomEndpoint}/v3/"; |
|
96
|
96
|
|
|
@@ -660,7 +660,7 @@ discard block |
|
|
block discarded – undo |
|
660
|
660
|
} else { |
|
661
|
661
|
// create new primary seed |
|
662
|
662
|
/** @var HierarchicalKey $primaryPrivateKey */ |
|
663
|
|
- list($primaryMnemonic, , $primaryPrivateKey) = $this->newPrimarySeed($options['passphrase']); |
|
|
663
|
+ list($primaryMnemonic,, $primaryPrivateKey) = $this->newPrimarySeed($options['passphrase']); |
|
664
|
664
|
if ($storePrimaryMnemonic !== false) { |
|
665
|
665
|
$storePrimaryMnemonic = true; |
|
666
|
666
|
} |
|
@@ -699,7 +699,7 @@ discard block |
|
|
block discarded – undo |
|
699
|
699
|
$backupPublicKey = null; |
|
700
|
700
|
if (!isset($options['backup_mnemonic']) && !isset($options['backup_public_key'])) { |
|
701
|
701
|
/** @var HierarchicalKey $backupPrivateKey */ |
|
702
|
|
- list($backupMnemonic, , ) = $this->newBackupSeed(); |
|
|
702
|
+ list($backupMnemonic,,) = $this->newBackupSeed(); |
|
703
|
703
|
} else if (isset($options['backup_mnemonic'])) { |
|
704
|
704
|
$backupMnemonic = $options['backup_mnemonic']; |
|
705
|
705
|
} elseif (isset($options['backup_public_key'])) { |
|
@@ -732,7 +732,7 @@ discard block |
|
|
block discarded – undo |
|
732
|
732
|
); |
|
733
|
733
|
|
|
734
|
734
|
// received the blocktrail public keys |
|
735
|
|
- $blocktrailPublicKeys = Util::arrayMapWithIndex(function ($keyIndex, $pubKeyTuple) { |
|
|
735
|
+ $blocktrailPublicKeys = Util::arrayMapWithIndex(function($keyIndex, $pubKeyTuple) { |
|
736
|
736
|
return [$keyIndex, BIP32Key::create(HierarchicalKeyFactory::fromExtended($pubKeyTuple[0]), $pubKeyTuple[1])]; |
|
737
|
737
|
}, $data['blocktrail_public_keys']); |
|
738
|
738
|
|
|
@@ -854,7 +854,7 @@ discard block |
|
|
block discarded – undo |
|
854
|
854
|
); |
|
855
|
855
|
|
|
856
|
856
|
// received the blocktrail public keys |
|
857
|
|
- $blocktrailPublicKeys = Util::arrayMapWithIndex(function ($keyIndex, $pubKeyTuple) { |
|
|
857
|
+ $blocktrailPublicKeys = Util::arrayMapWithIndex(function($keyIndex, $pubKeyTuple) { |
|
858
|
858
|
return [$keyIndex, BIP32Key::create(HierarchicalKeyFactory::fromExtended($pubKeyTuple[0]), $pubKeyTuple[1])]; |
|
859
|
859
|
}, $data['blocktrail_public_keys']); |
|
860
|
860
|
|
|
@@ -889,7 +889,7 @@ discard block |
|
|
block discarded – undo |
|
889
|
889
|
'backup_seed' => $backupSeed ? MnemonicFactory::bip39()->entropyToMnemonic(new Buffer($backupSeed)) : null, |
|
890
|
890
|
'recovery_encrypted_secret' => $recoveryEncryptedSecret ? MnemonicFactory::bip39()->entropyToMnemonic(new Buffer(base64_decode($recoveryEncryptedSecret))) : null, |
|
891
|
891
|
'encrypted_secret' => $encryptedSecret ? MnemonicFactory::bip39()->entropyToMnemonic(new Buffer(base64_decode($encryptedSecret))) : null, |
|
892
|
|
- 'blocktrail_public_keys' => Util::arrayMapWithIndex(function ($keyIndex, BIP32Key $pubKey) { |
|
|
892
|
+ 'blocktrail_public_keys' => Util::arrayMapWithIndex(function($keyIndex, BIP32Key $pubKey) { |
|
893
|
893
|
return [$keyIndex, $pubKey->tuple()]; |
|
894
|
894
|
}, $blocktrailPublicKeys), |
|
895
|
895
|
], |
|
@@ -999,7 +999,7 @@ discard block |
|
|
block discarded – undo |
|
999
|
999
|
); |
|
1000
|
1000
|
|
|
1001
|
1001
|
// received the blocktrail public keys |
|
1002
|
|
- $blocktrailPublicKeys = Util::arrayMapWithIndex(function ($keyIndex, $pubKeyTuple) { |
|
|
1002
|
+ $blocktrailPublicKeys = Util::arrayMapWithIndex(function($keyIndex, $pubKeyTuple) { |
|
1003
|
1003
|
return [$keyIndex, BIP32Key::create(HierarchicalKeyFactory::fromExtended($pubKeyTuple[0]), $pubKeyTuple[1])]; |
|
1004
|
1004
|
}, $data['blocktrail_public_keys']); |
|
1005
|
1005
|
|
|
@@ -1034,7 +1034,7 @@ discard block |
|
|
block discarded – undo |
|
1034
|
1034
|
'backup_seed' => $backupSeed ? MnemonicFactory::bip39()->entropyToMnemonic($backupSeed) : null, |
|
1035
|
1035
|
'recovery_encrypted_secret' => $recoveryEncryptedSecret ? EncryptionMnemonic::encode($recoveryEncryptedSecret) : null, |
|
1036
|
1036
|
'encrypted_secret' => $encryptedSecret ? EncryptionMnemonic::encode($encryptedSecret) : null, |
|
1037
|
|
- 'blocktrail_public_keys' => Util::arrayMapWithIndex(function ($keyIndex, BIP32Key $pubKey) { |
|
|
1037
|
+ 'blocktrail_public_keys' => Util::arrayMapWithIndex(function($keyIndex, BIP32Key $pubKey) { |
|
1038
|
1038
|
return [$keyIndex, $pubKey->tuple()]; |
|
1039
|
1039
|
}, $blocktrailPublicKeys), |
|
1040
|
1040
|
] |
|
@@ -1228,10 +1228,7 @@ discard block |
|
|
block discarded – undo |
|
1228
|
1228
|
} |
|
1229
|
1229
|
|
|
1230
|
1230
|
$identifier = $options['identifier']; |
|
1231
|
|
- $readonly = isset($options['readonly']) ? $options['readonly'] : |
|
1232
|
|
- (isset($options['readOnly']) ? $options['readOnly'] : |
|
1233
|
|
- (isset($options['read-only']) ? $options['read-only'] : |
|
1234
|
|
- false)); |
|
|
1231
|
+ $readonly = isset($options['readonly']) ? $options['readonly'] : (isset($options['readOnly']) ? $options['readOnly'] : (isset($options['read-only']) ? $options['read-only'] : false)); |
|
1235
|
1232
|
|
|
1236
|
1233
|
// get the wallet data from the server |
|
1237
|
1234
|
$data = $this->getWallet($identifier); |
|
@@ -1930,7 +1927,7 @@ discard block |
|
|
block discarded – undo |
|
1930
|
1927
|
*/ |
|
1931
|
1928
|
public static function sortMultisigKeys(array $pubKeys) { |
|
1932
|
1929
|
$result = array_values($pubKeys); |
|
1933
|
|
- usort($result, function (PublicKeyInterface $a, PublicKeyInterface $b) { |
|
|
1930
|
+ usort($result, function(PublicKeyInterface $a, PublicKeyInterface $b) { |
|
1934
|
1931
|
$av = $a->getHex(); |
|
1935
|
1932
|
$bv = $b->getHex(); |
|
1936
|
1933
|
return $av == $bv ? 0 : $av > $bv ? 1 : -1; |
|
@@ -1956,7 +1953,7 @@ discard block |
|
|
block discarded – undo |
|
1956
|
1953
|
} |
|
1957
|
1954
|
|
|
1958
|
1955
|
public static function normalizeBIP32KeyArray($keys) { |
|
1959
|
|
- return Util::arrayMapWithIndex(function ($idx, $key) { |
|
|
1956
|
+ return Util::arrayMapWithIndex(function($idx, $key) { |
|
1960
|
1957
|
return [$idx, self::normalizeBIP32Key($key)]; |
|
1961
|
1958
|
}, $keys); |
|
1962
|
1959
|
} |