@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.browser.mjs +83 -3
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.cjs +83 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +83 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.browser.mjs
CHANGED
|
@@ -17357,6 +17357,76 @@ async function getSlot0(publicClient, poolAddress) {
|
|
|
17357
17357
|
}
|
|
17358
17358
|
}
|
|
17359
17359
|
/**
|
|
17360
|
+
* Gets slot0 data from an Aerodrome V3 pool
|
|
17361
|
+
* @param poolAddress The pool address
|
|
17362
|
+
*/
|
|
17363
|
+
async function getAerodromeSlot0(publicClient, poolAddress) {
|
|
17364
|
+
try {
|
|
17365
|
+
const slot0 = await publicClient.readContract({
|
|
17366
|
+
address: poolAddress,
|
|
17367
|
+
abi: [{
|
|
17368
|
+
inputs: [],
|
|
17369
|
+
name: "slot0",
|
|
17370
|
+
outputs: [
|
|
17371
|
+
{
|
|
17372
|
+
internalType: "uint160",
|
|
17373
|
+
name: "sqrtPriceX96",
|
|
17374
|
+
type: "uint160"
|
|
17375
|
+
},
|
|
17376
|
+
{
|
|
17377
|
+
internalType: "int24",
|
|
17378
|
+
name: "tick",
|
|
17379
|
+
type: "int24"
|
|
17380
|
+
},
|
|
17381
|
+
{
|
|
17382
|
+
internalType: "uint16",
|
|
17383
|
+
name: "observationIndex",
|
|
17384
|
+
type: "uint16"
|
|
17385
|
+
},
|
|
17386
|
+
{
|
|
17387
|
+
internalType: "uint16",
|
|
17388
|
+
name: "observationCardinality",
|
|
17389
|
+
type: "uint16"
|
|
17390
|
+
},
|
|
17391
|
+
{
|
|
17392
|
+
internalType: "uint16",
|
|
17393
|
+
name: "observationCardinalityNext",
|
|
17394
|
+
type: "uint16"
|
|
17395
|
+
},
|
|
17396
|
+
{
|
|
17397
|
+
internalType: "bool",
|
|
17398
|
+
name: "unlocked",
|
|
17399
|
+
type: "bool"
|
|
17400
|
+
}
|
|
17401
|
+
],
|
|
17402
|
+
stateMutability: "view",
|
|
17403
|
+
type: "function"
|
|
17404
|
+
}],
|
|
17405
|
+
functionName: "slot0"
|
|
17406
|
+
});
|
|
17407
|
+
return {
|
|
17408
|
+
data: {
|
|
17409
|
+
sqrtPriceX96: slot0[0],
|
|
17410
|
+
tick: Number(slot0[1]),
|
|
17411
|
+
observationIndex: slot0[2],
|
|
17412
|
+
observationCardinality: slot0[3],
|
|
17413
|
+
observationCardinalityNext: slot0[4],
|
|
17414
|
+
feeProtocol: 0,
|
|
17415
|
+
unlocked: slot0[5]
|
|
17416
|
+
},
|
|
17417
|
+
status: 200,
|
|
17418
|
+
success: true
|
|
17419
|
+
};
|
|
17420
|
+
} catch (error) {
|
|
17421
|
+
return {
|
|
17422
|
+
data: null,
|
|
17423
|
+
status: 500,
|
|
17424
|
+
success: false,
|
|
17425
|
+
error: error instanceof Error ? error.message : "Unknown error occurred"
|
|
17426
|
+
};
|
|
17427
|
+
}
|
|
17428
|
+
}
|
|
17429
|
+
/**
|
|
17360
17430
|
* Gets global state from an Algebra pool
|
|
17361
17431
|
* @param poolAddress The pool address
|
|
17362
17432
|
* @param isDirectional Whether the pool is directional
|
|
@@ -17581,6 +17651,7 @@ async function getPoolState(publicClient, params) {
|
|
|
17581
17651
|
error: poolSharkResponse.error
|
|
17582
17652
|
};
|
|
17583
17653
|
} else if (params.isAlgebraPool) stateResponse = await getGlobalState(publicClient, params.poolAddress, params.isAlgebraDirectionPool || false);
|
|
17654
|
+
else if (params.isAerodromePool) stateResponse = await getAerodromeSlot0(publicClient, params.poolAddress);
|
|
17584
17655
|
else stateResponse = await getSlot0(publicClient, params.poolAddress);
|
|
17585
17656
|
if (!stateResponse.success || !stateResponse.data) throw new Error(stateResponse.error || "Failed to read pool state");
|
|
17586
17657
|
return {
|
|
@@ -17935,6 +18006,7 @@ var VaultDepositClient = class {
|
|
|
17935
18006
|
const poolInstanceResponse = await this.getPoolInstance({
|
|
17936
18007
|
vaultAddress,
|
|
17937
18008
|
chain: { id: chainId },
|
|
18009
|
+
isAerodromePool: isAerodromeVault(protocol),
|
|
17938
18010
|
isAlgebraPool: isAlgebraProtocol(protocol),
|
|
17939
18011
|
isPoolSharkPool: isPoolSharkProtocol(protocol),
|
|
17940
18012
|
isAlgebraIntegralPool: isAlgebraIntegralProtocol(protocol),
|
|
@@ -18025,9 +18097,14 @@ var VaultDepositClient = class {
|
|
|
18025
18097
|
unlocked: poolSharkResponse.data.unlocked === 1
|
|
18026
18098
|
}
|
|
18027
18099
|
};
|
|
18028
|
-
else slot0Response =
|
|
18029
|
-
|
|
18030
|
-
|
|
18100
|
+
else slot0Response = {
|
|
18101
|
+
data: null,
|
|
18102
|
+
status: poolSharkResponse.status,
|
|
18103
|
+
success: false,
|
|
18104
|
+
error: poolSharkResponse.error
|
|
18105
|
+
};
|
|
18106
|
+
} else if (params.isAlgebraPool) slot0Response = await getGlobalState(this.publicClient, poolData.data.id, params.isAlgebraDirectionPool);
|
|
18107
|
+
else if (params.isAerodromePool) slot0Response = await getAerodromeSlot0(this.publicClient, poolData.data.id);
|
|
18031
18108
|
else slot0Response = await getSlot0(this.publicClient, poolData.data.id);
|
|
18032
18109
|
if (!slot0Response.success || !slot0Response.data) throw new Error("Failed to read pool state");
|
|
18033
18110
|
const slot0 = slot0Response.data;
|
|
@@ -18352,6 +18429,7 @@ async function calculateLimitPrice(publicClient, params) {
|
|
|
18352
18429
|
try {
|
|
18353
18430
|
const slot0Data = await getPoolState(publicClient, {
|
|
18354
18431
|
poolAddress: params.pool,
|
|
18432
|
+
isAerodromePool: params.ammType === AMMType.Aerodrome,
|
|
18355
18433
|
isAlgebraPool: params.ammType === AMMType.Algebra,
|
|
18356
18434
|
isAlgebraIntegralPool: params.ammType === AMMType.AlgebraIntegral,
|
|
18357
18435
|
isAlgebraDirectionPool: params.ammType === AMMType.AlgebraDirectional,
|
|
@@ -18359,6 +18437,7 @@ async function calculateLimitPrice(publicClient, params) {
|
|
|
18359
18437
|
});
|
|
18360
18438
|
if (!slot0Data.success || !slot0Data.data) throw new Error(slot0Data.error || "Failed to get pool state");
|
|
18361
18439
|
const sqrtPriceX96BigInt = getPoolPrice(slot0Data.data, {
|
|
18440
|
+
isAerodromePool: params.ammType === AMMType.Aerodrome,
|
|
18362
18441
|
isAlgebraPool: params.ammType === AMMType.Algebra,
|
|
18363
18442
|
isAlgebraIntegralPool: params.ammType === AMMType.AlgebraIntegral,
|
|
18364
18443
|
isPoolSharkPool: false
|
|
@@ -18391,6 +18470,7 @@ async function getPoolSlot0(publicClient, poolAddress, ammType) {
|
|
|
18391
18470
|
try {
|
|
18392
18471
|
const poolState = await getPoolStateWithPrice(publicClient, {
|
|
18393
18472
|
poolAddress,
|
|
18473
|
+
isAerodromePool: ammType === AMMType.Aerodrome,
|
|
18394
18474
|
isAlgebraPool: ammType === AMMType.Algebra,
|
|
18395
18475
|
isAlgebraIntegralPool: ammType === AMMType.AlgebraIntegral,
|
|
18396
18476
|
isAlgebraDirectionPool: ammType === AMMType.AlgebraDirectional,
|