Skip to content
LogoLogo

waitForIndexer

Block until ocean-node's indexer has an asset, or has a specific update to it.

Useful directly after publishing: the metadata transaction confirms on chain before the indexer has processed it, so an immediate getAsset can still miss.

Usage

const  = await .('did:ope:2a6ebce0af...') 

To wait for a particular update rather than merely for the asset to exist, pass the transaction hash. This matters when editing, where the asset already exists and you need the indexer to have picked up your change specifically:

const { ,  } = await .(
  new ().('Renamed').()
)
 
const  = await .( 
  . as string, 
  . 
) 

publish() and edit() can do this for you — pass { waitForIndexer: true }.

Returns

  • Type: AssetV5 | undefined

The indexed asset, or undefined if it did not appear before the retry limit. It returns rather than throws, so you can decide whether a timeout is fatal.

Parameters

did

  • Type: string

txid (optional)

  • Type: string

Wait for the update carried by this transaction, not just for the asset to exist.