@steerprotocol/sdk 3.0.24 → 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 +32 -10
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.cjs +32 -10
- 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 +32 -10
- 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,10 +14986,12 @@ 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" },
|
|
14982
|
-
Quoter: { [Chain.Mainnet]: "0xeae871C4a8dD267146558C362c86805FB7e3Fd2F" }
|
|
14993
|
+
Quoter: { [Chain.Mainnet]: "0xeae871C4a8dD267146558C362c86805FB7e3Fd2F" },
|
|
14994
|
+
EntryPointAddress: { [Chain.Mainnet]: "0x79616564DB0294ecBa5912f1cE985FD1c11eeF51" }
|
|
14983
14995
|
});
|
|
14984
14996
|
//#endregion
|
|
14985
14997
|
//#region src/const/amm/configs/protocols/spark-integral.ts
|
|
@@ -15290,8 +15302,10 @@ const CUSTOM_BEACON_TO_PROTOCOL_MAP = {
|
|
|
15290
15302
|
[MultiPositionManagers.MultiPositionBittensorUniV3]: Protocol.BittensorUniV3,
|
|
15291
15303
|
[MultiPositionManagers.MultiPositionAerodromeV3]: Protocol.AerodromeV3,
|
|
15292
15304
|
[MultiPositionManagers.MultiPositionReserveV4]: Protocol.UniswapV4,
|
|
15293
|
-
[MultiPositionManagers.TestCypherAlgebraIntegralHook]: Protocol.Cypher
|
|
15305
|
+
[MultiPositionManagers.TestCypherAlgebraIntegralHook]: Protocol.Cypher,
|
|
15306
|
+
[MultiPositionManagers.TestQuickswapAlgebraIntegralHook]: Protocol.QuickSwapIntegral
|
|
15294
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];
|
|
15295
15309
|
/**`
|
|
15296
15310
|
* Retrieves the beacon name associated with a given protocol.
|
|
15297
15311
|
*
|
|
@@ -15319,10 +15333,13 @@ function getBeaconNameByProtocol(protocol) {
|
|
|
15319
15333
|
*/
|
|
15320
15334
|
const getProtocolConfigByBeacon = (beacon, theGraphApiKey) => {
|
|
15321
15335
|
if (!beacon) return null;
|
|
15336
|
+
const protocolConfig = getAmmConfig(theGraphApiKey);
|
|
15337
|
+
const customProtocol = getCustomProtocolByBeacon(beacon);
|
|
15338
|
+
if (customProtocol) return protocolConfig[customProtocol];
|
|
15322
15339
|
const beaconLower = beacon.toLowerCase();
|
|
15323
15340
|
const matchedProtocol = Object.entries(BEACON_TO_PROTOCOL_MAP).find(([key]) => beaconLower.includes(key));
|
|
15324
15341
|
if (!matchedProtocol) return null;
|
|
15325
|
-
return
|
|
15342
|
+
return protocolConfig[matchedProtocol[1]];
|
|
15326
15343
|
};
|
|
15327
15344
|
/**
|
|
15328
15345
|
* Determines the protocol type from a given beacon identifier.
|
|
@@ -15337,7 +15354,8 @@ const getProtocolConfigByBeacon = (beacon, theGraphApiKey) => {
|
|
|
15337
15354
|
*/
|
|
15338
15355
|
function getProtocolTypeByBeacon(beacon) {
|
|
15339
15356
|
if (!beacon) return null;
|
|
15340
|
-
|
|
15357
|
+
const customProtocol = getCustomProtocolByBeacon(beacon);
|
|
15358
|
+
if (customProtocol) return customProtocol;
|
|
15341
15359
|
const beaconLower = beacon.toLowerCase();
|
|
15342
15360
|
const matchedProtocol = Object.entries(BEACON_TO_SUPPORTED_PROTOCOL_MAP).sort(([a], [b]) => b.length - a.length).find(([key]) => beaconLower.includes(key));
|
|
15343
15361
|
return matchedProtocol ? matchedProtocol[1] : null;
|
|
@@ -19622,14 +19640,18 @@ var VaultClient = class extends SubgraphClient {
|
|
|
19622
19640
|
const normalizedProtocol = this.normalizeProtocolValue(protocol);
|
|
19623
19641
|
return Object.values(Protocol).find((protocolValue) => this.normalizeProtocolValue(protocolValue) === normalizedProtocol) || null;
|
|
19624
19642
|
}
|
|
19625
|
-
getProtocolBeaconNames(protocol) {
|
|
19643
|
+
getProtocolBeaconNames(protocol, chainId) {
|
|
19626
19644
|
const resolvedProtocol = this.resolveProtocolEnum(protocol);
|
|
19627
19645
|
if (!resolvedProtocol) return [];
|
|
19628
19646
|
const protocolConfig = getAmmConfig(this.subgraphStudioKey)[resolvedProtocol];
|
|
19629
19647
|
const beaconNames = [];
|
|
19648
|
+
const chain = chainId ? chainIdToName(chainId) : void 0;
|
|
19630
19649
|
if (protocolConfig?.beaconContract) beaconNames.push(protocolConfig.beaconContract);
|
|
19631
19650
|
if (protocolConfig?.additionalBeaconContracts?.length) beaconNames.push(...protocolConfig.additionalBeaconContracts);
|
|
19632
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);
|
|
19633
19655
|
if (resolvedProtocol === Protocol.Blackhole) beaconNames.push(MultiPositionManagers.MultiPositionBlackholeOld);
|
|
19634
19656
|
const beaconAlias = getBeaconNameByProtocol(resolvedProtocol);
|
|
19635
19657
|
if (beaconAlias) beaconNames.push(beaconAlias);
|
|
@@ -19671,7 +19693,7 @@ var VaultClient = class extends SubgraphClient {
|
|
|
19671
19693
|
const normalizedExpectedBeacon = this.normalizeProtocolValue(expectedBeacon);
|
|
19672
19694
|
if (normalizedExpectedBeacon.length > 0 && normalizedBeaconName.includes(normalizedExpectedBeacon)) return true;
|
|
19673
19695
|
if (!resolvedProtocol) return false;
|
|
19674
|
-
return this.getProtocolBeaconNames(resolvedProtocol).some((beacon) => {
|
|
19696
|
+
return this.getProtocolBeaconNames(resolvedProtocol, vault.chainId).some((beacon) => {
|
|
19675
19697
|
const normalizedBeacon = this.normalizeProtocolValue(beacon);
|
|
19676
19698
|
return normalizedBeacon.length > 0 && normalizedBeaconName === normalizedBeacon;
|
|
19677
19699
|
});
|
|
@@ -19975,7 +19997,7 @@ var VaultClient = class extends SubgraphClient {
|
|
|
19975
19997
|
if (!chain) throw new Error(`Unsupported chainId: ${chainId}`);
|
|
19976
19998
|
const subgraphUrl = steerSubgraphConfig[chain];
|
|
19977
19999
|
if (!subgraphUrl) throw new Error(`No subgraph configured for chain: ${chain}`);
|
|
19978
|
-
const beaconNames = this.getProtocolBeaconNames(filter?.protocol);
|
|
20000
|
+
const beaconNames = this.getProtocolBeaconNames(filter?.protocol, chainId);
|
|
19979
20001
|
if (filter?.beaconName) beaconNames.push(filter.beaconName);
|
|
19980
20002
|
const uniqueBeaconNames = [...new Set(beaconNames.filter((name) => name.length > 0))];
|
|
19981
20003
|
const subgraphVaults = await this.subgraphVaultClient.getAllVaultsFromSubgraph({
|
|
@@ -20095,7 +20117,7 @@ var VaultClient = class extends SubgraphClient {
|
|
|
20095
20117
|
if (!chain) throw new Error(`Unsupported chainId: ${chainId}`);
|
|
20096
20118
|
const subgraphUrl = steerSubgraphConfig[chain];
|
|
20097
20119
|
if (!subgraphUrl) throw new Error(`No subgraph configured for chain: ${chain}`);
|
|
20098
|
-
const beaconNames = this.getProtocolBeaconNames(filter?.protocol);
|
|
20120
|
+
const beaconNames = this.getProtocolBeaconNames(filter?.protocol, chainId);
|
|
20099
20121
|
if (filter?.beaconName) beaconNames.push(filter.beaconName);
|
|
20100
20122
|
const uniqueBeaconNames = [...new Set(beaconNames.filter((name) => name.length > 0))];
|
|
20101
20123
|
const subgraphVaults = await this.subgraphVaultClient.getAllVaultsFromSubgraph({
|