Skip to main content

Function: readShadowSubmitOutcome

Call Signature​

readShadowSubmitOutcome(method, signedBody, result): ShadowSubmitOutcome

Normalizes a shadow write's raw answer. For 'RequestTrade' the result is a ShadowSubmitOutcome, whose success always has queued; any other method may also be a ShadowSyncSuccess (no queued).

A 2xx envelope with error === false is a success when it is a queued RequestTrade that acknowledges the EXACT signed uniqueKey, or a synchronous (mode: 'sync') liquidity write. Everything else is classified as a failure from the status and the body's code.

Parameters​

ParameterType
method"RequestTrade"
signedBodyRecord<string, unknown>
resultShadowSubmitResult

Returns​

ShadowSubmitOutcome

Throws​

GSwapSDKError SHADOW_NOT_QUEUED when a RequestTrade success does not queue the signed uniqueKey (a synchronous or mismatched answer must never be accepted as a swap).

Call Signature​

readShadowSubmitOutcome(method, signedBody, result): ShadowSubmitOutcome | ShadowSyncSuccess

Normalizes a shadow write's raw answer. For 'RequestTrade' the result is a ShadowSubmitOutcome, whose success always has queued; any other method may also be a ShadowSyncSuccess (no queued).

A 2xx envelope with error === false is a success when it is a queued RequestTrade that acknowledges the EXACT signed uniqueKey, or a synchronous (mode: 'sync') liquidity write. Everything else is classified as a failure from the status and the body's code.

Parameters​

ParameterType
methodstring
signedBodyRecord<string, unknown>
resultShadowSubmitResult

Returns​

ShadowSubmitOutcome | ShadowSyncSuccess

Throws​

GSwapSDKError SHADOW_NOT_QUEUED when a RequestTrade success does not queue the signed uniqueKey (a synchronous or mismatched answer must never be accepted as a swap).