Skip to content

Commit a1750eb

Browse files
committed
Simplify block wait
1 parent 1ac6a08 commit a1750eb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/waitForInitialBlocks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { assertEx } from '@xylabs/assert'
22
import { delay } from '@xylabs/delay'
3+
import { isDefined } from '@xylabs/typeof'
34
import { HttpRpcXyoConnection } from '@xyo-network/xl1-rpc'
45

56
export const waitForInitialBlocks = async (maxAttempts = 10): Promise<void> => {
@@ -12,7 +13,7 @@ export const waitForInitialBlocks = async (maxAttempts = 10): Promise<void> => {
1213
attempts++
1314
try {
1415
const [block] = (await viewer.currentBlock()) ?? []
15-
if (block?.block > 0) {
16+
if (isDefined(block?.block)) {
1617
return // Success
1718
}
1819
} catch {}

0 commit comments

Comments
 (0)