| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace App\Module\Blockchain\Dto;
- /**
- * 区块链交易结果数据传输对象
- */
- class TransactionResult
- {
- /**
- * @var int 交易状态 1=已确认 0=未确认
- */
- public $status;
-
- /**
- * @var int|null 区块高度(十进制)
- */
- public $blockNumber;
-
- /**
- * @var string|null 消耗的Gas数量
- */
- public $gasUsed;
-
- /**
- * @var string|null 实际Gas价格
- */
- public $effectiveGasPrice;
- /**
- * 构造函数
- * @param int $status 交易状态
- * @param int|null $blockNumber 区块高度
- * @param string|null $gasUsed 消耗的Gas数量
- * @param string|null $effectiveGasPrice 实际Gas价格
- */
- public function __construct(
- int $status,
- ?int $blockNumber = null,
- ?string $gasUsed = null,
- ?string $effectiveGasPrice = null
- ) {
- $this->status = $status;
- $this->blockNumber = $blockNumber;
- $this->gasUsed = $gasUsed;
- $this->effectiveGasPrice = $effectiveGasPrice;
- }
- /**
- * 转换为数组
- * @return array
- */
- public function toArray(): array
- {
- return [
- 'status' => $this->status,
- 'blockNumber' => $this->blockNumber,
- 'gasUsed' => $this->gasUsed,
- 'effectiveGasPrice' => $this->effectiveGasPrice
- ];
- }
- }
|