@steerprotocol/sdk 1.30.2 → 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.
- package/dist/cjs/base/VaultClient.js +25 -25
- package/dist/cjs/base/VaultClient.js.map +1 -1
- package/dist/cjs/const/stabilityVaults/stabilityVaultsConfig.js +5 -5
- package/dist/cjs/const/stabilityVaults/stabilityVaultsConfig.js.map +1 -1
- package/dist/cjs/utils/SubgraphVaultClient.js +5 -5
- package/dist/cjs/utils/SubgraphVaultClient.js.map +1 -1
- package/dist/esm/base/VaultClient.js +5 -5
- package/dist/esm/base/VaultClient.js.map +1 -1
- package/dist/esm/const/stabilityVaults/stabilityVaultsConfig.js +1 -1
- package/dist/esm/const/stabilityVaults/stabilityVaultsConfig.js.map +1 -1
- package/dist/esm/utils/SubgraphVaultClient.js +2 -2
- package/dist/esm/utils/SubgraphVaultClient.js.map +1 -1
- package/dist/types/const/stabilityVaults/stabilityVaultsConfig.d.ts +1 -1
- package/dist/types/const/stabilityVaults/stabilityVaultsConfig.d.ts.map +1 -1
- package/dist/types/utils/SubgraphVaultClient.d.ts +1 -1
- package/dist/types/utils/SubgraphVaultClient.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/base/VaultClient.ts +5 -5
- package/src/const/stabilityVaults/stabilityVaultsConfig.ts +1 -1
- package/src/utils/SubgraphVaultClient.ts +3 -3
|
@@ -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
|
|
19
|
+
const index_js_1 = require("../const/index.js");
|
|
20
20
|
const ammConfig_js_1 = require("../const/amm/configs/ammConfig.js");
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
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
|
|
29
|
-
const
|
|
30
|
-
const
|
|
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
|
|
161
|
-
this.withdrawClient = new
|
|
162
|
-
this.singleAssetDepositClient = new
|
|
163
|
-
this.subgraphVaultClient = new
|
|
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(
|
|
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 ===
|
|
191
|
-
beaconNames.push(
|
|
190
|
+
if (resolvedProtocol === chain_js_1.Protocol.Blackhole) {
|
|
191
|
+
beaconNames.push(chain_js_1.MultiPositionManagers.MultiPositionBlackholeOld);
|
|
192
192
|
}
|
|
193
|
-
const beaconAlias = (0,
|
|
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,
|
|
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,
|
|
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 !==
|
|
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,
|
|
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 =
|
|
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,
|
|
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,
|
|
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 =
|
|
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,
|
|
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);
|