Skip to content

@swapped/connect-sdk / react / UseExchangePayAmountResult

Type Alias: UseExchangePayAmountResult ​

UseExchangePayAmountResult = object

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:38

Result of useExchangePayAmount.

Properties ​

amount ​

amount: string

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:40

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


amountFloat ​

amountFloat: number | null

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:49

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


error ​

error: AmountValidationError | null

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:81

Structured validation error after touch, or null when valid / not yet touched. Switch on error.code for i18n; use error.message for the English default.


formattedMaxAmount ​

formattedMaxAmount: string | null

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:66

Display-ready maximum, or null when no max is set. Prefer over formatting maxAmountFiat yourself.


formattedMinAmount ​

formattedMinAmount: string | null

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:61

Display-ready minimum (thousands separators), or null when unavailable. Prefer over formatting minAmountFiat yourself.


isLoading ​

isLoading: boolean

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:85

Whether supported currencies are still loading (min amount may be unavailable).


isValid ​

isValid: boolean

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:83

Whether the amount satisfies the minimum and optional maximum.


maxAmountFiat ​

maxAmountFiat: number | null

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:56

Maximum fiat amount (currently USD) for the selected currency, optionally tightened by hook options. null when no currency is selected.


minAmountFiat ​

minAmountFiat: number | null

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:51

Minimum fiat amount (currently USD) for the selected currency, or null when none is selected.


onBlur ​

onBlur: () => void

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:72

Blur handler (optional delay via the shared amount input).

Returns ​

void


resetTouched ​

resetTouched: () => void

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:74

Clear touched and cancel any pending blur timer.

Returns ​

void


setAmount ​

setAmount: (value) => void

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:47

Update the amount. Sanitizes to digits and at most DEFAULT_FIAT_DECIMALS places. Optionally clamps to max when UseExchangePayAmountOptions.clampToMax is enabled.

Parameters ​

value ​

string

Returns ​

void


setToMin ​

setToMin: () => void

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.ts:76

Set the amount to the currency minimum when available.

Returns ​

void


setTouched ​

setTouched: (touched) => void

Defined in: src/react/exchange-pay/hooks/useExchangePayAmount.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/exchange-pay/hooks/useExchangePayAmount.ts:68

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