public Optional<Bytes> getRevertReason(final DataFetchingEnvironment environment) {
    return getReceipt(environment)
        .map(TransactionReceiptWithMetadata::getReceipt)
        .flatMap(TransactionReceipt::getRevertReason);
  }
Retrieves the revert reason of the transaction, if any.

<p>This method uses the getReceipt method to get the receipt of the transaction. It then checks
the revert reason of the receipt. It would be an empty Optional for successful transactions.
Otherwise, it returns an Optional containing the revert reason.

@param environment the data fetching environment.
@return an Optional containing a Bytes object representing the revert reason of the
    transaction, or an empty Optional .
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/internal/pojoadapter/TransactionAdapter.java