public function upgradeKeyIndex($keyIndex) {
        if ($this->locked) {
            throw new \Exception("Wallet needs to be unlocked to upgrade key index");
        }

        $walletPath = WalletPath::create($keyIndex);

        // do the upgrade to the new 'key_index'
        $primaryPublicKey = $this->primaryPrivateKey->buildKey((string)$walletPath->keyIndexPath()->publicPath());

        // $primaryPublicKey = BIP32::extended_private_to_public(BIP32::build_key($this->primaryPrivateKey->tuple(), (string)$walletPath->keyIndexPath()));
        $result = $this->sdk->upgradeKeyIndex($this->identifier, $keyIndex, $primaryPublicKey->tuple());

        $this->primaryPublicKeys[$keyIndex] = $primaryPublicKey;
        $this->keyIndex = $keyIndex;

        // update the blocktrail public keys
        foreach ($result['blocktrail_public_keys'] as $keyIndex => $pubKey) {
            if (!isset($this->blocktrailPublicKeys[$keyIndex])) {
                $path = $pubKey[1];
                $pubKey = $pubKey[0];
                $this->blocktrailPublicKeys[$keyIndex] = BIP32Key::create(HierarchicalKeyFactory::fromExtended($pubKey), $path);
            }
        }

        return true;
    }
public function upgradeKeyIndex($keyIndex) {
        if ($this->locked) {
            throw new \Exception("Wallet needs to be unlocked to upgrade key index");
        }

        $walletPath = WalletPath::create($keyIndex);

        // do the upgrade to the new 'key_index'
        $primaryPublicKey = $this->primaryPrivateKey->buildKey((string)$walletPath->keyIndexPath()->publicPath());

        // $primaryPublicKey = BIP32::extended_private_to_public(BIP32::build_key($this->primaryPrivateKey->tuple(), (string)$walletPath->keyIndexPath()));
        $result = $this->sdk->upgradeKeyIndex($this->identifier, $keyIndex, $primaryPublicKey->tuple());

        $this->primaryPublicKeys[$keyIndex] = $primaryPublicKey;
        $this->keyIndex = $keyIndex;

        // update the blocktrail public keys
        foreach ($result['blocktrail_public_keys'] as $keyIndex => $pubKey) {
            if (!isset($this->blocktrailPublicKeys[$keyIndex])) {
                $path = $pubKey[1];
                $pubKey = $pubKey[0];
                $this->blocktrailPublicKeys[$keyIndex] = BIP32Key::create(HierarchicalKeyFactory::fromExtended($pubKey), $path);
            }
        }

        return true;
    }
public function upgradeKeyIndex ( $ keyIndex ) { if ( $ this -> locked ) { throw new \ Exception ( "Wallet needs to be unlocked to upgrade key index" ) ; } $ walletPath = WalletPath :: create ( $ keyIndex ) ; // do the upgrade to the new 'key_index' $ primaryPublicKey = $ this -> primaryPrivateKey -> buildKey ( ( string ) $ walletPath -> keyIndexPath ( ) -> publicPath ( ) ) ; // $primaryPublicKey = BIP32::extended_private_to_public(BIP32::build_key($this->primaryPrivateKey->tuple(), (string)$walletPath->keyIndexPath())); $ result = $ this -> sdk -> upgradeKeyIndex ( $ this -> identifier , $ keyIndex , $ primaryPublicKey -> tuple ( ) ) ; $ this -> primaryPublicKeys [ $ keyIndex ] = $ primaryPublicKey ; $ this -> keyIndex = $ keyIndex ; // update the blocktrail public keys foreach ( $ result [ 'blocktrail_public_keys' ] as $ keyIndex => $ pubKey ) { if ( ! isset ( $ this -> blocktrailPublicKeys [ $ keyIndex ] ) ) { $ path = $ pubKey [ 1 ] ; $ pubKey = $ pubKey [ 0 ] ; $ this -> blocktrailPublicKeys [ $ keyIndex ] = BIP32Key :: create ( HierarchicalKeyFactory :: fromExtended ( $ pubKey ) , $ path ) ; } } return true ; }
upgrade wallet to different blocktrail cosign key

@param $keyIndex
@return bool
@throws \Exception
upgrade wallet to different blocktrail cosign key