Skip to content

@swapped/connect-sdk / react / UseDualAmountInputResult

Type Alias: UseDualAmountInputResult

UseDualAmountInputResult = object

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

Result of useDualAmountInput.

Properties

amount

amount: string

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

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


amountDisplay

amountDisplay: string

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

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

Fiat amount string (2 dp).


amountFiatFloat

amountFiatFloat: number | null

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

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


amountFloat

amountFloat: number | null

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

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


error

error: AmountValidationError | null

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

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


exchangeRate

exchangeRate: number | null

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

Current exchange rate, or null.


isFiatAvailable

isFiatAvailable: boolean

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

Whether a usable exchange rate is available for fiat conversion.


isValid

isValid: boolean

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

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

Blur handler that marks touched after UseDualAmountInputOptions.touchedDelay.

Returns

void


requiresAdjustment

requiresAdjustment: boolean

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

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

Clear both amounts and touched state.

Returns

void


resetTouched

resetTouched: () => void

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

Clear touched and cancel any pending blur timer.

Returns

void


setAmount

setAmount: (value) => void

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

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

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

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

Mark the field as touched.

Parameters

touched

boolean

Returns

void


touched

touched: boolean

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

Whether the field has been blurred or submitted.


warning

warning: AmountValidationError | null

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

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