public static RawPrivateTransaction decode(final String hexTransaction) {
        final byte[] transaction = Numeric.hexStringToByteArray(hexTransaction);
        final TransactionType transactionType = getPrivateTransactionType(transaction);

        if (transactionType == TransactionType.EIP1559) {
            return decodePrivateTransaction1559(transaction);
        }
        return decodeLegacyPrivateTransaction(transaction);
    }
@Test
    public void testDecoding1559() {
        final BigInteger nonce = BigInteger.ZERO;
        final long chainId = 2018;
        final BigInteger gasLimit = BigInteger.TEN;
        final BigInteger maxPriorityFeePerGas = BigInteger.ONE;
        final BigInteger maxFeePerGas = BigInteger.ONE;
        final String to = "0x0add5355";

        final PrivateTransaction1559 privateTx =
                PrivateTransaction1559.createTransaction(
                        chainId,
                        nonce,
                        gasLimit,
                        to,
                        "",
                        maxPriorityFeePerGas,
                        maxFeePerGas,
                        MOCK_ENCLAVE_KEY,
                        MOCK_PRIVATE_FOR,
                        RESTRICTED);

        byte[] encodedMessage =
                PrivateTransactionEncoder.encode(new RawPrivateTransaction(privateTx));
        final String hexMessage = Numeric.toHexString(encodedMessage);

        final PrivateTransaction1559 result =
                (PrivateTransaction1559)
                        PrivateTransactionDecoder.decode(hexMessage).getPrivateTransaction();
        assertNotNull(result);
        assertEquals(nonce, result.getNonce());
        assertEquals(chainId, result.getChainId());
        assertEquals(maxPriorityFeePerGas, result.getMaxPriorityFeePerGas());
        assertEquals(maxFeePerGas, result.getMaxFeePerGas());
        assertEquals(gasLimit, result.getGasLimit());
        assertEquals(to, result.getTo());
        assertEquals("0x", result.getData());
        assertEquals(MOCK_ENCLAVE_KEY, result.getPrivateFrom());
        assertEquals(MOCK_PRIVATE_FOR, result.getPrivateFor().get());
        assertEquals(RESTRICTED, result.getRestriction());
    }