Arcium LogoArcium TS SDK Docs

createPacker

createPacker<TInput, TOutput, TFields>(fields, typeName): Packer<TInput, TOutput>

Creates a type-safe packer from field definitions. Use as const on the fields array for compile-time field name validation.

Type Parameters

Type ParameterDefault type
TInput extends Record<string, unknown>-
TOutput extends Record<string, unknown>-
TFields extends readonly FieldInfo[]readonly FieldInfo[]

Parameters

ParameterTypeDefault valueDescription
fieldsTFields & ValidateFieldNames<TInput, TFields>undefinedField definitions from generated code.
typeNamestring'Packer'Type name for debugging.

Returns

Packer<TInput, TOutput>