public Bytes getCode(final DataFetchingEnvironment environment) {

    if (account.get() instanceof BonsaiAccount) {
      final BlockchainQueries query = getBlockchainQueries(environment);
      return query
          .getAndMapWorldState(
              blockNumber.orElse(query.headBlockNumber()),
              ws -> Optional.of(ws.get(account.get().getAddress()).getCode()))
          .get();
    } else {
      return account.map(AccountState::getCode).orElse(Bytes.EMPTY);
    }
  }
Returns the code of the account.

@param environment the DataFetchingEnvironment
@return the code of the account
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/internal/pojoadapter/AccountAdapter.java