@gala-chain/gswap-sdk 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -374,6 +374,208 @@ export declare class ChainGateway {
374
374
  get httpRequestor(): HttpRequestor;
375
375
  }
376
376
  //#endregion
377
+ //#region src/classes/gdex_stream.d.ts
378
+ /** Options for {@link GdexStreamService}. */
379
+ export interface GdexStreamConfig {
380
+ /** Stream endpoint. Defaults to production (`wss://dex-backend-prod1.defi.gala.com/ws`). */
381
+ url?: string | undefined;
382
+ /** Reconnect attempts after an unexpected close. Default 5. */
383
+ reconnectAttempts?: number | undefined;
384
+ /** Delay before the first reconnect attempt; doubles each attempt. Default 2000 ms. */
385
+ reconnectDelayMs?: number | undefined;
386
+ /** How long a request waits for its response. Default 15000 ms. */
387
+ requestTimeoutMs?: number | undefined;
388
+ /**
389
+ * A standards-compatible WebSocket constructor. Required on Node.js older than 22, which has no
390
+ * global `WebSocket` (pass the one from the `ws` package).
391
+ */
392
+ webSocketImpl?: unknown;
393
+ }
394
+ /** The channels of the realtime stream. */
395
+ export type GdexChannel = 'pool' | 'balance' | 'poolCreated' | 'swap' | 'liquidity' | 'blocks';
396
+ /** A pool named by its two token class keys (pipe form) and fee tier. */
397
+ export interface GdexPoolKey {
398
+ token0ClassKey: string;
399
+ token1ClassKey: string;
400
+ fee: number;
401
+ }
402
+ /** A pool named either by its key or by its hash (`v2:<poolRef>` for a v2 pool). */
403
+ export type GdexPoolSelector = {
404
+ pool: GdexPoolKey;
405
+ } | {
406
+ poolHash: string;
407
+ };
408
+ /** Options common to every subscription. */
409
+ export interface GdexSubscribeOptions {
410
+ /** Send the current state right after the subscribe response. */
411
+ snapshot?: boolean | undefined;
412
+ /** Trim each event to these fields; identity and envelope fields always stay. */
413
+ fields?: string[] | undefined;
414
+ }
415
+ /** Filters for {@link GdexStreamService.subscribeLiquidity}; all optional. */
416
+ export interface GdexLiquidityFilter {
417
+ /** Only this pool, named by its key. */
418
+ pool?: GdexPoolKey | undefined;
419
+ /** Only this pool, named by its hash (`v2:<poolRef>` for a v2 pool). */
420
+ poolHash?: string | undefined;
421
+ /** Only events for this LP wallet (the position's owner). */
422
+ owner?: string | undefined;
423
+ /** Only this transaction. */
424
+ transactionId?: string | undefined;
425
+ /** Contract version filter. */
426
+ version?: 'v1' | 'v2' | 'all' | undefined;
427
+ }
428
+ /** One committed add, remove or collect, as the `liquidity` channel reports it. */
429
+ export interface GdexLiquidityEvent {
430
+ version: 'v1' | 'v2';
431
+ pool: GdexPoolKey;
432
+ poolHash: string;
433
+ transactionId: string;
434
+ /** `add`, `remove` or `collect`. */
435
+ action: 'add' | 'remove' | 'collect';
436
+ /** The position's owner (the LP wallet). */
437
+ owner: string;
438
+ /** v1: the position id. v2: the chain position key `<pool>|<tickLow>|<tickHigh>|<owner>`. */
439
+ positionId?: string;
440
+ tickLower?: number;
441
+ tickUpper?: number;
442
+ /** v2 only: the position's liquidity after the operation; `"0"` means it is closed. */
443
+ liquidityAfter?: string;
444
+ /** Principal moved: deposited by an add, withdrawn by a remove, `"0"` for a collect. */
445
+ amount0: string;
446
+ amount1: string;
447
+ /** Fees paid out. v2: always present (`"0"` for an add). v1: present on a collect only. */
448
+ fees0?: string;
449
+ fees1?: string;
450
+ /** v2 only. */
451
+ token0Symbol?: string;
452
+ token1Symbol?: string;
453
+ blockNumber: number;
454
+ timestamp: string;
455
+ }
456
+ /** Whether a stream payload carries every field of a {@link GdexLiquidityEvent}. */
457
+ export declare function isGdexLiquidityEvent(value: Record<string, unknown>): value is Record<string, unknown> & GdexLiquidityEvent;
458
+ /** A live subscription. */
459
+ export interface GdexSubscription {
460
+ subscriptionId: string;
461
+ unsubscribe(): Promise<void>;
462
+ }
463
+ /** A JSON-RPC error answered by the stream. */
464
+ export declare class GdexStreamError extends Error {
465
+ readonly code: number;
466
+ readonly data?: unknown;
467
+ constructor(code: number, message: string, data?: unknown);
468
+ }
469
+ /**
470
+ * Client for the gSwap realtime stream (gdex WebSocket Protocol v1): JSON-RPC 2.0 over one raw
471
+ * WebSocket, with automatic reconnect and resubscribe.
472
+ *
473
+ * @example
474
+ * ```typescript
475
+ * const stream = new GdexStreamService();
476
+ * await stream.connect();
477
+ * await stream.subscribeLiquidity(event => console.log(event.action, event.owner), {
478
+ * owner: 'client|618ae395c1c653111d3315be',
479
+ * });
480
+ * ```
481
+ */
482
+ export declare class GdexStreamService {
483
+ private readonly url;
484
+ private readonly requestTimeoutMs;
485
+ private readonly webSocketConstructor;
486
+ private readonly backoff;
487
+ private socket;
488
+ private connectPromise;
489
+ private nextRequestId;
490
+ private readonly pending;
491
+ private readonly subscriptionsByServerId;
492
+ private readonly activeSubscriptions;
493
+ private intentionalClose;
494
+ private reconnecting;
495
+ private reconnectTimer;
496
+ private reconnectDelayResolve;
497
+ constructor(config?: GdexStreamConfig);
498
+ /** Open the connection. Resolves at once when already connected. */
499
+ connect(): Promise<void>;
500
+ /** Close the connection and stop reconnecting. */
501
+ disconnect(): void;
502
+ isConnected(): boolean;
503
+ /** Raw JSON-RPC escape hatch. */
504
+ request<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;
505
+ serverInfo(): Promise<Record<string, unknown>>;
506
+ ping(): Promise<{
507
+ pong: boolean;
508
+ serverTime: string;
509
+ }>;
510
+ getPool(selector: GdexPoolSelector): Promise<Record<string, unknown>>;
511
+ getBalance(owner: string, tokenClassKey?: string): Promise<Record<string, unknown>>;
512
+ getPositions(opts: {
513
+ owner: string;
514
+ pool?: GdexPoolKey;
515
+ poolHash?: string;
516
+ limit?: number;
517
+ bookmark?: string;
518
+ }): Promise<{
519
+ positions: Record<string, unknown>[];
520
+ bookmark: string;
521
+ }>;
522
+ getBlockHeight(): Promise<{
523
+ blockNumber: number;
524
+ timestamp: string;
525
+ }>;
526
+ quote(params: {
527
+ tokenIn: string;
528
+ tokenOut: string;
529
+ fee?: number;
530
+ amountIn?: string;
531
+ amountOut?: string;
532
+ }): Promise<Record<string, unknown>>;
533
+ getToken(tokenClassKey: string): Promise<Record<string, unknown>>;
534
+ /** One event per committed swap. Omit the pool to receive every pool's swaps. */
535
+ subscribeSwaps(cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions & {
536
+ pool?: GdexPoolKey;
537
+ poolHash?: string;
538
+ transactionId?: string;
539
+ }): Promise<GdexSubscription>;
540
+ /**
541
+ * State changes of one pool (price, tick, reserves, liquidity). These events carry no acting wallet:
542
+ * on v2 `creator` is whoever created the pool, not whoever just traded or added liquidity. For
543
+ * "who did it", use {@link subscribeLiquidity} (`owner`) or {@link subscribeSwaps} (`sender`).
544
+ */
545
+ subscribePool(selector: GdexPoolSelector, cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions): Promise<GdexSubscription>;
546
+ /** Balance changes of one wallet. */
547
+ subscribeBalances(owner: string, cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions & {
548
+ tokenClassKey?: string;
549
+ }): Promise<GdexSubscription>;
550
+ /** Each newly created pool. */
551
+ subscribePoolCreated(cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions & {
552
+ tokenClassKey?: string;
553
+ }): Promise<GdexSubscription>;
554
+ /**
555
+ * One event per committed AddLiquidity, RemoveLiquidity and CollectPositionFees, on both contract
556
+ * versions. Every filter is optional; with none, every liquidity event arrives. These events never
557
+ * appear on {@link subscribeSwaps}. There is no snapshot: read positions with {@link getPositions}.
558
+ * Deduplicate by `transactionId` plus `positionId`: a v1 BatchSubmit can hold several operations
559
+ * under one transaction id.
560
+ */
561
+ subscribeLiquidity(cb: (event: GdexLiquidityEvent) => void, opts?: GdexSubscribeOptions & GdexLiquidityFilter): Promise<GdexSubscription>;
562
+ /** Each block-height advance. */
563
+ subscribeBlocks(cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions): Promise<GdexSubscription>;
564
+ private openSocket;
565
+ private handleMessage;
566
+ private subscribe;
567
+ private unsubscribe;
568
+ private startReconnectLoop;
569
+ private reconnectLoop;
570
+ private resubscribeAll;
571
+ private resubscribeWithRateLimitRetry;
572
+ private waitForReconnectDelay;
573
+ private clearReconnectTimer;
574
+ private rejectPending;
575
+ private readRetryAfterMs;
576
+ private isRecord;
577
+ }
578
+ //#endregion
377
579
  //#region src/types/fees.d.ts
378
580
  /**
379
581
  * Fee tiers for pools.
@@ -1071,9 +1273,11 @@ export declare class Swaps {
1071
1273
  //#region src/types/env.d.ts
1072
1274
  /** SDK deployment environment. */
1073
1275
  export type GSwapEnv = 'prod' | 'stage';
1074
- /** Backend URL used by one SDK deployment environment. */
1276
+ /** Backend URLs used by one SDK deployment environment. */
1075
1277
  export interface GSwapEnvironmentConfig {
1076
1278
  dexBackendBaseUrl: string;
1279
+ /** The realtime stream endpoint (raw WebSocket, JSON-RPC 2.0). */
1280
+ dexBackendWsUrl: string;
1077
1281
  }
1078
1282
  /** Built-in GalaSwap deployment environments. */
1079
1283
  export declare const GSWAP_ENVIRONMENTS: Readonly<Record<GSwapEnv, GSwapEnvironmentConfig>>;
@@ -1087,6 +1291,10 @@ export interface GSwapOptions {
1087
1291
  dexBackendBaseUrl?: string | undefined;
1088
1292
  httpRequestor?: HttpRequestor | undefined;
1089
1293
  chainCallTimeoutMs?: number | undefined;
1294
+ /** Realtime stream endpoint. Defaults to the environment's, or is derived from `dexBackendBaseUrl`. */
1295
+ dexBackendWsUrl?: string | undefined;
1296
+ /** WebSocket constructor for the realtime stream; required on Node.js older than 22. */
1297
+ webSocketImpl?: unknown;
1090
1298
  }
1091
1299
  /** Main entry point for the current GalaChainDex SDK. */
1092
1300
  export declare class GSwap {
@@ -1101,6 +1309,9 @@ export declare class GSwap {
1101
1309
  readonly positions: Positions;
1102
1310
  readonly swaps: Swaps;
1103
1311
  readonly assets: Assets;
1312
+ readonly dexBackendWsUrl: string;
1313
+ private readonly webSocketImpl;
1314
+ private streamClient;
1104
1315
  /**
1105
1316
  * Create an SDK client for prod or stage.
1106
1317
  *
@@ -1111,6 +1322,18 @@ export declare class GSwap {
1111
1322
  * ```
1112
1323
  */
1113
1324
  constructor(options?: GSwapOptions);
1325
+ /**
1326
+ * The realtime stream client for this environment (created on first use, not connected until you
1327
+ * call `connect()`).
1328
+ *
1329
+ * @example
1330
+ * ```typescript
1331
+ * const gSwap = new GSwap({ env: 'stage' });
1332
+ * await gSwap.stream.connect();
1333
+ * await gSwap.stream.subscribeLiquidity((event) => console.log(event.action, event.amount0));
1334
+ * ```
1335
+ */
1336
+ get stream(): GdexStreamService;
1114
1337
  }
1115
1338
  //#endregion
1116
1339
  //#region src/classes/gswap_sdk_error.d.ts
package/dist/index.d.ts CHANGED
@@ -374,6 +374,208 @@ export declare class ChainGateway {
374
374
  get httpRequestor(): HttpRequestor;
375
375
  }
376
376
  //#endregion
377
+ //#region src/classes/gdex_stream.d.ts
378
+ /** Options for {@link GdexStreamService}. */
379
+ export interface GdexStreamConfig {
380
+ /** Stream endpoint. Defaults to production (`wss://dex-backend-prod1.defi.gala.com/ws`). */
381
+ url?: string | undefined;
382
+ /** Reconnect attempts after an unexpected close. Default 5. */
383
+ reconnectAttempts?: number | undefined;
384
+ /** Delay before the first reconnect attempt; doubles each attempt. Default 2000 ms. */
385
+ reconnectDelayMs?: number | undefined;
386
+ /** How long a request waits for its response. Default 15000 ms. */
387
+ requestTimeoutMs?: number | undefined;
388
+ /**
389
+ * A standards-compatible WebSocket constructor. Required on Node.js older than 22, which has no
390
+ * global `WebSocket` (pass the one from the `ws` package).
391
+ */
392
+ webSocketImpl?: unknown;
393
+ }
394
+ /** The channels of the realtime stream. */
395
+ export type GdexChannel = 'pool' | 'balance' | 'poolCreated' | 'swap' | 'liquidity' | 'blocks';
396
+ /** A pool named by its two token class keys (pipe form) and fee tier. */
397
+ export interface GdexPoolKey {
398
+ token0ClassKey: string;
399
+ token1ClassKey: string;
400
+ fee: number;
401
+ }
402
+ /** A pool named either by its key or by its hash (`v2:<poolRef>` for a v2 pool). */
403
+ export type GdexPoolSelector = {
404
+ pool: GdexPoolKey;
405
+ } | {
406
+ poolHash: string;
407
+ };
408
+ /** Options common to every subscription. */
409
+ export interface GdexSubscribeOptions {
410
+ /** Send the current state right after the subscribe response. */
411
+ snapshot?: boolean | undefined;
412
+ /** Trim each event to these fields; identity and envelope fields always stay. */
413
+ fields?: string[] | undefined;
414
+ }
415
+ /** Filters for {@link GdexStreamService.subscribeLiquidity}; all optional. */
416
+ export interface GdexLiquidityFilter {
417
+ /** Only this pool, named by its key. */
418
+ pool?: GdexPoolKey | undefined;
419
+ /** Only this pool, named by its hash (`v2:<poolRef>` for a v2 pool). */
420
+ poolHash?: string | undefined;
421
+ /** Only events for this LP wallet (the position's owner). */
422
+ owner?: string | undefined;
423
+ /** Only this transaction. */
424
+ transactionId?: string | undefined;
425
+ /** Contract version filter. */
426
+ version?: 'v1' | 'v2' | 'all' | undefined;
427
+ }
428
+ /** One committed add, remove or collect, as the `liquidity` channel reports it. */
429
+ export interface GdexLiquidityEvent {
430
+ version: 'v1' | 'v2';
431
+ pool: GdexPoolKey;
432
+ poolHash: string;
433
+ transactionId: string;
434
+ /** `add`, `remove` or `collect`. */
435
+ action: 'add' | 'remove' | 'collect';
436
+ /** The position's owner (the LP wallet). */
437
+ owner: string;
438
+ /** v1: the position id. v2: the chain position key `<pool>|<tickLow>|<tickHigh>|<owner>`. */
439
+ positionId?: string;
440
+ tickLower?: number;
441
+ tickUpper?: number;
442
+ /** v2 only: the position's liquidity after the operation; `"0"` means it is closed. */
443
+ liquidityAfter?: string;
444
+ /** Principal moved: deposited by an add, withdrawn by a remove, `"0"` for a collect. */
445
+ amount0: string;
446
+ amount1: string;
447
+ /** Fees paid out. v2: always present (`"0"` for an add). v1: present on a collect only. */
448
+ fees0?: string;
449
+ fees1?: string;
450
+ /** v2 only. */
451
+ token0Symbol?: string;
452
+ token1Symbol?: string;
453
+ blockNumber: number;
454
+ timestamp: string;
455
+ }
456
+ /** Whether a stream payload carries every field of a {@link GdexLiquidityEvent}. */
457
+ export declare function isGdexLiquidityEvent(value: Record<string, unknown>): value is Record<string, unknown> & GdexLiquidityEvent;
458
+ /** A live subscription. */
459
+ export interface GdexSubscription {
460
+ subscriptionId: string;
461
+ unsubscribe(): Promise<void>;
462
+ }
463
+ /** A JSON-RPC error answered by the stream. */
464
+ export declare class GdexStreamError extends Error {
465
+ readonly code: number;
466
+ readonly data?: unknown;
467
+ constructor(code: number, message: string, data?: unknown);
468
+ }
469
+ /**
470
+ * Client for the gSwap realtime stream (gdex WebSocket Protocol v1): JSON-RPC 2.0 over one raw
471
+ * WebSocket, with automatic reconnect and resubscribe.
472
+ *
473
+ * @example
474
+ * ```typescript
475
+ * const stream = new GdexStreamService();
476
+ * await stream.connect();
477
+ * await stream.subscribeLiquidity(event => console.log(event.action, event.owner), {
478
+ * owner: 'client|618ae395c1c653111d3315be',
479
+ * });
480
+ * ```
481
+ */
482
+ export declare class GdexStreamService {
483
+ private readonly url;
484
+ private readonly requestTimeoutMs;
485
+ private readonly webSocketConstructor;
486
+ private readonly backoff;
487
+ private socket;
488
+ private connectPromise;
489
+ private nextRequestId;
490
+ private readonly pending;
491
+ private readonly subscriptionsByServerId;
492
+ private readonly activeSubscriptions;
493
+ private intentionalClose;
494
+ private reconnecting;
495
+ private reconnectTimer;
496
+ private reconnectDelayResolve;
497
+ constructor(config?: GdexStreamConfig);
498
+ /** Open the connection. Resolves at once when already connected. */
499
+ connect(): Promise<void>;
500
+ /** Close the connection and stop reconnecting. */
501
+ disconnect(): void;
502
+ isConnected(): boolean;
503
+ /** Raw JSON-RPC escape hatch. */
504
+ request<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;
505
+ serverInfo(): Promise<Record<string, unknown>>;
506
+ ping(): Promise<{
507
+ pong: boolean;
508
+ serverTime: string;
509
+ }>;
510
+ getPool(selector: GdexPoolSelector): Promise<Record<string, unknown>>;
511
+ getBalance(owner: string, tokenClassKey?: string): Promise<Record<string, unknown>>;
512
+ getPositions(opts: {
513
+ owner: string;
514
+ pool?: GdexPoolKey;
515
+ poolHash?: string;
516
+ limit?: number;
517
+ bookmark?: string;
518
+ }): Promise<{
519
+ positions: Record<string, unknown>[];
520
+ bookmark: string;
521
+ }>;
522
+ getBlockHeight(): Promise<{
523
+ blockNumber: number;
524
+ timestamp: string;
525
+ }>;
526
+ quote(params: {
527
+ tokenIn: string;
528
+ tokenOut: string;
529
+ fee?: number;
530
+ amountIn?: string;
531
+ amountOut?: string;
532
+ }): Promise<Record<string, unknown>>;
533
+ getToken(tokenClassKey: string): Promise<Record<string, unknown>>;
534
+ /** One event per committed swap. Omit the pool to receive every pool's swaps. */
535
+ subscribeSwaps(cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions & {
536
+ pool?: GdexPoolKey;
537
+ poolHash?: string;
538
+ transactionId?: string;
539
+ }): Promise<GdexSubscription>;
540
+ /**
541
+ * State changes of one pool (price, tick, reserves, liquidity). These events carry no acting wallet:
542
+ * on v2 `creator` is whoever created the pool, not whoever just traded or added liquidity. For
543
+ * "who did it", use {@link subscribeLiquidity} (`owner`) or {@link subscribeSwaps} (`sender`).
544
+ */
545
+ subscribePool(selector: GdexPoolSelector, cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions): Promise<GdexSubscription>;
546
+ /** Balance changes of one wallet. */
547
+ subscribeBalances(owner: string, cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions & {
548
+ tokenClassKey?: string;
549
+ }): Promise<GdexSubscription>;
550
+ /** Each newly created pool. */
551
+ subscribePoolCreated(cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions & {
552
+ tokenClassKey?: string;
553
+ }): Promise<GdexSubscription>;
554
+ /**
555
+ * One event per committed AddLiquidity, RemoveLiquidity and CollectPositionFees, on both contract
556
+ * versions. Every filter is optional; with none, every liquidity event arrives. These events never
557
+ * appear on {@link subscribeSwaps}. There is no snapshot: read positions with {@link getPositions}.
558
+ * Deduplicate by `transactionId` plus `positionId`: a v1 BatchSubmit can hold several operations
559
+ * under one transaction id.
560
+ */
561
+ subscribeLiquidity(cb: (event: GdexLiquidityEvent) => void, opts?: GdexSubscribeOptions & GdexLiquidityFilter): Promise<GdexSubscription>;
562
+ /** Each block-height advance. */
563
+ subscribeBlocks(cb: (event: Record<string, unknown>) => void, opts?: GdexSubscribeOptions): Promise<GdexSubscription>;
564
+ private openSocket;
565
+ private handleMessage;
566
+ private subscribe;
567
+ private unsubscribe;
568
+ private startReconnectLoop;
569
+ private reconnectLoop;
570
+ private resubscribeAll;
571
+ private resubscribeWithRateLimitRetry;
572
+ private waitForReconnectDelay;
573
+ private clearReconnectTimer;
574
+ private rejectPending;
575
+ private readRetryAfterMs;
576
+ private isRecord;
577
+ }
578
+ //#endregion
377
579
  //#region src/types/fees.d.ts
378
580
  /**
379
581
  * Fee tiers for pools.
@@ -1071,9 +1273,11 @@ export declare class Swaps {
1071
1273
  //#region src/types/env.d.ts
1072
1274
  /** SDK deployment environment. */
1073
1275
  export type GSwapEnv = 'prod' | 'stage';
1074
- /** Backend URL used by one SDK deployment environment. */
1276
+ /** Backend URLs used by one SDK deployment environment. */
1075
1277
  export interface GSwapEnvironmentConfig {
1076
1278
  dexBackendBaseUrl: string;
1279
+ /** The realtime stream endpoint (raw WebSocket, JSON-RPC 2.0). */
1280
+ dexBackendWsUrl: string;
1077
1281
  }
1078
1282
  /** Built-in GalaSwap deployment environments. */
1079
1283
  export declare const GSWAP_ENVIRONMENTS: Readonly<Record<GSwapEnv, GSwapEnvironmentConfig>>;
@@ -1087,6 +1291,10 @@ export interface GSwapOptions {
1087
1291
  dexBackendBaseUrl?: string | undefined;
1088
1292
  httpRequestor?: HttpRequestor | undefined;
1089
1293
  chainCallTimeoutMs?: number | undefined;
1294
+ /** Realtime stream endpoint. Defaults to the environment's, or is derived from `dexBackendBaseUrl`. */
1295
+ dexBackendWsUrl?: string | undefined;
1296
+ /** WebSocket constructor for the realtime stream; required on Node.js older than 22. */
1297
+ webSocketImpl?: unknown;
1090
1298
  }
1091
1299
  /** Main entry point for the current GalaChainDex SDK. */
1092
1300
  export declare class GSwap {
@@ -1101,6 +1309,9 @@ export declare class GSwap {
1101
1309
  readonly positions: Positions;
1102
1310
  readonly swaps: Swaps;
1103
1311
  readonly assets: Assets;
1312
+ readonly dexBackendWsUrl: string;
1313
+ private readonly webSocketImpl;
1314
+ private streamClient;
1104
1315
  /**
1105
1316
  * Create an SDK client for prod or stage.
1106
1317
  *
@@ -1111,6 +1322,18 @@ export declare class GSwap {
1111
1322
  * ```
1112
1323
  */
1113
1324
  constructor(options?: GSwapOptions);
1325
+ /**
1326
+ * The realtime stream client for this environment (created on first use, not connected until you
1327
+ * call `connect()`).
1328
+ *
1329
+ * @example
1330
+ * ```typescript
1331
+ * const gSwap = new GSwap({ env: 'stage' });
1332
+ * await gSwap.stream.connect();
1333
+ * await gSwap.stream.subscribeLiquidity((event) => console.log(event.action, event.amount0));
1334
+ * ```
1335
+ */
1336
+ get stream(): GdexStreamService;
1114
1337
  }
1115
1338
  //#endregion
1116
1339
  //#region src/classes/gswap_sdk_error.d.ts