@steerprotocol/sdk 1.30.0 → 1.30.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.
@@ -7,6 +7,7 @@ import {
7
7
  SubgraphResponse,
8
8
  SubgraphVaultDetails,
9
9
  SubgraphVaultDetailsWithLpData,
10
+ SubgraphVaultPosition,
10
11
  VaultFetchOptions,
11
12
  } from './subgraph-types';
12
13
 
@@ -43,6 +44,14 @@ const FIND_ALL_VAULTS = (batchSize: number = 1000, timestamp?: string) => {
43
44
  admin
44
45
  executionBundle
45
46
  }
47
+ positions(first: 1, orderBy: timestamp, orderDirection: desc) {
48
+ id
49
+ upperTick
50
+ lowerTick
51
+ relativeWeight
52
+ }
53
+ fees0
54
+ fees1
46
55
  beaconName
47
56
  payloadIpfs
48
57
  deployer
@@ -78,6 +87,14 @@ const FIND_ALL_VAULTS = (batchSize: number = 1000, timestamp?: string) => {
78
87
  admin
79
88
  executionBundle
80
89
  }
90
+ positions(first: 1, orderBy: timestamp, orderDirection: desc) {
91
+ id
92
+ upperTick
93
+ lowerTick
94
+ relativeWeight
95
+ }
96
+ fees0
97
+ fees1
81
98
  beaconName
82
99
  payloadIpfs
83
100
  deployer
@@ -118,6 +135,14 @@ const FIND_ALL_VAULTS_BY_PROTOCOL = (
118
135
  totalLPTokensIssued
119
136
  createdAt
120
137
  feeTier
138
+ positions(first: 1, orderBy: timestamp, orderDirection: desc) {
139
+ id
140
+ upperTick
141
+ lowerTick
142
+ relativeWeight
143
+ }
144
+ fees0
145
+ fees1
121
146
  strategyToken {
122
147
  id
123
148
  name
@@ -162,6 +187,14 @@ const FIND_ALL_VAULTS_BY_PROTOCOL = (
162
187
  admin
163
188
  executionBundle
164
189
  }
190
+ positions(first: 1, orderBy: timestamp, orderDirection: desc) {
191
+ id
192
+ upperTick
193
+ lowerTick
194
+ relativeWeight
195
+ }
196
+ fees0
197
+ fees1
165
198
  beaconName
166
199
  payloadIpfs
167
200
  deployer
@@ -184,8 +217,10 @@ export class SubgraphVaultClient {
184
217
  chainId: number,
185
218
  aprMap: Map<string, number>
186
219
  ): VaultNode {
187
- // Get the chain enum from chainId
188
220
  const feeApr = aprMap.get(vault.id) ? aprMap.get(vault.id) : undefined;
221
+
222
+ const tickRange = this.computeTickRange(vault.positions ?? []);
223
+
189
224
  return {
190
225
  id: vault.id,
191
226
  chainId,
@@ -195,8 +230,19 @@ export class SubgraphVaultClient {
195
230
  protocolBaseType: this.getProtocolBaseType(vault.beaconName),
196
231
  name: vault.name || '',
197
232
  feeApr: feeApr ? parseFloat(feeApr.toString()) : undefined,
198
- stakingApr: undefined, // Not available in subgraph
199
- merklApr: undefined, // Not available in subgraph
233
+ stakingApr: undefined,
234
+ merklApr: undefined,
235
+ positions: (vault.positions ?? []).map((p) => ({
236
+ id: p.id,
237
+ upperTick: parseInt(p.upperTick, 10),
238
+ lowerTick: parseInt(p.lowerTick, 10),
239
+ relativeWeight: p.relativeWeight,
240
+ })),
241
+ tickRange,
242
+ fees:
243
+ vault.fees0 !== undefined && vault.fees1 !== undefined
244
+ ? { fees0: vault.fees0, fees1: vault.fees1 }
245
+ : undefined,
200
246
  pool: {
201
247
  id: vault.pool,
202
248
  poolAddress: vault.pool,
@@ -209,7 +255,7 @@ export class SubgraphVaultClient {
209
255
  token0: {
210
256
  id: vault.token0,
211
257
  symbol: vault.token0Symbol,
212
- name: vault.token0Symbol, // Using symbol as name since name is not available
258
+ name: vault.token0Symbol,
213
259
  decimals: parseInt(vault.token0Decimals),
214
260
  address: vault.token0,
215
261
  chainId,
@@ -217,7 +263,7 @@ export class SubgraphVaultClient {
217
263
  token1: {
218
264
  id: vault.token1,
219
265
  symbol: vault.token1Symbol,
220
- name: vault.token1Symbol, // Using symbol as name since name is not available
266
+ name: vault.token1Symbol,
221
267
  decimals: parseInt(vault.token1Decimals),
222
268
  address: vault.token1,
223
269
  chainId,
@@ -225,6 +271,31 @@ export class SubgraphVaultClient {
225
271
  };
226
272
  }
227
273
 
274
+ /**
275
+ * Compute the tick range across all vault positions.
276
+ * Returns the minimum lowerTick and maximum upperTick, giving the full
277
+ * span of liquidity currently deployed by the vault strategy.
278
+ */
279
+ private computeTickRange(
280
+ positions: SubgraphVaultPosition[]
281
+ ): VaultNode['tickRange'] {
282
+ if (!positions.length) return undefined;
283
+
284
+ let minLowerTick = Infinity;
285
+ let maxUpperTick = -Infinity;
286
+
287
+ for (const pos of positions) {
288
+ const lower = parseInt(pos.lowerTick, 10);
289
+ const upper = parseInt(pos.upperTick, 10);
290
+ if (!isNaN(lower) && lower < minLowerTick) minLowerTick = lower;
291
+ if (!isNaN(upper) && upper > maxUpperTick) maxUpperTick = upper;
292
+ }
293
+
294
+ if (minLowerTick === Infinity || maxUpperTick === -Infinity) return undefined;
295
+
296
+ return { minLowerTick, maxUpperTick };
297
+ }
298
+
228
299
  /**
229
300
  * Get protocol base type from beacon name
230
301
  */
@@ -4,6 +4,13 @@ import { Address } from 'viem';
4
4
  * Types for Steer subgraph responses
5
5
  */
6
6
 
7
+ export interface SubgraphVaultPosition {
8
+ id: string;
9
+ upperTick: string;
10
+ lowerTick: string;
11
+ relativeWeight: string;
12
+ }
13
+
7
14
  export interface SubgraphVaultDetails {
8
15
  id: string;
9
16
  name: string;
@@ -31,6 +38,9 @@ export interface SubgraphVaultDetails {
31
38
  admin: string;
32
39
  executionBundle: string;
33
40
  };
41
+ positions: SubgraphVaultPosition[];
42
+ fees0: string;
43
+ fees1: string;
34
44
  beaconName: string;
35
45
  payloadIpfs: string;
36
46
  deployer: string;