Skip to main content

Function: assertCanonicalPair

assertCanonicalPair(token0, token1): void

Asserts that a pair is in the contract's canonical order (token0 < token1 by plain string comparison), which every write DTO requires. A pair a caller took from a stale quote or position can be reversed; signing it would sign something other than what was priced.

Parameters​

ParameterType
token0string
token1string

Returns​

void

Throws​

GSwapSDKError NON_CANONICAL_PAIR (params.token0, params.token1) otherwise.