public static byte[] signMessage(RawTransaction rawTransaction, Credentials credentials) {
        byte[] encodedTransaction;
        if (rawTransaction.getTransaction().getType().isEip4844()) {
            encodedTransaction = encode4844(rawTransaction);
        } else {
            encodedTransaction = encode(rawTransaction);
        }
        Sign.SignatureData signatureData =
                Sign.signMessage(encodedTransaction, credentials.getEcKeyPair());

        return encode(rawTransaction, signatureData);
    }
@Test
    public void testEip1559Transaction() {
        assertArrayEquals(
                TransactionEncoder.signMessage(
                        createEip1559RawTransaction(), SampleKeys.CREDENTIALS_ETH_EXAMPLE),
                (Numeric.hexStringToByteArray(
                        "02f8698206178082162e8310c8e082753094627306090abab3a6e1400e9345bc60c78a8bef577b80c001a0d1f9ee3bdde4d4e0792c7089b84059fb28e17f494556d8a775450b1dd6c318a1a038bd3e2fb9e018528e0a41f57c7a32a8d23b2693e0451aa6ef4519b234466e7f")));

        assertArrayEquals(
                TransactionEncoder.signMessage(
                        createEip1559RawTransaction(), 1559L, SampleKeys.CREDENTIALS_ETH_EXAMPLE),
                (Numeric.hexStringToByteArray(
                        "02f8698206178082162e8310c8e082753094627306090abab3a6e1400e9345bc60c78a8bef577b80c001a0d1f9ee3bdde4d4e0792c7089b84059fb28e17f494556d8a775450b1dd6c318a1a038bd3e2fb9e018528e0a41f57c7a32a8d23b2693e0451aa6ef4519b234466e7f")));
    }