Skip to content

API ReferenceValidationFunction

dynamicLOCCollateralRules()

Call Signature

function dynamicLOCCollateralRules<P>(field): ValidationRule<P>[];

Creates validation rules for a dynamic LOC collateral field.

Sync: checks the collateral token address format and that the amount is positive. Async: checks that the token is enabled and that the vault plus wallet balances are sufficient.

Dynamic LOC creation reserves the requested collateral amount without the vault withdrawal fee, so its asynchronous sufficiency check uses the raw amount. modifyLOCCollateral sizes projected collateral through checkCreditedTokenValidity and does not call this factory.

Type Parameters

Type Parameter
P

Parameters

ParameterTypeDescription
fieldkeyof P & stringThe collateral TokenAmount field to validate.

Returns

ValidationRule<P>[]

Call Signature

function dynamicLOCCollateralRules<P, Field>(field, additionalSync): ValidationRule<P>[];

Creates validation rules for a dynamic LOC collateral field and appends a synchronous operation-specific check.

Type Parameters

Type ParameterDescription
P-
Field extends stringThe exact string key of P validated by this factory.

Parameters

ParameterTypeDescription
fieldFieldThe collateral TokenAmount field to validate.
additionalSync(values, ctx) => ValidationIssue[]A check whose values view exposes only the selected non-nullish field. When P is explicit, Field must also be explicit. Read the field directly; key enumeration always throws.

Returns

ValidationRule<P>[]