@steerprotocol/sdk 3.0.20 → 3.0.21

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.cjs CHANGED
@@ -40695,6 +40695,76 @@ async function getSlot0(publicClient, poolAddress) {
40695
40695
  }
40696
40696
  }
40697
40697
  /**
40698
+ * Gets slot0 data from an Aerodrome V3 pool
40699
+ * @param poolAddress The pool address
40700
+ */
40701
+ async function getAerodromeSlot0(publicClient, poolAddress) {
40702
+ try {
40703
+ const slot0 = await publicClient.readContract({
40704
+ address: poolAddress,
40705
+ abi: [{
40706
+ inputs: [],
40707
+ name: "slot0",
40708
+ outputs: [
40709
+ {
40710
+ internalType: "uint160",
40711
+ name: "sqrtPriceX96",
40712
+ type: "uint160"
40713
+ },
40714
+ {
40715
+ internalType: "int24",
40716
+ name: "tick",
40717
+ type: "int24"
40718
+ },
40719
+ {
40720
+ internalType: "uint16",
40721
+ name: "observationIndex",
40722
+ type: "uint16"
40723
+ },
40724
+ {
40725
+ internalType: "uint16",
40726
+ name: "observationCardinality",
40727
+ type: "uint16"
40728
+ },
40729
+ {
40730
+ internalType: "uint16",
40731
+ name: "observationCardinalityNext",
40732
+ type: "uint16"
40733
+ },
40734
+ {
40735
+ internalType: "bool",
40736
+ name: "unlocked",
40737
+ type: "bool"
40738
+ }
40739
+ ],
40740
+ stateMutability: "view",
40741
+ type: "function"
40742
+ }],
40743
+ functionName: "slot0"
40744
+ });
40745
+ return {
40746
+ data: {
40747
+ sqrtPriceX96: slot0[0],
40748
+ tick: Number(slot0[1]),
40749
+ observationIndex: slot0[2],
40750
+ observationCardinality: slot0[3],
40751
+ observationCardinalityNext: slot0[4],
40752
+ feeProtocol: 0,
40753
+ unlocked: slot0[5]
40754
+ },
40755
+ status: 200,
40756
+ success: true
40757
+ };
40758
+ } catch (error) {
40759
+ return {
40760
+ data: null,
40761
+ status: 500,
40762
+ success: false,
40763
+ error: error instanceof Error ? error.message : "Unknown error occurred"
40764
+ };
40765
+ }
40766
+ }
40767
+ /**
40698
40768
  * Gets global state from an Algebra pool
40699
40769
  * @param poolAddress The pool address
40700
40770
  * @param isDirectional Whether the pool is directional
@@ -40919,6 +40989,7 @@ async function getPoolState(publicClient, params) {
40919
40989
  error: poolSharkResponse.error
40920
40990
  };
40921
40991
  } else if (params.isAlgebraPool) stateResponse = await getGlobalState(publicClient, params.poolAddress, params.isAlgebraDirectionPool || false);
40992
+ else if (params.isAerodromePool) stateResponse = await getAerodromeSlot0(publicClient, params.poolAddress);
40922
40993
  else stateResponse = await getSlot0(publicClient, params.poolAddress);
40923
40994
  if (!stateResponse.success || !stateResponse.data) throw new Error(stateResponse.error || "Failed to read pool state");
40924
40995
  return {
@@ -41273,6 +41344,7 @@ var VaultDepositClient = class {
41273
41344
  const poolInstanceResponse = await this.getPoolInstance({
41274
41345
  vaultAddress,
41275
41346
  chain: { id: chainId },
41347
+ isAerodromePool: isAerodromeVault(protocol),
41276
41348
  isAlgebraPool: isAlgebraProtocol(protocol),
41277
41349
  isPoolSharkPool: isPoolSharkProtocol(protocol),
41278
41350
  isAlgebraIntegralPool: isAlgebraIntegralProtocol(protocol),
@@ -41363,9 +41435,14 @@ var VaultDepositClient = class {
41363
41435
  unlocked: poolSharkResponse.data.unlocked === 1
41364
41436
  }
41365
41437
  };
41366
- else slot0Response = poolSharkResponse;
41367
- }
41368
- if (params.isAlgebraPool) slot0Response = await getGlobalState(this.publicClient, poolData.data.id, params.isAlgebraDirectionPool);
41438
+ else slot0Response = {
41439
+ data: null,
41440
+ status: poolSharkResponse.status,
41441
+ success: false,
41442
+ error: poolSharkResponse.error
41443
+ };
41444
+ } else if (params.isAlgebraPool) slot0Response = await getGlobalState(this.publicClient, poolData.data.id, params.isAlgebraDirectionPool);
41445
+ else if (params.isAerodromePool) slot0Response = await getAerodromeSlot0(this.publicClient, poolData.data.id);
41369
41446
  else slot0Response = await getSlot0(this.publicClient, poolData.data.id);
41370
41447
  if (!slot0Response.success || !slot0Response.data) throw new Error("Failed to read pool state");
41371
41448
  const slot0 = slot0Response.data;
@@ -41690,6 +41767,7 @@ async function calculateLimitPrice(publicClient, params) {
41690
41767
  try {
41691
41768
  const slot0Data = await getPoolState(publicClient, {
41692
41769
  poolAddress: params.pool,
41770
+ isAerodromePool: params.ammType === AMMType.Aerodrome,
41693
41771
  isAlgebraPool: params.ammType === AMMType.Algebra,
41694
41772
  isAlgebraIntegralPool: params.ammType === AMMType.AlgebraIntegral,
41695
41773
  isAlgebraDirectionPool: params.ammType === AMMType.AlgebraDirectional,
@@ -41697,6 +41775,7 @@ async function calculateLimitPrice(publicClient, params) {
41697
41775
  });
41698
41776
  if (!slot0Data.success || !slot0Data.data) throw new Error(slot0Data.error || "Failed to get pool state");
41699
41777
  const sqrtPriceX96BigInt = getPoolPrice(slot0Data.data, {
41778
+ isAerodromePool: params.ammType === AMMType.Aerodrome,
41700
41779
  isAlgebraPool: params.ammType === AMMType.Algebra,
41701
41780
  isAlgebraIntegralPool: params.ammType === AMMType.AlgebraIntegral,
41702
41781
  isPoolSharkPool: false
@@ -41729,6 +41808,7 @@ async function getPoolSlot0(publicClient, poolAddress, ammType) {
41729
41808
  try {
41730
41809
  const poolState = await getPoolStateWithPrice(publicClient, {
41731
41810
  poolAddress,
41811
+ isAerodromePool: ammType === AMMType.Aerodrome,
41732
41812
  isAlgebraPool: ammType === AMMType.Algebra,
41733
41813
  isAlgebraIntegralPool: ammType === AMMType.AlgebraIntegral,
41734
41814
  isAlgebraDirectionPool: ammType === AMMType.AlgebraDirectional,