Skip to content

@swapped/connect-sdk / react / UseAmountInputResult

Type Alias: UseAmountInputResult

UseAmountInputResult = object

Defined in: src/react/amount-input/useAmountInput.ts:52

Result of useAmountInput.

Properties

amount

amount: string

Defined in: src/react/amount-input/useAmountInput.ts:54

Controlled amount string for the input (value={amount}).


amountFloat

amountFloat: number | null

Defined in: src/react/amount-input/useAmountInput.ts:66

Numeric representation of amount, or null when empty or invalid.


error

error: AmountValidationError | null

Defined in: src/react/amount-input/useAmountInput.ts:80

Blocking validation error after touch, or null when valid / not yet touched.


isValid

isValid: boolean

Defined in: src/react/amount-input/useAmountInput.ts:90

Whether the amount has no blocking failure (ignores touched). Soft above_spendable in 'balance' mode does not invalidate.


onBlur

onBlur: () => void

Defined in: src/react/amount-input/useAmountInput.ts:72

Blur handler that marks touched after UseAmountInputOptions.touchedDelay.

Returns

void


requiresAdjustment

requiresAdjustment: boolean

Defined in: src/react/amount-input/useAmountInput.ts:95

Whether the amount is above the spendable ceiling and will be auto-adjusted on submit.


reset

reset: () => void

Defined in: src/react/amount-input/useAmountInput.ts:76

Clear amount and touched state.

Returns

void


resetTouched

resetTouched: () => void

Defined in: src/react/amount-input/useAmountInput.ts:74

Clear touched and cancel any pending blur timer.

Returns

void


setAmount

setAmount: (value) => void

Defined in: src/react/amount-input/useAmountInput.ts:56

Update the amount. Sanitizes via sanitizeAmountInput.

Parameters

value

string

Returns

void


setAmountExact

setAmountExact: (value, options?) => void

Defined in: src/react/amount-input/useAmountInput.ts:61

Set a pre-computed amount (Max button, clamping, setToMin). Still runs through the sanitizer. Optionally marks the field touched.

Parameters

value

string

options?
touch?

boolean

Returns

void


setToMin

setToMin: () => void

Defined in: src/react/amount-input/useAmountInput.ts:78

Set the amount to UseAmountInputOptions.minAmount when available.

Returns

void


setTouched

setTouched: (touched) => void

Defined in: src/react/amount-input/useAmountInput.ts:70

Mark the field as touched — call on blur or before submit.

Parameters

touched

boolean

Returns

void


touched

touched: boolean

Defined in: src/react/amount-input/useAmountInput.ts:68

Whether the field has been blurred or submitted (gates showing error).


warning

warning: AmountValidationError | null

Defined in: src/react/amount-input/useAmountInput.ts:85

Non-blocking soft-ceiling warning after touch (above_spendable in 'balance' mode), or null.