Skip to content

@gala-chain/chaincodeAPI


API > validateTokenOrder

Function: validateTokenOrder()

validateTokenOrder(token0, token1): string[]

Validates and normalizes the order of two tokens for pool creation.

Ensures that token0 is lexicographically smaller than token1 and that both tokens are different.

Parameters

token0: TokenClassKey

The first token's class key.

token1: TokenClassKey

The second token's class key.

Returns

A tuple containing the normalized token0 and token1 keys.

Throws

ValidationFailedError if tokens are the same or in the wrong order.

Source

chaincode/src/dex/dexUtils.ts:65