@steerprotocol/sdk 1.30.1 → 1.30.3

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.
@@ -16,18 +16,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.VaultClient = void 0;
18
18
  const api_sdk_1 = require("@steerprotocol/api-sdk");
19
- const const_1 = require("../const");
19
+ const index_js_1 = require("../const/index.js");
20
20
  const ammConfig_js_1 = require("../const/amm/configs/ammConfig.js");
21
- const protocol_1 = require("../const/amm/utils/protocol");
22
- const chain_1 = require("../const/chain");
23
- const subgraph_1 = require("../const/subgraph");
24
- const SubgraphVaultClient_1 = require("../utils/SubgraphVaultClient");
21
+ const protocol_js_1 = require("../const/amm/utils/protocol.js");
22
+ const chain_js_1 = require("../const/chain.js");
23
+ const subgraph_js_1 = require("../const/subgraph.js");
24
+ const SubgraphVaultClient_js_1 = require("../utils/SubgraphVaultClient.js");
25
25
  const api_js_1 = require("../const/api.js");
26
26
  const abis_js_1 = require("../const/deployments/abis.js");
27
27
  const SubgraphClient_js_1 = require("./SubgraphClient.js");
28
- const index_js_1 = require("./vault/deposit/index.js");
29
- const index_js_2 = require("./vault/single-asset/index.js");
30
- const index_js_3 = require("./vault/withdraw/index.js");
28
+ const index_js_2 = require("./vault/deposit/index.js");
29
+ const index_js_3 = require("./vault/single-asset/index.js");
30
+ const index_js_4 = require("./vault/withdraw/index.js");
31
31
  __exportStar(require("./vault/single-asset/index.js"), exports);
32
32
  const VAULT_ABI = abis_js_1.abis.QuickSwapUniv3MultiPositionLiquidityManager;
33
33
  // Custom ABI for reward functions
@@ -157,10 +157,10 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
157
157
  this.apiClient = (0, api_sdk_1.createClient)(apiUrl);
158
158
  this.publicClient = publicClient;
159
159
  this.walletClient = walletClient;
160
- this.depositClient = new index_js_1.VaultDepositClient(publicClient, walletClient);
161
- this.withdrawClient = new index_js_3.VaultWithdrawClient(publicClient, walletClient);
162
- this.singleAssetDepositClient = new index_js_2.SingleAssetDepositClient(publicClient, walletClient);
163
- this.subgraphVaultClient = new SubgraphVaultClient_1.SubgraphVaultClient();
160
+ this.depositClient = new index_js_2.VaultDepositClient(publicClient, walletClient);
161
+ this.withdrawClient = new index_js_4.VaultWithdrawClient(publicClient, walletClient);
162
+ this.singleAssetDepositClient = new index_js_3.SingleAssetDepositClient(publicClient, walletClient);
163
+ this.subgraphVaultClient = new SubgraphVaultClient_js_1.SubgraphVaultClient();
164
164
  this.subgraphStudioKey = subgraphStudioKey || '';
165
165
  }
166
166
  normalizeProtocolValue(value) {
@@ -171,7 +171,7 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
171
171
  return null;
172
172
  }
173
173
  const normalizedProtocol = this.normalizeProtocolValue(protocol);
174
- const matchedProtocol = Object.values(chain_1.Protocol).find(protocolValue => this.normalizeProtocolValue(protocolValue) === normalizedProtocol);
174
+ const matchedProtocol = Object.values(chain_js_1.Protocol).find(protocolValue => this.normalizeProtocolValue(protocolValue) === normalizedProtocol);
175
175
  return matchedProtocol || null;
176
176
  }
177
177
  getProtocolBeaconNames(protocol) {
@@ -187,10 +187,10 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
187
187
  if (protocolConfig?.beaconContractSushiManaged) {
188
188
  beaconNames.push(protocolConfig.beaconContractSushiManaged);
189
189
  }
190
- if (resolvedProtocol === chain_1.Protocol.Blackhole) {
191
- beaconNames.push(chain_1.MultiPositionManagers.MultiPositionBlackholeOld);
190
+ if (resolvedProtocol === chain_js_1.Protocol.Blackhole) {
191
+ beaconNames.push(chain_js_1.MultiPositionManagers.MultiPositionBlackholeOld);
192
192
  }
193
- const beaconAlias = (0, const_1.getBeaconNameByProtocol)(resolvedProtocol);
193
+ const beaconAlias = (0, index_js_1.getBeaconNameByProtocol)(resolvedProtocol);
194
194
  if (beaconAlias) {
195
195
  beaconNames.push(beaconAlias);
196
196
  }
@@ -221,7 +221,7 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
221
221
  vaultMatchesProtocolFilter(vault, protocolFilter, resolvedProtocol) {
222
222
  const normalizedFilter = this.normalizeProtocolValue(protocolFilter);
223
223
  const normalizedBeaconName = this.normalizeProtocolValue(vault.beaconName);
224
- const resolvedVaultProtocol = (0, const_1.getProtocolTypeByBeacon)(vault.beaconName);
224
+ const resolvedVaultProtocol = (0, index_js_1.getProtocolTypeByBeacon)(vault.beaconName);
225
225
  const directCandidates = [vault.protocol, vault.protocolBaseType, resolvedVaultProtocol || ''];
226
226
  const hasDirectMatch = directCandidates.some(candidate => {
227
227
  if (!candidate) {
@@ -233,7 +233,7 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
233
233
  return true;
234
234
  }
235
235
  const expectedBeacon = resolvedProtocol
236
- ? (0, const_1.getBeaconNameByProtocol)(resolvedProtocol)
236
+ ? (0, index_js_1.getBeaconNameByProtocol)(resolvedProtocol)
237
237
  : protocolFilter;
238
238
  const normalizedExpectedBeacon = this.normalizeProtocolValue(expectedBeacon);
239
239
  return normalizedExpectedBeacon.length > 0 && normalizedBeaconName.includes(normalizedExpectedBeacon);
@@ -290,7 +290,7 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
290
290
  // Fetch ALL vaults from both sources in parallel (no pagination at source level)
291
291
  const [apiResult, subgraphResult] = await Promise.allSettled([
292
292
  this.getAllVaultsFromApi(apiFilter),
293
- filter?.chainId !== chain_1.ChainId.Avalanche ? this.getAllVaultsFromSubgraph(filter) : Promise.reject(new Error('Avalanche not supported'))
293
+ filter?.chainId !== chain_js_1.ChainId.Avalanche ? this.getAllVaultsFromSubgraph(filter) : Promise.reject(new Error('Avalanche not supported'))
294
294
  ]);
295
295
  // Extract successful results
296
296
  const apiVaults = apiResult.status === 'fulfilled' && apiResult.value.success && apiResult.value.data
@@ -545,12 +545,12 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
545
545
  throw new Error('ChainId is required for subgraph');
546
546
  }
547
547
  // Get chain enum from chainId
548
- const chain = (0, const_1.chainIdToName)(chainId);
548
+ const chain = (0, index_js_1.chainIdToName)(chainId);
549
549
  if (!chain) {
550
550
  throw new Error(`Unsupported chainId: ${chainId}`);
551
551
  }
552
552
  // Get subgraph URL for this chain
553
- const subgraphUrl = subgraph_1.steerSubgraphConfig[chain];
553
+ const subgraphUrl = subgraph_js_1.steerSubgraphConfig[chain];
554
554
  if (!subgraphUrl) {
555
555
  throw new Error(`No subgraph configured for chain: ${chain}`);
556
556
  }
@@ -568,7 +568,7 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
568
568
  beaconNames: uniqueBeaconNames
569
569
  });
570
570
  // Get all supported protocols for this chain
571
- const supportedProtocols = (0, protocol_1.getProtocolsForChainId)(chainId, this.subgraphStudioKey);
571
+ const supportedProtocols = (0, protocol_js_1.getProtocolsForChainId)(chainId, this.subgraphStudioKey);
572
572
  // Fetch APR data for all protocols in parallel
573
573
  const aprPromises = supportedProtocols.map(protocol => this.getAprs({ chainId, protocol }).catch(error => {
574
574
  console.warn(`Failed to fetch APR for protocol ${protocol}:`, error);
@@ -682,12 +682,12 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
682
682
  throw new Error('ChainId is required for subgraph fallback');
683
683
  }
684
684
  // Get chain enum from chainId
685
- const chain = (0, const_1.chainIdToName)(chainId);
685
+ const chain = (0, index_js_1.chainIdToName)(chainId);
686
686
  if (!chain) {
687
687
  throw new Error(`Unsupported chainId: ${chainId}`);
688
688
  }
689
689
  // Get subgraph URL for this chain
690
- const subgraphUrl = subgraph_1.steerSubgraphConfig[chain];
690
+ const subgraphUrl = subgraph_js_1.steerSubgraphConfig[chain];
691
691
  if (!subgraphUrl) {
692
692
  throw new Error(`No subgraph configured for chain: ${chain}`);
693
693
  }
@@ -705,7 +705,7 @@ class VaultClient extends SubgraphClient_js_1.SubgraphClient {
705
705
  beaconNames: uniqueBeaconNames
706
706
  });
707
707
  // Get all supported protocols for this chain
708
- const supportedProtocols = (0, protocol_1.getProtocolsForChainId)(chainId, this.subgraphStudioKey);
708
+ const supportedProtocols = (0, protocol_js_1.getProtocolsForChainId)(chainId, this.subgraphStudioKey);
709
709
  // Fetch APR data for all protocols in parallel
710
710
  const aprPromises = supportedProtocols.map(protocol => this.getAprs({ chainId, protocol }).catch(error => {
711
711
  console.warn(`Failed to fetch APR for protocol ${protocol}:`, error);