@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / react / useWatchPrice

Function: useWatchPrice()

useWatchPrice(asset): PriceFeedStatus

Defined in: packages/sdk/src/hooks.ts:761

Watch one asset's price feed (e.g. "BTC", "ETH") while mounted (ref-counted; shared with the price data hooks) and report its watch state.

Render off the returned state. "error" means the server rejected this asset's subscription: the price hooks keep returning their last values, which have stopped updating. See PriceFeedStatus.

Background acquisition failures use the configured debug/console warning channel. Use the corresponding useWatchMarketResult/useWatchUserResult/useWatchPriceResult hook for inline error UI.

Parameters

asset

string | undefined

Returns

PriceFeedStatus

Throws

No Markets provider is mounted.