Skip to main content

Function: toEvmSide()

function toEvmSide(side): OptionSide;

Defined in: evm-client/src/utils.ts:212

A decoded uint8 narrowed to the contract's OptionSide.

The generated struct types expose each enum's value union, while the ABI only records uint8 — so viem decodes a plain number and something has to narrow it. That gap is deliberate on the generator's side (see the note in evm-contracts' scripts/generate-types.ts: only the narrowing direction is asserted), which makes this the intended shape of the boundary rather than a workaround. Doing it here means an out-of-range discriminant fails loudly at the decode, not silently later in a hash preimage.

Parameters​

ParameterType
sidenumber

Returns​

OptionSide