@steerprotocol/sdk 1.18.4 → 1.19.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.
@@ -0,0 +1,931 @@
1
+ /**
2
+ * @fileoverview Pool Query Adapter - Provides GraphQL queries for different DEX protocols
3
+ * @module PoolQueryAdapter
4
+ */
5
+ import { isShadowProtocol, Protocol } from '../const';
6
+ /**
7
+ * GraphQL query to fetch top pools from Shadow protocol by volume
8
+ * Returns pools ordered by volumeUSD in descending order
9
+ * @internal
10
+ */
11
+ const FETCH_TOP_POOLS_SHADOW = `
12
+ query {
13
+ clPools(first: $limit, orderBy: volumeUSD, orderDirection: desc, subgraphError: allow){
14
+ id
15
+ volumeUSD
16
+ token0 {
17
+ id
18
+ name
19
+ symbol
20
+ decimals
21
+ }
22
+ token1 {
23
+ id
24
+ name
25
+ symbol
26
+ decimals
27
+ }
28
+ feeTier
29
+ volumeToken0
30
+ volumeToken1
31
+ tick
32
+ liquidity
33
+ }
34
+ }
35
+ `;
36
+ /**
37
+ * GraphQL query to fetch top pools from Uniswap V3 protocol by volume
38
+ * Returns pools ordered by volumeUSD in descending order
39
+ * @internal
40
+ */
41
+ const FETCH_TOP_POOLS_UNISWAP = `
42
+ query {
43
+ pools(first: $limit, orderBy: volumeUSD, orderDirection: desc, subgraphError: allow){
44
+ id
45
+ volumeUSD
46
+ token0 {
47
+ id
48
+ name
49
+ symbol
50
+ decimals
51
+ }
52
+ token1 {
53
+ id
54
+ name
55
+ symbol
56
+ decimals
57
+ }
58
+ feeTier
59
+ volumeToken0
60
+ volumeToken1
61
+ tick
62
+ liquidity
63
+ }
64
+ }
65
+ `;
66
+ /**
67
+ * GraphQL query to fetch top pools from Thruster protocol by TVL
68
+ * Returns pools ordered by totalValueLockedETH in descending order
69
+ * @internal
70
+ */
71
+ const FETCH_TOP_POOLS_THRUSTER = `
72
+ query {
73
+ pools(first: 500, orderBy: totalValueLockedETH, orderDirection: desc, subgraphError: allow){
74
+ id
75
+ volumeUSD
76
+ totalValueLockedETH
77
+ token0 {
78
+ id
79
+ name
80
+ symbol
81
+ decimals
82
+ }
83
+ token1 {
84
+ id
85
+ name
86
+ symbol
87
+ decimals
88
+ }
89
+ feeTier
90
+ volumeToken0
91
+ volumeToken1
92
+ tick
93
+ liquidity
94
+ }
95
+ }
96
+ `;
97
+ /**
98
+ * GraphQL query to fetch top pools from PoolShark protocol by volume
99
+ * Returns limit pools ordered by volumeUsd in descending order
100
+ * @internal
101
+ */
102
+ const FETCH_POOLSHARK_TOP_POOLS = `
103
+ {
104
+ limitPools(first: 500, orderBy: volumeUsd, orderDirection: desc, subgraphError: allow) {
105
+ id
106
+ volumeUsd
107
+ totalValueLockedEth
108
+ token0 {
109
+ id
110
+ name
111
+ symbol
112
+ decimals
113
+ }
114
+ token1 {
115
+ id
116
+ name
117
+ symbol
118
+ decimals
119
+ }
120
+ feeTier {
121
+ id
122
+ }
123
+ }
124
+ }
125
+ `;
126
+ /**
127
+ * GraphQL query to fetch top pools from Algebra-based protocols by volume
128
+ * Returns pools ordered by volumeUSD in descending order
129
+ * @internal
130
+ */
131
+ const FETCH_TOP_POOLS_ALGEBRA = `
132
+ query {
133
+ pools(first: 500, orderBy: volumeUSD, orderDirection: desc, subgraphError: allow){
134
+ id
135
+ volumeUSD
136
+ token0 {
137
+ id
138
+ name
139
+ symbol
140
+ decimals
141
+ }
142
+ token1 {
143
+ id
144
+ name
145
+ symbol
146
+ decimals
147
+ }
148
+ tick
149
+ liquidity
150
+ }
151
+ }
152
+ `;
153
+ /**
154
+ * GraphQL query to fetch top pools from Ocelex protocol
155
+ * Returns first 500 pools with basic volume and liquidity data
156
+ * @internal
157
+ */
158
+ const FETCH_TOP_POOLS_OCELEX = `
159
+ query {
160
+ pools(first: 500){
161
+ id
162
+ volumeUSD
163
+ token0 {
164
+ id
165
+ name
166
+ symbol
167
+ decimals
168
+ }
169
+ token1 {
170
+ id
171
+ name
172
+ symbol
173
+ decimals
174
+ }
175
+ tick
176
+ liquidity
177
+ }
178
+ }
179
+ `;
180
+ /**
181
+ * GraphQL query to fetch top pools from Kyo protocol by volume
182
+ * Returns pools ordered by volumeUSD in descending order with fee information
183
+ * @internal
184
+ */
185
+ const FETCH_TOP_POOLS_KYO = `
186
+ query {
187
+ pools(first: 500, orderBy: volumeUSD, orderDirection: desc, subgraphError: allow){
188
+ id
189
+ volumeUSD
190
+ token0 {
191
+ id
192
+ name
193
+ symbol
194
+ decimals
195
+ }
196
+ token1 {
197
+ id
198
+ name
199
+ symbol
200
+ decimals
201
+ }
202
+ fee
203
+ volumeToken0
204
+ volumeToken1
205
+ tick
206
+ liquidity
207
+ }
208
+ }
209
+ `;
210
+ /**
211
+ * GraphQL query to fetch top pools from ArthSwap protocol by volume
212
+ * Returns pools ordered by volumeUSD_DESC with fee tier information
213
+ * @internal
214
+ */
215
+ const FETCH_ARTHSWAP_TOP_POOLS = `
216
+ {
217
+ pools(limit:500, orderBy: volumeUSD_DESC) {
218
+ id
219
+ volumeUSD
220
+ token0 {
221
+ id
222
+ name
223
+ symbol
224
+ decimals
225
+ }
226
+ token1 {
227
+ id
228
+ name
229
+ symbol
230
+ decimals
231
+ }
232
+ feeTier
233
+ tick
234
+ liquidity
235
+ }
236
+ }
237
+ `;
238
+ /**
239
+ * Returns the appropriate GraphQL query for fetching top pools based on protocol type
240
+ *
241
+ * @param protocol - The DEX protocol to fetch pools from
242
+ * @param isAlgebraPool - Whether the protocol is based on Algebra
243
+ * @returns GraphQL query string for fetching top pools
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * const query = getTopPoolsQuery(Protocol.UniswapV3, false);
248
+ * // Returns FETCH_TOP_POOLS_UNISWAP query
249
+ * ```
250
+ */
251
+ export const getTopPoolsQuery = (protocol, isAlgebraPool) => {
252
+ if (protocol === Protocol.ArthSwap || protocol === Protocol.ThickV2) {
253
+ return FETCH_ARTHSWAP_TOP_POOLS;
254
+ }
255
+ else if (protocol === Protocol.Thruster) {
256
+ return FETCH_TOP_POOLS_THRUSTER;
257
+ }
258
+ else if (protocol === Protocol.Ocelex) {
259
+ return FETCH_TOP_POOLS_OCELEX;
260
+ }
261
+ else if (protocol === Protocol.PoolShark) {
262
+ return FETCH_POOLSHARK_TOP_POOLS;
263
+ }
264
+ else if (protocol === Protocol.Kyo) {
265
+ return FETCH_TOP_POOLS_KYO;
266
+ }
267
+ else if (isShadowProtocol(protocol)) {
268
+ return FETCH_TOP_POOLS_SHADOW;
269
+ }
270
+ else if (isAlgebraPool) {
271
+ return FETCH_TOP_POOLS_ALGEBRA;
272
+ }
273
+ else {
274
+ return FETCH_TOP_POOLS_UNISWAP;
275
+ }
276
+ };
277
+ // --- Token Pool Queries for fetchPoolsForTokens ---
278
+ /**
279
+ * GraphQL query to fetch pools containing a specific token from Algebra-based protocols
280
+ * Returns up to 50 pools ordered by volume that contain the specified token
281
+ * @internal
282
+ */
283
+ export const FETCH_TOKEN_POOLS_ALGEBRA = `
284
+ query pools($token: String!) {
285
+ pools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {
286
+ or: [
287
+ {
288
+ token0: $token
289
+ }
290
+ {
291
+ token1: $token
292
+ }
293
+ ]
294
+ }, subgraphError: allow){
295
+ id
296
+ volumeUSD
297
+ token0 {
298
+ id
299
+ name
300
+ symbol
301
+ decimals
302
+ }
303
+ token1 {
304
+ id
305
+ name
306
+ symbol
307
+ decimals
308
+ }
309
+ tick
310
+ liquidity
311
+ }
312
+ }
313
+ `;
314
+ /**
315
+ * GraphQL query to fetch pools containing a specific token from Ocelex protocol
316
+ * Returns up to 50 pools that contain the specified token
317
+ * @internal
318
+ */
319
+ export const FETCH_TOKEN_POOLS_OCELEX = `
320
+ query pools($token: ID!) {
321
+ pools(first: 50, where: {
322
+ or: [
323
+ {
324
+ token0: $token
325
+ }
326
+ {
327
+ token1: $token
328
+ }
329
+ ]
330
+ }){
331
+ id
332
+ volumeUSD
333
+ token0 {
334
+ id
335
+ name
336
+ symbol
337
+ }
338
+ token1 {
339
+ id
340
+ name
341
+ symbol
342
+ }
343
+ tick
344
+ liquidity
345
+ }
346
+ }
347
+ `;
348
+ /**
349
+ * GraphQL query to fetch pools containing a specific token from ArthSwap protocol
350
+ * Returns up to 50 pools ordered by volume that contain the specified token
351
+ * @internal
352
+ */
353
+ export const FETCH_TOKEN_POOLS_ARTHSWAP = `
354
+ query pools($token: String!) {
355
+ pools(limit: 50, orderBy: volumeUSD_DESC, where: {
356
+ OR: [
357
+ {
358
+ token0Id_eq: $token
359
+ }
360
+ {
361
+ token1Id_eq: $token
362
+ }
363
+ ]
364
+ }){
365
+ id
366
+ volumeUSD
367
+ token0 {
368
+ id
369
+ name
370
+ symbol
371
+ decimals
372
+ }
373
+ token1 {
374
+ id
375
+ name
376
+ symbol
377
+ decimals
378
+ }
379
+ feeTier
380
+ tick
381
+ liquidity
382
+ }
383
+ }
384
+ `;
385
+ /**
386
+ * GraphQL query to fetch pools containing a specific token from Uniswap V3 protocol
387
+ * Returns up to 50 pools ordered by volume that contain the specified token
388
+ * @internal
389
+ */
390
+ export const FETCH_TOKEN_POOLS_UNISWAP = `
391
+ query pools($token: String!) {
392
+ pools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {
393
+ or: [
394
+ {
395
+ token0: $token
396
+ }
397
+ {
398
+ token1: $token
399
+ }
400
+ ]
401
+ }, subgraphError: allow){
402
+ id
403
+ volumeUSD
404
+ token0 {
405
+ id
406
+ name
407
+ symbol
408
+ decimals
409
+ }
410
+ token1 {
411
+ id
412
+ name
413
+ symbol
414
+ decimals
415
+ }
416
+ feeTier
417
+ volumeToken0
418
+ volumeToken1
419
+ tick
420
+ liquidity
421
+ }
422
+ }
423
+ `;
424
+ /**
425
+ * GraphQL query to fetch pools containing a specific token from Shadow protocol
426
+ * Returns up to 50 CL pools ordered by volume that contain the specified token
427
+ * @internal
428
+ */
429
+ export const FETCH_TOKEN_POOLS_SHADOW = `
430
+ query pools($token: String!) {
431
+ clPools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {
432
+ or: [
433
+ {
434
+ token0: $token
435
+ }
436
+ {
437
+ token1: $token
438
+ }
439
+ ]
440
+ }, subgraphError: allow){
441
+ id
442
+ volumeUSD
443
+ token0 {
444
+ id
445
+ name
446
+ symbol
447
+ decimals
448
+ }
449
+ token1 {
450
+ id
451
+ name
452
+ symbol
453
+ decimals
454
+ }
455
+ feeTier
456
+ volumeToken0
457
+ volumeToken1
458
+ tick
459
+ liquidity
460
+ }
461
+ }
462
+ `;
463
+ /**
464
+ * GraphQL query to fetch pools containing a specific token from PoolShark protocol
465
+ * Returns up to 50 limit pools ordered by TVL that contain the specified token
466
+ * @internal
467
+ */
468
+ export const FETCH_TOKEN_POOLS_POOLSHARK = `
469
+ query pools($token: String!) {
470
+ limitPools(first: 50, orderBy: totalValueLockedEth, orderDirection: desc, where: {
471
+ or: [
472
+ {
473
+ token0: $token
474
+ }
475
+ {
476
+ token1: $token
477
+ }
478
+ ]
479
+ }, subgraphError: allow){
480
+ id
481
+ volumeUsd
482
+ totalValueLockedEth
483
+ token0 {
484
+ id
485
+ name
486
+ symbol
487
+ decimals
488
+ }
489
+ token1 {
490
+ id
491
+ name
492
+ symbol
493
+ decimals
494
+ }
495
+ feeTier {
496
+ id
497
+ }
498
+ volumeToken0
499
+ volumeToken1
500
+ tick
501
+ liquidity
502
+ }
503
+ }
504
+ `;
505
+ /**
506
+ * GraphQL query to fetch pools where specified token is token0 from Lynex protocol
507
+ * Returns up to 50 pools ordered by volume where token is the first token
508
+ * @internal
509
+ */
510
+ export const FETCH_TOKEN_POOLS_LYNEX_TOKEN0 = `
511
+ query pools($token: String!) {
512
+ pools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {
513
+ token0: $token
514
+ }, subgraphError: allow){
515
+ id
516
+ volumeUSD
517
+ token0 {
518
+ id
519
+ name
520
+ symbol
521
+ decimals
522
+ }
523
+ token1 {
524
+ id
525
+ name
526
+ symbol
527
+ decimals
528
+ }
529
+ tick
530
+ liquidity
531
+ }
532
+ }
533
+ `;
534
+ /**
535
+ * GraphQL query to fetch pools where specified token is token1 from Lynex protocol
536
+ * Returns up to 50 pools ordered by volume where token is the second token
537
+ * @internal
538
+ */
539
+ export const FETCH_TOKEN_POOLS_LYNEX_TOKEN1 = `
540
+ query pools($token: String!) {
541
+ pools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {
542
+ token1: $token
543
+ }, subgraphError: allow){
544
+ id
545
+ volumeUSD
546
+ token0 {
547
+ id
548
+ name
549
+ symbol
550
+ decimals
551
+ }
552
+ token1 {
553
+ id
554
+ name
555
+ symbol
556
+ decimals
557
+ }
558
+ tick
559
+ liquidity
560
+ }
561
+ }
562
+ `;
563
+ /**
564
+ * GraphQL query to fetch pools where specified token is token0 from Thruster protocol
565
+ * Returns up to 50 pools ordered by TVL where token is the first token
566
+ * @internal
567
+ */
568
+ export const FETCH_TOKEN_POOLS_THRUSTER_TOKEN0 = `
569
+ query pools($token: String!) {
570
+ pools(first: 50, orderBy: totalValueLockedETH, orderDirection: desc, where: {
571
+ token0: $token
572
+ }, subgraphError: allow){
573
+ id
574
+ volumeUSD
575
+ totalValueLockedETH
576
+ token0 {
577
+ id
578
+ name
579
+ symbol
580
+ decimals
581
+ }
582
+ token1 {
583
+ id
584
+ name
585
+ symbol
586
+ decimals
587
+ }
588
+ feeTier
589
+ volumeToken0
590
+ volumeToken1
591
+ tick
592
+ liquidity
593
+ }
594
+ }
595
+ `;
596
+ /**
597
+ * GraphQL query to fetch pools where specified token is token1 from Thruster protocol
598
+ * Returns up to 50 pools ordered by TVL where token is the second token
599
+ * @internal
600
+ */
601
+ export const FETCH_TOKEN_POOLS_THRUSTER_TOKEN1 = `
602
+ query pools($token: String!) {
603
+ pools(first: 50, orderBy: totalValueLockedETH, orderDirection: desc, where: {
604
+ token1: $token
605
+ }, subgraphError: allow){
606
+ id
607
+ volumeUSD
608
+ totalValueLockedETH
609
+ token0 {
610
+ id
611
+ name
612
+ symbol
613
+ decimals
614
+ }
615
+ token1 {
616
+ id
617
+ name
618
+ symbol
619
+ decimals
620
+ }
621
+ feeTier
622
+ volumeToken0
623
+ volumeToken1
624
+ tick
625
+ liquidity
626
+ }
627
+ }
628
+ `;
629
+ /**
630
+ * GraphQL query to fetch pools containing a specific token from Kyo protocol
631
+ * Returns up to 50 pools ordered by volume that contain the specified token
632
+ * @internal
633
+ */
634
+ export const FETCH_TOKEN_POOLS_KYO = `
635
+ query pools($token: String!) {
636
+ pools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {
637
+ or: [
638
+ {
639
+ token0: $token
640
+ }
641
+ {
642
+ token1: $token
643
+ }
644
+ ]
645
+ }, subgraphError: allow){
646
+ id
647
+ volumeUSD
648
+ token0 {
649
+ id
650
+ name
651
+ symbol
652
+ decimals
653
+ }
654
+ token1 {
655
+ id
656
+ name
657
+ symbol
658
+ decimals
659
+ }
660
+ fee
661
+ volumeToken0
662
+ volumeToken1
663
+ tick
664
+ liquidity
665
+ }
666
+ }
667
+ `;
668
+ /**
669
+ * Returns the appropriate GraphQL query for fetching pools containing a specific token
670
+ *
671
+ * @param isAlgebraPool - Whether the protocol is based on Algebra
672
+ * @param protocol - The DEX protocol to fetch pools from
673
+ * @returns GraphQL query string for fetching token pools
674
+ *
675
+ * @example
676
+ * ```typescript
677
+ * const query = getTokenPoolsQueryByAddress(false, Protocol.UniswapV3);
678
+ * // Returns FETCH_TOKEN_POOLS_UNISWAP query
679
+ * ```
680
+ */
681
+ export const getTokenPoolsQueryByAddress = (isAlgebraPool, protocol) => {
682
+ if (isAlgebraPool) {
683
+ if (protocol === Protocol.Ocelex) {
684
+ return FETCH_TOKEN_POOLS_OCELEX;
685
+ }
686
+ return FETCH_TOKEN_POOLS_ALGEBRA;
687
+ }
688
+ else if (protocol === Protocol.ArthSwap || protocol === Protocol.ThickV2) {
689
+ return FETCH_TOKEN_POOLS_ARTHSWAP;
690
+ }
691
+ else if (protocol === Protocol.PoolShark) {
692
+ return FETCH_TOKEN_POOLS_POOLSHARK;
693
+ }
694
+ else if (protocol === Protocol.Kyo) {
695
+ return FETCH_TOKEN_POOLS_KYO;
696
+ }
697
+ else if (isShadowProtocol(protocol)) {
698
+ return FETCH_TOKEN_POOLS_SHADOW;
699
+ }
700
+ else {
701
+ return FETCH_TOKEN_POOLS_UNISWAP;
702
+ }
703
+ };
704
+ /**
705
+ * GraphQL query to fetch detailed information for a specific pool from Algebra-based protocols
706
+ * Returns pool details including tokens, volume, tick, and liquidity
707
+ * @internal
708
+ */
709
+ const FETCH_POOL_DETAILS_ALGEBRA = `
710
+ query pools($pool: String! ) {
711
+ pool(id: $pool, subgraphError: allow){
712
+ id
713
+ volumeUSD
714
+ token0 {
715
+ id
716
+ name
717
+ symbol
718
+ }
719
+ token1 {
720
+ id
721
+ name
722
+ symbol
723
+ }
724
+ tick
725
+ liquidity
726
+ }
727
+ }
728
+ `;
729
+ /**
730
+ * GraphQL query to fetch detailed information for a specific pool from Ocelex protocol
731
+ * Returns pool details including tokens, volume, tick, and liquidity
732
+ * @internal
733
+ */
734
+ const FETCH_POOL_DETAILS_OCELEX = `
735
+ query pools($pool: ID!) {
736
+ pool(id: $pool){
737
+ id
738
+ volumeUSD
739
+ token0 {
740
+ id
741
+ name
742
+ symbol
743
+ }
744
+ token1 {
745
+ id
746
+ name
747
+ symbol
748
+ }
749
+ tick
750
+ liquidity
751
+ }
752
+ }
753
+ `;
754
+ /**
755
+ * GraphQL query to fetch detailed information for a specific pool from Uniswap V3 protocol
756
+ * Returns comprehensive pool details including fees, TVL, and volume data
757
+ * @internal
758
+ */
759
+ const FETCH_POOL_DETAILS_UNISWAP = `
760
+ query pools($pool: String! ) {
761
+ pool(id: $pool, subgraphError: allow){
762
+ id
763
+ volumeUSD
764
+ token0 {
765
+ id
766
+ name
767
+ symbol
768
+ }
769
+ token1 {
770
+ id
771
+ name
772
+ symbol
773
+ }
774
+ feeTier
775
+ totalValueLockedETH
776
+ volumeToken0
777
+ volumeToken1
778
+ tick
779
+ liquidity
780
+ }
781
+ }
782
+ `;
783
+ /**
784
+ * GraphQL query to fetch detailed information for a specific pool from Shadow protocol
785
+ * Returns CL pool details including tokens, volume, tick, and liquidity
786
+ * @internal
787
+ */
788
+ const FETCH_POOL_DETAILS_SHADOW = `
789
+ query pools($pool: String! ) {
790
+ clPool(id: $pool, subgraphError: allow){
791
+ id
792
+ volumeUSD
793
+ token0 {
794
+ id
795
+ name
796
+ symbol
797
+ }
798
+ token1 {
799
+ id
800
+ name
801
+ symbol
802
+ }
803
+ feeTier
804
+ volumeToken0
805
+ volumeToken1
806
+ tick
807
+ liquidity
808
+ }
809
+ }
810
+ `;
811
+ /**
812
+ * GraphQL query to fetch detailed information for a specific pool from PoolShark protocol
813
+ * Returns limit pool details including tokens, volume, and fee information
814
+ * @internal
815
+ */
816
+ const FETCH_POOL_DETAILS_POOLSHARK = `
817
+ query pools($pool: String! ) {
818
+ limitPools(where: {id: $pool}){
819
+ id
820
+ volumeUsd
821
+ token0 {
822
+ id
823
+ name
824
+ symbol
825
+ }
826
+ token1 {
827
+ id
828
+ name
829
+ symbol
830
+ }
831
+ feeTier {
832
+ id
833
+ }
834
+ tick
835
+ liquidity
836
+ }
837
+ }
838
+ `;
839
+ /**
840
+ * GraphQL query to fetch detailed information for a specific pool from ArthSwap protocol
841
+ * Returns pool details including tokens, volume, fee tier, and liquidity
842
+ * @internal
843
+ */
844
+ const FETCH_POOL_DETAILS_ARTHSWAP = `
845
+ query pools($pool: String! ) {
846
+ pools(where: {id_eq: $pool}){
847
+ id
848
+ volumeUSD
849
+ token0 {
850
+ id
851
+ name
852
+ symbol
853
+ }
854
+ token1 {
855
+ id
856
+ name
857
+ symbol
858
+ }
859
+ feeTier
860
+ tick
861
+ liquidity
862
+ }
863
+ }
864
+ `;
865
+ /**
866
+ * GraphQL query to fetch detailed information for a specific pool from Kyo protocol
867
+ * Returns pool details including tokens, volume, fee, and liquidity with decimals
868
+ * @internal
869
+ */
870
+ const FETCH_POOL_DETAILS_KYO = `
871
+ query pools($pool: String! ) {
872
+ pool(id: $pool, subgraphError: allow){
873
+ id
874
+ volumeUSD
875
+ token0 {
876
+ id
877
+ name
878
+ symbol
879
+ decimals
880
+ }
881
+ token1 {
882
+ id
883
+ name
884
+ symbol
885
+ decimals
886
+ }
887
+ fee
888
+ volumeToken0
889
+ volumeToken1
890
+ tick
891
+ liquidity
892
+ }
893
+ }
894
+ `;
895
+ /**
896
+ * Returns the appropriate GraphQL query for fetching detailed pool information
897
+ *
898
+ * @param isAlgebraPool - Whether the protocol is based on Algebra
899
+ * @param protocol - The DEX protocol to fetch pool details from (optional)
900
+ * @returns GraphQL query string for fetching pool details
901
+ *
902
+ * @example
903
+ * ```typescript
904
+ * const query = getPoolDetailsQuery(false, Protocol.UniswapV3);
905
+ * // Returns FETCH_POOL_DETAILS_UNISWAP query
906
+ * ```
907
+ */
908
+ export const getPoolDetailsQuery = (isAlgebraPool, protocol) => {
909
+ if (protocol === Protocol.ArthSwap || protocol === Protocol.ThickV2) {
910
+ return FETCH_POOL_DETAILS_ARTHSWAP;
911
+ }
912
+ else if (protocol === Protocol.Ocelex) {
913
+ return FETCH_POOL_DETAILS_OCELEX;
914
+ }
915
+ else if (protocol === Protocol.PoolShark) {
916
+ return FETCH_POOL_DETAILS_POOLSHARK;
917
+ }
918
+ else if (protocol === Protocol.Kyo) {
919
+ return FETCH_POOL_DETAILS_KYO;
920
+ }
921
+ else if (protocol && isShadowProtocol(protocol)) {
922
+ return FETCH_POOL_DETAILS_SHADOW;
923
+ }
924
+ else if (isAlgebraPool) {
925
+ return FETCH_POOL_DETAILS_ALGEBRA;
926
+ }
927
+ else {
928
+ return FETCH_POOL_DETAILS_UNISWAP;
929
+ }
930
+ };
931
+ //# sourceMappingURL=PoolQueryAdapter.js.map