From ff704e3dbae14d7d38ddf86bb9cc194d9b5f6f62 Mon Sep 17 00:00:00 2001 From: Alfonso Bribiesca Date: Tue, 8 Oct 2024 15:49:14 -0600 Subject: [PATCH] adjust for rest of transactions --- src/Transactions/Deserializer.php | 7 ++++++- src/Transactions/Serializer.php | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Transactions/Deserializer.php b/src/Transactions/Deserializer.php index ae008d5..f0c41f2 100644 --- a/src/Transactions/Deserializer.php +++ b/src/Transactions/Deserializer.php @@ -71,7 +71,12 @@ private function deserializeCommon(array &$data): void $data['type'] = $this->buffer->readUInt16(); $data['nonce'] = strval($this->buffer->readUInt64()); $data['senderPublicKey'] = $this->buffer->readHex(33 * 2); - $data['fee'] = $this->buffer->readUInt256(); + + if ($data['type'] === Types::EVM_CALL) { + $data['fee'] = $this->buffer->readUInt256(); + } else { + $data['fee'] = strval($this->buffer->readUInt64()); + } } private function deserializeVendorField(Transaction $transaction): void diff --git a/src/Transactions/Serializer.php b/src/Transactions/Serializer.php index abed46f..07c38a4 100644 --- a/src/Transactions/Serializer.php +++ b/src/Transactions/Serializer.php @@ -7,6 +7,7 @@ use ArkEcosystem\Crypto\ByteBuffer\ByteBuffer; use ArkEcosystem\Crypto\Configuration\Network; use ArkEcosystem\Crypto\Enums\TypeGroup; +use ArkEcosystem\Crypto\Enums\Types; use ArkEcosystem\Crypto\Transactions\Types\Transaction; use BitWasp\Buffertools\Buffer; @@ -107,7 +108,11 @@ private function serializeCommon(ByteBuffer $buffer): void $buffer->writeHex($this->transaction->data['senderPublicKey']); } - $buffer->writeUint256($this->transaction->data['fee']); + if ($this->transaction->data['type'] === Types::EVM_CALL) { + $buffer->writeUint256($this->transaction->data['fee']); + } else { + $buffer->writeUint64($this->transaction->data['fee']); + } } private function serializeVendorField(ByteBuffer $buffer): void