public Optional<Long> getEstimateGas(final DataFetchingEnvironment environment) {
    // until the miner can expose the current "proposed block" we have no
    // speculative environment, so estimate against latest.
    final Optional<CallResult> result = getCall(environment);
    return result.map(CallResult::getGasUsed);
  }
Estimates the gas required for a transaction.

<p>This method calls the getCall method to simulate the transaction and then retrieves the gas
used by the transaction. The gas estimation is done against the latest block as there is
currently no way to expose the current "proposed block" for a speculative environment.

@param environment the data fetching environment.
@return an Optional containing the estimated gas for the transaction, or an empty Optional if
    the transaction simulation was not successful.
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/internal/pojoadapter/PendingStateAdapter.java