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

Help fuel-indexer fetch transactions efficiently #1174

Closed
ra0x3 opened this issue May 4, 2023 · 3 comments
Closed

Help fuel-indexer fetch transactions efficiently #1174

ra0x3 opened this issue May 4, 2023 · 3 comments

Comments

@ra0x3
Copy link

ra0x3 commented May 4, 2023

  • Currently on the fuel-indexer, when fetching transactions for a block, we're grabbing the transaction fragments, and then making requests to fuel-core via the GQL client, for each transaction fragment
    • Meaning, we're making a GraphQL request for each transaction (not very efficient)
  • It would be great if, for a given block, we could either fetch the transactions in bulk OR, if we could have the transactions included in the block itself
  • We tried some previous work with this in Allow for GraphQL batch requests in fuel-client #764
    • This issue also references the original issue in fuel-indexer
  • @xgreenx, @Voxelot mentions I should reach out to you personally about this :)
  • Happy to provide any other details
@xgreenx
Copy link
Collaborator

xgreenx commented May 4, 2023

You should already be able to fetch blocks with all transactions and any additional data via GraphQL.
image

On the rust side, you can reuse types from fuel-core-client and compose them into the type that should fetch all data in one run. For example, you can define FullBlock type that fetches Transaction instead of TransactionIdFragment, which should return the full block for you. if you need some additional data from transactions, you can define your own Mytransaction that returns limited/extended fields.

image

@xgreenx
Copy link
Collaborator

xgreenx commented May 4, 2023

Hmm, the FuelClient::query function is private but with #1175 you can write your own queries=)

xgreenx added a commit that referenced this issue May 9, 2023
Makes the `FuelClient::query` public to allow custom queries. Added an
example of how to write custom queries for
#1174 but it requires access
to the `schema.sdl`
@xgreenx
Copy link
Collaborator

xgreenx commented Jul 12, 2023

Solved on the indexer side FuelLabs/fuel-indexer#288

@xgreenx xgreenx closed this as completed Jul 12, 2023
goldenpath1109 added a commit to goldenpath1109/fuel-core that referenced this issue Sep 7, 2024
Makes the `FuelClient::query` public to allow custom queries. Added an
example of how to write custom queries for
FuelLabs/fuel-core#1174 but it requires access
to the `schema.sdl`
crypto523 added a commit to crypto523/fuel-core that referenced this issue Oct 7, 2024
Makes the `FuelClient::query` public to allow custom queries. Added an
example of how to write custom queries for
FuelLabs/fuel-core#1174 but it requires access
to the `schema.sdl`
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

No branches or pull requests

2 participants