@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 @@
1
+ {"version":3,"file":"PoolQueryAdapter.js","sourceRoot":"","sources":["../../../src/utils/PoolQueryAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEtD;;;;GAIG;AACH,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwB9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwB/B,CAAC;AAEF;;;;GAIG;AACH,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBhC,CAAC;AAEF;;;;GAIG;AACH,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBjC,CAAC;AAEF;;;;GAIG;AACH,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqB/B,CAAC;AAEF;;;;GAIG;AACH,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwB3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBhC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAE,aAAsB,EAAU,EAAE;IACrF,IAAI,QAAQ,KAAK,QAAQ,CAAC,QAAQ,IAAI,QAAQ,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpE,OAAO,wBAAwB,CAAC;IAClC,CAAC;SAAM,IAAI,QAAQ,KAAK,QAAQ,CAAC,QAA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AM,CAAC;QACN,OAAO,0BAA0B,CAAA;IACnC,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,257 @@
1
+ import type { PublicClient, WalletClient } from 'viem';
2
+ import { PoolData, SteerResponse } from '../types';
3
+ import { SubgraphClient } from './SubgraphClient';
4
+ import { Protocol } from '../const/chain';
5
+ /**
6
+ * GraphQL token data interface representing token information from subgraph responses
7
+ * @interface GraphQLTokenData
8
+ */
9
+ export interface GraphQLTokenData {
10
+ /** Token symbol (e.g., "ETH", "USDC") */
11
+ symbol: string;
12
+ /** Token contract address */
13
+ id: string;
14
+ /** Number of decimal places for the token */
15
+ decimals: string;
16
+ /** Human-readable token name */
17
+ name: string;
18
+ }
19
+ /**
20
+ * GraphQL pool data interface representing pool information from subgraph responses
21
+ * @interface GraphQLPoolData
22
+ */
23
+ export interface GraphQLPoolData {
24
+ /** Pool contract address */
25
+ id: string;
26
+ /** First token in the pool */
27
+ token0: GraphQLTokenData;
28
+ /** Second token in the pool */
29
+ token1: GraphQLTokenData;
30
+ /** 24-hour trading volume in USD */
31
+ volumeUSD: string;
32
+ /** Current tick of the pool */
33
+ tick: string;
34
+ /** Total liquidity in the pool */
35
+ liquidity: string;
36
+ /** Fee tier for the pool (optional) */
37
+ feeTier?: string;
38
+ /** 24-hour volume of token0 (optional) */
39
+ volumeToken0?: string;
40
+ /** 24-hour volume of token1 (optional) */
41
+ volumeToken1?: string;
42
+ /** Total value locked in ETH (optional) */
43
+ totalValueLockedETH?: string;
44
+ /** Alternative field name for volume USD (optional) */
45
+ volumeUsd?: string;
46
+ /** Alternative field name for TVL in ETH (optional) */
47
+ totalValueLockedEth?: string;
48
+ }
49
+ /**
50
+ * Filter criteria for querying pools
51
+ * @interface PoolFilter
52
+ */
53
+ export interface PoolFilter {
54
+ /** Chain ID to filter pools by */
55
+ chainId?: number;
56
+ /** Protocol to filter pools by */
57
+ protocol?: Protocol;
58
+ /** Minimum volume in USD to filter pools */
59
+ minVolumeUSD?: number;
60
+ /** Token address to find pools containing this token */
61
+ tokenAddress?: string;
62
+ /** Maximum number of pools to return */
63
+ limit?: number;
64
+ }
65
+ /**
66
+ * Client for fetching pool data from various DEX protocol subgraphs
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * import { createPublicClient, createWalletClient, http } from 'viem';
71
+ * import { mainnet } from 'viem/chains';
72
+ * import { PoolClient } from '@steerprotocol/sdk';
73
+ *
74
+ * const client = createPublicClient({
75
+ * chain: mainnet,
76
+ * transport: http()
77
+ * }) as PublicClient & WalletClient;
78
+ *
79
+ * const poolClient = new PoolClient(client, 'your-subgraph-studio-key');
80
+ *
81
+ * // Fetch top pools
82
+ * const topPools = await poolClient.getTopPools(100, Protocol.UniswapV3, 1);
83
+ * ```
84
+ *
85
+ * @extends SubgraphClient
86
+ * @group Pool
87
+ */
88
+ export declare class PoolClient extends SubgraphClient {
89
+ /** Public client for blockchain interactions */
90
+ protected readonly publicClient: PublicClient;
91
+ /** Default timeout for GraphQL queries in milliseconds */
92
+ private readonly defaultTimeout;
93
+ /** Counter for tracking API call metrics */
94
+ private apiCallCount;
95
+ /** Subgraph Studio API key for rate limiting */
96
+ private readonly subgraphStudioKey;
97
+ /**
98
+ * Creates a new PoolClient instance
99
+ *
100
+ * @param client - Combined public and wallet client for blockchain interactions
101
+ * @param subgraphStudioKey - Optional Subgraph Studio API key for higher rate limits
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * const poolClient = new PoolClient(client, 'your-api-key');
106
+ * ```
107
+ */
108
+ constructor(client: PublicClient & WalletClient, subgraphStudioKey?: string);
109
+ /**
110
+ * Resets the API call counter for metrics tracking
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * poolClient.resetMetrics();
115
+ * ```
116
+ */
117
+ resetMetrics(): void;
118
+ /**
119
+ * Gets current metrics for monitoring API usage
120
+ *
121
+ * @returns Object containing current metrics
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * const metrics = poolClient.getMetrics();
126
+ * console.log(`API calls made: ${metrics.apiCallCount}`);
127
+ * ```
128
+ */
129
+ getMetrics(): {
130
+ apiCallCount: number;
131
+ };
132
+ /**
133
+ * Fetches data from GraphQL endpoint with retry logic for rate limits
134
+ *
135
+ * @param query - GraphQL query string
136
+ * @param variables - Variables for the GraphQL query
137
+ * @param protocol - Protocol to query
138
+ * @param chainId - Chain ID to query
139
+ * @returns Promise containing the response data
140
+ *
141
+ * @throws {Error} When subgraph endpoint is not available
142
+ * @throws {Error} When rate limit is exceeded after max retries
143
+ * @throws {Error} When GraphQL query times out
144
+ *
145
+ * @internal
146
+ */
147
+ private fetchFromGraph;
148
+ /**
149
+ * Fetches the top pools for a specific protocol by trading volume
150
+ *
151
+ * @param count - Number of pools to fetch (default: 500)
152
+ * @param protocol - Protocol to fetch pools from
153
+ * @param chainId - Chain ID to fetch pools from
154
+ * @returns Promise containing an array of top pools
155
+ *
156
+ * @example
157
+ * ```typescript
158
+ * // Get top 100 Uniswap V3 pools on Ethereum
159
+ * const topPools = await poolClient.getTopPools(100, Protocol.UniswapV3, 1);
160
+ * if (topPools.success) {
161
+ * console.log(`Found ${topPools.data.length} pools`);
162
+ * }
163
+ * ```
164
+ *
165
+ * @throws {Error} When failed to fetch pools from subgraph
166
+ */
167
+ getTopPools(count: number | undefined, protocol: Protocol, chainId: number): Promise<SteerResponse<GraphQLPoolData[]>>;
168
+ /**
169
+ * Fetches detailed information for a specific pool by its ID
170
+ *
171
+ * @param poolId - Pool contract address to fetch
172
+ * @param protocol - Protocol the pool belongs to
173
+ * @param chainId - Chain ID where the pool exists
174
+ * @returns Promise containing pool details or null if not found
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * // Get specific pool details
179
+ * const poolDetails = await poolClient.getPoolById(
180
+ * '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640',
181
+ * Protocol.UniswapV3,
182
+ * 1
183
+ * );
184
+ * if (poolDetails.success && poolDetails.data) {
185
+ * console.log(`Pool: ${poolDetails.data.token0.symbol}/${poolDetails.data.token1.symbol}`);
186
+ * }
187
+ * ```
188
+ *
189
+ * @throws {Error} When failed to fetch pool from subgraph
190
+ */
191
+ getPoolById(poolId: string, protocol: Protocol, chainId: number): Promise<SteerResponse<GraphQLPoolData | null>>;
192
+ /**
193
+ * Fetches pools containing multiple tokens in batches for better performance
194
+ *
195
+ * @param tokenAddresses - Array of token contract addresses
196
+ * @param protocol - Protocol to fetch pools from
197
+ * @param chainId - Chain ID to fetch pools from
198
+ * @param batchSize - Number of tokens to process in each batch (default: 10)
199
+ * @returns Promise containing all pools found for the tokens
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * // Get pools for multiple tokens
204
+ * const tokenAddresses = [
205
+ * '0xa0b86a33e6f8b07b71c3a39ef77a6b6e8f1b7b7e', // USDC
206
+ * '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' // WETH
207
+ * ];
208
+ * const pools = await poolClient.fetchPoolsForTokensBatch(
209
+ * tokenAddresses,
210
+ * Protocol.UniswapV3,
211
+ * 1,
212
+ * 5
213
+ * );
214
+ * ```
215
+ *
216
+ * @throws {Error} When batch processing fails
217
+ */
218
+ fetchPoolsForTokensBatch(tokenAddresses: string[], protocol: Protocol, chainId: number, batchSize?: number): Promise<SteerResponse<GraphQLPoolData[]>>;
219
+ /**
220
+ * Fetches all pools containing a specific token
221
+ *
222
+ * @param tokenAddress - Token contract address
223
+ * @param protocol - Protocol to fetch pools from
224
+ * @param chainId - Chain ID to fetch pools from
225
+ * @returns Promise containing pools that include the specified token
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * // Get all USDC pools on Uniswap V3
230
+ * const usdcPools = await poolClient.fetchPoolsForToken(
231
+ * '0xa0b86a33e6f8b07b71c3a39ef77a6b6e8f1b7b7e',
232
+ * Protocol.UniswapV3,
233
+ * 1
234
+ * );
235
+ * if (usdcPools.success) {
236
+ * console.log(`Found ${usdcPools.data.length} USDC pools`);
237
+ * }
238
+ * ```
239
+ *
240
+ * @throws {Error} When failed to fetch pools for token
241
+ */
242
+ fetchPoolsForToken(tokenAddress: string, protocol: Protocol, chainId: number): Promise<SteerResponse<GraphQLPoolData[]>>;
243
+ /**
244
+ * Filters pools based on validity criteria such as tick range and liquidity
245
+ *
246
+ * @param pools - Array of pools to filter
247
+ * @returns Array of valid pools that meet the criteria
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * const validPools = poolClient.filterValidPools(allPools);
252
+ * console.log(`Filtered down to ${validPools.length} valid pools`);
253
+ * ```
254
+ */
255
+ filterValidPools(pools: PoolData[]): PoolData[];
256
+ }
257
+ //# sourceMappingURL=PoolClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PoolClient.d.ts","sourceRoot":"","sources":["../../../src/base/PoolClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,QAAQ,EAET,MAAM,gBAAgB,CAAC;AAQxB;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,+BAA+B;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,u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MAAM,YAAM,EACnB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC,CAAC;IA8C5C;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,WAAW,CACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,aAAa,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IAqCjD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACU,wBAAwB,CACnC,cAAc,EAAE,MAAM,EAAE,EACxB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAW,GACrB,OAAO,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC,CAAC;IAqG5C;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,kBAAkB,CAC7B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC,CAAC;IA4C5C;;;;;;;;;;;OAWG;IACI,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE;CA6BvD"}
@@ -2,16 +2,17 @@ import { SteerConfig, SteerResponse } from './types';
2
2
  import { SubgraphClient } from './base/SubgraphClient';
3
3
  import { VaultClient } from './base/VaultClient';
4
4
  import { SmartRewardsClient } from './base/SmartRewardClient';
5
+ import { PoolClient } from './base/PoolClient';
5
6
  import { StakingClient } from './base/StakingClient';
6
7
  /**
7
8
  * The main client for interacting with the Steer Protocol.
8
- * This client provides access to vault operations and smart rewards functionality.
9
+ * This client provides access to vault operations, smart rewards functionality, pool data, and staking.
9
10
  *
10
11
  * @example
11
12
  * ```typescript
12
13
  * import { createPublicClient, createWalletClient, http } from 'viem';
13
14
  * import { mainnet } from 'viem/chains';
14
- * import { SteerClient } from '@steerprotocol/sdk';
15
+ * import { SteerClient, Protocol } from '@steerprotocol/sdk';
15
16
  *
16
17
  * // Create viem clients
17
18
  * const publicClient = createPublicClient({
@@ -28,7 +29,8 @@ import { StakingClient } from './base/StakingClient';
28
29
  * const steerClient = new SteerClient({
29
30
  * environment: 'production',
30
31
  * client: publicClient,
31
- * walletClient: walletClient
32
+ * walletClient: walletClient,
33
+ * subgraphStudioKey: 'your-subgraph-studio-key' // Optional
32
34
  * });
33
35
  *
34
36
  * // Use vault operations
@@ -37,6 +39,13 @@ import { StakingClient } from './base/StakingClient';
37
39
  * // Use rewards functionality
38
40
  * const campaigns = await steerClient.rewards.getCampaigns(1);
39
41
  * const summary = await steerClient.rewards.getRewardSummary(userAddress, chainId);
42
+ *
43
+ * // Use pool data functionality
44
+ * const topPools = await steerClient.pools.getTopPools(100, Protocol.UniswapV3, 1);
45
+ * const poolDetails = await steerClient.pools.getPoolById(poolId, Protocol.UniswapV3, 1);
46
+ *
47
+ * // Use staking functionality
48
+ * const stakingPools = await steerClient.staking.getStakingPools(1);
40
49
  * ```
41
50
  *
42
51
  * @group Client
@@ -50,9 +59,26 @@ export declare class SteerClient extends SubgraphClient {
50
59
  readonly rewards: SmartRewardsClient;
51
60
  /** The staking client instance for interacting with staking pools */
52
61
  readonly staking: StakingClient;
62
+ /** The pool client instance for fetching pool data from DEX protocols */
63
+ readonly pools: PoolClient;
53
64
  /**
54
65
  * Creates a new instance of the SteerClient
66
+ *
55
67
  * @param config - The configuration object for the client
68
+ * @param config.environment - The environment to use ('production' or 'development')
69
+ * @param config.client - The viem client for blockchain interactions
70
+ * @param config.walletClient - Optional wallet client for write operations
71
+ * @param config.subgraphStudioKey - Optional Subgraph Studio API key for higher rate limits
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const steerClient = new SteerClient({
76
+ * environment: 'production',
77
+ * client: publicClient,
78
+ * walletClient: walletClient,
79
+ * subgraphStudioKey: 'your-key'
80
+ * });
81
+ * ```
56
82
  */
57
83
  constructor(config: SteerConfig);
58
84
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBAAa,WAAY,SAAQ,cAAc;IAE7C,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAE3D,kEAAkE;IAClE,SAAgB,MAAM,EAAE,WAAW,CAAC;IAEpC,qEAAqE;IACrE,SAAgB,OAAO,EAAE,kBAAkB,CAAC;IAE5C,qEAAqE;IACrE,SAAgB,OAAO,EAAE,aAAa,CAAC;IAEvC;;;OAGG;gBACS,MAAM,EAAE,WAAW;IAqC/B;;;;;;;;;;OAUG;IACU,cAAc,CAAC,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAa5D"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBAAa,WAAY,SAAQ,cAAc;IAE7C,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAE3D,kEAAkE;IAClE,SAAgB,MAAM,EAAE,WAAW,CAAC;IAEpC,qEAAqE;IACrE,SAAgB,OAAO,EAAE,kBAAkB,CAAC;IAE5C,qEAAqE;IACrE,SAAgB,OAAO,EAAE,aAAa,CAAC;IAEvC,yEAAyE;IACzE,SAAgB,KAAK,EAAE,UAAU,CAAC;IAElC;;;;;;;;;;;;;;;;;;OAkBG;gBACS,MAAM,EAAE,WAAW;IA6C/B;;;;;;;;;;OAUG;IACU,cAAc,CAAC,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAa5D"}
@@ -4,6 +4,7 @@ export * from './types';
4
4
  export * from './base/VaultClient';
5
5
  export * from './base/SubgraphClient';
6
6
  export * from './base/StakingClient';
7
+ export * from './base/PoolClient';
7
8
  export * from './const';
8
9
  /**
9
10
  * @packageDocumentation
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG"}
@@ -1,9 +1,18 @@
1
1
  import type { Address, Client, TestClient, WalletClient } from 'viem';
2
2
  import { Chain, Protocol } from './const/chain';
3
+ /**
4
+ * Configuration object for initializing the SteerClient
5
+ * @interface SteerConfig
6
+ */
3
7
  export interface SteerConfig {
8
+ /** The environment to use for API calls */
4
9
  environment?: 'production' | 'development';
10
+ /** The viem client for blockchain interactions */
5
11
  client: Client | TestClient;
12
+ /** Optional wallet client for write operations */
6
13
  walletClient?: WalletClient;
14
+ /** Optional Subgraph Studio API key for higher rate limits */
15
+ subgraphStudioKey?: string;
7
16
  }
8
17
  export interface SteerResponse<T> {
9
18
  data: T | null;
@@ -51,6 +60,13 @@ export interface PoolData {
51
60
  chainId: number;
52
61
  feeTier: number;
53
62
  tickSpacing: number | bigint;
63
+ tick?: string;
64
+ liquidity?: string;
65
+ volumeUSD?: string;
66
+ volumeToken0?: string;
67
+ volumeToken1?: string;
68
+ totalValueLockedETH?: string;
69
+ totalValueLockedUSD?: string;
54
70
  }
55
71
  export interface Slot0 {
56
72
  price?: bigint;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;IAC3C,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,IAAI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,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM;KAAG,KAAK,IAAI,QAAQ,GAAG,MAAM;CAAE,CAAC;AACtE,MAAM,MAAM,oBAAoB,GAAG,MAAM;KAAG,KAAK,IAAI,KAAK,GAAG,MAAM;CAAE,CAAA;AAErE,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAC;SAAG,KAAK,IAAI,KAAK,GAAG,MAAM;KAAE,CAAC,CAAA;IAC/C,cAAc,EAAE,OAAO,CAAC;SAAG,KAAK,IAAI,KAAK,GAAG,MAAM;KAAE,CAAC,CAAA;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;SAAG,KAAK,IAAI,KAAK,GAAG,MAAM;KAAE,CAAC,CAAA;IACzD,iBAAiB,CAAC,EAAE,OAAO,CAAC;SAAG,KAAK,IAAI,KAAK,GAAG,MAAM;KAAE,CAAC,CAAA;IACzD,eAAe,CAAC,EAAE,OAAO,CAAC;SAAG,KAAK,IAAI,KAAK,GAAG,MAAM;KAAE,CAAC,CAAA;IACvD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;SAAG,KAAK,IAAI,KAAK,GAAG,MAAM;KAAE,CAAC,CAAA;CACrD,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC;KAAG,QAAQ,IAAI,iBAAiB,GAAG,YAAY;CAAE,CAAC,CAAC"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @fileoverview Pool Query Adapter - Provides GraphQL queries for different DEX protocols
3
+ * @module PoolQueryAdapter
4
+ */
5
+ import { Protocol } from '../const';
6
+ /**
7
+ * Returns the appropriate GraphQL query for fetching top pools based on protocol type
8
+ *
9
+ * @param protocol - The DEX protocol to fetch pools from
10
+ * @param isAlgebraPool - Whether the protocol is based on Algebra
11
+ * @returns GraphQL query string for fetching top pools
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const query = getTopPoolsQuery(Protocol.UniswapV3, false);
16
+ * // Returns FETCH_TOP_POOLS_UNISWAP query
17
+ * ```
18
+ */
19
+ export declare const getTopPoolsQuery: (protocol: Protocol, isAlgebraPool: boolean) => string;
20
+ /**
21
+ * GraphQL query to fetch pools containing a specific token from Algebra-based protocols
22
+ * Returns up to 50 pools ordered by volume that contain the specified token
23
+ * @internal
24
+ */
25
+ export declare const FETCH_TOKEN_POOLS_ALGEBRA = "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n tick\n liquidity\n\t}\n}\n";
26
+ /**
27
+ * GraphQL query to fetch pools containing a specific token from Ocelex protocol
28
+ * Returns up to 50 pools that contain the specified token
29
+ * @internal
30
+ */
31
+ export declare const FETCH_TOKEN_POOLS_OCELEX = "\nquery pools($token: ID!) {\n\tpools(first: 50, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n }\n token1 {\n id\n name\n symbol\n }\n tick\n liquidity\n\t}\n}\n";
32
+ /**
33
+ * GraphQL query to fetch pools containing a specific token from ArthSwap protocol
34
+ * Returns up to 50 pools ordered by volume that contain the specified token
35
+ * @internal
36
+ */
37
+ export declare const FETCH_TOKEN_POOLS_ARTHSWAP = "\nquery pools($token: String!) {\n\tpools(limit: 50, orderBy: volumeUSD_DESC, where: {\n OR: [\n {\n\t\t\t\ttoken0Id_eq: $token\n }\n {\n token1Id_eq: $token\n }\n ]\n }){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier\n tick\n liquidity\n\t}\n}\n";
38
+ /**
39
+ * GraphQL query to fetch pools containing a specific token from Uniswap V3 protocol
40
+ * Returns up to 50 pools ordered by volume that contain the specified token
41
+ * @internal
42
+ */
43
+ export declare const FETCH_TOKEN_POOLS_UNISWAP = "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n";
44
+ /**
45
+ * GraphQL query to fetch pools containing a specific token from Shadow protocol
46
+ * Returns up to 50 CL pools ordered by volume that contain the specified token
47
+ * @internal
48
+ */
49
+ export declare const FETCH_TOKEN_POOLS_SHADOW = "\nquery pools($token: String!) {\n\tclPools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n";
50
+ /**
51
+ * GraphQL query to fetch pools containing a specific token from PoolShark protocol
52
+ * Returns up to 50 limit pools ordered by TVL that contain the specified token
53
+ * @internal
54
+ */
55
+ export declare const FETCH_TOKEN_POOLS_POOLSHARK = "\nquery pools($token: String!) {\n\tlimitPools(first: 50, orderBy: totalValueLockedEth, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUsd\n totalValueLockedEth\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier {\n id\n }\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n";
56
+ /**
57
+ * GraphQL query to fetch pools where specified token is token0 from Lynex protocol
58
+ * Returns up to 50 pools ordered by volume where token is the first token
59
+ * @internal
60
+ */
61
+ export declare const FETCH_TOKEN_POOLS_LYNEX_TOKEN0 = "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n token0: $token\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n tick\n liquidity\n\t}\n}\n";
62
+ /**
63
+ * GraphQL query to fetch pools where specified token is token1 from Lynex protocol
64
+ * Returns up to 50 pools ordered by volume where token is the second token
65
+ * @internal
66
+ */
67
+ export declare const FETCH_TOKEN_POOLS_LYNEX_TOKEN1 = "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n token1: $token\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n tick\n liquidity\n\t}\n}\n";
68
+ /**
69
+ * GraphQL query to fetch pools where specified token is token0 from Thruster protocol
70
+ * Returns up to 50 pools ordered by TVL where token is the first token
71
+ * @internal
72
+ */
73
+ export declare const FETCH_TOKEN_POOLS_THRUSTER_TOKEN0 = "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: totalValueLockedETH, orderDirection: desc, where: {\n\t\ttoken0: $token\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n totalValueLockedETH\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n";
74
+ /**
75
+ * GraphQL query to fetch pools where specified token is token1 from Thruster protocol
76
+ * Returns up to 50 pools ordered by TVL where token is the second token
77
+ * @internal
78
+ */
79
+ export declare const FETCH_TOKEN_POOLS_THRUSTER_TOKEN1 = "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: totalValueLockedETH, orderDirection: desc, where: {\n\t\ttoken1: $token\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n totalValueLockedETH\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n";
80
+ /**
81
+ * GraphQL query to fetch pools containing a specific token from Kyo protocol
82
+ * Returns up to 50 pools ordered by volume that contain the specified token
83
+ * @internal
84
+ */
85
+ export declare const FETCH_TOKEN_POOLS_KYO = "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n fee\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n";
86
+ /**
87
+ * Returns the appropriate GraphQL query for fetching pools containing a specific token
88
+ *
89
+ * @param isAlgebraPool - Whether the protocol is based on Algebra
90
+ * @param protocol - The DEX protocol to fetch pools from
91
+ * @returns GraphQL query string for fetching token pools
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * const query = getTokenPoolsQueryByAddress(false, Protocol.UniswapV3);
96
+ * // Returns FETCH_TOKEN_POOLS_UNISWAP query
97
+ * ```
98
+ */
99
+ export declare const getTokenPoolsQueryByAddress: (isAlgebraPool: boolean, protocol: Protocol) => "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($token: ID!) {\n\tpools(first: 50, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n }\n token1 {\n id\n name\n symbol\n }\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($token: String!) {\n\tpools(limit: 50, orderBy: volumeUSD_DESC, where: {\n OR: [\n {\n\t\t\t\ttoken0Id_eq: $token\n }\n {\n token1Id_eq: $token\n }\n ]\n }){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($token: String!) {\n\tclPools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($token: String!) {\n\tlimitPools(first: 50, orderBy: totalValueLockedEth, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUsd\n totalValueLockedEth\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n feeTier {\n id\n }\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($token: String!) {\n\tpools(first: 50, orderBy: volumeUSD, orderDirection: desc, where: {\n or: [\n {\n\t\t\t\ttoken0: $token\n }\n {\n token1: $token\n }\n ]\n }, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n fee\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n";
100
+ /**
101
+ * Returns the appropriate GraphQL query for fetching detailed pool information
102
+ *
103
+ * @param isAlgebraPool - Whether the protocol is based on Algebra
104
+ * @param protocol - The DEX protocol to fetch pool details from (optional)
105
+ * @returns GraphQL query string for fetching pool details
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const query = getPoolDetailsQuery(false, Protocol.UniswapV3);
110
+ * // Returns FETCH_POOL_DETAILS_UNISWAP query
111
+ * ```
112
+ */
113
+ export declare const getPoolDetailsQuery: (isAlgebraPool: boolean, protocol?: Protocol) => "\nquery pools($pool: String! ) {\n\tpool(id: $pool, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n }\n token1 {\n id\n name\n symbol\n }\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($pool: ID!) {\n\tpool(id: $pool){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n }\n token1 {\n id\n name\n symbol\n }\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($pool: String! ) {\n\tpool(id: $pool, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n }\n token1 {\n id\n name\n symbol\n }\n feeTier\n totalValueLockedETH\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($pool: String! ) {\n\tclPool(id: $pool, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n }\n token1 {\n id\n name\n symbol\n }\n feeTier\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($pool: String! ) {\n\tlimitPools(where: {id: $pool}){\n\t\tid\n volumeUsd\n token0 {\n id\n name\n symbol\n }\n token1 {\n id\n name\n symbol\n }\n feeTier {\n id\n }\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($pool: String! ) {\n\tpools(where: {id_eq: $pool}){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n }\n token1 {\n id\n name\n symbol\n }\n feeTier\n tick\n liquidity\n\t}\n}\n" | "\nquery pools($pool: String! ) {\n\tpool(id: $pool, subgraphError: allow){\n\t\tid\n volumeUSD\n token0 {\n id\n name\n symbol\n decimals\n }\n token1 {\n id\n name\n symbol\n decimals\n }\n fee\n volumeToken0\n volumeToken1\n tick\n liquidity\n\t}\n}\n";
114
+ //# sourceMappingURL=PoolQueryAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PoolQueryAdapter.d.ts","sourceRoot":"","sources":["../../../src/utils/PoolQueryAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAoB,QAAQ,EAAE,MAAM,UAAU,CAAC;AAkPtD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,aAAc,QAAQ,iBAAiB,OAAO,KAAG,MAkB7E,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,2bA8BrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,uVA4BpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,2aA+BtC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,4eAiCrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,8eAiCpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,uiBAoCvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,yWAuB1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,yWAuB1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,6bA2B7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,6bA2B7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,weAiCjC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,kBAAmB,OAAO,YAAY,QAAQ,wqGAiBrF,CAAC;AAwMF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,kBAAmB,OAAO,aAAa,QAAQ,26DAgB5E,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steerprotocol/sdk",
3
- "version": "1.18.4",
3
+ "version": "1.19.1",
4
4
  "description": "Steer Protocol SDK",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -25,7 +25,7 @@
25
25
  "lint": "eslint . --ext .ts",
26
26
  "format": "prettier --write \"src/**/*.ts\"",
27
27
  "prepare": "npm run build",
28
- "docs": "typedoc --out docs --entryPoints src/index.ts src/client.ts src/base/SmartRewards.ts src/base/SubgraphClient.ts src/base/VaultClient.ts --name \"Steer Protocol SDK\" --readme README.md --excludePrivate --excludeProtected",
28
+ "docs": "typedoc --out docs --entryPoints src/index.ts src/client.ts src/base/SmartRewards.ts src/base/SubgraphClient.ts src/base/VaultClient.ts src/base/PoolClient.ts --name \"Steer Protocol SDK\" --readme README.md --excludePrivate --excludeProtected",
29
29
  "docs:watch": "typedoc --out docs --entryPoints src/index.ts src/base/SmartRewards.ts src/generated/sdk.ts --name \"Steer Protocol SDK\" --readme README.md --excludePrivate --excludeProtected --plugin none --watch",
30
30
  "docs:serve": "npx serve docs",
31
31
  "commit": "git-cz",