Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add explorer graphql #27

Merged
merged 2 commits into from
Aug 9, 2023
Merged

feat: add explorer graphql #27

merged 2 commits into from
Aug 9, 2023

Conversation

luizstacio
Copy link
Member

@luizstacio luizstacio commented Aug 5, 2023

This PR creates a GraphQL API that returns the data from fuel-core and extends it with metadata. This approach will be a base for the feature work when we include more metadata like ABIs and code parsing.

This is a different approach from the Federation. The problem with the federation is that it incentives a chain of queries.

Ex.: If we want to know the tokens and accounts from related data from a transaction list, the interface would be required to;

  1. Execute a request to load the transactions
  2. Create logic to get assetIds and Accounts it wants to have the metadata
  3. Execute another request to load the accounts and tokens metadata

With the approach from Schema Stitching, we can chain this data directly on the server, offloading the logic from the client side (interface) and returning all the data the interface needs in a single request if the data is requested.
Ex.: If the interface wants to know the metadata of the tokens and account, it will inform on the query, and we will return it on a single query.

On this PR;

  • Create a Graphql API that extends fuel-core
  • Add metadata loaders for accounts and tokens

@LuizAsFight
Copy link
Contributor

@luizstacio I was reading and looks like Apollo Federation is a good option for combining graphql schemas, but it's a more advanced approach that creates a unified schema by defining relationships between different services and allowing queries across these services.

maybe something we can explore in the future

Copy link
Contributor

@LuizAsFight LuizAsFight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting approach, I tested and it's working for both data from node and extended mocked data

@luizstacio
Copy link
Member Author

luizstacio commented Aug 9, 2023

@luizstacio I was reading and looks like Apollo Federation is a good option for combining graphql schemas, but it's a more advanced approach that creates a unified schema by defining relationships between different services and allowing queries across these services.

maybe something we can explore in the future

The federation works in a different way from the stitching, because of interdependencies like the one in the description.

@luizstacio luizstacio merged commit 7818809 into main Aug 9, 2023
@luizstacio luizstacio deleted the ls/mock-graphql branch August 9, 2023 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants