src/Transactions/Deserializer.php
public function deserialize(): Transaction
    {
        $transaction = new Transaction();
        $transaction->version = $this->buffer->readUInt8();
        $transaction->network = $this->buffer->readUInt8();
        $transaction->type = $this->buffer->readUInt8();
        $transaction->timestamp = $this->buffer->readUInt32();
        $transaction->senderPublicKey = $this->buffer->readHex(33);
        $transaction->fee = $this->buffer->readUInt64();

        $vendorFieldLength = $this->buffer->readUInt8();
        if ($vendorFieldLength > 0) {
            $transaction->vendorFieldHex = $this->buffer->readHex($vendorFieldLength);
        }

        $assetOffset = (41 + 8 + 1) * 2 + $vendorFieldLength * 2;

        $transaction = $this->handleType($assetOffset, $transaction);

        if (! isset($transaction->amount)) {
            $transaction->amount = 0;
        }

        if (! isset($transaction->version) || 1 === $transaction->version) {
            $transaction = $this->handleVersionOne($transaction);
        }

        if (2 === $transaction->version) {
            $transaction = $this->handleVersionTwo($transaction);
        }

        return $transaction;
    }
public function deserialize(): Transaction
    {
        $transaction = new Transaction();
        $transaction->version = $this->buffer->readUInt8();
        $transaction->network = $this->buffer->readUInt8();
        $transaction->type = $this->buffer->readUInt8();
        $transaction->timestamp = $this->buffer->readUInt32();
        $transaction->senderPublicKey = $this->buffer->readHex(33);
        $transaction->fee = $this->buffer->readUInt64();

        $vendorFieldLength = $this->buffer->readUInt8();
        if ($vendorFieldLength > 0) {
            $transaction->vendorFieldHex = $this->buffer->readHex($vendorFieldLength);
        }

        $assetOffset = (41 + 8 + 1) * 2 + $vendorFieldLength * 2;

        $transaction = $this->handleType($assetOffset, $transaction);

        if (! isset($transaction->amount)) {
            $transaction->amount = 0;
        }

        if (! isset($transaction->version) || 1 === $transaction->version) {
            $transaction = $this->handleVersionOne($transaction);
        }

        if (2 === $transaction->version) {
            $transaction = $this->handleVersionTwo($transaction);
        }

        return $transaction;
    }
public function deserialize ( ) : Transaction { $ transaction = new Transaction ( ) ; $ transaction -> version = $ this -> buffer -> readUInt8 ( ) ; $ transaction -> network = $ this -> buffer -> readUInt8 ( ) ; $ transaction -> type = $ this -> buffer -> readUInt8 ( ) ; $ transaction -> timestamp = $ this -> buffer -> readUInt32 ( ) ; $ transaction -> senderPublicKey = $ this -> buffer -> readHex ( 33 ) ; $ transaction -> fee = $ this -> buffer -> readUInt64 ( ) ; $ vendorFieldLength = $ this -> buffer -> readUInt8 ( ) ; if ( $ vendorFieldLength > 0 ) { $ transaction -> vendorFieldHex = $ this -> buffer -> readHex ( $ vendorFieldLength ) ; } $ assetOffset = ( 41 + 8 + 1 ) * 2 + $ vendorFieldLength * 2 ; $ transaction = $ this -> handleType ( $ assetOffset , $ transaction ) ; if ( ! isset ( $ transaction -> amount ) ) { $ transaction -> amount = 0 ; } if ( ! isset ( $ transaction -> version ) || 1 === $ transaction -> version ) { $ transaction = $ this -> handleVersionOne ( $ transaction ) ; } if ( 2 === $ transaction -> version ) { $ transaction = $ this -> handleVersionTwo ( $ transaction ) ; } return $ transaction ; }
Perform AIP11 compliant deserialization.

@return \ArkEcosystem\Crypto\Transactions\Transaction
Perform AIP11 compliant deserialization .