Skip to content

API ReferenceValidationFunction

staticLOCCollateralRules()

Call Signature

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

Creates validation rules for a static 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.

Static LOC creation reserves the requested amount plus the vault withdrawal fee, so its asynchronous sufficiency check always includes that fee. 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 staticLOCCollateralRules<P, Field>(field, additionalSync): ValidationRule<P>[];

Creates validation rules for a static 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>[]