Skip to main content

Function: isNoMarket()

gSwap SDK 2.0.0-rc.4


gSwap SDK 2.0.0-rc.4 / isNoMarket

Function: isNoMarket()

isNoMarket(error): boolean

Defined in: packages/gswap-sdk/dist/index.d.ts:4212

True when a failure means "there is no market to trade this pair": NO_POOL_AVAILABLE (no pool at any fee tier), INSUFFICIENT_LIQUIDITY (a pool too thin to quote), UNKNOWN_TOKEN (the DEX has no trading symbol for the token), or a READ that was answered 404 (a quote the backend cannot find, error.notFound). It replaces an app's own code === ... || code === ... || notFound list, so the empty-state ("No market for this pair") has one definition.

A write that was answered 404 (it carries a uniqueKey) is a missing route, not a missing market, and is not this. Accepts an SDK error or a plain-object view (FailureView); every other value is false.

Parameters​

error​

unknown

Returns​

boolean

Example​

if (isNoMarket(error)) showEmptyState(t('swap.noMarket')); else showError(error);