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 testDecoding() {
        final BigInteger nonce = BigInteger.ZERO;
        final BigInteger gasPrice = BigInteger.ONE;
        final BigInteger gasLimit = BigInteger.TEN;
        final String to = "0x0add5355";
        final RawPrivateTransaction rawTransaction =
                RawPrivateTransaction.createTransaction(
                        nonce,
                        gasPrice,
                        gasLimit,
                        to,
                        "",
                        MOCK_ENCLAVE_KEY,
                        MOCK_PRIVATE_FOR,
                        null,
                        RESTRICTED);
        byte[] encodedMessage = PrivateTransactionEncoder.encode(rawTransaction);
        final String hexMessage = Numeric.toHexString(encodedMessage);

        final RawPrivateTransaction result = PrivateTransactionDecoder.decode(hexMessage);
        assertNotNull(result);
        assertEquals(nonce, result.getNonce());
        assertEquals(gasPrice, result.getGasPrice());
        assertEquals(gasLimit, result.getGasLimit());
        assertEquals(to, result.getTo());
        assertEquals("", result.getData());
        assertEquals(MOCK_ENCLAVE_KEY, result.getPrivateFrom());
        assertEquals(MOCK_PRIVATE_FOR, result.getPrivateFor().get());
        assertEquals(RESTRICTED, result.getRestriction());
    }