@panoptic-eng/sdk 1.0.21 → 1.0.23
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.d.ts +4 -4
- package/dist/cow/index.js +3 -3
- package/dist/cow/types.d.ts +2 -3
- package/dist/{cow-C_SGXoWr.js → cow-BilQfbNT.js} +2 -2
- package/dist/{cow-C_SGXoWr.js.map → cow-BilQfbNT.js.map} +1 -1
- package/dist/{index-BuJcj5aO.d.ts → index-CIlr4SNh.d.ts} +4 -3
- package/dist/index-CIlr4SNh.d.ts.map +1 -0
- package/dist/index.d.ts +696 -5908
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1393 -579
- package/dist/index.js.map +1 -1
- package/dist/{irm-CfM383Ku.js → irm-C7EQwrga.js} +332 -3
- package/dist/irm-C7EQwrga.js.map +1 -0
- package/dist/irm-CSJX9BsU.d.ts +5694 -0
- package/dist/irm-CSJX9BsU.d.ts.map +1 -0
- package/dist/panoptic/v2/index.d.ts +438 -10
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +200 -8
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/{position-BK4a-Yyu.js → position-CsIEneku.js} +33 -2
- package/dist/position-CsIEneku.js.map +1 -0
- package/dist/{router-CMrp245w.js → router-BM10ZWY5.js} +90 -40
- package/dist/router-BM10ZWY5.js.map +1 -0
- package/dist/simulation-4SzTI-xf.d.ts +435 -0
- package/dist/simulation-4SzTI-xf.d.ts.map +1 -0
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/tx-Banz1S18.d.ts +367 -0
- package/dist/tx-Banz1S18.d.ts.map +1 -0
- package/dist/{types-CRvvn2ce.d.ts → types-Bzw_7NJv.d.ts} +2 -2
- package/dist/{types-CRvvn2ce.d.ts.map → types-Bzw_7NJv.d.ts.map} +1 -1
- package/dist/types-CspUPolV.d.ts +892 -0
- package/dist/types-CspUPolV.d.ts.map +1 -0
- package/dist/uniswap/index.d.ts +121 -4
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +228 -4
- package/dist/uniswap/index.js.map +1 -0
- package/dist/{writes-DymnVbiE.js → writes-BnO9zj-Z.js} +42 -11
- package/dist/writes-BnO9zj-Z.js.map +1 -0
- package/dist/zodiac/index.d.ts +439 -0
- package/dist/zodiac/index.d.ts.map +1 -0
- package/dist/zodiac/index.js +944 -0
- package/dist/zodiac/index.js.map +1 -0
- package/package.json +6 -1
- package/dist/index-BuJcj5aO.d.ts.map +0 -1
- package/dist/index-DVMjZi1E.d.ts +0 -1801
- package/dist/index-DVMjZi1E.d.ts.map +0 -1
- package/dist/irm-CGykVo3q.d.ts +0 -32
- package/dist/irm-CGykVo3q.d.ts.map +0 -1
- package/dist/irm-CfM383Ku.js.map +0 -1
- package/dist/irm-zWjtffWA.d.ts +0 -85
- package/dist/irm-zWjtffWA.d.ts.map +0 -1
- package/dist/panoptic/v2/types/index.d.ts +0 -3
- package/dist/panoptic/v2/types/index.js +0 -0
- package/dist/position-BK4a-Yyu.js.map +0 -1
- package/dist/router-CMrp245w.js.map +0 -1
- package/dist/types-BQejAFnu.d.ts +0 -245
- package/dist/types-BQejAFnu.d.ts.map +0 -1
- package/dist/writes-DymnVbiE.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BORROW_INDEX_BITS, BPS_SCALE, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, RATE_AT_TARGET_BITS, SECONDS_PER_YEAR, UNREALIZED_INTEREST_BITS, annualizePerSecondRateWad, deriveSupplyRatePerSecWad, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatRateWad, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatWad, formatWadPercent, formatWadSigned, getAccountCollateral, getAccountSummaryBasic, getAccountSummaryRisk, getCollateralAddresses, getCollateralData, getCurrentRates, getInterestState, getIrmCurrent, getIrmCurve, getLiquidationPrices, getNetLiquidationValue, getNetLiquidationValues, isLiquidatable, packMarketState, panopticQueryAbi, parseTokenAmount, parseWad, ratePerSecWadToAprPct, readBlockAndAggregate, requireReturnData, utilizationBpsToWad, utilizationPctToWad } from "../../irm-
|
|
2
|
-
import { AccountInsolventError, AlreadyInitializedError, BPS_DENOMINATOR, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MAX_TICK, MAX_TRACKED_CHUNKS, MIN_TICK, MaxRetriesExceededError, MissingPositionIdsError, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, ORACLE_EPOCH_SECONDS, OracleRateLimitedError, PanopticError
|
|
3
|
-
import { approveErc20ForCow, cancelCowOrder, checkCowApproval, getCowOrderStatus, isCowSupportedChain, quoteCowSwap, signAndSubmitCowOrder } from "../../cow-
|
|
4
|
-
import { addLegToTokenId, approve, approveAndWait, approvePool, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertTradeable, borrow, borrowAndWait, buildBatchDispatchArgs, buildOpenPositionCalldata, buildUniqueLoan, calculateResyncBlock, cancelTransaction, checkApproval, clearCheckpoint, clearTrackedPositions, closePosition, closePositionAndWait, countLegs, createFileStorage, createMemoryStorage, createNonceManager, createTokenIdBuilder, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeg, decodePoolId, decodeTickSpacing$1, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, detectReorg, dispatch, dispatchAndWait, encodeLeg, encodePoolId, encodeV4PoolId, executeBatchDispatch, executeBatchDispatchAndWait, forceExercise, forceExerciseAndWait, getAssetIndex, getClosedPositionsKey, getOpenPositionIds, getPendingPositionsKey, getPoolMetaKey, getPoolPrefix, getPositionMetaKey, getPositionsKey, getSchemaVersionKey, getSyncCheckpointKey, getTrackedChunksKey, getTrackedPositionIds, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isGasError, isInputListFailError, isLoan, isLoanLeg, isNonceError, isPositionTracked, isRetryableRpcError, isShortOnly, isSpread, jsonSerializer, liquidate, liquidateAndWait, loadCheckpoint, mint, mintAndWait, openPosition, openPositionAndWait, pokeOracle, pokeOracleAndWait, previewBorrow, previewUnwrap, previewWrap, publicBroadcaster, recoverSnapshot, recoverSnapshotFromTx, redeem, redeemAndWait, repay, repayAndWait, resolveTokenIndex, rollPosition, rollPositionAndWait, saveCheckpoint, selectDispatchForAccount, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, simulateOpenPosition, simulateWithTokenFlow, smartRepay, smartRepayAndWait, speedUpTransaction, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, validateBatch, validatePoolId, verifyBlockContinuity, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi } from "../../writes-
|
|
5
|
-
import { approveErc20ForPermit2, approveRouterViaPermit2, checkRouterApproval, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, swapExactInViaRouter, swapExactOutViaRouter } from "../../router-
|
|
1
|
+
import { BORROW_INDEX_BITS, BPS_SCALE, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, RATE_AT_TARGET_BITS, SECONDS_PER_YEAR, UNREALIZED_INTEREST_BITS, annualizePerSecondRateWad, deriveSupplyRatePerSecWad, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatRateWad, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatWad, formatWadPercent, formatWadSigned, getAccountCollateral, getAccountSummaryBasic, getAccountSummaryRisk, getChainDeployment, getCollateralAddresses, getCollateralData, getCurrentRates, getInterestState, getIrmCurrent, getIrmCurve, getLiquidationPrices, getNetLiquidationValue, getNetLiquidationValues, isLiquidatable, isSupportedChain, packMarketState, panopticQueryAbi$1 as panopticQueryAbi, parseTokenAmount, parseWad, ratePerSecWadToAprPct, readBlockAndAggregate, requireChainDeployment, requireReturnData, utilizationBpsToWad, utilizationPctToWad } from "../../irm-C7EQwrga.js";
|
|
2
|
+
import { AccountInsolventError, AlreadyInitializedError, BPS_DENOMINATOR, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MAX_TICK, MAX_TRACKED_CHUNKS, MIN_TICK, MaxRetriesExceededError, MissingPositionIdsError, 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, REORG_DEPTH, ReentrancyError, RpcError, RpcResponseError, SCHEMA_VERSION, STANDARD_TICK_WIDTHS, STORAGE_PREFIX, SafeModeError, StaleDataError, StaleOracleError, StorageDataNotFoundError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UTILIZATION_DENOMINATOR, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, WAD, WrongPoolIdError, WrongUniswapPoolError, ZERO_COLLATERAL, ZERO_VALUATION, ZeroAddressError, ZeroCollateralRequirementError, calculatePortfolioDelta, calculatePortfolioGamma, calculatePortfolioGreeks, calculatePortfolioValue, calculatePositionDelta, calculatePositionDeltaWithSwap, calculatePositionGamma, calculatePositionGreeks, calculatePositionValue, collateralTrackerV2Abi, decodeLeftRightSigned, decodeLeftRightUnsigned, decodePosition, decodePositionBalance, decodeTickSpacing, fetchPoolId, formatPriceRange, formatTick, formatTickRange, getBlockMeta, getLegDelta, getLegGamma, getLegNetValueWidth0, getLegValue, getOracleState, getPool, getPoolMetadata, getPosition, getPositionGreeks, getPositions, getPricesAtTick, getRiskParameters, getTickSpacing, getUtilization, isCall, isDefinedRisk, isPanopticErrorType, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticPoolV2Abi, panopticQueryAbi as panopticQueryAbi$1, parsePanopticError, priceToTick, riskEngineAbi, roundToTickSpacing, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, sqrtPriceX96ToPriceDecimalScaled, sqrtPriceX96ToTick, stateViewAbi, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96, uniswapV3PoolAbi, validateBuilderCode } from "../../position-CsIEneku.js";
|
|
3
|
+
import { approveErc20ForCow, cancelCowOrder, checkCowApproval, getCowOrderStatus, isCowSupportedChain, quoteCowSwap, signAndSubmitCowOrder } from "../../cow-BilQfbNT.js";
|
|
4
|
+
import { addLegToTokenId, approve, approveAndWait, approvePool, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertTradeable, borrow, borrowAndWait, buildBatchDispatchArgs, buildOpenPositionCalldata, buildUniqueLoan, calculateResyncBlock, cancelTransaction, checkApproval, clearCheckpoint, clearTrackedPositions, closePosition, closePositionAndWait, countLegs, createFileStorage, createMemoryStorage, createNonceManager, createTokenIdBuilder, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeg, decodePoolId, decodeTickSpacing$1, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, detectReorg, dispatch, dispatchAndWait, encodeLeg, encodePoolId, encodeV4PoolId, executeBatchDispatch, executeBatchDispatchAndWait, forceExercise, forceExerciseAndWait, getAssetIndex, getClosedPositionsKey, getOpenPositionIds, getPendingPositionsKey, getPoolMetaKey, getPoolPrefix, getPositionMetaKey, getPositionsKey, getSchemaVersionKey, getSyncCheckpointKey, getTrackedChunksKey, getTrackedPositionIds, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isGasError, isInputListFailError, isLoan, isLoanLeg, isNonceError, isPositionTracked, isRetryableRpcError, isShortOnly, isSpread, jsonSerializer, liquidate, liquidateAndWait, loadCheckpoint, mint, mintAndWait, openPosition, openPositionAndWait, pokeOracle, pokeOracleAndWait, previewBorrow, previewUnwrap, previewWrap, publicBroadcaster, recoverSnapshot, recoverSnapshotFromTx, redeem, redeemAndWait, repay, repayAndWait, resolveTokenIndex, rollPosition, rollPositionAndWait, saveCheckpoint, selectDispatchForAccount, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, simulateOpenPosition, simulateWithTokenFlow, smartRepay, smartRepayAndWait, speedUpTransaction, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, validateBatch, validatePoolId, verifyBlockContinuity, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi } from "../../writes-BnO9zj-Z.js";
|
|
5
|
+
import { approveErc20ForPermit2, approveRouterViaPermit2, checkRouterApproval, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, swapExactInViaRouter, swapExactOutViaRouter } from "../../router-BM10ZWY5.js";
|
|
6
6
|
import { ContractFunctionExecutionError, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, getAddress, keccak256, zeroAddress } from "viem";
|
|
7
7
|
import { multicall } from "viem/actions";
|
|
8
8
|
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
@@ -971,6 +971,15 @@ async function getPositionsWithPremia(params) {
|
|
|
971
971
|
//#endregion
|
|
972
972
|
//#region src/panoptic/v2/reads/collateralEstimate.ts
|
|
973
973
|
/**
|
|
974
|
+
* Max int24 (2^23 - 1), used as the per-position `effectiveLiquidityLimit` (the
|
|
975
|
+
* 3rd element of the dispatch tickAndSpreadLimits triplet). Passing this lets the
|
|
976
|
+
* contract clamp to its real on-chain `maxSpread()` ceiling, matching the live
|
|
977
|
+
* trade. Passing 0 instead forces the limit to 0, so any long-leg removal reverts
|
|
978
|
+
* with EffectiveLiquidityAboveThreshold and ITM/size measurements silently
|
|
979
|
+
* collapse (see PanopticPool._mintInSFPMAndUpdateCollateral / _checkLiquiditySpread).
|
|
980
|
+
*/
|
|
981
|
+
const MAX_EFFECTIVE_LIQUIDITY_LIMIT = 8388607;
|
|
982
|
+
/**
|
|
974
983
|
* Maximum value of a Solidity `uint64`. `PanopticQuery.getRequiredBase` computes
|
|
975
984
|
* the requirement for a synthetic position sized at `type(uint64).max`, so the
|
|
976
985
|
* returned value must be scaled down to the caller's actual `positionSize`.
|
|
@@ -1144,7 +1153,6 @@ async function tryDispatchSimulation(params) {
|
|
|
1144
1153
|
const { client, poolAddress, account, tokenId, existingPositionIds, positionSize, swapAtMint } = params;
|
|
1145
1154
|
try {
|
|
1146
1155
|
const finalPositionIdList = [...existingPositionIds, tokenId];
|
|
1147
|
-
const MAX_EFFECTIVE_LIQUIDITY_LIMIT = 8388607;
|
|
1148
1156
|
const tickLimits$1 = swapAtMint ? [
|
|
1149
1157
|
887272,
|
|
1150
1158
|
-887272,
|
|
@@ -1220,7 +1228,7 @@ async function getRequiredCreditForITM(params) {
|
|
|
1220
1228
|
[[
|
|
1221
1229
|
Number(MAX_TICK),
|
|
1222
1230
|
Number(MIN_TICK),
|
|
1223
|
-
|
|
1231
|
+
MAX_EFFECTIVE_LIQUIDITY_LIMIT
|
|
1224
1232
|
]],
|
|
1225
1233
|
false,
|
|
1226
1234
|
0n
|
|
@@ -1245,6 +1253,153 @@ async function getRequiredCreditForITM(params) {
|
|
|
1245
1253
|
};
|
|
1246
1254
|
}
|
|
1247
1255
|
/**
|
|
1256
|
+
* Dust threshold (raw token units) below which an ITM measurement is treated as
|
|
1257
|
+
* zero. Token-flow deltas carry sub-unit rounding noise from on-chain math and
|
|
1258
|
+
* the sqrt/tick conversions below; 1000n raw units swallows that noise while
|
|
1259
|
+
* staying many orders of magnitude below any real ITM credit (which is on the
|
|
1260
|
+
* order of `positionSize`).
|
|
1261
|
+
*/
|
|
1262
|
+
const FLOW_NEUTRAL_DUST_THRESHOLD = 1000n;
|
|
1263
|
+
const Q192$1 = 1n << 192n;
|
|
1264
|
+
const POOL_ID_MASK = (1n << 64n) - 1n;
|
|
1265
|
+
/**
|
|
1266
|
+
* Floor integer square root for bigints (Newton's method). Exact for all
|
|
1267
|
+
* non-negative inputs — no float precision loss for values above 2^53.
|
|
1268
|
+
*/
|
|
1269
|
+
function isqrt(value) {
|
|
1270
|
+
if (value < 0n) throw new PanopticError("isqrt of negative number");
|
|
1271
|
+
if (value < 2n) return value;
|
|
1272
|
+
let x = value;
|
|
1273
|
+
let y = x + 1n >> 1n;
|
|
1274
|
+
while (y < x) {
|
|
1275
|
+
x = y;
|
|
1276
|
+
y = x + value / x >> 1n;
|
|
1277
|
+
}
|
|
1278
|
+
return x;
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Round a signed tick to the nearest multiple of `spacing` (bigint, nearest).
|
|
1282
|
+
*/
|
|
1283
|
+
function roundToSpacing(tick, spacing) {
|
|
1284
|
+
if (spacing <= 1n) return tick;
|
|
1285
|
+
const half = spacing / 2n;
|
|
1286
|
+
const quotient = tick >= 0n ? (tick + half) / spacing : (tick - half) / spacing;
|
|
1287
|
+
return quotient * spacing;
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Create a flow-neutral tokenId by prepending a width=0 credit/loan leg that
|
|
1291
|
+
* offsets the net ITM token flow.
|
|
1292
|
+
*
|
|
1293
|
+
* When a position is ITM, opening it produces an imbalanced single-sided token
|
|
1294
|
+
* flow. This function measures that net flow via {@link getRequiredCreditForITM}
|
|
1295
|
+
* and prepends a single width=0 leg (at index 0, with `asset !== tokenType` so
|
|
1296
|
+
* its notional scales continuously by strike) sized so its token flow is equal
|
|
1297
|
+
* and opposite. The result has net flow ~zero at mint.
|
|
1298
|
+
*
|
|
1299
|
+
* The leg occupies index 0; existing legs are shifted to indices 1..n with their
|
|
1300
|
+
* `riskPartner` references remapped (self-partners stay self, cross-partners +1).
|
|
1301
|
+
* The input `positionSize` is never modified — the leg is sized via its strike.
|
|
1302
|
+
*
|
|
1303
|
+
* @param params - The parameters
|
|
1304
|
+
* @returns The flow-neutral tokenId with metadata
|
|
1305
|
+
* @throws PanopticError if the tokenId already has 4 legs, positionSize <= 0, or
|
|
1306
|
+
* the required neutralizing strike falls outside the valid tick range.
|
|
1307
|
+
*/
|
|
1308
|
+
async function createFlowNeutralTokenId(params) {
|
|
1309
|
+
const { client, poolAddress, account, tokenId, positionSize, existingPositionIds, blockNumber } = params;
|
|
1310
|
+
if (positionSize <= 0n) throw new PanopticError("positionSize must be positive to create flow-neutral position");
|
|
1311
|
+
const legCount = countLegs(tokenId);
|
|
1312
|
+
if (legCount >= 4n) throw new PanopticError("Cannot prepend neutralizing leg: tokenId already has 4 legs");
|
|
1313
|
+
const credit = await getRequiredCreditForITM({
|
|
1314
|
+
client,
|
|
1315
|
+
poolAddress,
|
|
1316
|
+
account,
|
|
1317
|
+
tokenId,
|
|
1318
|
+
positionSize,
|
|
1319
|
+
existingPositionIds,
|
|
1320
|
+
blockNumber,
|
|
1321
|
+
_meta: params._meta
|
|
1322
|
+
});
|
|
1323
|
+
const abs0 = credit.creditAmount0 < 0n ? -credit.creditAmount0 : credit.creditAmount0;
|
|
1324
|
+
const abs1 = credit.creditAmount1 < 0n ? -credit.creditAmount1 : credit.creditAmount1;
|
|
1325
|
+
const tickBefore = credit.tokenFlow.tickBefore;
|
|
1326
|
+
if (tickBefore === null) throw new PanopticError("Cannot create flow-neutral position: current tick unavailable");
|
|
1327
|
+
const sqrtPX96 = tickToSqrtPriceX96(tickBefore);
|
|
1328
|
+
const abs0InToken1 = abs0 * sqrtPX96 * sqrtPX96 / Q192$1;
|
|
1329
|
+
let itmTokenIndex;
|
|
1330
|
+
let amount;
|
|
1331
|
+
if (abs0InToken1 <= FLOW_NEUTRAL_DUST_THRESHOLD && abs1 <= FLOW_NEUTRAL_DUST_THRESHOLD) return {
|
|
1332
|
+
tokenId,
|
|
1333
|
+
positionSize,
|
|
1334
|
+
neutralStrike: 0n,
|
|
1335
|
+
neutralAsset: 0n,
|
|
1336
|
+
neutralTokenType: 0n,
|
|
1337
|
+
neutralIsCredit: false,
|
|
1338
|
+
originalCredit: credit,
|
|
1339
|
+
strikeResidualTick: 0n,
|
|
1340
|
+
_meta: credit._meta
|
|
1341
|
+
};
|
|
1342
|
+
else if (abs0InToken1 >= abs1) {
|
|
1343
|
+
itmTokenIndex = 0n;
|
|
1344
|
+
amount = credit.creditAmount0;
|
|
1345
|
+
} else {
|
|
1346
|
+
itmTokenIndex = 1n;
|
|
1347
|
+
amount = credit.creditAmount1;
|
|
1348
|
+
}
|
|
1349
|
+
const absAmount = amount < 0n ? -amount : amount;
|
|
1350
|
+
const legTokenType = itmTokenIndex;
|
|
1351
|
+
const legAsset = itmTokenIndex === 0n ? 1n : 0n;
|
|
1352
|
+
const legIsLong = amount < 0n;
|
|
1353
|
+
const sqrtKrawX96 = isqrt(absAmount * Q192$1 / positionSize);
|
|
1354
|
+
let signedTick;
|
|
1355
|
+
try {
|
|
1356
|
+
signedTick = sqrtPriceX96ToTick(sqrtKrawX96);
|
|
1357
|
+
} catch {
|
|
1358
|
+
throw new PanopticError("Cannot create flow-neutral position: neutralizing strike out of bounds");
|
|
1359
|
+
}
|
|
1360
|
+
const tickSpacing = decodeTickSpacing$1(tokenId);
|
|
1361
|
+
const roundedTick = roundToSpacing(signedTick, tickSpacing);
|
|
1362
|
+
const strikeResidualTick = signedTick - roundedTick;
|
|
1363
|
+
if (roundedTick < MIN_TICK || roundedTick > MAX_TICK) throw new PanopticError("Cannot create flow-neutral position: neutralizing strike out of bounds");
|
|
1364
|
+
const neutralStrike = legAsset === 0n ? roundedTick : -roundedTick;
|
|
1365
|
+
const poolId = tokenId & POOL_ID_MASK;
|
|
1366
|
+
let newTokenId = addLegToTokenId(poolId, {
|
|
1367
|
+
index: 0n,
|
|
1368
|
+
asset: legAsset,
|
|
1369
|
+
tokenType: legTokenType,
|
|
1370
|
+
optionRatio: 1n,
|
|
1371
|
+
isLong: legIsLong ? 1n : 0n,
|
|
1372
|
+
riskPartner: 0n,
|
|
1373
|
+
strike: neutralStrike,
|
|
1374
|
+
width: 0n
|
|
1375
|
+
});
|
|
1376
|
+
for (const leg of decodeAllLegs(tokenId)) {
|
|
1377
|
+
const newIndex = leg.index + 1n;
|
|
1378
|
+
const newRiskPartner = leg.riskPartner === leg.index ? newIndex : leg.riskPartner + 1n;
|
|
1379
|
+
newTokenId = addLegToTokenId(newTokenId, {
|
|
1380
|
+
index: newIndex,
|
|
1381
|
+
asset: leg.asset,
|
|
1382
|
+
tokenType: leg.tokenType,
|
|
1383
|
+
optionRatio: leg.optionRatio,
|
|
1384
|
+
isLong: leg.isLong ? 1n : 0n,
|
|
1385
|
+
riskPartner: newRiskPartner,
|
|
1386
|
+
strike: leg.strike,
|
|
1387
|
+
width: leg.width
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
return {
|
|
1391
|
+
tokenId: newTokenId,
|
|
1392
|
+
positionSize,
|
|
1393
|
+
neutralStrike,
|
|
1394
|
+
neutralAsset: legAsset,
|
|
1395
|
+
neutralTokenType: legTokenType,
|
|
1396
|
+
neutralIsCredit: legIsLong,
|
|
1397
|
+
originalCredit: credit,
|
|
1398
|
+
strikeResidualTick,
|
|
1399
|
+
_meta: credit._meta
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1248
1403
|
* Find the maximum withdrawable amount from a CollateralTracker using binary search.
|
|
1249
1404
|
*
|
|
1250
1405
|
* When a user has open positions, the standard `maxWithdraw()` returns 0 because
|
|
@@ -5273,6 +5428,14 @@ const queryKeys = {
|
|
|
5273
5428
|
account,
|
|
5274
5429
|
tokenId.toString()
|
|
5275
5430
|
],
|
|
5431
|
+
flowNeutralTokenId: (chainId, poolAddress, account, tokenId) => [
|
|
5432
|
+
...queryKeys.all,
|
|
5433
|
+
"flowNeutralTokenId",
|
|
5434
|
+
chainId.toString(),
|
|
5435
|
+
poolAddress,
|
|
5436
|
+
account,
|
|
5437
|
+
tokenId.toString()
|
|
5438
|
+
],
|
|
5276
5439
|
interestState: (chainId, poolAddress, account) => [
|
|
5277
5440
|
...queryKeys.all,
|
|
5278
5441
|
"interestState",
|
|
@@ -5917,6 +6080,35 @@ function useEstimateCollateralRequired(poolAddress, tokenId, positionSize, query
|
|
|
5917
6080
|
gcTime: options?.gcTime
|
|
5918
6081
|
});
|
|
5919
6082
|
}
|
|
6083
|
+
function useFlowNeutralTokenId(poolAddress, tokenId, positionSize, account, options) {
|
|
6084
|
+
const ctx = usePanopticContext();
|
|
6085
|
+
const resolvedAccount = account ?? ctx.account;
|
|
6086
|
+
const neutralizeITM = options?.neutralizeITM ?? true;
|
|
6087
|
+
return useQuery({
|
|
6088
|
+
queryKey: [
|
|
6089
|
+
...queryKeys.flowNeutralTokenId(ctx.chainId, poolAddress, resolvedAccount ?? "", tokenId),
|
|
6090
|
+
getClientCacheScopeKey(ctx.publicClient, ctx.clientScope),
|
|
6091
|
+
positionSize.toString(),
|
|
6092
|
+
(options?.existingPositionIds ?? []).map(String).join(","),
|
|
6093
|
+
neutralizeITM,
|
|
6094
|
+
positionSize,
|
|
6095
|
+
options?.existingPositionIds
|
|
6096
|
+
],
|
|
6097
|
+
queryFn: () => {
|
|
6098
|
+
if (!resolvedAccount) throw new Error("account required for createFlowNeutralTokenId");
|
|
6099
|
+
return createFlowNeutralTokenId({
|
|
6100
|
+
client: ctx.publicClient,
|
|
6101
|
+
poolAddress,
|
|
6102
|
+
account: resolvedAccount,
|
|
6103
|
+
tokenId,
|
|
6104
|
+
positionSize,
|
|
6105
|
+
existingPositionIds: options?.existingPositionIds
|
|
6106
|
+
});
|
|
6107
|
+
},
|
|
6108
|
+
enabled: (options?.enabled ?? true) && neutralizeITM && !!resolvedAccount && tokenId !== 0n && positionSize > 0n,
|
|
6109
|
+
refetchInterval: options?.refetchInterval
|
|
6110
|
+
});
|
|
6111
|
+
}
|
|
5920
6112
|
function useMaxPositionSize(poolAddress, tokenId, queryAddress, account, options) {
|
|
5921
6113
|
const ctx = usePanopticContext();
|
|
5922
6114
|
const resolvedAccount = account ?? ctx.account;
|
|
@@ -10921,5 +11113,5 @@ function useTxEventConfirmation({ txHash, poolAddress = zeroAddress, collateralT
|
|
|
10921
11113
|
}
|
|
10922
11114
|
|
|
10923
11115
|
//#endregion
|
|
10924
|
-
export { AccountInsolventError, AlreadyInitializedError, BORROW_INDEX_BITS, BPS_DENOMINATOR, BPS_SCALE, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, 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, MAX_TICK, MAX_TRACKED_CHUNKS, MIN_TICK, MaxRetriesExceededError, MissingPositionIdsError, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, ORACLE_EPOCH_SECONDS, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticProvider, 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, SafeModeError, StaleDataError, StaleOracleError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UNREALIZED_INTEREST_BITS, UTILIZATION_DENOMINATOR, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, WAD, WrongPoolIdError, WrongUniswapPoolError, ZERO_COLLATERAL, ZERO_VALUATION, ZeroAddressError, ZeroCollateralRequirementError, addLegToTokenId, addPendingPosition, addTrackedChunks, annualizePerSecondRateWad, approve, approveAndWait, approvePool, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertTradeable, borrow, borrowAndWait, buildBatchDispatchArgs, buildOpenPositionCalldata, buildUniqueLoan, calculateAccountGreeksPure, calculatePortfolioDelta, calculatePortfolioGamma, calculatePortfolioGreeks, calculatePortfolioValue, calculatePositionDelta, calculatePositionDeltaWithSwap, calculatePositionGamma, calculatePositionGreeks, calculatePositionValue, calculateResyncBlock, calculateSpreadWad, cancelTransaction, checkApproval, checkCollateralAcrossTicks, cleanupStalePendingPositions, clearCheckpoint, clearPendingPositions, clearTrackedChunks, clearTrackedPositions, clearTradeHistory, closePosition, closePositionAndWait, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, countLegs, createEventPoller, createEventSubscription, createFileStorage, createMemoryStorage, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeLeg, decodePanopticTokenURI, decodePoolId, decodeTickSpacing$1 as decodeTickSpacing, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveSupplyRatePerSecWad, detectReorg, dispatch, dispatchAndWait, encodeLeg, encodePoolId, encodePoolKeyBytes, encodeV3PoolKeyBytes, encodeV4PoolId, estimateBlockNumbers, estimateCollateralRequired, executeBatchDispatch, executeBatchDispatchAndWait, failPendingPosition, fetchPoolId, 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, getAccountBuyingPower, getAccountCollateral, getAccountGreeks, getAccountHistory, getAccountPremia, getAccountSummaryBasic, getAccountSummaryRisk, getAssetIndex, getBlockMeta, getChunkLiquidities, getChunkSpreads, getClosedPositions, getClosedPositionsKey, getCollateralAddresses, getCollateralData, getCollateralSharePrices, getCollateralTotalAssetsBatch, getCurrentRates, getDeltaHedgeParams, getEnforcedTickLimits, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getGuardianUnlockState, getInterestState, getIrmCurrent, getIrmCurve, getLegDelta, getLegGamma, getLegNetValueWidth0, getLegValue, getLiquidationPrices, getMarginBuffer, getMaxPositionSize, getMaxWithdrawable, getNativeTokenPrice, getNetLiquidationValue, getNetLiquidationValues, getOpenPositionIds, getOpenPositionPreview, getOracleState, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPendingPositionsKey, getPool, getPoolDeploymentBlock, getPoolDisplayId, getPoolLiquidities, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPortfolioValue, getPosition, getPositionChunkData, getPositionEnrichmentData, getPositionGreeks, getPositionMetaKey, getPositions, getPositionsKey, getPositionsWithPremia, getPriceHistory, getPricesAtTick, getRealizedPnL, getRequiredCreditForITM, getRiskParameters, getSafeMode, getSchemaVersionKey, getStreamiaHistory, getSyncCheckpointKey, getSyncStatus, getTickSpacing, getTokenListId, getTrackedChunks, getTrackedChunksKey, getTrackedPositionIds, getTradeHistory, getUniswapFeeHistory, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, getUtilization, hasLoanOrCredit, hasLongLeg, interpolateBlocks, isCall, isCowSupportedChain, isCredit, isCreditLeg, isDefinedRisk, isGasError, isInputListFailError, isLiquidatable, isLoan, isLoanLeg, isNonceError, isPanopticErrorType, isPositionTracked, isRetryableRpcError, isShortOnly, isSpread, jsonSerializer, liquidate, liquidateAndWait, loadCheckpoint, minePoolAddress, mint, mintAndWait, multicallRead, mutationEffects, openPosition, openPositionAndWait, optimizeTokenIdRiskPartners, packMarketState, parseBps, parseCollateralLog, parsePanopticError, parsePoolLog, parseTokenAmount, parseTokenListId, parseWad, pokeOracle, pokeOracleAndWait, previewBorrow, previewDeposit, previewMint, previewRedeem, previewUnwrap, previewWithdraw, previewWrap, priceToTick, publicBroadcaster, queryKeys, ratePerSecWadToAprPct, reconstructFromEvents, recoverSnapshot, recoverSnapshotFromTx, redeem, redeemAndWait, removeTrackedChunks, repay, repayAndWait, resolveBlockNumbers, resolvePanopticPoolFromPoolId, resolveTokenIndex, resolveUniswapV4PoolKey, rollPosition, rollPositionAndWait, roundToTickSpacing, saveCheckpoint, saveClosedPosition, scanChunks, selectDispatchForAccount, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, simulateBatchDispatch, simulateClosePosition, simulateDeployNewPool, simulateDeposit, simulateDispatch, simulateForceExercise, simulateLiquidate, simulateOpenPosition, simulateSFPMBurn, simulateSFPMMint, simulateSettle, simulateSwapExactIn, simulateSwapExactOut, simulateWithdraw, smartRepay, smartRepayAndWait, speedUpTransaction, sqrtPriceX96ToPriceDecimalScaled, sqrtPriceX96ToTick, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, useAccountCollateral, useAccountGreeks, useAccountPremia, useAccountSummaryBasic, useAccountSummaryRisk, useAddPendingPosition, useApprove, useApproveErc20ForCow, useApproveErc20ForPermit2, useApprovePool, useApproveRouterViaPermit2, useBatchDispatch as useBatchDispatchHook, useBorrow as useBorrowHook, useCancelCowOrder, useCheckCowApproval, useCheckRouterApproval, useChunkSpreads, useClearTrackedPositions, useClosePosition as useClosePositionHook, useClosedPositions, useCollateralData, useConfirmPendingPosition, useCowOrderStatus, useCurrentRates, useDeployNewPool as useDeployNewPoolHook, useDeposit as useDepositHook, useDispatch as useDispatchHook, useEstimateCollateralRequired, useEventPoller, useEventSubscription, useFactoryConstructMetadata, useFactoryOwnerOf, useFactoryTokenURI, useFailPendingPosition, useForceExercise as useForceExerciseHook, useGuardianUnlockState, useInterestState, useIsLiquidatable, useLiquidate as useLiquidateHook, useLiquidationPrices, useMarginBuffer, useMaxPositionSize, useMaxWithdrawable, useMinePoolAddress as useMinePoolAddressHook, useMintShares, useNativeTokenPrice, useNetLiquidationValue, useNetLiquidationValues, useOpenPosition as useOpenPositionHook, useOpenPositionPreview, useOptimizeRiskPartners, useOracleState, usePanopticContext, usePanopticPoolAddress, usePokeOracle as usePokeOracleHook, usePool, usePoolLiquidities, usePosition, usePositionGreeks, usePositions, usePositionsWithPremia, usePreviewBorrow, usePreviewDeposit, usePreviewMint, usePreviewRedeem, usePreviewWithdraw, usePriceHistory, useQuoteCowSwap, useQuoteSwapExactInViaRouter, useQuoteSwapExactOutViaRouter, useRealizedPnL, useRedeem as useRedeemHook, useRepay as useRepayHook, useResolveUniswapV4PoolKey, useRiskParameters, useRollPosition as useRollPositionHook, useSafeMode, useSettleAccumulatedPremia as useSettleAccumulatedPremiaHook, useSimulateBatchDispatch, useSimulateClosePosition, useSimulateDeployNewPool, useSimulateDeposit, useSimulateDispatch, useSimulateForceExercise, useSimulateLiquidate, useSimulateOpenPosition, useSimulateSFPMBurn, useSimulateSFPMMint, useSimulateSettle, useSimulateSwapExactIn, useSimulateSwapExactOut, useSimulateWithdraw, useSmartRepay as useSmartRepayHook, useStreamiaHistory, useSubmitCowOrder, useSupply as useSupplyHook, useSwapExactIn, useSwapExactInViaRouter, useSwapExactOut, useSwapExactOutViaRouter, useSyncPositions, useSyncStatus, useTrackedPositionIds, useTradeHistory, useTxEventConfirmation, useUniswapFeeHistory, useUniswapV3PoolInfo, useUniswapV3PoolLiquidities, useUniswapV4PoolBasicState, useUniswapV4PoolInfo, useUniswapV4PoolLiquidities, useUnsupply as useUnsupplyHook, useUnwrapWeth, useUnwrapXstock, useUtilization, useValidateBuilderCode, useWatchEvents, useWithdraw as useWithdrawHook, useWithdrawWithPositions as useWithdrawWithPositionsHook, useWrapEth, useWrapXstock, utilizationBpsToWad, utilizationPctToWad, validateBatch, validateBuilderCode, validatePoolId, verifyBlockContinuity, watchEvents, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
|
|
11116
|
+
export { AccountInsolventError, AlreadyInitializedError, BORROW_INDEX_BITS, BPS_DENOMINATOR, BPS_SCALE, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, 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, MAX_TICK, MAX_TRACKED_CHUNKS, MIN_TICK, MaxRetriesExceededError, MissingPositionIdsError, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, ORACLE_EPOCH_SECONDS, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticProvider, 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, SafeModeError, StaleDataError, StaleOracleError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UNREALIZED_INTEREST_BITS, UTILIZATION_DENOMINATOR, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, WAD, WrongPoolIdError, WrongUniswapPoolError, ZERO_COLLATERAL, ZERO_VALUATION, ZeroAddressError, ZeroCollateralRequirementError, addLegToTokenId, addPendingPosition, addTrackedChunks, annualizePerSecondRateWad, approve, approveAndWait, approvePool, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertTradeable, borrow, borrowAndWait, buildBatchDispatchArgs, buildOpenPositionCalldata, buildUniqueLoan, calculateAccountGreeksPure, calculatePortfolioDelta, calculatePortfolioGamma, calculatePortfolioGreeks, calculatePortfolioValue, calculatePositionDelta, calculatePositionDeltaWithSwap, calculatePositionGamma, calculatePositionGreeks, calculatePositionValue, calculateResyncBlock, calculateSpreadWad, cancelTransaction, checkApproval, checkCollateralAcrossTicks, cleanupStalePendingPositions, clearCheckpoint, clearPendingPositions, clearTrackedChunks, clearTrackedPositions, clearTradeHistory, closePosition, closePositionAndWait, collateralTrackerV2Abi, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, countLegs, createEventPoller, createEventSubscription, createFileStorage, createFlowNeutralTokenId, createMemoryStorage, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeLeg, decodePanopticTokenURI, decodePoolId, decodeTickSpacing$1 as decodeTickSpacing, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveSupplyRatePerSecWad, detectReorg, dispatch, dispatchAndWait, encodeLeg, encodePoolId, encodePoolKeyBytes, encodeV3PoolKeyBytes, encodeV4PoolId, estimateBlockNumbers, estimateCollateralRequired, executeBatchDispatch, executeBatchDispatchAndWait, failPendingPosition, fetchPoolId, 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, getAccountBuyingPower, getAccountCollateral, getAccountGreeks, getAccountHistory, getAccountPremia, getAccountSummaryBasic, getAccountSummaryRisk, getAssetIndex, getBlockMeta, getChainDeployment, getChunkLiquidities, getChunkSpreads, getClosedPositions, getClosedPositionsKey, getCollateralAddresses, getCollateralData, getCollateralSharePrices, getCollateralTotalAssetsBatch, getCurrentRates, getDeltaHedgeParams, getEnforcedTickLimits, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getGuardianUnlockState, getInterestState, getIrmCurrent, getIrmCurve, getLegDelta, getLegGamma, getLegNetValueWidth0, getLegValue, getLiquidationPrices, getMarginBuffer, getMaxPositionSize, getMaxWithdrawable, getNativeTokenPrice, getNetLiquidationValue, getNetLiquidationValues, getOpenPositionIds, getOpenPositionPreview, getOracleState, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPendingPositionsKey, getPool, getPoolDeploymentBlock, getPoolDisplayId, getPoolLiquidities, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPortfolioValue, getPosition, getPositionChunkData, getPositionEnrichmentData, getPositionGreeks, getPositionMetaKey, getPositions, getPositionsKey, getPositionsWithPremia, getPriceHistory, getPricesAtTick, getRealizedPnL, getRequiredCreditForITM, getRiskParameters, getSafeMode, getSchemaVersionKey, getStreamiaHistory, getSyncCheckpointKey, getSyncStatus, getTickSpacing, getTokenListId, getTrackedChunks, getTrackedChunksKey, getTrackedPositionIds, getTradeHistory, getUniswapFeeHistory, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, getUtilization, hasLoanOrCredit, hasLongLeg, interpolateBlocks, isCall, isCowSupportedChain, isCredit, isCreditLeg, isDefinedRisk, isGasError, isInputListFailError, isLiquidatable, isLoan, isLoanLeg, isNonceError, isPanopticErrorType, isPositionTracked, isRetryableRpcError, isShortOnly, isSpread, isSupportedChain, jsonSerializer, liquidate, liquidateAndWait, loadCheckpoint, minePoolAddress, mint, mintAndWait, multicallRead, mutationEffects, openPosition, openPositionAndWait, optimizeTokenIdRiskPartners, packMarketState, panopticPoolV2Abi, parseBps, parseCollateralLog, parsePanopticError, parsePoolLog, parseTokenAmount, parseTokenListId, parseWad, pokeOracle, pokeOracleAndWait, previewBorrow, previewDeposit, previewMint, previewRedeem, previewUnwrap, previewWithdraw, previewWrap, priceToTick, publicBroadcaster, queryKeys, ratePerSecWadToAprPct, reconstructFromEvents, recoverSnapshot, recoverSnapshotFromTx, redeem, redeemAndWait, removeTrackedChunks, repay, repayAndWait, requireChainDeployment, resolveBlockNumbers, resolvePanopticPoolFromPoolId, resolveTokenIndex, resolveUniswapV4PoolKey, rollPosition, rollPositionAndWait, roundToTickSpacing, saveCheckpoint, saveClosedPosition, scanChunks, selectDispatchForAccount, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, simulateBatchDispatch, simulateClosePosition, simulateDeployNewPool, simulateDeposit, simulateDispatch, simulateForceExercise, simulateLiquidate, simulateOpenPosition, simulateSFPMBurn, simulateSFPMMint, simulateSettle, simulateSwapExactIn, simulateSwapExactOut, simulateWithdraw, smartRepay, smartRepayAndWait, speedUpTransaction, sqrtPriceX96ToPriceDecimalScaled, sqrtPriceX96ToTick, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, useAccountCollateral, useAccountGreeks, useAccountPremia, useAccountSummaryBasic, useAccountSummaryRisk, useAddPendingPosition, useApprove, useApproveErc20ForCow, useApproveErc20ForPermit2, useApprovePool, useApproveRouterViaPermit2, useBatchDispatch as useBatchDispatchHook, useBorrow as useBorrowHook, useCancelCowOrder, useCheckCowApproval, useCheckRouterApproval, useChunkSpreads, useClearTrackedPositions, useClosePosition as useClosePositionHook, useClosedPositions, useCollateralData, useConfirmPendingPosition, useCowOrderStatus, useCurrentRates, useDeployNewPool as useDeployNewPoolHook, useDeposit as useDepositHook, useDispatch as useDispatchHook, useEstimateCollateralRequired, useEventPoller, useEventSubscription, useFactoryConstructMetadata, useFactoryOwnerOf, useFactoryTokenURI, useFailPendingPosition, useFlowNeutralTokenId, useForceExercise as useForceExerciseHook, useGuardianUnlockState, useInterestState, useIsLiquidatable, useLiquidate as useLiquidateHook, useLiquidationPrices, useMarginBuffer, useMaxPositionSize, useMaxWithdrawable, useMinePoolAddress as useMinePoolAddressHook, useMintShares, useNativeTokenPrice, useNetLiquidationValue, useNetLiquidationValues, useOpenPosition as useOpenPositionHook, useOpenPositionPreview, useOptimizeRiskPartners, useOracleState, usePanopticContext, usePanopticPoolAddress, usePokeOracle as usePokeOracleHook, usePool, usePoolLiquidities, usePosition, usePositionGreeks, usePositions, usePositionsWithPremia, usePreviewBorrow, usePreviewDeposit, usePreviewMint, usePreviewRedeem, usePreviewWithdraw, usePriceHistory, useQuoteCowSwap, useQuoteSwapExactInViaRouter, useQuoteSwapExactOutViaRouter, useRealizedPnL, useRedeem as useRedeemHook, useRepay as useRepayHook, useResolveUniswapV4PoolKey, useRiskParameters, useRollPosition as useRollPositionHook, useSafeMode, useSettleAccumulatedPremia as useSettleAccumulatedPremiaHook, useSimulateBatchDispatch, useSimulateClosePosition, useSimulateDeployNewPool, useSimulateDeposit, useSimulateDispatch, useSimulateForceExercise, useSimulateLiquidate, useSimulateOpenPosition, useSimulateSFPMBurn, useSimulateSFPMMint, useSimulateSettle, useSimulateSwapExactIn, useSimulateSwapExactOut, useSimulateWithdraw, useSmartRepay as useSmartRepayHook, useStreamiaHistory, useSubmitCowOrder, useSupply as useSupplyHook, useSwapExactIn, useSwapExactInViaRouter, useSwapExactOut, useSwapExactOutViaRouter, useSyncPositions, useSyncStatus, useTrackedPositionIds, useTradeHistory, useTxEventConfirmation, useUniswapFeeHistory, useUniswapV3PoolInfo, useUniswapV3PoolLiquidities, useUniswapV4PoolBasicState, useUniswapV4PoolInfo, useUniswapV4PoolLiquidities, useUnsupply as useUnsupplyHook, useUnwrapWeth, useUnwrapXstock, useUtilization, useValidateBuilderCode, useWatchEvents, useWithdraw as useWithdrawHook, useWithdrawWithPositions as useWithdrawWithPositionsHook, useWrapEth, useWrapXstock, utilizationBpsToWad, utilizationPctToWad, validateBatch, validateBuilderCode, validatePoolId, verifyBlockContinuity, watchEvents, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
|
|
10925
11117
|
//# sourceMappingURL=index.js.map
|