Skip to main content
Version: 1.15.0

Function: resolveEncoder()

resolveEncoder<F>(encoders: Partial<Record<TokenPoolVersion, F | null>>, version: TokenPoolVersion, op: string): F

Defined in: cct/evm/token-pool/contracts.ts:901

Returns the encoder registered at the greatest version less than or equal to version, walking TokenPoolVersion downwards from version.

A table entry says one of two things:

  • absent key — the calldata did not change here, so it inherits the closest lower entry. One entry per calldata change therefore covers every higher version.
  • explicit null — the function was removed at this version, so the op is reported unsupported rather than emitting calldata for a selector the pool does not implement.

Type Parameters​

Type Parameter
F

Parameters​

ParameterTypeDescription
encodersPartial<Record<TokenPoolVersion, F | null>>Sparse table keyed by TokenPoolVersion; null marks a removal ceiling.
versionTokenPoolVersionThe resolved on-chain pool version to encode for.
opstringOperation name, for the error.

Returns​

F

Throws​

CCTOperationUnsupportedError if nothing is registered at or below version, or if the walk hits an explicit null ceiling first