Skip to main content

Function: isUniqueKeyConsumed()

gSwap SDK 2.0.0-rc.4


gSwap SDK 2.0.0-rc.4 / isUniqueKeyConsumed

Function: isUniqueKeyConsumed()

isUniqueKeyConsumed(error): boolean

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

True when the gateway answered that the write's uniqueKey was ALREADY CONSUMED: a CHAIN_DISPATCH_FAILED with HTTP status 409. The first attempt under that key may be applied (classifyFailure says unknown), so the app confirms the key it holds instead of submitting again or showing the server's text. It replaces error.code === 'CHAIN_DISPATCH_FAILED' && error.status === 409 and the regex on "already saved". Accepts an SDK error or a plain-object view (FailureView: code and status); every other value is false.

Parameters​

error​

unknown

Returns​

boolean

Example​

if (isUniqueKeyConsumed(error)) return confirmAndShowResult(error.uniqueKey);