public function sweepWallet($destinationAddress, $sweepBatchSize = 200) {
        if ($this->debug) {
            echo "\nstarting wallet sweeping to address $destinationAddress";
        }

        //do wallet fund discovery
        if (!isset($this->sweepData)) {
            $this->discoverWalletFunds($sweepBatchSize);
        }

        if ($this->sweepData['balance'] === 0) {
            //no funds found
            throw new \Exception("No funds found after searching through {$this->sweepData['addressesSearched']} addresses");
        }

        //create and sign the transaction
        $transaction = $this->createTransaction($destinationAddress);

        //return or send the transaction
        return $transaction->getHex();
    }
public function sweepWallet($destinationAddress, $sweepBatchSize = 200) {
        if ($this->debug) {
            echo "\nstarting wallet sweeping to address $destinationAddress";
        }

        //do wallet fund discovery
        if (!isset($this->sweepData)) {
            $this->discoverWalletFunds($sweepBatchSize);
        }

        if ($this->sweepData['balance'] === 0) {
            //no funds found
            throw new \Exception("No funds found after searching through {$this->sweepData['addressesSearched']} addresses");
        }

        //create and sign the transaction
        $transaction = $this->createTransaction($destinationAddress);

        //return or send the transaction
        return $transaction->getHex();
    }
public function sweepWallet ( $ destinationAddress , $ sweepBatchSize = 200 ) { if ( $ this -> debug ) { echo "\nstarting wallet sweeping to address $destinationAddress" ; } //do wallet fund discovery if ( ! isset ( $ this -> sweepData ) ) { $ this -> discoverWalletFunds ( $ sweepBatchSize ) ; } if ( $ this -> sweepData [ 'balance' ] === 0 ) { //no funds found throw new \ Exception ( "No funds found after searching through {$this->sweepData['addressesSearched']} addresses" ) ; } //create and sign the transaction $ transaction = $ this -> createTransaction ( $ destinationAddress ) ; //return or send the transaction return $ transaction -> getHex ( ) ; }
sweep the wallet of all funds and send to a single address

@param string    $destinationAddress     address to receive found funds
@param int       $sweepBatchSize         number of addresses to search at a time
@return string                           HEX string of signed transaction
@throws \Exception
sweep the wallet of all funds and send to a single address