The explorer has four components broken down into their own respective directory
/db
/graphql
/indexer
/ui
The db is driven by the ent framework. It is an ORM where we generate our schemas as code and automatically create migrations and update our DB.
We have a graphql server that serves data from our db component. We use gqlgen to generate our graphql schema and resolvers.
The Indexer listens to events published by the xprovider subscription that we generate for each rollup.
The UI is a remix application using react, typescript and hosted on the remix app server. We use tailwind to drive all of our CSS as well.
In order to run the explorer locally you need a few things.
- A devnet running on your local machine
- Indexer
- DB
- GraphQL
- UI
You can run this all with the following command to build all the backend go binaries and run them. The components in the devnet include the omni network dev net, indexer, db and the graphql server.
You need to have docker installed and running to execute the following command:
You can either build all of the component with the following:
make buildthen run:
make run-devnetor run:
make run-cleanIf you want to stop the local devnet you can run:
make stopor from the omni root folder:
make devnet-cleanLocally visit: http://localhost:21335 for the GraphiQL interface
We currently have 3 chains in the devnet currently, those chainids are:
- 100
- 200
- 16561
So if you were to go and query an xblock, you would need to set one of those as the sourceChainID field.
ex:
query{
xblock(sourceChainID: 200, height: 35){
SourceChainID
BlockHeight
Messages{
StreamOffset
}
Receipts{
TxHash
}
}
}Currently we aren't deploying the UI (yet) as part of our devnet. You can run it from the explorer/ui folder with the following:
make run-explorerFor local development in the explorer/ui folder:
pnpm run dev