@panoptic-eng/sdk 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cow/index.js +3 -3
- package/dist/{cow-BilQfbNT.js → cow-DW6LjXES.js} +2 -2
- package/dist/{cow-BilQfbNT.js.map → cow-DW6LjXES.js.map} +1 -1
- package/dist/index.d.ts +74 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +116 -3
- package/dist/index.js.map +1 -1
- package/dist/{irm-C7EQwrga.js → irm-Dw6fa-DV.js} +2 -2
- package/dist/{irm-C7EQwrga.js.map → irm-Dw6fa-DV.js.map} +1 -1
- package/dist/panoptic/v2/index.d.ts +169 -40
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +280 -115
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/{position-CsIEneku.js → position-GYsTTl71.js} +20 -2
- package/dist/position-GYsTTl71.js.map +1 -0
- package/dist/{router-BM10ZWY5.js → router-_vB5ArjF.js} +2 -2
- package/dist/{router-BM10ZWY5.js.map → router-_vB5ArjF.js.map} +1 -1
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +3 -3
- package/dist/{writes-BnO9zj-Z.js → writes-h-IX3XQq.js} +37 -3
- package/dist/writes-h-IX3XQq.js.map +1 -0
- package/package.json +1 -1
- package/dist/position-CsIEneku.js.map +0 -1
- package/dist/writes-BnO9zj-Z.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$1 as 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, 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-
|
|
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";
|
|
@@ -1047,7 +1047,7 @@ async function estimateCollateralRequired(params) {
|
|
|
1047
1047
|
* @returns Maximum position size with bounds and block metadata
|
|
1048
1048
|
*/
|
|
1049
1049
|
async function getMaxPositionSize(params) {
|
|
1050
|
-
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;
|
|
1051
1051
|
const targetBlockNumber = blockNumber ?? params._meta?.blockNumber ?? await client.getBlockNumber();
|
|
1052
1052
|
let positionIds;
|
|
1053
1053
|
if (existingPositionIds !== void 0) positionIds = existingPositionIds;
|
|
@@ -1090,7 +1090,8 @@ async function getMaxPositionSize(params) {
|
|
|
1090
1090
|
low: maxSizeAtMaxUtil / 2n,
|
|
1091
1091
|
high: maxSizeAtMinUtil * 2n,
|
|
1092
1092
|
precisionDivisor,
|
|
1093
|
-
swapAtMint
|
|
1093
|
+
swapAtMint,
|
|
1094
|
+
usePremiaAsCollateral
|
|
1094
1095
|
});
|
|
1095
1096
|
return {
|
|
1096
1097
|
maxSize,
|
|
@@ -1104,7 +1105,7 @@ async function getMaxPositionSize(params) {
|
|
|
1104
1105
|
* Tests 5 points per round (sextiles), narrowing the range by 6x each iteration.
|
|
1105
1106
|
*/
|
|
1106
1107
|
async function binarySearchMaxSize(params) {
|
|
1107
|
-
const { client, poolAddress, account, tokenId, existingPositionIds, precisionDivisor, swapAtMint } = params;
|
|
1108
|
+
const { client, poolAddress, account, tokenId, existingPositionIds, precisionDivisor, swapAtMint, usePremiaAsCollateral } = params;
|
|
1108
1109
|
let { low, high } = params;
|
|
1109
1110
|
const trySize = (positionSize) => tryDispatchSimulation({
|
|
1110
1111
|
client,
|
|
@@ -1113,7 +1114,8 @@ async function binarySearchMaxSize(params) {
|
|
|
1113
1114
|
tokenId,
|
|
1114
1115
|
existingPositionIds,
|
|
1115
1116
|
positionSize,
|
|
1116
|
-
swapAtMint
|
|
1117
|
+
swapAtMint,
|
|
1118
|
+
usePremiaAsCollateral
|
|
1117
1119
|
});
|
|
1118
1120
|
while (high - low > 1n && high - low > low / precisionDivisor) {
|
|
1119
1121
|
const range = high - low;
|
|
@@ -1150,7 +1152,7 @@ async function binarySearchMaxSize(params) {
|
|
|
1150
1152
|
* Try to simulate opening a position with the given size.
|
|
1151
1153
|
*/
|
|
1152
1154
|
async function tryDispatchSimulation(params) {
|
|
1153
|
-
const { client, poolAddress, account, tokenId, existingPositionIds, positionSize, swapAtMint } = params;
|
|
1155
|
+
const { client, poolAddress, account, tokenId, existingPositionIds, positionSize, swapAtMint, usePremiaAsCollateral } = params;
|
|
1154
1156
|
try {
|
|
1155
1157
|
const finalPositionIdList = [...existingPositionIds, tokenId];
|
|
1156
1158
|
const tickLimits$1 = swapAtMint ? [
|
|
@@ -1170,7 +1172,7 @@ async function tryDispatchSimulation(params) {
|
|
|
1170
1172
|
finalPositionIdList,
|
|
1171
1173
|
[positionSize],
|
|
1172
1174
|
[tickLimits$1],
|
|
1173
|
-
|
|
1175
|
+
usePremiaAsCollateral,
|
|
1174
1176
|
0n
|
|
1175
1177
|
]
|
|
1176
1178
|
});
|
|
@@ -1215,9 +1217,19 @@ async function tryDispatchSimulation(params) {
|
|
|
1215
1217
|
* ```
|
|
1216
1218
|
*/
|
|
1217
1219
|
async function getRequiredCreditForITM(params) {
|
|
1218
|
-
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");
|
|
1219
1222
|
const targetBlockNumber = blockNumber ?? params._meta?.blockNumber ?? await client.getBlockNumber();
|
|
1220
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
|
+
];
|
|
1221
1233
|
const callData = encodeFunctionData({
|
|
1222
1234
|
abi: panopticPoolV2Abi,
|
|
1223
1235
|
functionName: "dispatch",
|
|
@@ -1225,11 +1237,7 @@ async function getRequiredCreditForITM(params) {
|
|
|
1225
1237
|
[tokenId],
|
|
1226
1238
|
finalPositionIdList,
|
|
1227
1239
|
[positionSize],
|
|
1228
|
-
[
|
|
1229
|
-
Number(MAX_TICK),
|
|
1230
|
-
Number(MIN_TICK),
|
|
1231
|
-
MAX_EFFECTIVE_LIQUIDITY_LIMIT
|
|
1232
|
-
]],
|
|
1240
|
+
[tickTriplet],
|
|
1233
1241
|
false,
|
|
1234
1242
|
0n
|
|
1235
1243
|
]
|
|
@@ -1253,11 +1261,45 @@ async function getRequiredCreditForITM(params) {
|
|
|
1253
1261
|
};
|
|
1254
1262
|
}
|
|
1255
1263
|
/**
|
|
1256
|
-
*
|
|
1257
|
-
*
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
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.
|
|
1261
1303
|
*/
|
|
1262
1304
|
const FLOW_NEUTRAL_DUST_THRESHOLD = 1000n;
|
|
1263
1305
|
const Q192$1 = 1n << 192n;
|
|
@@ -1278,124 +1320,235 @@ function isqrt(value) {
|
|
|
1278
1320
|
return x;
|
|
1279
1321
|
}
|
|
1280
1322
|
/**
|
|
1281
|
-
*
|
|
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.
|
|
1282
1336
|
*/
|
|
1283
|
-
function
|
|
1284
|
-
|
|
1285
|
-
const
|
|
1286
|
-
const
|
|
1287
|
-
|
|
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
|
+
};
|
|
1288
1356
|
}
|
|
1289
1357
|
/**
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1293
|
-
*
|
|
1294
|
-
*
|
|
1295
|
-
*
|
|
1296
|
-
*
|
|
1297
|
-
*
|
|
1298
|
-
*
|
|
1299
|
-
*
|
|
1300
|
-
*
|
|
1301
|
-
|
|
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.
|
|
1302
1452
|
*
|
|
1303
1453
|
* @param params - The parameters
|
|
1304
|
-
* @returns The flow-neutral tokenId
|
|
1305
|
-
*
|
|
1306
|
-
* the
|
|
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.
|
|
1307
1459
|
*/
|
|
1308
1460
|
async function createFlowNeutralTokenId(params) {
|
|
1309
|
-
const { client, poolAddress, account, tokenId, positionSize, existingPositionIds, blockNumber } = params;
|
|
1461
|
+
const { client, poolAddress, account, tokenId, positionSize, existingPositionIds, swapAtMint = true, referenceSize, queryAddress, blockNumber } = params;
|
|
1310
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;
|
|
1311
1464
|
const legCount = countLegs(tokenId);
|
|
1312
|
-
if (legCount >= 4n) throw new PanopticError("Cannot
|
|
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;
|
|
1313
1469
|
const credit = await getRequiredCreditForITM({
|
|
1314
1470
|
client,
|
|
1315
1471
|
poolAddress,
|
|
1316
1472
|
account,
|
|
1317
1473
|
tokenId,
|
|
1318
|
-
positionSize,
|
|
1474
|
+
positionSize: measureSize,
|
|
1319
1475
|
existingPositionIds,
|
|
1476
|
+
swapAtMint,
|
|
1320
1477
|
blockNumber,
|
|
1321
1478
|
_meta: params._meta
|
|
1322
1479
|
});
|
|
1323
|
-
const abs0 = credit.creditAmount0 < 0n ? -credit.creditAmount0 : credit.creditAmount0;
|
|
1324
|
-
const abs1 = credit.creditAmount1 < 0n ? -credit.creditAmount1 : credit.creditAmount1;
|
|
1325
1480
|
const tickBefore = credit.tokenFlow.tickBefore;
|
|
1326
1481
|
if (tickBefore === null) throw new PanopticError("Cannot create flow-neutral position: current tick unavailable");
|
|
1327
1482
|
const sqrtPX96 = tickToSqrtPriceX96(tickBefore);
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
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 {
|
|
1332
1508
|
tokenId,
|
|
1333
1509
|
positionSize,
|
|
1334
|
-
|
|
1335
|
-
neutralAsset: 0n,
|
|
1336
|
-
neutralTokenType: 0n,
|
|
1337
|
-
neutralIsCredit: false,
|
|
1510
|
+
neutralLegs: [],
|
|
1338
1511
|
originalCredit: credit,
|
|
1339
|
-
|
|
1512
|
+
neutralizedTokenFlow: credit.tokenFlow,
|
|
1340
1513
|
_meta: credit._meta
|
|
1341
1514
|
};
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
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;
|
|
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;
|
|
1355
1521
|
try {
|
|
1356
|
-
|
|
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
|
+
});
|
|
1357
1533
|
} catch {
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
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
|
|
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
|
|
1388
1544
|
});
|
|
1389
1545
|
}
|
|
1390
1546
|
return {
|
|
1391
|
-
tokenId:
|
|
1547
|
+
tokenId: combined,
|
|
1392
1548
|
positionSize,
|
|
1393
|
-
|
|
1394
|
-
neutralAsset: legAsset,
|
|
1395
|
-
neutralTokenType: legTokenType,
|
|
1396
|
-
neutralIsCredit: legIsLong,
|
|
1549
|
+
neutralLegs,
|
|
1397
1550
|
originalCredit: credit,
|
|
1398
|
-
|
|
1551
|
+
neutralizedTokenFlow: residual.tokenFlow,
|
|
1399
1552
|
_meta: credit._meta
|
|
1400
1553
|
};
|
|
1401
1554
|
}
|
|
@@ -5428,12 +5581,11 @@ const queryKeys = {
|
|
|
5428
5581
|
account,
|
|
5429
5582
|
tokenId.toString()
|
|
5430
5583
|
],
|
|
5431
|
-
flowNeutralTokenId: (chainId, poolAddress,
|
|
5584
|
+
flowNeutralTokenId: (chainId, poolAddress, tokenId) => [
|
|
5432
5585
|
...queryKeys.all,
|
|
5433
5586
|
"flowNeutralTokenId",
|
|
5434
5587
|
chainId.toString(),
|
|
5435
5588
|
poolAddress,
|
|
5436
|
-
account,
|
|
5437
5589
|
tokenId.toString()
|
|
5438
5590
|
],
|
|
5439
5591
|
interestState: (chainId, poolAddress, account) => [
|
|
@@ -6084,15 +6236,23 @@ function useFlowNeutralTokenId(poolAddress, tokenId, positionSize, account, opti
|
|
|
6084
6236
|
const ctx = usePanopticContext();
|
|
6085
6237
|
const resolvedAccount = account ?? ctx.account;
|
|
6086
6238
|
const neutralizeITM = options?.neutralizeITM ?? true;
|
|
6239
|
+
const swapAtMint = options?.swapAtMint ?? true;
|
|
6240
|
+
const referenceSize = options?.referenceSize;
|
|
6241
|
+
const queryAddress = options?.queryAddress;
|
|
6087
6242
|
return useQuery({
|
|
6088
6243
|
queryKey: [
|
|
6089
|
-
...queryKeys.flowNeutralTokenId(ctx.chainId, poolAddress,
|
|
6244
|
+
...queryKeys.flowNeutralTokenId(ctx.chainId, poolAddress, tokenId),
|
|
6090
6245
|
getClientCacheScopeKey(ctx.publicClient, ctx.clientScope),
|
|
6246
|
+
resolvedAccount ?? "",
|
|
6091
6247
|
positionSize.toString(),
|
|
6092
6248
|
(options?.existingPositionIds ?? []).map(String).join(","),
|
|
6093
6249
|
neutralizeITM,
|
|
6250
|
+
swapAtMint,
|
|
6094
6251
|
positionSize,
|
|
6095
|
-
options?.existingPositionIds
|
|
6252
|
+
options?.existingPositionIds,
|
|
6253
|
+
(referenceSize ?? 0n).toString(),
|
|
6254
|
+
referenceSize,
|
|
6255
|
+
queryAddress ?? ""
|
|
6096
6256
|
],
|
|
6097
6257
|
queryFn: () => {
|
|
6098
6258
|
if (!resolvedAccount) throw new Error("account required for createFlowNeutralTokenId");
|
|
@@ -6102,7 +6262,10 @@ function useFlowNeutralTokenId(poolAddress, tokenId, positionSize, account, opti
|
|
|
6102
6262
|
account: resolvedAccount,
|
|
6103
6263
|
tokenId,
|
|
6104
6264
|
positionSize,
|
|
6105
|
-
existingPositionIds: options?.existingPositionIds
|
|
6265
|
+
existingPositionIds: options?.existingPositionIds,
|
|
6266
|
+
swapAtMint,
|
|
6267
|
+
referenceSize,
|
|
6268
|
+
queryAddress
|
|
6106
6269
|
});
|
|
6107
6270
|
},
|
|
6108
6271
|
enabled: (options?.enabled ?? true) && neutralizeITM && !!resolvedAccount && tokenId !== 0n && positionSize > 0n,
|
|
@@ -6120,7 +6283,8 @@ function useMaxPositionSize(poolAddress, tokenId, queryAddress, account, options
|
|
|
6120
6283
|
options?.existingPositionIds?.map(String).join(",") ?? "",
|
|
6121
6284
|
options?.existingPositionIds,
|
|
6122
6285
|
options?.swapAtMint ?? false,
|
|
6123
|
-
options?.precisionPct ?? 1
|
|
6286
|
+
options?.precisionPct ?? 1,
|
|
6287
|
+
options?.usePremiaAsCollateral ?? false
|
|
6124
6288
|
],
|
|
6125
6289
|
queryFn: () => {
|
|
6126
6290
|
if (!resolvedAccount) throw new Error("account required for getMaxPositionSize");
|
|
@@ -6132,7 +6296,8 @@ function useMaxPositionSize(poolAddress, tokenId, queryAddress, account, options
|
|
|
6132
6296
|
queryAddress,
|
|
6133
6297
|
existingPositionIds: options?.existingPositionIds,
|
|
6134
6298
|
swapAtMint: options?.swapAtMint,
|
|
6135
|
-
precisionPct: options?.precisionPct
|
|
6299
|
+
precisionPct: options?.precisionPct,
|
|
6300
|
+
usePremiaAsCollateral: options?.usePremiaAsCollateral
|
|
6136
6301
|
});
|
|
6137
6302
|
},
|
|
6138
6303
|
enabled: (options?.enabled ?? true) && !!resolvedAccount,
|
|
@@ -11113,5 +11278,5 @@ function useTxEventConfirmation({ txHash, poolAddress = zeroAddress, collateralT
|
|
|
11113
11278
|
}
|
|
11114
11279
|
|
|
11115
11280
|
//#endregion
|
|
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 };
|
|
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 };
|
|
11117
11282
|
//# sourceMappingURL=index.js.map
|