@panoptic-eng/sdk 1.0.22 → 1.0.24
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-DW6LjXES.js} +2 -2
- package/dist/{cow-C_SGXoWr.js.map → cow-DW6LjXES.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 +75 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +116 -3
- package/dist/index.js.map +1 -1
- package/dist/{irm-C7OUVANR.d.ts → irm-CSJX9BsU.d.ts} +56 -3
- package/dist/{irm-C7OUVANR.d.ts.map → irm-CSJX9BsU.d.ts.map} +1 -1
- package/dist/{irm-DNK3N7qk.js → irm-Dw6fa-DV.js} +34 -3
- package/dist/irm-Dw6fa-DV.js.map +1 -0
- package/dist/panoptic/v2/index.d.ts +569 -12
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +378 -21
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/{position-BK4a-Yyu.js → position-GYsTTl71.js} +51 -2
- package/dist/position-GYsTTl71.js.map +1 -0
- package/dist/{router-BZvOeloX.js → router-_vB5ArjF.js} +2 -2
- package/dist/{router-BZvOeloX.js.map → router-_vB5ArjF.js.map} +1 -1
- 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/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 +3 -3
- package/dist/uniswap/index.js +3 -3
- package/dist/{writes-DymnVbiE.js → writes-h-IX3XQq.js} +77 -12
- package/dist/writes-h-IX3XQq.js.map +1 -0
- package/dist/zodiac/index.d.ts +1 -6
- package/dist/zodiac/index.d.ts.map +1 -1
- package/dist/zodiac/index.js +1 -6
- package/dist/zodiac/index.js.map +1 -1
- package/package.json +1 -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-DNK3N7qk.js.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/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, getChainDeployment, getCollateralAddresses, getCollateralData, getCurrentRates, getInterestState, getIrmCurrent, getIrmCurve, getLiquidationPrices, getNetLiquidationValue, getNetLiquidationValues, isLiquidatable, isSupportedChain, packMarketState, panopticQueryAbi, parseTokenAmount, parseWad, ratePerSecWadToAprPct, readBlockAndAggregate, requireChainDeployment, 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-Dw6fa-DV.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, getLegDeltaInVaultFrame, 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, toVaultFrameAtTick, uniswapV3PoolAbi, validateBuilderCode } from "../../position-GYsTTl71.js";
|
|
3
|
+
import { approveErc20ForCow, cancelCowOrder, checkCowApproval, getCowOrderStatus, isCowSupportedChain, quoteCowSwap, signAndSubmitCowOrder } from "../../cow-DW6LjXES.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-h-IX3XQq.js";
|
|
5
|
+
import { approveErc20ForPermit2, approveRouterViaPermit2, checkRouterApproval, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, swapExactInViaRouter, swapExactOutViaRouter } from "../../router-_vB5ArjF.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`.
|
|
@@ -1038,7 +1047,7 @@ async function estimateCollateralRequired(params) {
|
|
|
1038
1047
|
* @returns Maximum position size with bounds and block metadata
|
|
1039
1048
|
*/
|
|
1040
1049
|
async function getMaxPositionSize(params) {
|
|
1041
|
-
const { client, poolAddress, account, tokenId, queryAddress, existingPositionIds, storage, chainId, refine = true, precisionPct = 1, swapAtMint = false, blockNumber } = params;
|
|
1050
|
+
const { client, poolAddress, account, tokenId, queryAddress, existingPositionIds, storage, chainId, refine = true, precisionPct = 1, swapAtMint = false, usePremiaAsCollateral = false, blockNumber } = params;
|
|
1042
1051
|
const targetBlockNumber = blockNumber ?? params._meta?.blockNumber ?? await client.getBlockNumber();
|
|
1043
1052
|
let positionIds;
|
|
1044
1053
|
if (existingPositionIds !== void 0) positionIds = existingPositionIds;
|
|
@@ -1081,7 +1090,8 @@ async function getMaxPositionSize(params) {
|
|
|
1081
1090
|
low: maxSizeAtMaxUtil / 2n,
|
|
1082
1091
|
high: maxSizeAtMinUtil * 2n,
|
|
1083
1092
|
precisionDivisor,
|
|
1084
|
-
swapAtMint
|
|
1093
|
+
swapAtMint,
|
|
1094
|
+
usePremiaAsCollateral
|
|
1085
1095
|
});
|
|
1086
1096
|
return {
|
|
1087
1097
|
maxSize,
|
|
@@ -1095,7 +1105,7 @@ async function getMaxPositionSize(params) {
|
|
|
1095
1105
|
* Tests 5 points per round (sextiles), narrowing the range by 6x each iteration.
|
|
1096
1106
|
*/
|
|
1097
1107
|
async function binarySearchMaxSize(params) {
|
|
1098
|
-
const { client, poolAddress, account, tokenId, existingPositionIds, precisionDivisor, swapAtMint } = params;
|
|
1108
|
+
const { client, poolAddress, account, tokenId, existingPositionIds, precisionDivisor, swapAtMint, usePremiaAsCollateral } = params;
|
|
1099
1109
|
let { low, high } = params;
|
|
1100
1110
|
const trySize = (positionSize) => tryDispatchSimulation({
|
|
1101
1111
|
client,
|
|
@@ -1104,7 +1114,8 @@ async function binarySearchMaxSize(params) {
|
|
|
1104
1114
|
tokenId,
|
|
1105
1115
|
existingPositionIds,
|
|
1106
1116
|
positionSize,
|
|
1107
|
-
swapAtMint
|
|
1117
|
+
swapAtMint,
|
|
1118
|
+
usePremiaAsCollateral
|
|
1108
1119
|
});
|
|
1109
1120
|
while (high - low > 1n && high - low > low / precisionDivisor) {
|
|
1110
1121
|
const range = high - low;
|
|
@@ -1141,10 +1152,9 @@ async function binarySearchMaxSize(params) {
|
|
|
1141
1152
|
* Try to simulate opening a position with the given size.
|
|
1142
1153
|
*/
|
|
1143
1154
|
async function tryDispatchSimulation(params) {
|
|
1144
|
-
const { client, poolAddress, account, tokenId, existingPositionIds, positionSize, swapAtMint } = params;
|
|
1155
|
+
const { client, poolAddress, account, tokenId, existingPositionIds, positionSize, swapAtMint, usePremiaAsCollateral } = params;
|
|
1145
1156
|
try {
|
|
1146
1157
|
const finalPositionIdList = [...existingPositionIds, tokenId];
|
|
1147
|
-
const MAX_EFFECTIVE_LIQUIDITY_LIMIT = 8388607;
|
|
1148
1158
|
const tickLimits$1 = swapAtMint ? [
|
|
1149
1159
|
887272,
|
|
1150
1160
|
-887272,
|
|
@@ -1162,7 +1172,7 @@ async function tryDispatchSimulation(params) {
|
|
|
1162
1172
|
finalPositionIdList,
|
|
1163
1173
|
[positionSize],
|
|
1164
1174
|
[tickLimits$1],
|
|
1165
|
-
|
|
1175
|
+
usePremiaAsCollateral,
|
|
1166
1176
|
0n
|
|
1167
1177
|
]
|
|
1168
1178
|
});
|
|
@@ -1207,9 +1217,19 @@ async function tryDispatchSimulation(params) {
|
|
|
1207
1217
|
* ```
|
|
1208
1218
|
*/
|
|
1209
1219
|
async function getRequiredCreditForITM(params) {
|
|
1210
|
-
const { client, poolAddress, account, tokenId, positionSize, existingPositionIds = [], blockNumber } = params;
|
|
1220
|
+
const { client, poolAddress, account, tokenId, positionSize, existingPositionIds = [], swapAtMint = true, blockNumber } = params;
|
|
1221
|
+
if (blockNumber !== void 0 && params._meta !== void 0 && params._meta.blockNumber !== blockNumber) throw new PanopticError("getRequiredCreditForITM: blockNumber and _meta.blockNumber disagree; cannot guarantee same-block consistency");
|
|
1211
1222
|
const targetBlockNumber = blockNumber ?? params._meta?.blockNumber ?? await client.getBlockNumber();
|
|
1212
1223
|
const finalPositionIdList = [...existingPositionIds, tokenId];
|
|
1224
|
+
const tickTriplet = swapAtMint ? [
|
|
1225
|
+
Number(MAX_TICK),
|
|
1226
|
+
Number(MIN_TICK),
|
|
1227
|
+
MAX_EFFECTIVE_LIQUIDITY_LIMIT
|
|
1228
|
+
] : [
|
|
1229
|
+
Number(MIN_TICK),
|
|
1230
|
+
Number(MAX_TICK),
|
|
1231
|
+
MAX_EFFECTIVE_LIQUIDITY_LIMIT
|
|
1232
|
+
];
|
|
1213
1233
|
const callData = encodeFunctionData({
|
|
1214
1234
|
abi: panopticPoolV2Abi,
|
|
1215
1235
|
functionName: "dispatch",
|
|
@@ -1217,11 +1237,7 @@ async function getRequiredCreditForITM(params) {
|
|
|
1217
1237
|
[tokenId],
|
|
1218
1238
|
finalPositionIdList,
|
|
1219
1239
|
[positionSize],
|
|
1220
|
-
[
|
|
1221
|
-
Number(MAX_TICK),
|
|
1222
|
-
Number(MIN_TICK),
|
|
1223
|
-
0
|
|
1224
|
-
]],
|
|
1240
|
+
[tickTriplet],
|
|
1225
1241
|
false,
|
|
1226
1242
|
0n
|
|
1227
1243
|
]
|
|
@@ -1245,6 +1261,298 @@ async function getRequiredCreditForITM(params) {
|
|
|
1245
1261
|
};
|
|
1246
1262
|
}
|
|
1247
1263
|
/**
|
|
1264
|
+
* Read the net `itmAmounts` a mint of `tokenId` would produce, via
|
|
1265
|
+
* `PanopticQuery.getItmAmounts`. This is the swap-independent, per-leg-linear
|
|
1266
|
+
* projection that drives the SFPM's mint-time netting swap: the swap only fires
|
|
1267
|
+
* when `itmAmounts != 0`. Sizing width=0 legs so the combined tokenId returns
|
|
1268
|
+
* (~0, ~0) here makes the mint swap dust — regardless of Zap vs cover.
|
|
1269
|
+
*
|
|
1270
|
+
* @param params - The parameters
|
|
1271
|
+
* @returns The net itm0/itm1 with block metadata
|
|
1272
|
+
*/
|
|
1273
|
+
async function getItmAmounts(params) {
|
|
1274
|
+
const { client, queryAddress, poolAddress, tokenId, positionSize, blockNumber } = params;
|
|
1275
|
+
if (blockNumber !== void 0 && params._meta !== void 0 && params._meta.blockNumber !== blockNumber) throw new PanopticError("getItmAmounts: blockNumber and _meta.blockNumber disagree; cannot guarantee same-block consistency");
|
|
1276
|
+
const targetBlockNumber = blockNumber ?? params._meta?.blockNumber ?? await client.getBlockNumber();
|
|
1277
|
+
const [result, _meta] = await Promise.all([client.readContract({
|
|
1278
|
+
address: queryAddress,
|
|
1279
|
+
abi: panopticQueryAbi,
|
|
1280
|
+
functionName: "getItmAmounts",
|
|
1281
|
+
args: [
|
|
1282
|
+
poolAddress,
|
|
1283
|
+
tokenId,
|
|
1284
|
+
positionSize
|
|
1285
|
+
],
|
|
1286
|
+
blockNumber: targetBlockNumber
|
|
1287
|
+
}), params._meta ?? getBlockMeta({
|
|
1288
|
+
client,
|
|
1289
|
+
blockNumber: targetBlockNumber
|
|
1290
|
+
})]);
|
|
1291
|
+
const [itm0, itm1] = result;
|
|
1292
|
+
return {
|
|
1293
|
+
itm0,
|
|
1294
|
+
itm1,
|
|
1295
|
+
_meta
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Dust threshold (token1 value units) below which an itm amount is treated as
|
|
1300
|
+
* zero — negligible token flow not worth a neutralizing leg. token0 amounts are
|
|
1301
|
+
* converted to token1 value at the current tick before comparison so a tiny
|
|
1302
|
+
* high-decimal amount can't masquerade as real flow.
|
|
1303
|
+
*/
|
|
1304
|
+
const FLOW_NEUTRAL_DUST_THRESHOLD = 1000n;
|
|
1305
|
+
const Q192$1 = 1n << 192n;
|
|
1306
|
+
const POOL_ID_MASK = (1n << 64n) - 1n;
|
|
1307
|
+
/**
|
|
1308
|
+
* Floor integer square root for bigints (Newton's method). Exact for all
|
|
1309
|
+
* non-negative inputs — no float precision loss for values above 2^53.
|
|
1310
|
+
*/
|
|
1311
|
+
function isqrt(value) {
|
|
1312
|
+
if (value < 0n) throw new PanopticError("isqrt of negative number");
|
|
1313
|
+
if (value < 2n) return value;
|
|
1314
|
+
let x = value;
|
|
1315
|
+
let y = x + 1n >> 1n;
|
|
1316
|
+
while (y < x) {
|
|
1317
|
+
x = y;
|
|
1318
|
+
y = x + value / x >> 1n;
|
|
1319
|
+
}
|
|
1320
|
+
return x;
|
|
1321
|
+
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Solve a single width=0 neutralizing leg sized to offset a token's signed itm.
|
|
1324
|
+
*
|
|
1325
|
+
* The leg moves `tokenIndex`'s token (`tokenType = tokenIndex`) and is denominated
|
|
1326
|
+
* in the opposite asset (`asset = 1 - tokenIndex`) so `asset ≠ tokenType` and the
|
|
1327
|
+
* notional scales continuously by strike: `notional ≈ positionSize · 1.0001^signed`.
|
|
1328
|
+
* `signedAmount` is the itm to cancel (the leg's itm contribution is `-signedAmount`):
|
|
1329
|
+
* positive itm ⇒ a short LOAN leg (isLong=0), negative itm ⇒ a long CREDIT leg (isLong=1).
|
|
1330
|
+
*
|
|
1331
|
+
* Width=0 legs never mint Uniswap liquidity (see SFPM `_createPositionInAMM`), so their
|
|
1332
|
+
* strike is NOT grid-constrained — we use full 1-tick granularity for the tightest sizing.
|
|
1333
|
+
* The closed form `positionSize·1.0001^strike` matches the contract's width-2-chunk
|
|
1334
|
+
* `getAmountsMoved` to within ~dust, so no correction loop is needed.
|
|
1335
|
+
* Throws `PanopticError` if the required strike leaves the valid (exclusive) tick range.
|
|
1336
|
+
*/
|
|
1337
|
+
function buildNeutralLeg(tokenIndex, signedAmount, positionSize) {
|
|
1338
|
+
const absAmount = signedAmount < 0n ? -signedAmount : signedAmount;
|
|
1339
|
+
const legAsset = tokenIndex === 0n ? 1n : 0n;
|
|
1340
|
+
const legIsLong = signedAmount < 0n;
|
|
1341
|
+
const sqrtKrawX96 = isqrt(absAmount * Q192$1 / positionSize);
|
|
1342
|
+
let signedTick;
|
|
1343
|
+
try {
|
|
1344
|
+
signedTick = sqrtPriceX96ToTick(sqrtKrawX96);
|
|
1345
|
+
} catch {
|
|
1346
|
+
throw new PanopticError("Cannot create flow-neutral position: neutralizing strike out of bounds");
|
|
1347
|
+
}
|
|
1348
|
+
if (signedTick <= MIN_TICK || signedTick >= MAX_TICK) throw new PanopticError("Cannot create flow-neutral position: neutralizing strike out of bounds");
|
|
1349
|
+
const strike = legAsset === 0n ? signedTick : -signedTick;
|
|
1350
|
+
return {
|
|
1351
|
+
strike,
|
|
1352
|
+
asset: legAsset,
|
|
1353
|
+
tokenType: tokenIndex,
|
|
1354
|
+
isCredit: legIsLong
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Assemble a tokenId with the neutralizing legs (self-partnered, width=0) placed either
|
|
1359
|
+
* BEFORE or AFTER the base legs.
|
|
1360
|
+
*
|
|
1361
|
+
* The leg at index 0 sets the position's swap frame (the token the Zap sources) and the
|
|
1362
|
+
* canonical `positionSize` denomination, so placement is asset-directed:
|
|
1363
|
+
* - `prepend=false` (default, e.g. PUTs): base legs keep their indices (option leg stays
|
|
1364
|
+
* at index 0); neutral legs are appended at `baseLegCount..`.
|
|
1365
|
+
* - `prepend=true` (e.g. CALLs): neutral legs occupy indices `0..k-1` and the base legs
|
|
1366
|
+
* shift by `k` (riskPartner remapped: self-partners follow their new index, cross
|
|
1367
|
+
* partners +k). This puts the credit leg first so the mint swap is asset-token
|
|
1368
|
+
* friendly for a call.
|
|
1369
|
+
*/
|
|
1370
|
+
function assembleNeutralTokenId(poolId, baseTokenId, neutralLegs, prepend) {
|
|
1371
|
+
let out = poolId;
|
|
1372
|
+
const baseLegs = decodeAllLegs(baseTokenId);
|
|
1373
|
+
const k = BigInt(neutralLegs.length);
|
|
1374
|
+
const shift = prepend ? k : 0n;
|
|
1375
|
+
if (prepend) neutralLegs.forEach((leg, i) => {
|
|
1376
|
+
const index = BigInt(i);
|
|
1377
|
+
out = addLegToTokenId(out, {
|
|
1378
|
+
index,
|
|
1379
|
+
asset: leg.asset,
|
|
1380
|
+
tokenType: leg.tokenType,
|
|
1381
|
+
optionRatio: 1n,
|
|
1382
|
+
isLong: leg.isCredit ? 1n : 0n,
|
|
1383
|
+
riskPartner: index,
|
|
1384
|
+
strike: leg.strike,
|
|
1385
|
+
width: 0n
|
|
1386
|
+
});
|
|
1387
|
+
});
|
|
1388
|
+
for (const leg of baseLegs) {
|
|
1389
|
+
const newIndex = leg.index + shift;
|
|
1390
|
+
const newRiskPartner = leg.riskPartner === leg.index ? newIndex : leg.riskPartner + shift;
|
|
1391
|
+
out = addLegToTokenId(out, {
|
|
1392
|
+
index: newIndex,
|
|
1393
|
+
asset: leg.asset,
|
|
1394
|
+
tokenType: leg.tokenType,
|
|
1395
|
+
optionRatio: leg.optionRatio,
|
|
1396
|
+
isLong: leg.isLong ? 1n : 0n,
|
|
1397
|
+
riskPartner: newRiskPartner,
|
|
1398
|
+
strike: leg.strike,
|
|
1399
|
+
width: leg.width
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
if (!prepend) {
|
|
1403
|
+
const base = BigInt(baseLegs.length);
|
|
1404
|
+
neutralLegs.forEach((leg, i) => {
|
|
1405
|
+
const index = base + BigInt(i);
|
|
1406
|
+
out = addLegToTokenId(out, {
|
|
1407
|
+
index,
|
|
1408
|
+
asset: leg.asset,
|
|
1409
|
+
tokenType: leg.tokenType,
|
|
1410
|
+
optionRatio: 1n,
|
|
1411
|
+
isLong: leg.isCredit ? 1n : 0n,
|
|
1412
|
+
riskPartner: index,
|
|
1413
|
+
strike: leg.strike,
|
|
1414
|
+
width: 0n
|
|
1415
|
+
});
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
return out;
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Create a flow-neutral tokenId by adding width=0 credit/loan leg(s) that zero the
|
|
1422
|
+
* position's NET token transfer at mint — the amount the user would otherwise send/receive
|
|
1423
|
+
* (and be surprised by at burn).
|
|
1424
|
+
*
|
|
1425
|
+
* Each leg is sized against the **realized net flow**, measured by
|
|
1426
|
+
* {@link getRequiredCreditForITM} under the mint's own `swapAtMint`. Verified on-chain: a
|
|
1427
|
+
* width=0 leg's marginal effect on its token's flow is LINEAR and 1:1 with its notional
|
|
1428
|
+
* (`positionSize · 1.0001^strike`, matching the contract's `getAmountsMoved`). So sizing the
|
|
1429
|
+
* notional to `|net flow|` and solving the strike directly drives the residual to ~dust in
|
|
1430
|
+
* ONE shot — no fixed-point loop. (Example: flow 122.08 USDC → strike −228275 → residual
|
|
1431
|
+
* −0.032 USDC.)
|
|
1432
|
+
*
|
|
1433
|
+
* How many legs, keyed on swap mode:
|
|
1434
|
+
* - **Zap** (`swapAtMint=true`): the mint swap consolidates the flow into ONE token and a
|
|
1435
|
+
* width=0 leg can only move the asset axis afterwards, so we add a single leg on the
|
|
1436
|
+
* dominant token; the smaller side is a swap artifact left as dust.
|
|
1437
|
+
* - **Cover** (`swapAtMint=false`): no swap, so the flow is genuinely two-sided and each
|
|
1438
|
+
* token's flow is independent — we add one leg PER token above dust (up to 2), each
|
|
1439
|
+
* sized 1:1 to its own side. This neutralizes both sides of e.g. a two-leg straddle.
|
|
1440
|
+
* Each width=0 leg has `asset ≠ tokenType` (strike-tunable):
|
|
1441
|
+
* - token0 flow ← width=0 call leg (tokenType0, asset1)
|
|
1442
|
+
* - token1 flow ← width=0 put leg (tokenType1, asset0)
|
|
1443
|
+
* `creditAmount = −delta`: a positive amount (user would deposit) → a short LOAN leg;
|
|
1444
|
+
* negative (user would receive) → a long CREDIT leg. `neutralizedTokenFlow` is a single
|
|
1445
|
+
* verify measurement of the combined position under the ACTUAL mint swap mode.
|
|
1446
|
+
*
|
|
1447
|
+
* Neutral legs (self-partnered, width=0) are placed so index 0 carries the correct swap
|
|
1448
|
+
* frame: for a single-leg CALL (option `tokenType === asset`) they are PREPENDED so the
|
|
1449
|
+
* credit leg leads and the mint swap is asset-token friendly; for a PUT (and any multi-leg
|
|
1450
|
+
* base) they are APPENDED so the option leg stays at index 0. `positionSize` is never
|
|
1451
|
+
* modified.
|
|
1452
|
+
*
|
|
1453
|
+
* @param params - The parameters
|
|
1454
|
+
* @returns The flow-neutral tokenId, the neutralizing legs, the base net-flow
|
|
1455
|
+
* measurement, and the combined position's residual flow. `neutralLegs` is empty
|
|
1456
|
+
* when the position is OTM (input tokenId returned unchanged).
|
|
1457
|
+
* @throws PanopticError if positionSize <= 0, base legs + 1 > 4, the current tick
|
|
1458
|
+
* is unavailable, or a neutralizing strike falls outside the valid tick range.
|
|
1459
|
+
*/
|
|
1460
|
+
async function createFlowNeutralTokenId(params) {
|
|
1461
|
+
const { client, poolAddress, account, tokenId, positionSize, existingPositionIds, swapAtMint = true, referenceSize, queryAddress, blockNumber } = params;
|
|
1462
|
+
if (positionSize <= 0n) throw new PanopticError("positionSize must be positive to create flow-neutral position");
|
|
1463
|
+
const measureSize = referenceSize !== void 0 && referenceSize > 0n && referenceSize < positionSize ? referenceSize : positionSize;
|
|
1464
|
+
const legCount = countLegs(tokenId);
|
|
1465
|
+
if (legCount >= 4n) throw new PanopticError("Cannot append neutralizing leg: tokenId already has 4 legs");
|
|
1466
|
+
const poolId = tokenId & POOL_ID_MASK;
|
|
1467
|
+
const baseLegs = decodeAllLegs(tokenId);
|
|
1468
|
+
const prependNeutral = baseLegs.length === 1 && baseLegs[0].tokenType === baseLegs[0].asset;
|
|
1469
|
+
const credit = await getRequiredCreditForITM({
|
|
1470
|
+
client,
|
|
1471
|
+
poolAddress,
|
|
1472
|
+
account,
|
|
1473
|
+
tokenId,
|
|
1474
|
+
positionSize: measureSize,
|
|
1475
|
+
existingPositionIds,
|
|
1476
|
+
swapAtMint,
|
|
1477
|
+
blockNumber,
|
|
1478
|
+
_meta: params._meta
|
|
1479
|
+
});
|
|
1480
|
+
const tickBefore = credit.tokenFlow.tickBefore;
|
|
1481
|
+
if (tickBefore === null) throw new PanopticError("Cannot create flow-neutral position: current tick unavailable");
|
|
1482
|
+
const sqrtPX96 = tickToSqrtPriceX96(tickBefore);
|
|
1483
|
+
const valueAbs = (index, amount) => {
|
|
1484
|
+
const abs = amount < 0n ? -amount : amount;
|
|
1485
|
+
return index === 0n ? abs * sqrtPX96 * sqrtPX96 / Q192$1 : abs;
|
|
1486
|
+
};
|
|
1487
|
+
const flowFor = (index) => index === 0n ? credit.creditAmount0 : credit.creditAmount1;
|
|
1488
|
+
if (queryAddress !== void 0) {
|
|
1489
|
+
const itm = await getItmAmounts({
|
|
1490
|
+
client,
|
|
1491
|
+
queryAddress,
|
|
1492
|
+
poolAddress,
|
|
1493
|
+
tokenId,
|
|
1494
|
+
positionSize: measureSize,
|
|
1495
|
+
blockNumber: blockNumber ?? credit._meta.blockNumber,
|
|
1496
|
+
_meta: credit._meta
|
|
1497
|
+
});
|
|
1498
|
+
if (valueAbs(0n, itm.itm0) <= FLOW_NEUTRAL_DUST_THRESHOLD && valueAbs(1n, itm.itm1) <= FLOW_NEUTRAL_DUST_THRESHOLD) return {
|
|
1499
|
+
tokenId,
|
|
1500
|
+
positionSize,
|
|
1501
|
+
neutralLegs: [],
|
|
1502
|
+
originalCredit: credit,
|
|
1503
|
+
neutralizedTokenFlow: credit.tokenFlow,
|
|
1504
|
+
_meta: credit._meta
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
if (valueAbs(0n, credit.creditAmount0) <= FLOW_NEUTRAL_DUST_THRESHOLD && valueAbs(1n, credit.creditAmount1) <= FLOW_NEUTRAL_DUST_THRESHOLD) return {
|
|
1508
|
+
tokenId,
|
|
1509
|
+
positionSize,
|
|
1510
|
+
neutralLegs: [],
|
|
1511
|
+
originalCredit: credit,
|
|
1512
|
+
neutralizedTokenFlow: credit.tokenFlow,
|
|
1513
|
+
_meta: credit._meta
|
|
1514
|
+
};
|
|
1515
|
+
const indices = swapAtMint ? [valueAbs(0n, credit.creditAmount0) >= valueAbs(1n, credit.creditAmount1) ? 0n : 1n] : [0n, 1n].filter((i) => valueAbs(i, flowFor(i)) > FLOW_NEUTRAL_DUST_THRESHOLD);
|
|
1516
|
+
if (legCount + BigInt(indices.length) > 4n) throw new PanopticError(`Cannot add ${indices.length} neutralizing leg(s): tokenId would exceed 4 legs`);
|
|
1517
|
+
const neutralLegs = indices.map((i) => buildNeutralLeg(i, flowFor(i), measureSize));
|
|
1518
|
+
const combined = assembleNeutralTokenId(poolId, tokenId, neutralLegs, prependNeutral);
|
|
1519
|
+
const pinnedBlock = blockNumber ?? credit._meta.blockNumber;
|
|
1520
|
+
let residual;
|
|
1521
|
+
try {
|
|
1522
|
+
residual = await getRequiredCreditForITM({
|
|
1523
|
+
client,
|
|
1524
|
+
poolAddress,
|
|
1525
|
+
account,
|
|
1526
|
+
tokenId: combined,
|
|
1527
|
+
positionSize,
|
|
1528
|
+
existingPositionIds,
|
|
1529
|
+
swapAtMint,
|
|
1530
|
+
blockNumber: pinnedBlock,
|
|
1531
|
+
_meta: credit._meta
|
|
1532
|
+
});
|
|
1533
|
+
} catch {
|
|
1534
|
+
residual = await getRequiredCreditForITM({
|
|
1535
|
+
client,
|
|
1536
|
+
poolAddress,
|
|
1537
|
+
account,
|
|
1538
|
+
tokenId: combined,
|
|
1539
|
+
positionSize: measureSize,
|
|
1540
|
+
existingPositionIds,
|
|
1541
|
+
swapAtMint,
|
|
1542
|
+
blockNumber: pinnedBlock,
|
|
1543
|
+
_meta: credit._meta
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
return {
|
|
1547
|
+
tokenId: combined,
|
|
1548
|
+
positionSize,
|
|
1549
|
+
neutralLegs,
|
|
1550
|
+
originalCredit: credit,
|
|
1551
|
+
neutralizedTokenFlow: residual.tokenFlow,
|
|
1552
|
+
_meta: credit._meta
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1248
1556
|
* Find the maximum withdrawable amount from a CollateralTracker using binary search.
|
|
1249
1557
|
*
|
|
1250
1558
|
* When a user has open positions, the standard `maxWithdraw()` returns 0 because
|
|
@@ -5273,6 +5581,13 @@ const queryKeys = {
|
|
|
5273
5581
|
account,
|
|
5274
5582
|
tokenId.toString()
|
|
5275
5583
|
],
|
|
5584
|
+
flowNeutralTokenId: (chainId, poolAddress, tokenId) => [
|
|
5585
|
+
...queryKeys.all,
|
|
5586
|
+
"flowNeutralTokenId",
|
|
5587
|
+
chainId.toString(),
|
|
5588
|
+
poolAddress,
|
|
5589
|
+
tokenId.toString()
|
|
5590
|
+
],
|
|
5276
5591
|
interestState: (chainId, poolAddress, account) => [
|
|
5277
5592
|
...queryKeys.all,
|
|
5278
5593
|
"interestState",
|
|
@@ -5917,6 +6232,46 @@ function useEstimateCollateralRequired(poolAddress, tokenId, positionSize, query
|
|
|
5917
6232
|
gcTime: options?.gcTime
|
|
5918
6233
|
});
|
|
5919
6234
|
}
|
|
6235
|
+
function useFlowNeutralTokenId(poolAddress, tokenId, positionSize, account, options) {
|
|
6236
|
+
const ctx = usePanopticContext();
|
|
6237
|
+
const resolvedAccount = account ?? ctx.account;
|
|
6238
|
+
const neutralizeITM = options?.neutralizeITM ?? true;
|
|
6239
|
+
const swapAtMint = options?.swapAtMint ?? true;
|
|
6240
|
+
const referenceSize = options?.referenceSize;
|
|
6241
|
+
const queryAddress = options?.queryAddress;
|
|
6242
|
+
return useQuery({
|
|
6243
|
+
queryKey: [
|
|
6244
|
+
...queryKeys.flowNeutralTokenId(ctx.chainId, poolAddress, tokenId),
|
|
6245
|
+
getClientCacheScopeKey(ctx.publicClient, ctx.clientScope),
|
|
6246
|
+
resolvedAccount ?? "",
|
|
6247
|
+
positionSize.toString(),
|
|
6248
|
+
(options?.existingPositionIds ?? []).map(String).join(","),
|
|
6249
|
+
neutralizeITM,
|
|
6250
|
+
swapAtMint,
|
|
6251
|
+
positionSize,
|
|
6252
|
+
options?.existingPositionIds,
|
|
6253
|
+
(referenceSize ?? 0n).toString(),
|
|
6254
|
+
referenceSize,
|
|
6255
|
+
queryAddress ?? ""
|
|
6256
|
+
],
|
|
6257
|
+
queryFn: () => {
|
|
6258
|
+
if (!resolvedAccount) throw new Error("account required for createFlowNeutralTokenId");
|
|
6259
|
+
return createFlowNeutralTokenId({
|
|
6260
|
+
client: ctx.publicClient,
|
|
6261
|
+
poolAddress,
|
|
6262
|
+
account: resolvedAccount,
|
|
6263
|
+
tokenId,
|
|
6264
|
+
positionSize,
|
|
6265
|
+
existingPositionIds: options?.existingPositionIds,
|
|
6266
|
+
swapAtMint,
|
|
6267
|
+
referenceSize,
|
|
6268
|
+
queryAddress
|
|
6269
|
+
});
|
|
6270
|
+
},
|
|
6271
|
+
enabled: (options?.enabled ?? true) && neutralizeITM && !!resolvedAccount && tokenId !== 0n && positionSize > 0n,
|
|
6272
|
+
refetchInterval: options?.refetchInterval
|
|
6273
|
+
});
|
|
6274
|
+
}
|
|
5920
6275
|
function useMaxPositionSize(poolAddress, tokenId, queryAddress, account, options) {
|
|
5921
6276
|
const ctx = usePanopticContext();
|
|
5922
6277
|
const resolvedAccount = account ?? ctx.account;
|
|
@@ -5928,7 +6283,8 @@ function useMaxPositionSize(poolAddress, tokenId, queryAddress, account, options
|
|
|
5928
6283
|
options?.existingPositionIds?.map(String).join(",") ?? "",
|
|
5929
6284
|
options?.existingPositionIds,
|
|
5930
6285
|
options?.swapAtMint ?? false,
|
|
5931
|
-
options?.precisionPct ?? 1
|
|
6286
|
+
options?.precisionPct ?? 1,
|
|
6287
|
+
options?.usePremiaAsCollateral ?? false
|
|
5932
6288
|
],
|
|
5933
6289
|
queryFn: () => {
|
|
5934
6290
|
if (!resolvedAccount) throw new Error("account required for getMaxPositionSize");
|
|
@@ -5940,7 +6296,8 @@ function useMaxPositionSize(poolAddress, tokenId, queryAddress, account, options
|
|
|
5940
6296
|
queryAddress,
|
|
5941
6297
|
existingPositionIds: options?.existingPositionIds,
|
|
5942
6298
|
swapAtMint: options?.swapAtMint,
|
|
5943
|
-
precisionPct: options?.precisionPct
|
|
6299
|
+
precisionPct: options?.precisionPct,
|
|
6300
|
+
usePremiaAsCollateral: options?.usePremiaAsCollateral
|
|
5944
6301
|
});
|
|
5945
6302
|
},
|
|
5946
6303
|
enabled: (options?.enabled ?? true) && !!resolvedAccount,
|
|
@@ -10921,5 +11278,5 @@ function useTxEventConfirmation({ txHash, poolAddress = zeroAddress, collateralT
|
|
|
10921
11278
|
}
|
|
10922
11279
|
|
|
10923
11280
|
//#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, collateralTrackerV2Abi, 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, 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, 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 };
|
|
11281
|
+
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, getItmAmounts, getLegDelta, getLegDeltaInVaultFrame, 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, toVaultFrameAtTick, 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
11282
|
//# sourceMappingURL=index.js.map
|