@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / native / isMethodNotFound

Function: isMethodNotFound()

isMethodNotFound(error): boolean

Defined in: packages/sdk/src/native/client.ts:362

True when an error means "this node doesn't have that method".

These endpoints are node-version dependent, and a stock geth/anvil has none of them — so a UI that offers native features should degrade rather than break. Mirrors the same check the SDK's write path uses for realtime_sendRawTransaction.

Details

  • error: Whatever was thrown.

Example (Handling an unsupported method)

ts
import { createNative, isMethodNotFound } from "@somnia-chain/markets-sdk/native";

const stats = await native.getStatistics("earliest", "latest").catch((e) => {
  if (isMethodNotFound(e)) return null; // not a Somnia node — hide the panel
  throw e;
});

Parameters

error

unknown

Returns

boolean