@panoptic-eng/sdk 1.0.43 → 1.0.45
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 +10 -0
- package/dist/cow/index.js.map +1 -1
- package/dist/{cow-tRUtAUZy.js → cow-DIYBU1j9.js} +1 -1
- package/dist/{getTrackedPositionIds-ms3W9dYB.js → getTrackedPositionIds-CwBHzOO2.js} +1 -1
- package/dist/{greeks-GysWXct-.js → greeks-9aTE-DwO.js} +11 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/{irm-SPC2KxLA.js → irm-CvLqxTAo.js} +6 -7
- package/dist/panoptic/v2/greeks/index.js +10 -0
- package/dist/panoptic/v2/greeks/index.js.map +1 -1
- package/dist/panoptic/v2/index.d.ts +22 -6
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +24 -17
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/panoptic/v2/react-public.d.ts +22 -6
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +24 -17
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{router-BTfbaRfg.js → router-CUlQfzoc.js} +1 -1
- package/dist/{router-mLWy0MD9.js → router-OcmdMkXx.js} +2 -2
- package/dist/uniswap/index.js +10 -0
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-Djy0rVdh.js → v2-D5oeb9YD.js} +11 -14
- package/dist/{writes-_gfkBizf.js → writes-CG9mYns0.js} +4 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { StateViewAbi, formatTokenAmount, getAccountCollateral, panopticQueryAbi$1 as panopticQueryAbi, parseTokenAmount, readBlockAndAggregate, requireReturnData } from "./irm-
|
|
2
|
-
import { AccountInsolventError, ChunkLimitError, DEFAULT_VEGOID, InvalidHistoryRangeError, LEG_LIMITS, NotEnoughTokensError, PanopticError, PanopticValidationError, SafeModeError, StaleDataError, StorageDataNotFoundError, TOKEN_ID_BITS, UnhealthyPoolError, WrongUniswapPoolError, collateralTrackerV2Abi, decodeLeftRightSigned, decodeLeftRightUnsigned, decodePosition, decodePositionBalance, decodeTickSpacing, getBlockMeta, getClosedPositionsKey, getPendingPositionsKey, getPool, getPoolMetaKey, getPositionMetaKey, getPositionsKey, getTrackedChunksKey, getTrackedPositionIds, jsonSerializer, mintableAfterBuffer, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticPoolV2Abi, panopticQueryAbi as panopticQueryAbi$1, parsePanopticError, riskEngineAbi, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, uniswapV3PoolAbi } from "./getTrackedPositionIds-
|
|
3
|
-
import { MAX_TICK, MAX_TRACKED_CHUNKS, MIN_TICK, WAD, calculatePositionDelta, calculatePositionGamma, calculatePositionValue, priceToTick, sqrtPriceX96ToTick, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96 } from "./greeks-
|
|
4
|
-
import { addLegToTokenId, buildBatchDispatchArgs, buildUniqueCredit, buildUniqueLoan, countLegs, createTokenIdBuilder, decodeAllLegs, decodeTokenId, getCurrentPositionSizes, getPoolTokensForSimulation, loadCheckpoint, resolveTokenIndex, simulateOpenPosition, simulateWithTokenFlow } from "./writes-
|
|
1
|
+
import { StateViewAbi, formatTokenAmount, getAccountCollateral, panopticQueryAbi$1 as panopticQueryAbi, parseTokenAmount, readBlockAndAggregate, requireReturnData } from "./irm-CvLqxTAo.js";
|
|
2
|
+
import { AccountInsolventError, ChunkLimitError, DEFAULT_VEGOID, InvalidHistoryRangeError, LEG_LIMITS, NotEnoughTokensError, PanopticError, PanopticValidationError, SafeModeError, StaleDataError, StorageDataNotFoundError, TOKEN_ID_BITS, UnhealthyPoolError, WrongUniswapPoolError, collateralTrackerV2Abi, decodeLeftRightSigned, decodeLeftRightUnsigned, decodePosition, decodePositionBalance, decodeTickSpacing, getBlockMeta, getClosedPositionsKey, getPendingPositionsKey, getPool, getPoolMetaKey, getPositionMetaKey, getPositionsKey, getTrackedChunksKey, getTrackedPositionIds, jsonSerializer, mintableAfterBuffer, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticPoolV2Abi, panopticQueryAbi as panopticQueryAbi$1, parsePanopticError, riskEngineAbi, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, uniswapV3PoolAbi } from "./getTrackedPositionIds-CwBHzOO2.js";
|
|
3
|
+
import { MAX_TICK, MAX_TRACKED_CHUNKS, MIN_TICK, NO_LOWER_LIQUIDATION_TICK, NO_UPPER_LIQUIDATION_TICK, WAD, calculatePositionDelta, calculatePositionGamma, calculatePositionValue, priceToTick, sqrtPriceX96ToTick, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96 } from "./greeks-9aTE-DwO.js";
|
|
4
|
+
import { addLegToTokenId, buildBatchDispatchArgs, buildUniqueCredit, buildUniqueLoan, countLegs, createTokenIdBuilder, decodeAllLegs, decodeTokenId, getCurrentPositionSizes, getPoolTokensForSimulation, loadCheckpoint, resolveTokenIndex, simulateOpenPosition, simulateWithTokenFlow } from "./writes-CG9mYns0.js";
|
|
5
5
|
import { BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, ExecutionRevertedError, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, getAddress, keccak256, toHex, zeroAddress } from "viem";
|
|
6
6
|
import { multicall } from "viem/actions";
|
|
7
7
|
|
|
@@ -3406,8 +3406,6 @@ async function checkCollateralAcrossTicks(params) {
|
|
|
3406
3406
|
blockNumber: targetBlockNumber
|
|
3407
3407
|
})]);
|
|
3408
3408
|
const [balanceRequired, tickData, liquidationPrices] = result;
|
|
3409
|
-
const MIN_TICK$2 = -887272n;
|
|
3410
|
-
const MAX_TICK$2 = 887272n;
|
|
3411
3409
|
const dataPoints = balanceRequired.map((point, index) => ({
|
|
3412
3410
|
tick: BigInt(tickData[index]),
|
|
3413
3411
|
balance: point[0],
|
|
@@ -3417,8 +3415,8 @@ async function checkCollateralAcrossTicks(params) {
|
|
|
3417
3415
|
const liqPriceUp = BigInt(liquidationPrices[1]);
|
|
3418
3416
|
return {
|
|
3419
3417
|
dataPoints,
|
|
3420
|
-
liquidationPriceDown: liqPriceDown ===
|
|
3421
|
-
liquidationPriceUp: liqPriceUp ===
|
|
3418
|
+
liquidationPriceDown: liqPriceDown === NO_LOWER_LIQUIDATION_TICK ? null : liqPriceDown,
|
|
3419
|
+
liquidationPriceUp: liqPriceUp === NO_UPPER_LIQUIDATION_TICK ? null : liqPriceUp,
|
|
3422
3420
|
_meta
|
|
3423
3421
|
};
|
|
3424
3422
|
}
|
|
@@ -4255,8 +4253,6 @@ function calculateAccountGreeksPure(params) {
|
|
|
4255
4253
|
|
|
4256
4254
|
//#endregion
|
|
4257
4255
|
//#region src/panoptic/v2/reads/margin.ts
|
|
4258
|
-
const MIN_TICK$1 = -887272n;
|
|
4259
|
-
const MAX_TICK$1 = 887272n;
|
|
4260
4256
|
const FP96 = 1n << 96n;
|
|
4261
4257
|
const Q128$2 = 1n << 128n;
|
|
4262
4258
|
/** Cap for a usage ratio with no collateral behind it. */
|
|
@@ -4468,8 +4464,8 @@ async function getMarginBuffer(params) {
|
|
|
4468
4464
|
if (liqPricesResult) {
|
|
4469
4465
|
const liqPriceDown = BigInt(liqPricesResult[0]);
|
|
4470
4466
|
const liqPriceUp = BigInt(liqPricesResult[1]);
|
|
4471
|
-
lowerLiquidationTick = liqPriceDown ===
|
|
4472
|
-
upperLiquidationTick = liqPriceUp ===
|
|
4467
|
+
lowerLiquidationTick = liqPriceDown === NO_LOWER_LIQUIDATION_TICK ? null : liqPriceDown;
|
|
4468
|
+
upperLiquidationTick = liqPriceUp === NO_UPPER_LIQUIDATION_TICK ? null : liqPriceUp;
|
|
4473
4469
|
if (lowerLiquidationTick !== null && upperLiquidationTick !== null) {
|
|
4474
4470
|
const distLower = currentTick - lowerLiquidationTick;
|
|
4475
4471
|
const distUpper = upperLiquidationTick - currentTick;
|
|
@@ -5133,8 +5129,9 @@ function computeUniswapFeesForBlock(blockData, legs) {
|
|
|
5133
5129
|
const feesAbove1 = currentTick < leg.upperTick ? upper.feeGrowthOutside1 : feeGrowthGlobal1 - upper.feeGrowthOutside1;
|
|
5134
5130
|
const fees0 = (feeGrowthGlobal0 - feesBelow0 - feesAbove0) * leg.liquidity / (1n << 128n);
|
|
5135
5131
|
const fees1 = (feeGrowthGlobal1 - feesBelow1 - feesAbove1) * leg.liquidity / (1n << 128n);
|
|
5136
|
-
|
|
5137
|
-
|
|
5132
|
+
const direction = leg.isLong === true ? -1n : 1n;
|
|
5133
|
+
total0 += direction * fees0;
|
|
5134
|
+
total1 += direction * fees1;
|
|
5138
5135
|
}
|
|
5139
5136
|
return {
|
|
5140
5137
|
total0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BatchValidationError, DEFAULT_VEGOID, InputListFailError, InvalidTickLimitsError, InvalidTokenIdParameterError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LoanSlotExhaustedError, MaxRetriesExceededError, MissingPositionIdsError, NoLoanPositionsError, OracleRateLimitedError, PanopticError, PositionSnapshotNotFoundError, ProviderLagError, STRIKE_CONVERSION_FACTOR, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, collateralTrackerV2Abi, createTxResult, decodeLeftRightUnsigned, decodeOracleTiming, getBlockMeta, getOpenPositionIds, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositions, getPositionsKey, getSyncCheckpointKey, getTrackedPositionIds, jsonSerializer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, parsePanopticError, submitWrite } from "./getTrackedPositionIds-
|
|
2
|
-
import { REORG_DEPTH, calculatePositionGreeks, tickLimits } from "./greeks-
|
|
1
|
+
import { BatchValidationError, DEFAULT_VEGOID, InputListFailError, InvalidTickLimitsError, InvalidTokenIdParameterError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LoanSlotExhaustedError, MaxRetriesExceededError, MissingPositionIdsError, NoLoanPositionsError, OracleRateLimitedError, PanopticError, PositionSnapshotNotFoundError, ProviderLagError, STRIKE_CONVERSION_FACTOR, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, collateralTrackerV2Abi, createTxResult, decodeLeftRightUnsigned, decodeOracleTiming, getBlockMeta, getOpenPositionIds, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositions, getPositionsKey, getSyncCheckpointKey, getTrackedPositionIds, jsonSerializer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, parsePanopticError, submitWrite } from "./getTrackedPositionIds-CwBHzOO2.js";
|
|
2
|
+
import { REORG_DEPTH, calculatePositionGreeks, tickLimits } from "./greeks-9aTE-DwO.js";
|
|
3
3
|
import { decodeFunctionResult, encodeFunctionData, erc20Abi, getAbiItem } from "viem";
|
|
4
4
|
|
|
5
5
|
//#region src/panoptic/v2/writes/broadcaster.ts
|
|
@@ -851,7 +851,7 @@ async function executeBatchDispatchAndWait(params) {
|
|
|
851
851
|
* ```
|
|
852
852
|
*/
|
|
853
853
|
async function liquidate(params) {
|
|
854
|
-
const { client, walletClient, account, poolAddress, liquidatee, positionIdListFrom, positionIdListTo, positionIdListToFinal, usePremiaAsCollateral = 0n, txOverrides } = params;
|
|
854
|
+
const { client, walletClient, account, poolAddress, liquidatee, positionIdListFrom, positionIdListTo, positionIdListToFinal, usePremiaAsCollateral = 0n, value, txOverrides } = params;
|
|
855
855
|
return submitWrite({
|
|
856
856
|
client,
|
|
857
857
|
walletClient,
|
|
@@ -866,6 +866,7 @@ async function liquidate(params) {
|
|
|
866
866
|
positionIdListToFinal,
|
|
867
867
|
usePremiaAsCollateral
|
|
868
868
|
],
|
|
869
|
+
value,
|
|
869
870
|
txOverrides
|
|
870
871
|
});
|
|
871
872
|
}
|