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