Skip to content

@swapped/connect-sdk / react / UseAmountInputResult

Type Alias: UseAmountInputResult ​

UseAmountInputResult = object

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

Result of useAmountInput.

Properties ​

amount ​

amount: string

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

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


amountFloat ​

amountFloat: number | null

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

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


error ​

error: AmountValidationError | null

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

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


isValid ​

isValid: boolean

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

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:74

Blur handler that marks touched after UseAmountInputOptions.touchedDelay.

Returns ​

void


requiresAdjustment ​

requiresAdjustment: boolean

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

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:78

Clear amount and touched state.

Returns ​

void


resetTouched ​

resetTouched: () => void

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

Clear touched and cancel any pending blur timer.

Returns ​

void


setAmount ​

setAmount: (value) => void

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

Update the amount. Sanitizes via sanitizeAmountInput.

Parameters ​

value ​

string

Returns ​

void


setAmountExact ​

setAmountExact: (value, options?) => void

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

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:80

Set the amount to UseAmountInputOptions.minAmount when available.

Returns ​

void


setTouched ​

setTouched: (touched) => void

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

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:70

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


warning ​

warning: AmountValidationError | null

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

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