@somnia-chain/markets-sdk


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

Function: isUnauthorized()

isUnauthorized(error): boolean

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

True when an error means "that method is operator-only on this node" — the { code: -1, message: "unauthorized" } a public endpoint returns for the protected methods.

Matches on the message, not the code, and that is deliberate: -1 is the node's default error code, shared by at least invalid range, could not load statistics and Block does not exist (all confirmed live). Keying on the code would report a bad block range as an authorization failure.

Details

  • error: Whatever was thrown.

Parameters

error

unknown

Returns

boolean