Function: chainErrorKeyOf
chainErrorKeyOf(
error):string|undefined
The chain's own machine-readable ErrorKey of a failure ('TOKEN_NOT_FOUND',
'NOT_ENOUGH_LIQUIDITY', ...), for an app that maps a chain refusal to its own copy: the
params.errorKey of a CHAIN_REJECTED (an apply result, or a body that carries the chain's
error) and of a CHAIN_DISPATCH_FAILED (the gateway adds the chain's key to the body it
answered). undefined when the failure is neither, or when it carries no key (the gateway sent
none: the SDK writes '', which is not a key). Map the KEY, never the message text.
Accepts an SDK error or a plain-object view (FailureView: code and params); every
other value is undefined. Other codes are undefined even when they have an errorKey-named
param, so a stray field cannot pass for a chain verdict.
error key token not found enough liquidity chain rejected dispatch failed
Parameters
| Parameter | Type |
|---|---|
error | unknown |
Returns
string | undefined
Example
const key = chainErrorKeyOf(error);
if (key === 'NOT_ENOUGH_LIQUIDITY') showTooThin(); else showGeneric(error);