fees
This module exposes shared fee configuration constants and residual gas helpers used by order and Express Trading flows.
Constants
Residual gas defaults
These constants define the default USD bounds the SDK keeps available for future network fees after a max-value action.
DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER—20DEFAULT_MIN_RESIDUAL_GAS_USD—20USD with 30-decimal precisionDEFAULT_MAX_RESIDUAL_GAS_USD—40USD with 30-decimal precisionRESIDUAL_GAS_AMOUNT_MULTIPLIER—20n
Functions
getResidualGasUsd
getResidualGasUsd(chainId: ContractsChainId): { min: bigint; max: bigint }
Returns the residual gas balance bounds for a contracts chain. Most chains use the default 20 to 40 USD range. MegaETH uses a smaller 1 to 2 USD range because its execution fees are sub-cent and the global default would lock much more balance than needed.
import { MEGAETH } from "@gmx-io/sdk/configs/chains";
import { getResidualGasUsd } from "@gmx-io/sdk/configs/fees";
const residualGas = getResidualGasUsd(MEGAETH);
console.log(residualGas.min); // 1 USD with 30-decimal precision
console.log(residualGas.max); // 2 USD with 30-decimal precision