@steerprotocol/sdk 3.0.25 → 3.0.27
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/index.browser.mjs +30 -9
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.cjs +30 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +30 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.browser.mjs
CHANGED
|
@@ -256,9 +256,15 @@ let MultiPositionManagers = /* @__PURE__ */ function(MultiPositionManagers) {
|
|
|
256
256
|
MultiPositionManagers["MultiPositionBittensorUniV3"] = "MultiPositionBittensorUniV3";
|
|
257
257
|
MultiPositionManagers["MultiPositionReserveV4"] = "MultiPositionReserveV4";
|
|
258
258
|
MultiPositionManagers["TestCypherAlgebraIntegralHook"] = "TestCypherAlgebraIntegralHook";
|
|
259
|
+
MultiPositionManagers["TestQuickswapAlgebraIntegralHook"] = "TestQuickswapAlgebraIntegralHook";
|
|
259
260
|
return MultiPositionManagers;
|
|
260
261
|
}({});
|
|
261
|
-
const AlgebgraHookBeacons = [
|
|
262
|
+
const AlgebgraHookBeacons = [
|
|
263
|
+
MultiPositionManagers.MultiPositionHenjinAlgebraHook,
|
|
264
|
+
MultiPositionManagers.AlgebraHook,
|
|
265
|
+
MultiPositionManagers.TestCypherAlgebraIntegralHook,
|
|
266
|
+
MultiPositionManagers.TestQuickswapAlgebraIntegralHook
|
|
267
|
+
];
|
|
262
268
|
const UniswapHookBeacons = [
|
|
263
269
|
MultiPositionManagers.MultiPositionUniswapV4Hook,
|
|
264
270
|
MultiPositionManagers.MultiPositionUniswapV4HookOld,
|
|
@@ -14429,7 +14435,11 @@ const quickSwapAlgebraConfig = () => ({
|
|
|
14429
14435
|
const quickSwapIntegralConfig = (theGraphApiKey) => ({
|
|
14430
14436
|
beaconContract: MultiPositionManagers.MultiPositionQuickSwapIntegral,
|
|
14431
14437
|
beaconAlgebraHook: MultiPositionManagers.AlgebraHook,
|
|
14432
|
-
algebraHookSupportedChains: [Chain.Base],
|
|
14438
|
+
algebraHookSupportedChains: [Chain.Base, Chain.Polygon],
|
|
14439
|
+
algebraHookBeaconsByChain: {
|
|
14440
|
+
[Chain.Base]: [MultiPositionManagers.AlgebraHook],
|
|
14441
|
+
[Chain.Polygon]: [MultiPositionManagers.TestQuickswapAlgebraIntegralHook]
|
|
14442
|
+
},
|
|
14433
14443
|
subgraph: {
|
|
14434
14444
|
[Chain.Soneium]: getTheGraphResolverUrl("3GsT6AiuDiSzh2fXbFxUKtBxT8rBEGVdQCgHSsKMPHiu", false, theGraphApiKey),
|
|
14435
14445
|
[Chain.Base]: getTheGraphResolverUrl("U65NKb6BsDPGqugPAda58ebMLa1RqeMFT76fndB77oe", false, theGraphApiKey),
|
|
@@ -14975,6 +14985,7 @@ const cypherConfig = (theGraphApiKey) => ({
|
|
|
14975
14985
|
beaconContract: MultiPositionManagers.MultiPositionCypher,
|
|
14976
14986
|
algebraHookSupportedChains: [Chain.Mainnet],
|
|
14977
14987
|
beaconAlgebraHook: MultiPositionManagers.TestCypherAlgebraIntegralHook,
|
|
14988
|
+
algebraHookBeaconsByChain: { [Chain.Mainnet]: [MultiPositionManagers.TestCypherAlgebraIntegralHook] },
|
|
14978
14989
|
subgraph: { [Chain.Mainnet]: getTheGraphResolverUrl("8knsFRJjoEtsRECVSdxhfbvidipCMdBjXx1hQmMRujHx", false, theGraphApiKey) },
|
|
14979
14990
|
factoryAddress: { [Chain.Mainnet]: "0xfb8Ed3485EfA29a0e4bed93351dD51B59fC4b0f0" },
|
|
14980
14991
|
TickLensAddress: { [Chain.Mainnet]: "0x4DA465E96E586B127ac0c8d02871Aa73F226cCC4" },
|
|
@@ -15290,8 +15301,10 @@ const CUSTOM_BEACON_TO_PROTOCOL_MAP = {
|
|
|
15290
15301
|
[MultiPositionManagers.MultiPositionBittensorUniV3]: Protocol.BittensorUniV3,
|
|
15291
15302
|
[MultiPositionManagers.MultiPositionAerodromeV3]: Protocol.AerodromeV3,
|
|
15292
15303
|
[MultiPositionManagers.MultiPositionReserveV4]: Protocol.UniswapV4,
|
|
15293
|
-
[MultiPositionManagers.TestCypherAlgebraIntegralHook]: Protocol.Cypher
|
|
15304
|
+
[MultiPositionManagers.TestCypherAlgebraIntegralHook]: Protocol.Cypher,
|
|
15305
|
+
[MultiPositionManagers.TestQuickswapAlgebraIntegralHook]: Protocol.QuickSwapIntegral
|
|
15294
15306
|
};
|
|
15307
|
+
const getCustomProtocolByBeacon = (beacon) => CUSTOM_BEACON_TO_PROTOCOL_MAP[beacon] || Object.entries(CUSTOM_BEACON_TO_PROTOCOL_MAP).find(([customBeacon]) => customBeacon.toLowerCase() === beacon.toLowerCase())?.[1];
|
|
15295
15308
|
/**`
|
|
15296
15309
|
* Retrieves the beacon name associated with a given protocol.
|
|
15297
15310
|
*
|
|
@@ -15319,10 +15332,13 @@ function getBeaconNameByProtocol(protocol) {
|
|
|
15319
15332
|
*/
|
|
15320
15333
|
const getProtocolConfigByBeacon = (beacon, theGraphApiKey) => {
|
|
15321
15334
|
if (!beacon) return null;
|
|
15335
|
+
const protocolConfig = getAmmConfig(theGraphApiKey);
|
|
15336
|
+
const customProtocol = getCustomProtocolByBeacon(beacon);
|
|
15337
|
+
if (customProtocol) return protocolConfig[customProtocol];
|
|
15322
15338
|
const beaconLower = beacon.toLowerCase();
|
|
15323
15339
|
const matchedProtocol = Object.entries(BEACON_TO_PROTOCOL_MAP).find(([key]) => beaconLower.includes(key));
|
|
15324
15340
|
if (!matchedProtocol) return null;
|
|
15325
|
-
return
|
|
15341
|
+
return protocolConfig[matchedProtocol[1]];
|
|
15326
15342
|
};
|
|
15327
15343
|
/**
|
|
15328
15344
|
* Determines the protocol type from a given beacon identifier.
|
|
@@ -15337,7 +15353,8 @@ const getProtocolConfigByBeacon = (beacon, theGraphApiKey) => {
|
|
|
15337
15353
|
*/
|
|
15338
15354
|
function getProtocolTypeByBeacon(beacon) {
|
|
15339
15355
|
if (!beacon) return null;
|
|
15340
|
-
|
|
15356
|
+
const customProtocol = getCustomProtocolByBeacon(beacon);
|
|
15357
|
+
if (customProtocol) return customProtocol;
|
|
15341
15358
|
const beaconLower = beacon.toLowerCase();
|
|
15342
15359
|
const matchedProtocol = Object.entries(BEACON_TO_SUPPORTED_PROTOCOL_MAP).sort(([a], [b]) => b.length - a.length).find(([key]) => beaconLower.includes(key));
|
|
15343
15360
|
return matchedProtocol ? matchedProtocol[1] : null;
|
|
@@ -19622,14 +19639,18 @@ var VaultClient = class extends SubgraphClient {
|
|
|
19622
19639
|
const normalizedProtocol = this.normalizeProtocolValue(protocol);
|
|
19623
19640
|
return Object.values(Protocol).find((protocolValue) => this.normalizeProtocolValue(protocolValue) === normalizedProtocol) || null;
|
|
19624
19641
|
}
|
|
19625
|
-
getProtocolBeaconNames(protocol) {
|
|
19642
|
+
getProtocolBeaconNames(protocol, chainId) {
|
|
19626
19643
|
const resolvedProtocol = this.resolveProtocolEnum(protocol);
|
|
19627
19644
|
if (!resolvedProtocol) return [];
|
|
19628
19645
|
const protocolConfig = getAmmConfig(this.subgraphStudioKey)[resolvedProtocol];
|
|
19629
19646
|
const beaconNames = [];
|
|
19647
|
+
const chain = chainId ? chainIdToName(chainId) : void 0;
|
|
19630
19648
|
if (protocolConfig?.beaconContract) beaconNames.push(protocolConfig.beaconContract);
|
|
19631
19649
|
if (protocolConfig?.additionalBeaconContracts?.length) beaconNames.push(...protocolConfig.additionalBeaconContracts);
|
|
19632
19650
|
if (protocolConfig?.beaconContractSushiManaged) beaconNames.push(protocolConfig.beaconContractSushiManaged);
|
|
19651
|
+
if (protocolConfig?.algebraHookBeaconsByChain) if (chain) beaconNames.push(...protocolConfig.algebraHookBeaconsByChain[chain] || []);
|
|
19652
|
+
else beaconNames.push(...Object.values(protocolConfig.algebraHookBeaconsByChain).flat());
|
|
19653
|
+
if (protocolConfig?.beaconAlgebraHook && (!chain || protocolConfig.algebraHookSupportedChains?.includes(chain) && !protocolConfig.algebraHookBeaconsByChain?.[chain]?.length)) beaconNames.push(protocolConfig.beaconAlgebraHook);
|
|
19633
19654
|
if (resolvedProtocol === Protocol.Blackhole) beaconNames.push(MultiPositionManagers.MultiPositionBlackholeOld);
|
|
19634
19655
|
const beaconAlias = getBeaconNameByProtocol(resolvedProtocol);
|
|
19635
19656
|
if (beaconAlias) beaconNames.push(beaconAlias);
|
|
@@ -19671,7 +19692,7 @@ var VaultClient = class extends SubgraphClient {
|
|
|
19671
19692
|
const normalizedExpectedBeacon = this.normalizeProtocolValue(expectedBeacon);
|
|
19672
19693
|
if (normalizedExpectedBeacon.length > 0 && normalizedBeaconName.includes(normalizedExpectedBeacon)) return true;
|
|
19673
19694
|
if (!resolvedProtocol) return false;
|
|
19674
|
-
return this.getProtocolBeaconNames(resolvedProtocol).some((beacon) => {
|
|
19695
|
+
return this.getProtocolBeaconNames(resolvedProtocol, vault.chainId).some((beacon) => {
|
|
19675
19696
|
const normalizedBeacon = this.normalizeProtocolValue(beacon);
|
|
19676
19697
|
return normalizedBeacon.length > 0 && normalizedBeaconName === normalizedBeacon;
|
|
19677
19698
|
});
|
|
@@ -19975,7 +19996,7 @@ var VaultClient = class extends SubgraphClient {
|
|
|
19975
19996
|
if (!chain) throw new Error(`Unsupported chainId: ${chainId}`);
|
|
19976
19997
|
const subgraphUrl = steerSubgraphConfig[chain];
|
|
19977
19998
|
if (!subgraphUrl) throw new Error(`No subgraph configured for chain: ${chain}`);
|
|
19978
|
-
const beaconNames = this.getProtocolBeaconNames(filter?.protocol);
|
|
19999
|
+
const beaconNames = this.getProtocolBeaconNames(filter?.protocol, chainId);
|
|
19979
20000
|
if (filter?.beaconName) beaconNames.push(filter.beaconName);
|
|
19980
20001
|
const uniqueBeaconNames = [...new Set(beaconNames.filter((name) => name.length > 0))];
|
|
19981
20002
|
const subgraphVaults = await this.subgraphVaultClient.getAllVaultsFromSubgraph({
|
|
@@ -20095,7 +20116,7 @@ var VaultClient = class extends SubgraphClient {
|
|
|
20095
20116
|
if (!chain) throw new Error(`Unsupported chainId: ${chainId}`);
|
|
20096
20117
|
const subgraphUrl = steerSubgraphConfig[chain];
|
|
20097
20118
|
if (!subgraphUrl) throw new Error(`No subgraph configured for chain: ${chain}`);
|
|
20098
|
-
const beaconNames = this.getProtocolBeaconNames(filter?.protocol);
|
|
20119
|
+
const beaconNames = this.getProtocolBeaconNames(filter?.protocol, chainId);
|
|
20099
20120
|
if (filter?.beaconName) beaconNames.push(filter.beaconName);
|
|
20100
20121
|
const uniqueBeaconNames = [...new Set(beaconNames.filter((name) => name.length > 0))];
|
|
20101
20122
|
const subgraphVaults = await this.subgraphVaultClient.getAllVaultsFromSubgraph({
|