Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
Receipt.php
Go to the documentation of this file.
1 <?php
11 namespace Ethereum\DataType;
12 
18 class Receipt extends EthDataType {
19 
24 
29 
33  public $blockHash;
34 
38  public $blockNumber;
39 
44 
48  public $gasUsed;
49 
54 
58  public $status;
59 
63  public $logs;
64 
76  public function __construct(EthD32 $transactionHash = null, EthQ $transactionIndex = null, EthD32 $blockHash = null, EthQ $blockNumber = null, EthQ $cumulativeGasUsed = null, EthQ $gasUsed = null, EthD20 $contractAddress = null, EthQ $status = null, array $logs = null) {
77  $this->transactionHash = $transactionHash;
78  $this->transactionIndex = $transactionIndex;
79  $this->blockHash = $blockHash;
80  $this->blockNumber = $blockNumber;
81  $this->cumulativeGasUsed = $cumulativeGasUsed;
82  $this->gasUsed = $gasUsed;
83  $this->contractAddress = $contractAddress;
84  $this->status = $status;
85  $this->logs = $logs;
86  }
87 
91  public static function getTypeArray() {
92  return array(
93  'transactionHash' => 'EthD32',
94  'transactionIndex' => 'EthQ',
95  'blockHash' => 'EthD32',
96  'blockNumber' => 'EthQ',
97  'cumulativeGasUsed' => 'EthQ',
98  'gasUsed' => 'EthQ',
99  'contractAddress' => 'EthD20',
100  'status' => 'EthQ',
101  'logs' => '[FilterChange]',
102  );
103  }
104 
108  public function toArray() {
109  $return = [];
110  (!is_null($this->transactionHash)) ? $return['transactionHash'] = $this->transactionHash->hexVal() : NULL;
111  (!is_null($this->transactionIndex)) ? $return['transactionIndex'] = $this->transactionIndex->hexVal() : NULL;
112  (!is_null($this->blockHash)) ? $return['blockHash'] = $this->blockHash->hexVal() : NULL;
113  (!is_null($this->blockNumber)) ? $return['blockNumber'] = $this->blockNumber->hexVal() : NULL;
114  (!is_null($this->cumulativeGasUsed)) ? $return['cumulativeGasUsed'] = $this->cumulativeGasUsed->hexVal() : NULL;
115  (!is_null($this->gasUsed)) ? $return['gasUsed'] = $this->gasUsed->hexVal() : NULL;
116  (!is_null($this->contractAddress)) ? $return['contractAddress'] = $this->contractAddress->hexVal() : NULL;
117  (!is_null($this->status)) ? $return['status'] = $this->status->hexVal() : NULL;
118  (!is_null($this->logs)) ? $return['logs'] = Ethereum::valueArray($this->logs, 'FilterChange') : array();
119  return $return;
120  }
121 }
__construct(EthD32 $transactionHash=null, EthQ $transactionIndex=null, EthD32 $blockHash=null, EthQ $blockNumber=null, EthQ $cumulativeGasUsed=null, EthQ $gasUsed=null, EthD20 $contractAddress=null, EthQ $status=null, array $logs=null)
Definition: Receipt.php:76
static valueArray(array $values, string $typeClass)
Definition: Ethereum.php:571
foreach($hosts as $url) status($eth)