Skip to content

Commit

Permalink
adjust for rest of transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsobries committed Oct 8, 2024
1 parent c1a9efe commit ff704e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Transactions/Deserializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/Transactions/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ff704e3

Please sign in to comment.