Class: DexFees
gSwap SDK 2.0.0-rc.4 / DexFees
Class: DexFees
Defined in: packages/gswap-sdk/dist/index.d.ts:1244
Network-fee quote for GalaChain DEX methods, derived from a server-side DryRun.
The client only SIGNS the DryRun wrapper (with whatever GalaChainSigner it is given) and the backend forwards it to the gateway, where the simulated writes carry the fee; the backend never holds a key. Intended for wallets: the DTO quoted is the typed message a dApp handed over.
Example
const fees = new DexFees({ dexBackendBaseUrl }, new PrivateKeySigner(sessionKey));
const quote = await fees.quote(publicKey, 'RequestTrade', toChainDto(message), {
contract: 'dex-contract',
});
const feeInGala = quote?.fees[0]?.feeInGala;
Constructors
Constructor
new DexFees(
client,signer):DexFees
Defined in: packages/gswap-sdk/dist/index.d.ts:1250
Parameters
client
signer
GalaChainSigner | undefined
Returns
DexFees
Methods
quote()
quote(
callerPublicKey,method,message,options?):Promise<DexFeeQuote|null>
Defined in: packages/gswap-sdk/dist/index.d.ts:1266
Quotes the network fee for method applied to message. The message is reduced with
toChainDto first, so an EIP-712 approval message can be passed as is.
Resolves null when the BACKEND could not be reached or answered unusably (offline, 4xx/5xx,
malformed body): a transport outcome, not a fee. Deciding what to charge when the chain is
silent is the backend's job (it serves source: 'default'), so the client never substitutes
a fee of its own, with ONE exception that mirrors the wallet: a dex-contract quote answered
403 or 404 means the contract has no fee route yet and resolves { source: 'default', '0' }.
Never throws on transport, so a fee lookup cannot block or break a signing screen.
Parameters
callerPublicKey
string
method
"Swap" | "RequestTrade" | "AddLiquidity" | "RemoveLiquidity" | "CollectPositionFees" | "CreatePool"
message
Record<string, unknown>
options?
Returns
Promise<DexFeeQuote | null>
Throws
GSwapSDKError NO_SIGNER when constructed without a signer; SIGNING_FAILED or
KEY_PROVIDER_FAILED (a pre-send error, the original as cause) when the signer fails, for
example a locked wallet.