Class: GSwap
gSwap SDK 2.0.0-rc.4 / GSwap
Class: GSwap
Defined in: packages/gswap-sdk/dist/index.d.ts:3383
Main entry point for the current GalaChainDex SDK: one client bundling the services that read
and write through the swap backend (quoting, swaps, pools, positions, assets,
market, leaderboard, onramper, symbols, fees, stream). See GSwapOptions for
configuration.
Constructors
Constructor
new GSwap(
options?):GSwap
Defined in: packages/gswap-sdk/dist/index.d.ts:3431
Create an SDK client for prod (the default) or stage, or for a dexBackendBaseUrl of your own.
Parameters
options?
Returns
GSwap
Example
const gSwap = new GSwap({ env: 'stage' });
const symbols = await gSwap.symbols.list();
Properties
assets
readonlyassets:Assets
Defined in: packages/gswap-sdk/dist/index.d.ts:3408
User token balances.
chainCallTimeoutMs
readonlychainCallTimeoutMs:number
Defined in: packages/gswap-sdk/dist/index.d.ts:3387
The request timeout in milliseconds (default 30 000; Infinity arms no timer).
dexBackendBaseUrl
readonlydexBackendBaseUrl:string
Defined in: packages/gswap-sdk/dist/index.d.ts:3385
The swap backend base URL every request goes to, without a trailing slash.
dexBackendWsUrl
readonlydexBackendWsUrl:string
Defined in: packages/gswap-sdk/dist/index.d.ts:3418
The realtime stream endpoint GSwap.stream connects to.
fees
readonlyfees:DexFees
Defined in: packages/gswap-sdk/dist/index.d.ts:3416
Network-fee quotes (DryRun) signed with this client's signer.
gateway
readonlygateway:ChainGateway
Defined in: packages/gswap-sdk/dist/index.d.ts:3396
The chain-gateway client every other service reads and writes through.
leaderboard
readonlyleaderboard:Leaderboard
Defined in: packages/gswap-sdk/dist/index.d.ts:3412
Trading-competition seasons and rankings.
market
readonlymarket:Market
Defined in: packages/gswap-sdk/dist/index.d.ts:3410
USD prices, price series and the platform volume totals.
onramper
readonlyonramper:Onramper
Defined in: packages/gswap-sdk/dist/index.d.ts:3414
The Onramper (fiat on-ramp) widget URL.
pools
readonlypools:Pools
Defined in: packages/gswap-sdk/dist/index.d.ts:3402
Pool, slot0 and composite-pool reads.
positions
readonlypositions:Positions
Defined in: packages/gswap-sdk/dist/index.d.ts:3404
Position reads, liquidity estimates and liquidity / pool-creation writes.
quoting
readonlyquoting:Quoting
Defined in: packages/gswap-sdk/dist/index.d.ts:3400
Read-only exact-input and exact-output quotes.
signer
readonlysigner:GalaChainSigner|undefined
Defined in: packages/gswap-sdk/dist/index.d.ts:3389
The signer given at construction, if any.
swaps
readonlyswaps:Swaps
Defined in: packages/gswap-sdk/dist/index.d.ts:3406
Queued swaps (RequestTrade), dark swaps and swap confirmation.
symbols
readonlysymbols:Symbols
Defined in: packages/gswap-sdk/dist/index.d.ts:3398
The trading-symbol registry.
walletAddress
readonlywalletAddress:string|undefined
Defined in: packages/gswap-sdk/dist/index.d.ts:3394
The account given at construction, if any, in the gateway's spelling (eth|<EIP-55>;
client|<id> as given).
Accessors
stream
Get Signature
get stream():
GdexStreamService
Defined in: packages/gswap-sdk/dist/index.d.ts:3443
The realtime stream client for this environment (created on first use, not connected until you
call connect()).
Example
const gSwap = new GSwap({ env: 'stage' });
await gSwap.stream.connect();
await gSwap.stream.subscribeLiquidity((event) => console.log(event.action, event.amount0));