Skip to main content

Function: validateNumericAmount()

gSwap SDK 2.0.0-rc.4


gSwap SDK 2.0.0-rc.4 / validateNumericAmount

Function: validateNumericAmount()

validateNumericAmount(amount, parameterName, allowZero?): void

Defined in: packages/gswap-sdk/dist/index.d.ts:4401

Validates a decimal amount: a string or BigNumber, never a JavaScript number.

Parameters​

amount​

NumericAmount

The amount to check.

parameterName​

string

The field name reported in the error's params.field.

allowZero?​

boolean

Accept zero (default false).

Returns​

void

Throws​

GSwapSDKError AMOUNT_IS_JS_NUMBER, AMOUNT_NOT_FINITE, AMOUNT_NOT_POSITIVE (zero when allowZero is false) or AMOUNT_NEGATIVE.