Skip to content

@swapped/connect-sdk / react / UseExchangePayAmountResult

Type Alias: UseExchangePayAmountResult

UseExchangePayAmountResult = object

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

Result of useExchangePayAmount.

Properties

amount

amount: string

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

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


amountFloat

amountFloat: number | null

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

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


error

error: AmountValidationError | null

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

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

Display-ready maximum from hook options, 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:53

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

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


isValid

isValid: boolean

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

Whether the amount satisfies the minimum and optional maximum.


maxAmountFiat

maxAmountFiat: number | null

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

Optional maximum fiat amount (currently USD) from hook options, or null when unset. Exchange Pay has no API-defined maximum.


minAmountFiat

minAmountFiat: number | null

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

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

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

Returns

void


resetTouched

resetTouched: () => void

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

Clear touched and cancel any pending blur timer.

Returns

void


setAmount

setAmount: (value) => void

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

Update the amount. Sanitizes to digits and at most two decimals. 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:68

Set the amount to the currency minimum when available.

Returns

void


setTouched

setTouched: (touched) => void

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

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

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