Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
Transaction.php
Go to the documentation of this file.
1 <?php
11 namespace Ethereum\DataType;
12 
18 class Transaction extends EthDataType {
19 
23  public $hash;
24 
28  public $nonce;
29 
33  public $blockHash;
34 
38  public $blockNumber;
39 
44 
48  public $from;
49 
53  public $to;
54 
58  public $value;
59 
63  public $gasPrice;
64 
68  public $gas;
69 
73  public $input;
74 
88  public function __construct(EthD32 $hash = null, EthQ $nonce = null, EthD32 $blockHash = null, EthQ $blockNumber = null, EthQ $transactionIndex = null, EthD20 $from = null, EthD20 $to = null, EthQ $value = null, EthQ $gasPrice = null, EthQ $gas = null, EthD $input = null) {
89  $this->hash = $hash;
90  $this->nonce = $nonce;
91  $this->blockHash = $blockHash;
92  $this->blockNumber = $blockNumber;
93  $this->transactionIndex = $transactionIndex;
94  $this->from = $from;
95  $this->to = $to;
96  $this->value = $value;
97  $this->gasPrice = $gasPrice;
98  $this->gas = $gas;
99  $this->input = $input;
100  }
101 
105  public static function getTypeArray() {
106  return array(
107  'hash' => 'EthD32',
108  'nonce' => 'EthQ',
109  'blockHash' => 'EthD32',
110  'blockNumber' => 'EthQ',
111  'transactionIndex' => 'EthQ',
112  'from' => 'EthD20',
113  'to' => 'EthD20',
114  'value' => 'EthQ',
115  'gasPrice' => 'EthQ',
116  'gas' => 'EthQ',
117  'input' => 'EthD',
118  );
119  }
120 
124  public function toArray() {
125  $return = [];
126  (!is_null($this->hash)) ? $return['hash'] = $this->hash->hexVal() : NULL;
127  (!is_null($this->nonce)) ? $return['nonce'] = $this->nonce->hexVal() : NULL;
128  (!is_null($this->blockHash)) ? $return['blockHash'] = $this->blockHash->hexVal() : NULL;
129  (!is_null($this->blockNumber)) ? $return['blockNumber'] = $this->blockNumber->hexVal() : NULL;
130  (!is_null($this->transactionIndex)) ? $return['transactionIndex'] = $this->transactionIndex->hexVal() : NULL;
131  (!is_null($this->from)) ? $return['from'] = $this->from->hexVal() : NULL;
132  (!is_null($this->to)) ? $return['to'] = $this->to->hexVal() : NULL;
133  (!is_null($this->value)) ? $return['value'] = $this->value->hexVal() : NULL;
134  (!is_null($this->gasPrice)) ? $return['gasPrice'] = $this->gasPrice->hexVal() : NULL;
135  (!is_null($this->gas)) ? $return['gas'] = $this->gas->hexVal() : NULL;
136  (!is_null($this->input)) ? $return['input'] = $this->input->hexVal() : NULL;
137  return $return;
138  }
139 }
__construct(EthD32 $hash=null, EthQ $nonce=null, EthD32 $blockHash=null, EthQ $blockNumber=null, EthQ $transactionIndex=null, EthD20 $from=null, EthD20 $to=null, EthQ $value=null, EthQ $gasPrice=null, EthQ $gas=null, EthD $input=null)
Definition: Transaction.php:88