src/Wallet.php
public function _buildTransfer($options)
    {
        $destinations = $options['destinations'];
        // Convert Monero amount to atomic units
        if(gettype($destinations) == "object"){
            $destinations->amount = $destinations->amount * 1e12;
            $destinations = array($destinations);
        } else {
            foreach ($destinations as &$destination){
                $destination->amount = $destination->amount * 1e12;
            }
        }
        // Define Mixin
        $mixin = (isset($options['mixin']) ? $options['mixin'] : 4);
        // Define Unlock Time
        $unlock_time = (isset($options['unlock_time']) ? $options['unlock_time'] : 0);
        // Define Payment ID
        $payment_id = (isset($options['payment_id']) ? $options['payment_id'] : null);
        // Build params array
        $params = [
            'destinations' => $destinations,
            'mixin' => $mixin,
            'unlock_time' => $unlock_time,
            'payment_id' => $payment_id
        ];
        // Set algorithm type if using transfer_split method
        if($options['method'] == "transfer_split"){
            $new_algorithm = (isset($options['new_algorithm']) ? $options['new_algorithm'] : false);
            $params['new_algorithm'] = $new_algorithm;
        }
        // Build request body
        $body = [
            'method' => $options['method'],
            'params' => $params
        ];
        return $body;
    }
public function _buildTransfer($options)
    {
        $destinations = $options['destinations'];
        // Convert Monero amount to atomic units
        if(gettype($destinations) == "object"){
            $destinations->amount = $destinations->amount * 1e12;
            $destinations = array($destinations);
        } else {
            foreach ($destinations as &$destination){
                $destination->amount = $destination->amount * 1e12;
            }
        }
        // Define Mixin
        $mixin = (isset($options['mixin']) ? $options['mixin'] : 4);
        // Define Unlock Time
        $unlock_time = (isset($options['unlock_time']) ? $options['unlock_time'] : 0);
        // Define Payment ID
        $payment_id = (isset($options['payment_id']) ? $options['payment_id'] : null);
        // Build params array
        $params = [
            'destinations' => $destinations,
            'mixin' => $mixin,
            'unlock_time' => $unlock_time,
            'payment_id' => $payment_id
        ];
        // Set algorithm type if using transfer_split method
        if($options['method'] == "transfer_split"){
            $new_algorithm = (isset($options['new_algorithm']) ? $options['new_algorithm'] : false);
            $params['new_algorithm'] = $new_algorithm;
        }
        // Build request body
        $body = [
            'method' => $options['method'],
            'params' => $params
        ];
        return $body;
    }
public function _buildTransfer ( $ options ) { $ destinations = $ options [ 'destinations' ] ; // Convert Monero amount to atomic units if ( gettype ( $ destinations ) == "object" ) { $ destinations -> amount = $ destinations -> amount * 1e12 ; $ destinations = array ( $ destinations ) ; } else { foreach ( $ destinations as & $ destination ) { $ destination -> amount = $ destination -> amount * 1e12 ; } } // Define Mixin $ mixin = ( isset ( $ options [ 'mixin' ] ) ? $ options [ 'mixin' ] : 4 ) ; // Define Unlock Time $ unlock_time = ( isset ( $ options [ 'unlock_time' ] ) ? $ options [ 'unlock_time' ] : 0 ) ; // Define Payment ID $ payment_id = ( isset ( $ options [ 'payment_id' ] ) ? $ options [ 'payment_id' ] : null ) ; // Build params array $ params = [ 'destinations' => $ destinations , 'mixin' => $ mixin , 'unlock_time' => $ unlock_time , 'payment_id' => $ payment_id ] ; // Set algorithm type if using transfer_split method if ( $ options [ 'method' ] == "transfer_split" ) { $ new_algorithm = ( isset ( $ options [ 'new_algorithm' ] ) ? $ options [ 'new_algorithm' ] : false ) ; $ params [ 'new_algorithm' ] = $ new_algorithm ; } // Build request body $ body = [ 'method' => $ options [ 'method' ] , 'params' => $ params ] ; return $ body ; }
Helper function for building transfer or transfer split request body
@param array $options
@return string
Helper function for building transfer or transfer split request body