@panoptic-eng/sdk 1.0.59 → 1.0.61
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/cow/index.js +1207 -484
- package/dist/cow/index.js.map +1 -1
- package/dist/{cow-CHb343la.js → cow-BItQK2Bi.js} +1 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -6
- package/dist/index.js.map +1 -1
- package/dist/{irm-BIaLQ-0n.js → irm-BEug2-TH.js} +2 -2
- package/dist/panoptic/v2/index.d.ts +62 -4
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +278 -83
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/panoptic/v2/react-public.d.ts +72 -6
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +294 -89
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{rates-COAJpKRd.js → rates-CPHxWqpT.js} +498 -482
- package/dist/{router-DiVbG7km.js → router-BZGHjEcU.js} +2 -2
- package/dist/{router-NeVmoCOu.js → router-kTiatP_R.js} +2 -2
- package/dist/{transactionFees-CNbjAigT.js → transactionFees-MocbcAyR.js} +10 -5
- package/dist/uniswap/index.js +724 -1
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-B23d5d4I.js → v2-odOz_0wM.js} +184 -201
- package/dist/vault-transaction-fees.d.ts +1 -0
- package/dist/vault-transaction-fees.d.ts.map +1 -1
- package/dist/vault-transaction-fees.js +10 -5
- package/dist/vault-transaction-fees.js.map +1 -1
- package/dist/{writes-CllMRkmo.js → writes-gs0k0uoN.js} +234 -38
- package/dist/zodiac/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -9397,6 +9397,10 @@ function extractErrorData(error) {
|
|
|
9397
9397
|
error.walk((e) => {
|
|
9398
9398
|
if (foundData) return false;
|
|
9399
9399
|
const node = e;
|
|
9400
|
+
if (typeof node.raw === "string" && node.raw.startsWith("0x") && node.raw.length > 10) {
|
|
9401
|
+
foundData = node.raw;
|
|
9402
|
+
return true;
|
|
9403
|
+
}
|
|
9400
9404
|
if (node.data && typeof node.data === "string" && node.data.startsWith("0x")) {
|
|
9401
9405
|
foundData = node.data;
|
|
9402
9406
|
return true;
|
|
@@ -9425,6 +9429,7 @@ function extractErrorData(error) {
|
|
|
9425
9429
|
let current = error;
|
|
9426
9430
|
const maxDepth = 10;
|
|
9427
9431
|
for (let i = 0; i < maxDepth && current; i++) {
|
|
9432
|
+
if (typeof current.raw === "string" && current.raw.startsWith("0x") && current.raw.length > 10) return current.raw;
|
|
9428
9433
|
if (current.data && typeof current.data === "string" && current.data.startsWith("0x")) return current.data;
|
|
9429
9434
|
if (current.data && typeof current.data === "object") {
|
|
9430
9435
|
const nested = current.data;
|
|
@@ -9438,7 +9443,7 @@ function extractErrorData(error) {
|
|
|
9438
9443
|
}
|
|
9439
9444
|
const obj = error;
|
|
9440
9445
|
if (obj.message && typeof obj.message === "string") {
|
|
9441
|
-
const signatureMatch = obj.message.match(/signature
|
|
9446
|
+
const signatureMatch = obj.message.match(/signature:?\s*["']?(0x[a-fA-F0-9]{8,})/i);
|
|
9442
9447
|
if (signatureMatch) return signatureMatch[1];
|
|
9443
9448
|
}
|
|
9444
9449
|
return null;
|
|
@@ -9987,6 +9992,21 @@ function isLoan(tokenId) {
|
|
|
9987
9992
|
return legs.length > 0 && legs.every(isLoanLeg);
|
|
9988
9993
|
}
|
|
9989
9994
|
/**
|
|
9995
|
+
* Index of the borrowed token when a TokenId is a single-leg loan.
|
|
9996
|
+
*
|
|
9997
|
+
* Returns undefined for credits, multi-leg loans, and positions mixing loans
|
|
9998
|
+
* with options: closing those can move both tokens for reasons other than
|
|
9999
|
+
* repaying one borrowed principal.
|
|
10000
|
+
*
|
|
10001
|
+
* @param tokenId - The TokenId to classify
|
|
10002
|
+
* @returns The borrowed token index (the leg's tokenType), or undefined
|
|
10003
|
+
*/
|
|
10004
|
+
function getSimpleLoanTokenIndex(tokenId) {
|
|
10005
|
+
const legs = decodeAllLegs(tokenId);
|
|
10006
|
+
if (legs.length !== 1 || !isLoanLeg(legs[0])) return void 0;
|
|
10007
|
+
return legs[0].tokenType === 0n ? 0n : 1n;
|
|
10008
|
+
}
|
|
10009
|
+
/**
|
|
9990
10010
|
* Check if a TokenId is a pure credit (all legs are credits).
|
|
9991
10011
|
*
|
|
9992
10012
|
* @param tokenId - The TokenId to check
|
|
@@ -11094,12 +11114,12 @@ function generateOverlappingTokenIds(params) {
|
|
|
11094
11114
|
//#region src/panoptic/v2/tokenId/split.ts
|
|
11095
11115
|
const POOL_ID_MASK$3 = (1n << TOKEN_ID_BITS.POOL_ID_SIZE) - 1n;
|
|
11096
11116
|
const MAX_UINT128$3 = (1n << 128n) - 1n;
|
|
11097
|
-
const MAX_UINT256$
|
|
11117
|
+
const MAX_UINT256$2 = (1n << 256n) - 1n;
|
|
11098
11118
|
function invalid(message) {
|
|
11099
11119
|
throw new PanopticValidationError(`splitTokenIdByTimescale: ${message}`);
|
|
11100
11120
|
}
|
|
11101
11121
|
function validateInput(tokenId, positionSize) {
|
|
11102
|
-
if (tokenId < 0n || tokenId > MAX_UINT256$
|
|
11122
|
+
if (tokenId < 0n || tokenId > MAX_UINT256$2) invalid("tokenId must fit in uint256");
|
|
11103
11123
|
if (positionSize <= 0n || positionSize > MAX_UINT128$3) invalid("positionSize must be between 1 and uint128.max");
|
|
11104
11124
|
const legs = decodeAllLegs(tokenId);
|
|
11105
11125
|
if (legs.length === 0) invalid("tokenId must contain at least one active leg");
|
|
@@ -12722,6 +12742,17 @@ function createTxResult(client, hash) {
|
|
|
12722
12742
|
* @returns TxResult
|
|
12723
12743
|
*/
|
|
12724
12744
|
async function submitWrite(params) {
|
|
12745
|
+
try {
|
|
12746
|
+
return await submitWriteRequest({
|
|
12747
|
+
...params,
|
|
12748
|
+
abi: [...params.abi, ...panopticErrorsAbi]
|
|
12749
|
+
});
|
|
12750
|
+
} catch (error) {
|
|
12751
|
+
if (error instanceof PanopticError) throw error;
|
|
12752
|
+
throw parsePanopticError(error)?.error ?? error;
|
|
12753
|
+
}
|
|
12754
|
+
}
|
|
12755
|
+
async function submitWriteRequest(params) {
|
|
12725
12756
|
const { client, walletClient, account, address, abi: abi$1, functionName, args, value, txOverrides } = params;
|
|
12726
12757
|
const broadcaster = txOverrides?.broadcaster;
|
|
12727
12758
|
if (broadcaster) {
|
|
@@ -21625,6 +21656,73 @@ async function optimizeTokenIdRiskPartners(params) {
|
|
|
21625
21656
|
return optimizedTokenId;
|
|
21626
21657
|
}
|
|
21627
21658
|
|
|
21659
|
+
//#endregion
|
|
21660
|
+
//#region src/panoptic/v2/reads/tickNetWindows.ts
|
|
21661
|
+
/**
|
|
21662
|
+
* Wide liquidity distributions from several adjacent `getTickNets*` windows.
|
|
21663
|
+
*
|
|
21664
|
+
* @module v2/reads/tickNetWindows
|
|
21665
|
+
*/
|
|
21666
|
+
/** Absolute Uniswap V3/V4 tick bounds. */
|
|
21667
|
+
const TICK_MIN$1 = -887272;
|
|
21668
|
+
const TICK_MAX$1 = 887272;
|
|
21669
|
+
/**
|
|
21670
|
+
* Join ascending, edge-sharing windows into one distribution anchored to `windows[mainIndex]`.
|
|
21671
|
+
*
|
|
21672
|
+
* Each `getTickNets*` window is a running sum of liquidityNet from its own first tick (only the
|
|
21673
|
+
* window holding the current tick is rescaled to the pool's liquidity), so a neighbour's values
|
|
21674
|
+
* are off by a constant. Adjacent windows share their edge tick; the offset that makes that tick
|
|
21675
|
+
* agree is applied to the whole neighbour. Stitching stops at the first window that does not share
|
|
21676
|
+
* an edge with the one before it.
|
|
21677
|
+
*/
|
|
21678
|
+
function stitchTickNetWindows(windows, mainIndex) {
|
|
21679
|
+
const main = windows[mainIndex];
|
|
21680
|
+
if (!main) return {
|
|
21681
|
+
ticks: [],
|
|
21682
|
+
liquidityNets: []
|
|
21683
|
+
};
|
|
21684
|
+
const ticks = [...main.ticks];
|
|
21685
|
+
const nets = [...main.liquidityNets];
|
|
21686
|
+
for (let i = mainIndex + 1; i < windows.length; i++) {
|
|
21687
|
+
const window = windows[i];
|
|
21688
|
+
const edge = ticks.length - 1;
|
|
21689
|
+
if (!window.ticks.length || window.ticks[0] !== ticks[edge]) break;
|
|
21690
|
+
const offset = nets[edge] - window.liquidityNets[0];
|
|
21691
|
+
ticks.push(...window.ticks.slice(1));
|
|
21692
|
+
nets.push(...window.liquidityNets.slice(1).map((value) => value + offset));
|
|
21693
|
+
}
|
|
21694
|
+
for (let i = mainIndex - 1; i >= 0; i--) {
|
|
21695
|
+
const window = windows[i];
|
|
21696
|
+
const last = window.ticks.length - 1;
|
|
21697
|
+
if (last < 0 || window.ticks[last] !== ticks[0]) break;
|
|
21698
|
+
const offset = nets[0] - window.liquidityNets[last];
|
|
21699
|
+
ticks.unshift(...window.ticks.slice(0, last));
|
|
21700
|
+
nets.unshift(...window.liquidityNets.slice(0, last).map((value) => value + offset));
|
|
21701
|
+
}
|
|
21702
|
+
return {
|
|
21703
|
+
ticks,
|
|
21704
|
+
liquidityNets: nets
|
|
21705
|
+
};
|
|
21706
|
+
}
|
|
21707
|
+
/**
|
|
21708
|
+
* Read the main window around `startTick` plus up to `windowsPerSide` windows of `nTicks` on each
|
|
21709
|
+
* side, in parallel, and stitch them. Side windows that would cross the tick bounds are skipped.
|
|
21710
|
+
*/
|
|
21711
|
+
async function readTickNetWindows({ startTick, mainNTicks, nTicks, tickSpacing, windowsPerSide, read }) {
|
|
21712
|
+
const center = Math.trunc(startTick / tickSpacing) * tickSpacing;
|
|
21713
|
+
const half = Number(nTicks) * tickSpacing;
|
|
21714
|
+
const mainHalf = Number(mainNTicks) * tickSpacing;
|
|
21715
|
+
const sideCenters = (direction) => Array.from({ length: windowsPerSide }, (_, k) => center + direction * (mainHalf + half + 2 * half * k)).filter((side) => side - half >= TICK_MIN$1 && side + half <= TICK_MAX$1);
|
|
21716
|
+
const below = sideCenters(-1).reverse();
|
|
21717
|
+
const above = sideCenters(1);
|
|
21718
|
+
const windows = await Promise.all([
|
|
21719
|
+
...below.map((side) => read(side, nTicks)),
|
|
21720
|
+
read(startTick, mainNTicks),
|
|
21721
|
+
...above.map((side) => read(side, nTicks))
|
|
21722
|
+
]);
|
|
21723
|
+
return stitchTickNetWindows(windows, below.length);
|
|
21724
|
+
}
|
|
21725
|
+
|
|
21628
21726
|
//#endregion
|
|
21629
21727
|
//#region src/panoptic/v2/reads/liquidity.ts
|
|
21630
21728
|
/**
|
|
@@ -21642,24 +21740,35 @@ async function optimizeTokenIdRiskPartners(params) {
|
|
|
21642
21740
|
async function getPoolLiquidities(params) {
|
|
21643
21741
|
const { client, poolAddress, queryAddress, startTick, nTicks, blockNumber } = params;
|
|
21644
21742
|
const targetBlockNumber = blockNumber ?? params._meta?.blockNumber ?? await client.getBlockNumber();
|
|
21645
|
-
const
|
|
21646
|
-
|
|
21647
|
-
|
|
21648
|
-
|
|
21649
|
-
|
|
21650
|
-
|
|
21651
|
-
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
|
|
21743
|
+
const windowsPerSide = params.windowsPerSide ?? 0;
|
|
21744
|
+
if (windowsPerSide > 0 && params.tickSpacing === void 0) throw new PanopticValidationError("getPoolLiquidities: tickSpacing is required with windowsPerSide");
|
|
21745
|
+
const [{ ticks, liquidityNets }, _meta] = await Promise.all([readTickNetWindows({
|
|
21746
|
+
startTick: Number(startTick),
|
|
21747
|
+
mainNTicks: nTicks,
|
|
21748
|
+
nTicks,
|
|
21749
|
+
tickSpacing: params.tickSpacing ?? 1,
|
|
21750
|
+
windowsPerSide,
|
|
21751
|
+
read: (centerTick, windowTicks) => client.readContract({
|
|
21752
|
+
address: queryAddress,
|
|
21753
|
+
abi: panopticQueryAbi$1,
|
|
21754
|
+
functionName: "getTickNets",
|
|
21755
|
+
args: [
|
|
21756
|
+
poolAddress,
|
|
21757
|
+
centerTick,
|
|
21758
|
+
windowTicks
|
|
21759
|
+
],
|
|
21760
|
+
blockNumber: targetBlockNumber
|
|
21761
|
+
}).then(([tickData, nets]) => ({
|
|
21762
|
+
ticks: tickData,
|
|
21763
|
+
liquidityNets: nets
|
|
21764
|
+
}))
|
|
21655
21765
|
}), params._meta ?? getBlockMeta({
|
|
21656
21766
|
client,
|
|
21657
21767
|
blockNumber: targetBlockNumber
|
|
21658
21768
|
})]);
|
|
21659
|
-
const [tickData, liquidityNets] = result;
|
|
21660
21769
|
return {
|
|
21661
|
-
ticks
|
|
21662
|
-
liquidityNets
|
|
21770
|
+
ticks,
|
|
21771
|
+
liquidityNets,
|
|
21663
21772
|
_meta
|
|
21664
21773
|
};
|
|
21665
21774
|
}
|
|
@@ -22738,6 +22847,32 @@ function computeUniswapFeesForBlock(blockData, legs) {
|
|
|
22738
22847
|
total1
|
|
22739
22848
|
};
|
|
22740
22849
|
}
|
|
22850
|
+
const MAX_UINT256$1 = 2n ** 256n - 1n;
|
|
22851
|
+
/**
|
|
22852
|
+
* Fee growth per unit of liquidity inside `[lowerTick, upperTick)` at one block,
|
|
22853
|
+
* wrapped to uint256 as the pool computes it. Diff two snapshots with
|
|
22854
|
+
* `feesFromFeeGrowthDelta` to get the fees a constant liquidity earned between them.
|
|
22855
|
+
*/
|
|
22856
|
+
function feeGrowthInsideX128(blockData, lowerTick, upperTick) {
|
|
22857
|
+
const lower = blockData.tickData.get(lowerTick);
|
|
22858
|
+
const upper = blockData.tickData.get(upperTick);
|
|
22859
|
+
if (!lower || !upper) return null;
|
|
22860
|
+
const { currentTick } = blockData;
|
|
22861
|
+
const inside = (global, lowerOutside, upperOutside) => {
|
|
22862
|
+
const below = currentTick >= lowerTick ? lowerOutside : global - lowerOutside;
|
|
22863
|
+
const above = currentTick < upperTick ? upperOutside : global - upperOutside;
|
|
22864
|
+
return global - below - above & MAX_UINT256$1;
|
|
22865
|
+
};
|
|
22866
|
+
return {
|
|
22867
|
+
feeGrowthInside0X128: inside(blockData.feeGrowthGlobal0, lower.feeGrowthOutside0, upper.feeGrowthOutside0),
|
|
22868
|
+
feeGrowthInside1X128: inside(blockData.feeGrowthGlobal1, lower.feeGrowthOutside1, upper.feeGrowthOutside1)
|
|
22869
|
+
};
|
|
22870
|
+
}
|
|
22871
|
+
/** Blocks before the chain's Multicall3 deployment need viem's deployless multicall. */
|
|
22872
|
+
function predatesMulticall3(client, blockNumber) {
|
|
22873
|
+
const deployedAt = client.chain?.contracts?.multicall3?.blockCreated;
|
|
22874
|
+
return blockNumber != null && deployedAt != null && blockNumber < BigInt(deployedAt);
|
|
22875
|
+
}
|
|
22741
22876
|
async function fetchUniswapBlockSnapshot(client, blockNumber, uniqueTicks, poolConfig) {
|
|
22742
22877
|
if (poolConfig.version === "v3") return fetchV3BlockSnapshot(client, poolConfig.poolAddress, blockNumber, uniqueTicks);
|
|
22743
22878
|
else return fetchV4BlockSnapshot(client, poolConfig.stateViewAddress, poolConfig.poolId, blockNumber, uniqueTicks);
|
|
@@ -22769,7 +22904,8 @@ async function fetchV3BlockSnapshot(client, poolAddress, blockNumber, uniqueTick
|
|
|
22769
22904
|
const results = await client.multicall({
|
|
22770
22905
|
contracts,
|
|
22771
22906
|
blockNumber,
|
|
22772
|
-
allowFailure: false
|
|
22907
|
+
allowFailure: false,
|
|
22908
|
+
deployless: predatesMulticall3(client, blockNumber)
|
|
22773
22909
|
});
|
|
22774
22910
|
const slot0Result = results[0];
|
|
22775
22911
|
const feeGrowthGlobal0 = results[1];
|
|
@@ -22814,7 +22950,8 @@ async function fetchV4BlockSnapshot(client, stateViewAddress, poolId, blockNumbe
|
|
|
22814
22950
|
const results = await client.multicall({
|
|
22815
22951
|
contracts,
|
|
22816
22952
|
blockNumber,
|
|
22817
|
-
allowFailure: false
|
|
22953
|
+
allowFailure: false,
|
|
22954
|
+
deployless: predatesMulticall3(client, blockNumber)
|
|
22818
22955
|
});
|
|
22819
22956
|
const slot0Result = results[0];
|
|
22820
22957
|
const feeGrowthResult = results[1];
|
|
@@ -23124,23 +23261,34 @@ function clampNTicks(startTick, tickSpacing, nTicks) {
|
|
|
23124
23261
|
* for the pool — only a deployed PanopticQuery on the chain.
|
|
23125
23262
|
*/
|
|
23126
23263
|
async function getUniswapV3PoolLiquidities(params) {
|
|
23127
|
-
const { client, poolAddress, queryAddress, startTick, nTicks } = params;
|
|
23128
|
-
|
|
23264
|
+
const { client, poolAddress, queryAddress, startTick, nTicks, windowsPerSide = 0 } = params;
|
|
23265
|
+
if (windowsPerSide > 0 && params.tickSpacing === void 0) throw new PanopticValidationError("getUniswapV3PoolLiquidities: tickSpacing is required with windowsPerSide");
|
|
23266
|
+
const safeN = clampNTicks(startTick, params.tickSpacing ?? 1, nTicks);
|
|
23129
23267
|
const _meta = await getBlockMeta({ client });
|
|
23130
|
-
const
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
23268
|
+
const { ticks, liquidityNets } = await readTickNetWindows({
|
|
23269
|
+
startTick,
|
|
23270
|
+
mainNTicks: safeN,
|
|
23271
|
+
nTicks,
|
|
23272
|
+
tickSpacing: params.tickSpacing ?? 1,
|
|
23273
|
+
windowsPerSide,
|
|
23274
|
+
read: (centerTick, windowTicks) => client.readContract({
|
|
23275
|
+
address: queryAddress,
|
|
23276
|
+
abi: panopticQueryAbi$1,
|
|
23277
|
+
functionName: "getTickNetsV3",
|
|
23278
|
+
args: [
|
|
23279
|
+
poolAddress,
|
|
23280
|
+
centerTick,
|
|
23281
|
+
windowTicks
|
|
23282
|
+
],
|
|
23283
|
+
blockNumber: _meta.blockNumber
|
|
23284
|
+
}).then(([windowTickData, windowNets]) => ({
|
|
23285
|
+
ticks: windowTickData,
|
|
23286
|
+
liquidityNets: windowNets
|
|
23287
|
+
}))
|
|
23140
23288
|
});
|
|
23141
23289
|
return {
|
|
23142
|
-
ticks
|
|
23143
|
-
liquidityNets
|
|
23290
|
+
ticks,
|
|
23291
|
+
liquidityNets,
|
|
23144
23292
|
_meta
|
|
23145
23293
|
};
|
|
23146
23294
|
}
|
|
@@ -23313,22 +23461,32 @@ async function getUniswapV4PoolLiquidities(params) {
|
|
|
23313
23461
|
const { client, queryAddress, poolManager, poolId, tickSpacing, startTick, nTicks } = params;
|
|
23314
23462
|
const safeN = clampNTicks(startTick, tickSpacing, nTicks);
|
|
23315
23463
|
const _meta = await getBlockMeta({ client });
|
|
23316
|
-
const
|
|
23317
|
-
|
|
23318
|
-
|
|
23319
|
-
|
|
23320
|
-
|
|
23321
|
-
|
|
23322
|
-
|
|
23323
|
-
|
|
23324
|
-
|
|
23325
|
-
|
|
23326
|
-
|
|
23327
|
-
|
|
23464
|
+
const { ticks, liquidityNets } = await readTickNetWindows({
|
|
23465
|
+
startTick,
|
|
23466
|
+
mainNTicks: safeN,
|
|
23467
|
+
nTicks,
|
|
23468
|
+
tickSpacing,
|
|
23469
|
+
windowsPerSide: params.windowsPerSide ?? 0,
|
|
23470
|
+
read: (centerTick, windowTicks) => client.readContract({
|
|
23471
|
+
address: queryAddress,
|
|
23472
|
+
abi: panopticQueryAbi$1,
|
|
23473
|
+
functionName: "getTickNetsV4",
|
|
23474
|
+
args: [
|
|
23475
|
+
poolManager,
|
|
23476
|
+
poolId,
|
|
23477
|
+
tickSpacing,
|
|
23478
|
+
centerTick,
|
|
23479
|
+
windowTicks
|
|
23480
|
+
],
|
|
23481
|
+
blockNumber: _meta.blockNumber
|
|
23482
|
+
}).then(([windowTickData, windowNets]) => ({
|
|
23483
|
+
ticks: windowTickData,
|
|
23484
|
+
liquidityNets: windowNets
|
|
23485
|
+
}))
|
|
23328
23486
|
});
|
|
23329
23487
|
return {
|
|
23330
|
-
ticks
|
|
23331
|
-
liquidityNets
|
|
23488
|
+
ticks,
|
|
23489
|
+
liquidityNets,
|
|
23332
23490
|
_meta
|
|
23333
23491
|
};
|
|
23334
23492
|
}
|
|
@@ -27851,6 +28009,62 @@ async function getLoanPositionsForToken(client, poolAddress, account, existingPo
|
|
|
27851
28009
|
};
|
|
27852
28010
|
});
|
|
27853
28011
|
}
|
|
28012
|
+
async function buildRepayDispatch(params) {
|
|
28013
|
+
const { client, account, poolAddress, chainId, token, amount, slippageBps, existingPositionIds, builderCode = 0n } = params;
|
|
28014
|
+
if (amount <= 0n) throw new Error("Repayment amount must be positive");
|
|
28015
|
+
const pool = await getPool({
|
|
28016
|
+
client,
|
|
28017
|
+
poolAddress,
|
|
28018
|
+
chainId
|
|
28019
|
+
});
|
|
28020
|
+
const tokenIndex = resolveTokenIndex(token, pool.collateralTracker0.token, pool.collateralTracker1.token);
|
|
28021
|
+
const loans = await getLoanPositionsForToken(client, poolAddress, account, existingPositionIds, tokenIndex);
|
|
28022
|
+
if (loans.length === 0) throw new NoLoanPositionsError(token);
|
|
28023
|
+
const totalDebt = loans.reduce((sum$1, l) => sum$1 + l.tokenAmount, 0n);
|
|
28024
|
+
const loanIds = loans.map((l) => l.tokenId);
|
|
28025
|
+
const remainder = totalDebt > amount ? totalDebt - amount : 0n;
|
|
28026
|
+
const { low: tickLimitLow, high: tickLimitHigh } = tickLimits(pool.currentTick, slippageBps);
|
|
28027
|
+
const ascendingLimits = [
|
|
28028
|
+
tickLimitLow,
|
|
28029
|
+
tickLimitHigh,
|
|
28030
|
+
0n
|
|
28031
|
+
];
|
|
28032
|
+
const nonLoanIds = existingPositionIds.filter((id) => !loanIds.includes(id));
|
|
28033
|
+
const opsPositionIds = [...loanIds];
|
|
28034
|
+
const opsSizes = loanIds.map(() => 0n);
|
|
28035
|
+
const opsLimits = loanIds.map(() => ascendingLimits);
|
|
28036
|
+
let finalPositionIdList;
|
|
28037
|
+
if (remainder > 0n) {
|
|
28038
|
+
const { tokenId: newLoanId, adjustedSize } = buildUniqueLoan(pool.poolId, tokenIndex, tokenIndex, pool.currentTick, pool.tickSpacing, nonLoanIds, remainder);
|
|
28039
|
+
opsPositionIds.push(newLoanId);
|
|
28040
|
+
opsSizes.push(adjustedSize);
|
|
28041
|
+
opsLimits.push(ascendingLimits);
|
|
28042
|
+
finalPositionIdList = [...nonLoanIds, newLoanId];
|
|
28043
|
+
} else finalPositionIdList = nonLoanIds;
|
|
28044
|
+
return {
|
|
28045
|
+
positionIdList: opsPositionIds,
|
|
28046
|
+
finalPositionIdList,
|
|
28047
|
+
positionSizes: opsSizes,
|
|
28048
|
+
tickAndSpreadLimits: opsLimits,
|
|
28049
|
+
usePremiaAsCollateral: false,
|
|
28050
|
+
builderCode
|
|
28051
|
+
};
|
|
28052
|
+
}
|
|
28053
|
+
/** Preview the same full or partial repayment dispatch used by smartRepay. */
|
|
28054
|
+
async function previewRepay(params) {
|
|
28055
|
+
const dispatch$1 = await buildRepayDispatch(params);
|
|
28056
|
+
const simulation = await simulateDispatch({
|
|
28057
|
+
client: params.client,
|
|
28058
|
+
account: params.account,
|
|
28059
|
+
poolAddress: params.poolAddress,
|
|
28060
|
+
existingPositionIdList: params.existingPositionIds,
|
|
28061
|
+
...dispatch$1
|
|
28062
|
+
});
|
|
28063
|
+
return {
|
|
28064
|
+
dispatch: dispatch$1,
|
|
28065
|
+
simulation
|
|
28066
|
+
};
|
|
28067
|
+
}
|
|
27854
28068
|
/**
|
|
27855
28069
|
* Smart repay: burns all loan positions for a token and optionally re-opens a smaller one.
|
|
27856
28070
|
*
|
|
@@ -27864,37 +28078,9 @@ async function getLoanPositionsForToken(client, poolAddress, account, existingPo
|
|
|
27864
28078
|
* @returns TxResult
|
|
27865
28079
|
*/
|
|
27866
28080
|
async function smartRepay(params) {
|
|
27867
|
-
const { client, walletClient, account, poolAddress,
|
|
28081
|
+
const { client, walletClient, account, poolAddress, txOverrides } = params;
|
|
27868
28082
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
|
27869
|
-
const
|
|
27870
|
-
client,
|
|
27871
|
-
poolAddress,
|
|
27872
|
-
chainId
|
|
27873
|
-
});
|
|
27874
|
-
const tokenIndex = resolveTokenIndex(token, pool.collateralTracker0.token, pool.collateralTracker1.token);
|
|
27875
|
-
const loans = await getLoanPositionsForToken(client, poolAddress, account, existingPositionIds, tokenIndex);
|
|
27876
|
-
if (loans.length === 0) throw new NoLoanPositionsError(token);
|
|
27877
|
-
const totalDebt = loans.reduce((sum$1, l) => sum$1 + l.tokenAmount, 0n);
|
|
27878
|
-
const loanIds = loans.map((l) => l.tokenId);
|
|
27879
|
-
const remainder = totalDebt > amount ? totalDebt - amount : 0n;
|
|
27880
|
-
const { low: tickLimitLow, high: tickLimitHigh } = tickLimits(pool.currentTick, slippageBps);
|
|
27881
|
-
const ascendingLimits = [
|
|
27882
|
-
Number(tickLimitLow),
|
|
27883
|
-
Number(tickLimitHigh),
|
|
27884
|
-
0
|
|
27885
|
-
];
|
|
27886
|
-
const nonLoanIds = existingPositionIds.filter((id) => !loanIds.includes(id));
|
|
27887
|
-
const opsPositionIds = [...loanIds];
|
|
27888
|
-
const opsSizes = loanIds.map(() => 0n);
|
|
27889
|
-
const opsLimits = loanIds.map(() => ascendingLimits);
|
|
27890
|
-
let finalPositionIdList;
|
|
27891
|
-
if (remainder > 0n) {
|
|
27892
|
-
const { tokenId: newLoanId, adjustedSize } = buildUniqueLoan(pool.poolId, tokenIndex, tokenIndex, pool.currentTick, pool.tickSpacing, nonLoanIds, remainder);
|
|
27893
|
-
opsPositionIds.push(newLoanId);
|
|
27894
|
-
opsSizes.push(adjustedSize);
|
|
27895
|
-
opsLimits.push(ascendingLimits);
|
|
27896
|
-
finalPositionIdList = [...nonLoanIds, newLoanId];
|
|
27897
|
-
} else finalPositionIdList = nonLoanIds;
|
|
28083
|
+
const intent = await buildRepayDispatch(params);
|
|
27898
28084
|
try {
|
|
27899
28085
|
return await submitWrite({
|
|
27900
28086
|
client,
|
|
@@ -27904,12 +28090,12 @@ async function smartRepay(params) {
|
|
|
27904
28090
|
abi: panopticPoolV2Abi,
|
|
27905
28091
|
functionName: "dispatch",
|
|
27906
28092
|
args: [
|
|
27907
|
-
|
|
27908
|
-
finalPositionIdList,
|
|
27909
|
-
|
|
27910
|
-
|
|
27911
|
-
|
|
27912
|
-
builderCode
|
|
28093
|
+
intent.positionIdList,
|
|
28094
|
+
intent.finalPositionIdList,
|
|
28095
|
+
intent.positionSizes,
|
|
28096
|
+
intent.tickAndSpreadLimits.map((limits) => limits.map(Number)),
|
|
28097
|
+
intent.usePremiaAsCollateral,
|
|
28098
|
+
intent.builderCode
|
|
27913
28099
|
],
|
|
27914
28100
|
txOverrides
|
|
27915
28101
|
});
|
|
@@ -28860,6 +29046,15 @@ async function quoteOneTokenFlow(params) {
|
|
|
28860
29046
|
detail: recovery.detail,
|
|
28861
29047
|
error: recovery.error
|
|
28862
29048
|
};
|
|
29049
|
+
if (minSwapRatioBps > 0n) {
|
|
29050
|
+
const residualInTargetTerms = convertToTokenIndex(abs(recovery.quote.netTokenOutChange), otherTokenIndex, targetTokenIndex, pool.sqrtPriceX96);
|
|
29051
|
+
const settledInTargetTerms = abs(recovery.quote.netTokenInChange) + residualInTargetTerms;
|
|
29052
|
+
if (residualInTargetTerms * BPS_DENOMINATOR$2 >= minSwapRatioBps * settledInTargetTerms) return {
|
|
29053
|
+
available: false,
|
|
29054
|
+
reason: "residual-not-single-token",
|
|
29055
|
+
detail: `covering the shortfall leaves ${recovery.quote.netTokenOutChange} of the other token (${residualInTargetTerms} in target token terms) against a target flow of ${recovery.quote.netTokenInChange}`
|
|
29056
|
+
};
|
|
29057
|
+
}
|
|
28863
29058
|
return {
|
|
28864
29059
|
available: true,
|
|
28865
29060
|
quote: {
|
|
@@ -31838,5 +32033,5 @@ function preparePositionValueCurve(curve) {
|
|
|
31838
32033
|
}
|
|
31839
32034
|
|
|
31840
32035
|
//#endregion
|
|
31841
|
-
export { AccountInsolventError, AlreadyInitializedError, BORROW_INDEX_BITS, BPS_DENOMINATOR, BPS_SCALE, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_MIN_SWAP_RATIO_BPS, DEFAULT_RECONNECT_CONFIG, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, MARKET_INDICATOR_PERIODS, MAX_TICK, MAX_TRACKED_CHUNKS, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MIN_TICK, MaxRetriesExceededError, MissingPositionIdsError, NO_LOWER_LIQUIDATION_TICK, NO_UPPER_LIQUIDATION_TICK, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, ORACLE_EPOCH_SECONDS, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, RATE_AT_TARGET_BITS, REORG_DEPTH, REQUIRED_BASE_ERROR_SENTINEL, ReentrancyError, RpcError, RpcResponseError, SCHEMA_VERSION, SECONDS_PER_YEAR, STANDARD_TICK_WIDTHS, STORAGE_PREFIX, STRIKE_LADDER_TARGET_STRIKES, SafeModeError, StaleDataError, StaleOracleError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UNREALIZED_INTEREST_BITS, UTILIZATION_DENOMINATOR, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, VARIANCE_RATIO_LAG, WAD, WrongPoolIdError, WrongUniswapPoolError, ZERO_COLLATERAL, ZERO_VALUATION, ZeroAddressError, ZeroCollateralRequirementError, addLegToTokenId, addPendingPosition, addTrackedChunks, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, apportion, approve, approveAndWait, approvePool, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertLpPositionFunded, assertTradeable, borrow, borrowAndWait, buildBatchDispatchArgs, buildCreditSwapCall, buildCreditWrappedDispatch, buildOpenPositionCalldata, buildProtectedSettleDispatch, buildProtectedSettlePlan, buildSettleSequenceCalls, buildSfpmSwapCalldata, buildSfpmSwapPlan, buildTemporaryLoanRecoveryDispatch, buildTokenShortfallRecoveryDispatch, buildUniqueCredit, buildUniqueLoan, buildUniqueWidthZeroLeg, calculateAccountGreeksPure, calculateMarketIndicator, calculatePortfolioDelta, calculatePortfolioGamma, calculatePortfolioGreeks, calculatePortfolioValue, calculatePositionDelta, calculatePositionDeltaDebtOnly, calculatePositionDeltaWithSwap, calculatePositionGamma, calculatePositionGreeks, calculatePositionValue, calculatePositionValues, calculateResyncBlock, calculateSpreadWad, calculateVarianceProfile, cancelTransaction, checkApproval, checkCollateralAcrossTicks, classifyStrategyGroups, classifyStrike, cleanupStalePendingPositions, clearCheckpoint, clearPendingPositions, clearTrackedChunks, clearTrackedPositions, clearTradeHistory, closePosition, closePositionAndWait, collateralCurveTicks, collateralRuleKindFor, collateralTrackerV2Abi, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, countLegs, createEventPoller, createEventSubscription, createFileStorage, createFlowNeutralTokenId, createMemoryStorage, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeLeg, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePanopticTokenURI, decodePoolId, decodeTickSpacing, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveSupplyRatePerSecWad, deriveUniqueTokenId, detectReorg, diagnoseOracleSafeMode, dispatch, dispatchAndWait, emptyLiquidateParams, encodeLeg, encodePoolId, encodePoolKeyBytes, encodeV3PoolKeyBytes, encodeV4PoolId, ensureSfpmV3PoolInitialized, estimateBlockNumbers, estimateCollateralBreakdown, estimateCollateralRequired, executeBatchDispatch, executeBatchDispatchAndWait, executeSettleSequence, executeSettleSequenceAndWait, failPendingPosition, feesFromFeeGrowthDelta, fetchPoolId, fetchSfpmV3PoolId, forceExercise, forceExerciseAndWait, formatBlockNumber, formatBps, formatCompact, formatDatetime, formatDuration, formatDurationSeconds, formatFeeTier, formatGas, formatGwei, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatPoolIdHex, formatPriceRange, formatRateWad, formatRatioPercent, formatTick, formatTickRange, formatTimestamp, formatTimestampLocale, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatTokenIdHex, formatTokenIdShort, formatTxHash, formatUtilization, formatWad, formatWadPercent, formatWadSigned, formatWei, generateOverlappingTokenIds, getAccountBuyingPower, getAccountCollateral, getAccountGreeks, getAccountHistory, getAccountPremia, getAccountSummaryBasic, getAccountSummaryRisk, getAssetIndex, getBlockMeta, getChainDeployment, getChunkLiquidities, getChunkSpreads, getClosedPositions, getClosedPositionsKey, getCollateralAddresses, getCollateralCurve, getCollateralCurveInputs, getCollateralData, getCollateralRequiredBase, getCollateralSharePrices, getCollateralTotalAssetsBatch, getCurrentRates, getDeltaHedgeParams, getEnforcedTickLimits, getExecutableLpMaxSize, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getForfeitablePremium, getGuardianUnlockState, getHedgeLimits, getInterestState, getIrmCurrent, getIrmCurve, getItmAmounts, getLegDelta, getLegDeltaInVaultFrame, getLegGamma, getLegNetValueWidth0, getLegValue, getLiquidationPrices, getMarginBuffer, getMaxPositionSize, getMaxRedeem, getMaxWithdrawable, getNativeTokenPrice, getNetLiquidationValue, getNetLiquidationValues, getNotEnoughTokensError, getOpenPositionIds, getOpenPositionPreview, getOracleRiskParameters, getOracleState, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPendingPositionsKey, getPool, getPoolCurrentTick, getPoolDeploymentBlock, getPoolDisplayId, getPoolLiquidities, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPortfolioValue, getPosition, getPositionChunkData, getPositionDeltaMetrics, getPositionEnrichmentData, getPositionGreeks, getPositionMetaKey, getPositionValueCurve, getPositions, getPositionsKey, getPositionsWithPremia, getPriceHistory, getPricesAtTick, getRealizedPnL, getRequiredCreditForITM, getRiskParameters, getSafeMode, getSchemaVersionKey, getStreamiaHistory, getSyncCheckpointKey, getSyncStatus, getTickSpacing, getTokenListId, getTrackedChunks, getTrackedChunksKey, getTrackedPositionIds, getTradeHistory, getUniswapFeeHistory, getUniswapV3LpPositionState, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4LpPositionState, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, getUtilization, hasLoanOrCredit, hasLongLeg, interpolateBlocks, isCall, isCredit, isCreditLeg, isDefinedRisk, isGasError, isInputListFailError, isLiquidatable, isLoan, isLoanLeg, isNonceError, isPanopticErrorType, isPositionTracked, isRetryableRpcError, isShortOnly, isSpread, isSupportedChain, isolateGroupTokenId, jsonSerializer, ladderStrikeSequence, liquidate, liquidateAndWait, loadCheckpoint, logReturns, marketPnlInQuote, marketRiskFromValues, marketScenario, minePoolAddress, mint, mintAndWait, mintableAfterBuffer, multicallRead, netLiquidationValueInQuote, openPosition, openPositionAndWait, optimizeTokenIdRiskPartners, oracleEpochAt, orderListForSettle, packMarketState, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi, parseBps, parseCollateralLog, parsePanopticError, parsePoolLog, parseTokenAmount, parseTokenListId, parseWad, planDeriveStrategy, pokeOracle, pokeOracleAndWait, positionValueKey, positionValueTicks, prepareIndicatorCandles, preparePositionValue, preparePositionValueCurve, previewBorrow, previewDeposit, previewMint, previewRedeem, previewUnwrap, previewWithdraw, previewWrap, priceToTick, publicBroadcaster, quoteLiquidation, quoteOneTokenFlow, quoteSfpmSwap, quoteTemporaryLoanRecovery, quoteTokenShortfallRecovery, quoteV3ExactIn, ratePerSecWadToAprPct, realizedBeta, reconstructFromEvents, recoverSnapshot, recoverSnapshotFromTx, redeem, redeemAndWait, removeTrackedChunks, repay, repayAndWait, requireChainDeployment, resolveBlockNumbers, resolveLadderStrike, resolvePanopticPoolFromPoolId, resolveTokenIndex, resolveUniswapV4PoolKey, riskEngineAbi, rollPosition, rollPositionAndWait, roundToTickSpacing, saveCheckpoint, saveClosedPosition, scaleCollateralRequired, scanChunks, screenAccountExact, selectDispatchForAccount, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, settlePremiumFrom, settlePremiumFromAndWait, simulateBatchDispatch, simulateClosePosition, simulateDeployNewPool, simulateDeposit, simulateDispatch, simulateForceExercise, simulateLiquidate, simulateOpenPosition, simulateSFPMBurn, simulateSFPMMint, simulateSettle, simulateSettlePremiumBatch, simulateSettlePremiumFrom, simulateSettleSequence, simulateSwapExactIn, simulateSwapExactOut, simulateWithTokenFlow, simulateWithdraw, slippageBpsToTickDistance, smartRepay, smartRepayAndWait, speedUpTransaction, splitTokenIdByTimescale, sqrtPriceX96ToPriceDecimalScaled, sqrtPriceX96ToTick, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96, toVaultFrameAtTick, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, utilizationBpsToWad, utilizationPctToWad, validateBatch, validateBuilderCode, validatePoolId, verifyBlockContinuity, watchEvents, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
|
|
32036
|
+
export { AccountInsolventError, AlreadyInitializedError, BORROW_INDEX_BITS, BPS_DENOMINATOR, BPS_SCALE, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_MIN_SWAP_RATIO_BPS, DEFAULT_RECONNECT_CONFIG, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, MARKET_INDICATOR_PERIODS, MAX_TICK, MAX_TRACKED_CHUNKS, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MIN_TICK, MaxRetriesExceededError, MissingPositionIdsError, NO_LOWER_LIQUIDATION_TICK, NO_UPPER_LIQUIDATION_TICK, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, ORACLE_EPOCH_SECONDS, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, RATE_AT_TARGET_BITS, REORG_DEPTH, REQUIRED_BASE_ERROR_SENTINEL, ReentrancyError, RpcError, RpcResponseError, SCHEMA_VERSION, SECONDS_PER_YEAR, STANDARD_TICK_WIDTHS, STORAGE_PREFIX, STRIKE_LADDER_TARGET_STRIKES, SafeModeError, StaleDataError, StaleOracleError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UNREALIZED_INTEREST_BITS, UTILIZATION_DENOMINATOR, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, VARIANCE_RATIO_LAG, WAD, WrongPoolIdError, WrongUniswapPoolError, ZERO_COLLATERAL, ZERO_VALUATION, ZeroAddressError, ZeroCollateralRequirementError, addLegToTokenId, addPendingPosition, addTrackedChunks, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, apportion, approve, approveAndWait, approvePool, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertLpPositionFunded, assertTradeable, borrow, borrowAndWait, buildBatchDispatchArgs, buildCreditSwapCall, buildCreditWrappedDispatch, buildOpenPositionCalldata, buildProtectedSettleDispatch, buildProtectedSettlePlan, buildSettleSequenceCalls, buildSfpmSwapCalldata, buildSfpmSwapPlan, buildTemporaryLoanRecoveryDispatch, buildTokenShortfallRecoveryDispatch, buildUniqueCredit, buildUniqueLoan, buildUniqueWidthZeroLeg, calculateAccountGreeksPure, calculateMarketIndicator, calculatePortfolioDelta, calculatePortfolioGamma, calculatePortfolioGreeks, calculatePortfolioValue, calculatePositionDelta, calculatePositionDeltaDebtOnly, calculatePositionDeltaWithSwap, calculatePositionGamma, calculatePositionGreeks, calculatePositionValue, calculatePositionValues, calculateResyncBlock, calculateSpreadWad, calculateVarianceProfile, cancelTransaction, checkApproval, checkCollateralAcrossTicks, classifyStrategyGroups, classifyStrike, cleanupStalePendingPositions, clearCheckpoint, clearPendingPositions, clearTrackedChunks, clearTrackedPositions, clearTradeHistory, closePosition, closePositionAndWait, collateralCurveTicks, collateralRuleKindFor, collateralTrackerV2Abi, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, countLegs, createEventPoller, createEventSubscription, createFileStorage, createFlowNeutralTokenId, createMemoryStorage, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeLeg, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePanopticTokenURI, decodePoolId, decodeTickSpacing, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveSupplyRatePerSecWad, deriveUniqueTokenId, detectReorg, diagnoseOracleSafeMode, dispatch, dispatchAndWait, emptyLiquidateParams, encodeLeg, encodePoolId, encodePoolKeyBytes, encodeV3PoolKeyBytes, encodeV4PoolId, ensureSfpmV3PoolInitialized, estimateBlockNumbers, estimateCollateralBreakdown, estimateCollateralRequired, executeBatchDispatch, executeBatchDispatchAndWait, executeSettleSequence, executeSettleSequenceAndWait, failPendingPosition, feeGrowthInsideX128, feesFromFeeGrowthDelta, fetchPoolId, fetchSfpmV3PoolId, fetchUniswapFeeData, forceExercise, forceExerciseAndWait, formatBlockNumber, formatBps, formatCompact, formatDatetime, formatDuration, formatDurationSeconds, formatFeeTier, formatGas, formatGwei, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatPoolIdHex, formatPriceRange, formatRateWad, formatRatioPercent, formatTick, formatTickRange, formatTimestamp, formatTimestampLocale, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatTokenIdHex, formatTokenIdShort, formatTxHash, formatUtilization, formatWad, formatWadPercent, formatWadSigned, formatWei, generateOverlappingTokenIds, getAccountBuyingPower, getAccountCollateral, getAccountGreeks, getAccountHistory, getAccountPremia, getAccountSummaryBasic, getAccountSummaryRisk, getAssetIndex, getBlockMeta, getChainDeployment, getChunkLiquidities, getChunkSpreads, getClosedPositions, getClosedPositionsKey, getCollateralAddresses, getCollateralCurve, getCollateralCurveInputs, getCollateralData, getCollateralRequiredBase, getCollateralSharePrices, getCollateralTotalAssetsBatch, getCurrentRates, getDeltaHedgeParams, getEnforcedTickLimits, getExecutableLpMaxSize, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getForfeitablePremium, getGuardianUnlockState, getHedgeLimits, getInterestState, getIrmCurrent, getIrmCurve, getItmAmounts, getLegDelta, getLegDeltaInVaultFrame, getLegGamma, getLegNetValueWidth0, getLegValue, getLiquidationPrices, getMarginBuffer, getMaxPositionSize, getMaxRedeem, getMaxWithdrawable, getNativeTokenPrice, getNetLiquidationValue, getNetLiquidationValues, getNotEnoughTokensError, getOpenPositionIds, getOpenPositionPreview, getOracleRiskParameters, getOracleState, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPendingPositionsKey, getPool, getPoolCurrentTick, getPoolDeploymentBlock, getPoolDisplayId, getPoolLiquidities, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPortfolioValue, getPosition, getPositionChunkData, getPositionDeltaMetrics, getPositionEnrichmentData, getPositionGreeks, getPositionMetaKey, getPositionValueCurve, getPositions, getPositionsKey, getPositionsWithPremia, getPriceHistory, getPricesAtTick, getRealizedPnL, getRequiredCreditForITM, getRiskParameters, getSafeMode, getSchemaVersionKey, getSimpleLoanTokenIndex, getStreamiaHistory, getSyncCheckpointKey, getSyncStatus, getTickSpacing, getTokenListId, getTrackedChunks, getTrackedChunksKey, getTrackedPositionIds, getTradeHistory, getUniswapFeeHistory, getUniswapV3LpPositionState, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4LpPositionState, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, getUtilization, hasLoanOrCredit, hasLongLeg, interpolateBlocks, isCall, isCredit, isCreditLeg, isDefinedRisk, isGasError, isInputListFailError, isLiquidatable, isLoan, isLoanLeg, isNonceError, isPanopticErrorType, isPositionTracked, isRetryableRpcError, isShortOnly, isSpread, isSupportedChain, isolateGroupTokenId, jsonSerializer, ladderStrikeSequence, liquidate, liquidateAndWait, loadCheckpoint, logReturns, marketPnlInQuote, marketRiskFromValues, marketScenario, minePoolAddress, mint, mintAndWait, mintableAfterBuffer, multicallRead, netLiquidationValueInQuote, openPosition, openPositionAndWait, optimizeTokenIdRiskPartners, oracleEpochAt, orderListForSettle, packMarketState, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi, parseBps, parseCollateralLog, parsePanopticError, parsePoolLog, parseTokenAmount, parseTokenListId, parseWad, planDeriveStrategy, pokeOracle, pokeOracleAndWait, positionValueKey, positionValueTicks, prepareIndicatorCandles, preparePositionValue, preparePositionValueCurve, previewBorrow, previewDeposit, previewMint, previewRedeem, previewRepay, previewUnwrap, previewWithdraw, previewWrap, priceToTick, publicBroadcaster, quoteLiquidation, quoteOneTokenFlow, quoteSfpmSwap, quoteTemporaryLoanRecovery, quoteTokenShortfallRecovery, quoteV3ExactIn, ratePerSecWadToAprPct, realizedBeta, reconstructFromEvents, recoverSnapshot, recoverSnapshotFromTx, redeem, redeemAndWait, removeTrackedChunks, repay, repayAndWait, requireChainDeployment, resolveBlockNumbers, resolveLadderStrike, resolvePanopticPoolFromPoolId, resolveTokenIndex, resolveUniswapV4PoolKey, riskEngineAbi, rollPosition, rollPositionAndWait, roundToTickSpacing, saveCheckpoint, saveClosedPosition, scaleCollateralRequired, scanChunks, screenAccountExact, selectDispatchForAccount, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, settlePremiumFrom, settlePremiumFromAndWait, simulateBatchDispatch, simulateClosePosition, simulateDeployNewPool, simulateDeposit, simulateDispatch, simulateForceExercise, simulateLiquidate, simulateOpenPosition, simulateSFPMBurn, simulateSFPMMint, simulateSettle, simulateSettlePremiumBatch, simulateSettlePremiumFrom, simulateSettleSequence, simulateSwapExactIn, simulateSwapExactOut, simulateWithTokenFlow, simulateWithdraw, slippageBpsToTickDistance, smartRepay, smartRepayAndWait, speedUpTransaction, splitTokenIdByTimescale, sqrtPriceX96ToPriceDecimalScaled, sqrtPriceX96ToTick, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96, toVaultFrameAtTick, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, utilizationBpsToWad, utilizationPctToWad, validateBatch, validateBuilderCode, validatePoolId, verifyBlockContinuity, watchEvents, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
|
|
31842
32037
|
//# sourceMappingURL=index.js.map
|