-
Notifications
You must be signed in to change notification settings - Fork 87
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 L1 indexer to fetch contract logs for the bridge #291
base: main
Are you sure you want to change the base?
Conversation
29ec81f
to
4713245
Compare
@@ -50,4 +50,4 @@ jobs: | |||
password: ${{ secrets.GITHUB_TOKEN }} | |||
image: ghcr.io/fuellabs/fuel-explorer | |||
dockerfile: deployment/Dockerfile.v2 | |||
context: ./packages/graphql-new | |||
context: . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not change the root dir here; this makes the image publish all the code from the repo instead of only the graphql package, drastically increasing the image size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luizstacio indeed :(
I'll need to figure out how to get rid of this – let me find a time to check that today.
I've added this because graphql-new
package has a peer dependency on the @fuel-explorer/contract-ids
.
(Outside that context
)
Does that make sense?
// Sync the logs | ||
try { | ||
await this.watchLogs(); | ||
} catch (e) { | ||
console.error(e); | ||
throw new Error('Failed to watch logs'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How watchLogs work? If the socket is closed as example by the server it autoReconnects?
Add L1 indexer, it'll sync contract events logs from a given start block number.
After that, it'll keep watching the blockchain for new logs and blocks.
New env vars have been added to the graphql:
FUEL_CHAIN_NAME
(examplefuelBeta5
)ETH_CHAIN_NAME
(examplesepolia
)ETH_ALCHEMY_ID
(your alchemy key)ETH_INFURA_ID
(your infura key – used as fallback to alchemy)ETH_INITIAL_BLOCK
(block number that got our contracts)📷 Indexer demo
pnpm sync:bridge
Screen.Recording.2024-04-04.at.18.04.24.mov
💾 API demo