diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index eed3ee17e..204e0cc0a 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -20,12 +20,11 @@ /** * @property string $id - * @property array|null $asset * @property BigNumber $amount + * @property BigNumber $gas_limit * @property BigNumber $gas_price * @property int $timestamp - * @property int $type - * @property int $type_group + * @property int $sequence * @property string $block_id * @property string|null $recipient_address * @property string $sender_public_key @@ -71,11 +70,10 @@ final class Transaction extends Model */ protected $casts = [ 'amount' => BigInteger::class, - 'asset' => 'array', 'gas_price' => BigInteger::class, + 'gas_limit' => BigInteger::class, 'timestamp' => UnixSeconds::class, - 'type_group' => 'int', - 'type' => 'int', + 'sequence' => 'int', 'block_height' => 'int', ]; diff --git a/app/ViewModels/TransactionViewModel.php b/app/ViewModels/TransactionViewModel.php index e008da3d6..48176e0da 100644 --- a/app/ViewModels/TransactionViewModel.php +++ b/app/ViewModels/TransactionViewModel.php @@ -84,6 +84,27 @@ public function nonce(): int return $this->transaction->nonce; } + public function gasLimit(): float + { + return UnitConverter::formatUnits((string) $this->transaction->gas_limit, 'wei'); + } + + public function gasUsed(): float + { + $receipt = $this->transaction->receipt; + + if ($receipt === null) { + return 0; + } + + return UnitConverter::formatUnits((string) $receipt->gas_used, 'wei'); + } + + public function sequence(): int + { + return $this->transaction->sequence; + } + public function fee(): float { return UnitConverter::formatUnits((string) $this->transaction->fee(), 'gwei'); diff --git a/resources/views/components/transaction/page/more-details.blade.php b/resources/views/components/transaction/page/more-details.blade.php index 2c691d14d..eed463272 100644 --- a/resources/views/components/transaction/page/more-details.blade.php +++ b/resources/views/components/transaction/page/more-details.blade.php @@ -13,14 +13,14 @@ class="mt-6 sm:hidden" - 64,004 + {{ ExplorerNumberFormatter::number($transaction->gasLimit()) }} - 63,185 + {{ ExplorerNumberFormatter::number($transaction->gasUsed()) }} @@ -30,7 +30,7 @@ class="pt-3" - 137 + {{ $transaction->sequence() }} @@ -90,16 +90,17 @@ class="mt-4 !px-0" - 63,185 - + allow-empty + />