-
Notifications
You must be signed in to change notification settings - Fork 193
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(common): add indexer URL to chain configs #2771
Changes from 6 commits
d5f1b30
30add79
6d41bce
3bb7659
5ae4a48
af77bb8
f96091f
f00f16d
0859b84
3a8f580
f093554
0d975e7
8dbaa34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@latticexyz/common": patch | ||
--- | ||
|
||
Added an optional `indexerUrl` property to `MUDChain` which is used as the default indexer URL in `createStoreSync`. | ||
|
||
Also added indexer URL's to the Redstone and Garnet chain configs. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import type { Chain } from "viem/chains"; | ||
|
||
export type MUDChain = Chain & { | ||
indexerUrl?: string; | ||
faucetUrl?: string; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ import { bigIntMax, chunk, isDefined, waitForIdle } from "@latticexyz/common/uti | |
import { getSnapshot } from "./getSnapshot"; | ||
import { fetchAndStoreLogs } from "./fetchAndStoreLogs"; | ||
import { Store as StoreConfig } from "@latticexyz/store"; | ||
import { MUDChain } from "@latticexyz/common/chains"; | ||
|
||
const debug = parentDebug.extend("createStoreSync"); | ||
|
||
|
@@ -96,7 +97,7 @@ export async function createStoreSync<config extends StoreConfig = StoreConfig>( | |
filters, | ||
initialState, | ||
initialBlockLogs, | ||
indexerUrl, | ||
indexerUrl: indexerUrl ?? (publicClient.chain as MUDChain).indexerUrl, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to pass the chain more explicitly to avoid this cast? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, I don't want to have a potential deviation between publicClient's chain and a chain passed in this cast is fine but you could be super defensive with something like
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we prob also still want some way to turn off the indexer if needed maybe we also allow |
||
}); | ||
|
||
onProgress?.({ | ||
|
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.
can we add a changelog for store-sync that talks about
createStoreSync
defaulting tochain.indexerUrl
(orfalse
to intentionally unset/not default)and then this one can just focus on adding
indexerUrl
toMUDChain
and filling it in for redstone, garnet chains