everest icon indicating copy to clipboard operation
everest copied to clipboard

Migrate Everest to use `graph-client` library

Open dotansimha opened this issue 3 years ago • 2 comments

We recently introduced https://github.com/graphprotocol/graph-client as a wrapper for making it easier to dapps to write JS/TS (browser/Node) apps.

This is an initial PR for using this client in Everest app, with minimal changes.

Changes includes:

  • Added graph-client and generated The Graph Client library (nothing too sophisticated at the moment, later we can leverage all the cool features there).
  • Moved GraphQL queries to be in .graphql files and updated the code accordingly (this way the graph client validates the operations at build time, and we get complete TypeScript support out of the box)
  • Adjust Gatsby configuration to support MJS and TS.
  • Replace cross-fetch with cross-undici-fetch for better native support (both Gatsby's Node env and browser env)

I recommend doing follow-up PRs later, to improve:

  • Migrate to TS (graph-client comes with a built-in support for TypedDocumentNode, so we can leverage type inference)
  • Upgrade Gatsby to latest (at the moment, I did some workarounds in Webpack config to make it work properly)
  • Upgrade Apollo-Client to v3 (graph-client comes with a built-in support for it)
  • Drop @graphprotocol/mutations and use built-in mutations support from graph-client
  • Upgrade to latest Node (16/17)

dotansimha avatar Mar 23 '22 11:03 dotansimha

Oops! We have a different version of this repo that's been migrated to Next. Hopefully will be easy to port over. Let's sync up offline

yanivtal avatar Mar 23 '22 22:03 yanivtal

Oops! We have a different version of this repo that's been migrated to Next. Hopefully will be easy to port over. Let's sync up offline

Sure no problem, it would be easier :)

dotansimha avatar Mar 24 '22 07:03 dotansimha