Skip to content

@swapped/connect-sdk / react / UseDualAmountInputResult

Type Alias: UseDualAmountInputResult

UseDualAmountInputResult = object

Defined in: src/react/amount-input/useDualAmountInput.ts:77

Result of useDualAmountInput.

Properties

amount

amount: string

Defined in: src/react/amount-input/useDualAmountInput.ts:79

Full-precision crypto amount (canonical; safe to submit).


amountDisplay

amountDisplay: string

Defined in: src/react/amount-input/useDualAmountInput.ts:84

Crypto string for binding to an input. Echoes typed text while editing crypto; display-formatted when derived from fiat.


amountFiat

amountFiat: string

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

Fiat amount string (see UseDualAmountInputOptions.maxFiatDecimals).


amountFiatFloat

amountFiatFloat: number | null

Defined in: src/react/amount-input/useDualAmountInput.ts:99

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


amountFloat

amountFloat: number | null

Defined in: src/react/amount-input/useDualAmountInput.ts:93

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


error

error: AmountValidationError | null

Defined in: src/react/amount-input/useDualAmountInput.ts:111

Blocking crypto-side validation error after touch, or null.


exchangeRate

exchangeRate: number | null

Defined in: src/react/amount-input/useDualAmountInput.ts:128

Current exchange rate, or null.


isFiatAvailable

isFiatAvailable: boolean

Defined in: src/react/amount-input/useDualAmountInput.ts:130

Whether a usable exchange rate is available for fiat conversion.


isValid

isValid: boolean

Defined in: src/react/amount-input/useDualAmountInput.ts:121

Whether the crypto 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/useDualAmountInput.ts:105

Blur handler that marks touched after UseDualAmountInputOptions.touchedDelay.

Returns

void


requiresAdjustment

requiresAdjustment: boolean

Defined in: src/react/amount-input/useDualAmountInput.ts:126

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


reset

reset: () => void

Defined in: src/react/amount-input/useDualAmountInput.ts:109

Clear both amounts and touched state.

Returns

void


resetTouched

resetTouched: () => void

Defined in: src/react/amount-input/useDualAmountInput.ts:107

Clear touched and cancel any pending blur timer.

Returns

void


setAmount

setAmount: (value) => void

Defined in: src/react/amount-input/useDualAmountInput.ts:86

Update the crypto amount and recompute fiat.

Parameters

value

string

Returns

void


setAmountExact

setAmountExact: (value, options?) => void

Defined in: src/react/amount-input/useDualAmountInput.ts:91

Set a pre-computed crypto amount (Max button). Bypasses the typing sanitizer so full precision is preserved.

Parameters

value

string

options?
touch?

boolean

Returns

void


setAmountFiat

setAmountFiat: (value) => void

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

Update the fiat amount and recompute crypto. No-op when fiat is unavailable.

Parameters

value

string

Returns

void


setTouched

setTouched: (touched) => void

Defined in: src/react/amount-input/useDualAmountInput.ts:103

Mark the field as touched.

Parameters

touched

boolean

Returns

void


touched

touched: boolean

Defined in: src/react/amount-input/useDualAmountInput.ts:101

Whether the field has been blurred or submitted.


warning

warning: AmountValidationError | null

Defined in: src/react/amount-input/useDualAmountInput.ts:116

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