We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ac6a08 commit a1750ebCopy full SHA for a1750eb
1 file changed
src/waitForInitialBlocks.ts
@@ -1,5 +1,6 @@
1
import { assertEx } from '@xylabs/assert'
2
import { delay } from '@xylabs/delay'
3
+import { isDefined } from '@xylabs/typeof'
4
import { HttpRpcXyoConnection } from '@xyo-network/xl1-rpc'
5
6
export const waitForInitialBlocks = async (maxAttempts = 10): Promise<void> => {
@@ -12,7 +13,7 @@ export const waitForInitialBlocks = async (maxAttempts = 10): Promise<void> => {
12
13
attempts++
14
try {
15
const [block] = (await viewer.currentBlock()) ?? []
- if (block?.block > 0) {
16
+ if (isDefined(block?.block)) {
17
return // Success
18
}
19
} catch {}
0 commit comments