public function new()
    {
        if (isset($this->constructor)) {
            $constructor = $this->constructor;
            $arguments = func_get_args();
            $callback = array_pop($arguments);

            $input_count = isset($constructor['inputs']) ? count($constructor['inputs']) : 0;
            if (count($arguments) < $input_count) {
                throw new InvalidArgumentException('Please make sure you have put all constructor params and callback.');
            }
            if (is_callable($callback) !== true) {
                throw new \InvalidArgumentException('The last param must be callback function.');
            }
            if (!isset($this->bytecode)) {
                throw new \InvalidArgumentException('Please call bytecode($bytecode) before new().');
            }
            $params = array_splice($arguments, 0, $input_count);
            $data = $this->ethabi->encodeParameters($constructor, $params);
            $transaction = [];

            if (count($arguments) > 0) {
                $transaction = $arguments[0];
            }
            $transaction['data'] = '0x' . $this->bytecode . Utils::stripZero($data);

            $this->eth->sendTransaction($transaction, function ($err, $transaction) use ($callback){
                if ($err !== null) {
                    return call_user_func($callback, $err, null);
                }
                return call_user_func($callback, null, $transaction);
            });
        }
    }
public function new()
    {
        if (isset($this->constructor)) {
            $constructor = $this->constructor;
            $arguments = func_get_args();
            $callback = array_pop($arguments);

            $input_count = isset($constructor['inputs']) ? count($constructor['inputs']) : 0;
            if (count($arguments) < $input_count) {
                throw new InvalidArgumentException('Please make sure you have put all constructor params and callback.');
            }
            if (is_callable($callback) !== true) {
                throw new \InvalidArgumentException('The last param must be callback function.');
            }
            if (!isset($this->bytecode)) {
                throw new \InvalidArgumentException('Please call bytecode($bytecode) before new().');
            }
            $params = array_splice($arguments, 0, $input_count);
            $data = $this->ethabi->encodeParameters($constructor, $params);
            $transaction = [];

            if (count($arguments) > 0) {
                $transaction = $arguments[0];
            }
            $transaction['data'] = '0x' . $this->bytecode . Utils::stripZero($data);

            $this->eth->sendTransaction($transaction, function ($err, $transaction) use ($callback){
                if ($err !== null) {
                    return call_user_func($callback, $err, null);
                }
                return call_user_func($callback, null, $transaction);
            });
        }
    }
public function new ( ) { if ( isset ( $ this -> constructor ) ) { $ constructor = $ this -> constructor ; $ arguments = func_get_args ( ) ; $ callback = array_pop ( $ arguments ) ; $ input_count = isset ( $ constructor [ 'inputs' ] ) ? count ( $ constructor [ 'inputs' ] ) : 0 ; if ( count ( $ arguments ) < $ input_count ) { throw new InvalidArgumentException ( 'Please make sure you have put all constructor params and callback.' ) ; } if ( is_callable ( $ callback ) !== true ) { throw new \ InvalidArgumentException ( 'The last param must be callback function.' ) ; } if ( ! isset ( $ this -> bytecode ) ) { throw new \ InvalidArgumentException ( 'Please call bytecode($bytecode) before new().' ) ; } $ params = array_splice ( $ arguments , 0 , $ input_count ) ; $ data = $ this -> ethabi -> encodeParameters ( $ constructor , $ params ) ; $ transaction = [ ] ; if ( count ( $ arguments ) > 0 ) { $ transaction = $ arguments [ 0 ] ; } $ transaction [ 'data' ] = '0x' . $ this -> bytecode . Utils :: stripZero ( $ data ) ; $ this -> eth -> sendTransaction ( $ transaction , function ( $ err , $ transaction ) use ( $ callback ) { if ( $ err !== null ) { return call_user_func ( $ callback , $ err , null ) ; } return call_user_func ( $ callback , null , $ transaction ) ; } ) ; } }
new
Deploy a contruct with params.

@param mixed
@return void
new Deploy a contruct with params .