Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
SendTransaction.php
Go to the documentation of this file.
1 <?php
11 namespace Ethereum\DataType;
12 
19 
23  public $from;
24 
28  public $data;
29 
33  public $to;
34 
38  public $gas;
39 
43  public $gasPrice;
44 
48  public $value;
49 
53  public $nonce;
54 
64  public function __construct(EthD20 $from, EthD $data, EthD20 $to = null, EthQ $gas = null, EthQ $gasPrice = null, EthQ $value = null, EthQ $nonce = null) {
65  $this->from = $from;
66  $this->data = $data;
67  $this->to = $to;
68  $this->gas = $gas;
69  $this->gasPrice = $gasPrice;
70  $this->value = $value;
71  $this->nonce = $nonce;
72  }
73 
77  public static function getTypeArray() {
78  return array(
79  'from' => 'EthD20',
80  'data' => 'EthD',
81  'to' => 'EthD20',
82  'gas' => 'EthQ',
83  'gasPrice' => 'EthQ',
84  'value' => 'EthQ',
85  'nonce' => 'EthQ',
86  );
87  }
88 
92  public function toArray() {
93  $return = [];
94  (!is_null($this->from)) ? $return['from'] = $this->from->hexVal() : NULL;
95  (!is_null($this->data)) ? $return['data'] = $this->data->hexVal() : NULL;
96  (!is_null($this->to)) ? $return['to'] = $this->to->hexVal() : NULL;
97  (!is_null($this->gas)) ? $return['gas'] = $this->gas->hexVal() : NULL;
98  (!is_null($this->gasPrice)) ? $return['gasPrice'] = $this->gasPrice->hexVal() : NULL;
99  (!is_null($this->value)) ? $return['value'] = $this->value->hexVal() : NULL;
100  (!is_null($this->nonce)) ? $return['nonce'] = $this->nonce->hexVal() : NULL;
101  return $return;
102  }
103 }
__construct(EthD20 $from, EthD $data, EthD20 $to=null, EthQ $gas=null, EthQ $gasPrice=null, EthQ $value=null, EthQ $nonce=null)