@panoptic-eng/sdk 1.0.69 → 1.0.71
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.map +1 -1
- package/dist/{cow-BBPknr5W.js → cow-QYYo31eR.js} +1 -1
- package/dist/index.d.ts +42 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -22
- package/dist/index.js.map +1 -1
- package/dist/{irm-DurYJ0ht.js → irm-HM0KEH12.js} +926 -2
- package/dist/panoptic/v2/index.d.ts +156 -2
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +1538 -74
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/panoptic/v2/react-public.d.ts +177 -2
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +1584 -74
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{providers-DubVMHWU.js → providers-CbcNt27n.js} +2 -1
- package/dist/{rates-B-eRYOTS.js → rates-DlqTkuXt.js} +1 -1
- package/dist/{router-ChMhfTqT.js → router-DDJ3OnDA.js} +29 -3
- package/dist/rpc/index.d.ts +9 -1
- package/dist/rpc/index.d.ts.map +1 -1
- package/dist/rpc/index.js +34 -2
- package/dist/rpc/index.js.map +1 -1
- package/dist/uniswap/index.d.ts +10 -1
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +27 -1
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-Bo1vZXvR.js → v2-BJtBYpJa.js} +537 -28
- package/dist/{writes-D53wWDT-.js → writes-DBu2ltcP.js} +33 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchValidationError, DEFAULT_VEGOID, InputListFailError, InvalidTickLimitsError, InvalidTokenIdParameterError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LoanSlotExhaustedError, MaxRetriesExceededError, MissingPositionIdsError, NoLoanPositionsError, OracleRateLimitedError, PanopticError, PanopticValidationError, PositionSnapshotNotFoundError, ProviderLagError, STANDARD_TICK_WIDTHS, STRIKE_CONVERSION_FACTOR, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, UnsafePremiumSettlementError, collateralTrackerV2Abi, createTxResult, decodeLeftRightUnsigned, decodeOracleTiming, decodePosition, decodeTickSpacing, formatTokenAmount, getBlockMeta, getOpenPositionIds, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositions, getPositionsKey, getSyncCheckpointKey, getTrackedPositionIds, jsonSerializer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, parsePanopticError, parseTokenAmount, submitWrite } from "./rates-
|
|
1
|
+
import { BatchValidationError, DEFAULT_VEGOID, InputListFailError, InvalidTickLimitsError, InvalidTokenIdParameterError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LoanSlotExhaustedError, MaxRetriesExceededError, MissingPositionIdsError, NoLoanPositionsError, OracleRateLimitedError, PanopticError, PanopticValidationError, PositionSnapshotNotFoundError, ProviderLagError, STANDARD_TICK_WIDTHS, STRIKE_CONVERSION_FACTOR, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, UnsafePremiumSettlementError, collateralTrackerV2Abi, createTxResult, decodeLeftRightUnsigned, decodeOracleTiming, decodePosition, decodeTickSpacing, formatTokenAmount, getBlockMeta, getOpenPositionIds, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositions, getPositionsKey, getSyncCheckpointKey, getTrackedPositionIds, jsonSerializer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, parsePanopticError, parseTokenAmount, submitWrite } from "./rates-DlqTkuXt.js";
|
|
2
2
|
import { MAX_TICK, MIN_TICK, REORG_DEPTH, calculatePositionGreeks, priceToTick, roundToTickSpacing, sqrtPriceX96ToTick, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96 } from "./greeks-DNPP24KL.js";
|
|
3
3
|
import { decodeFunctionResult, encodeFunctionData, erc20Abi, getAbiItem } from "viem";
|
|
4
4
|
|
|
@@ -3050,6 +3050,37 @@ function splitTokenIdByTimescale(tokenId, positionSize, targetTimescale) {
|
|
|
3050
3050
|
};
|
|
3051
3051
|
}
|
|
3052
3052
|
|
|
3053
|
+
//#endregion
|
|
3054
|
+
//#region src/panoptic/v2/tokenId/validate.ts
|
|
3055
|
+
/**
|
|
3056
|
+
* Validate a TokenId's structure using the rules of TokenId.validate.
|
|
3057
|
+
* This does not check pool registration, available liquidity, or account collateral.
|
|
3058
|
+
*/
|
|
3059
|
+
function getTokenIdValidationError(tokenId) {
|
|
3060
|
+
if (tokenId < 0n || tokenId >= 1n << 256n) return "Token ID must fit in uint256.";
|
|
3061
|
+
const legs = [];
|
|
3062
|
+
for (let index = 0n; index < TOKEN_ID_BITS.MAX_LEGS; index++) {
|
|
3063
|
+
const leg = decodeLeg(tokenId, index);
|
|
3064
|
+
if (leg.optionRatio === 0n) {
|
|
3065
|
+
const offset = TOKEN_ID_BITS.POOL_ID_SIZE + index * TOKEN_ID_BITS.LEG_SIZE;
|
|
3066
|
+
if (tokenId >> offset !== 0n) return "Position contains empty or non-contiguous legs.";
|
|
3067
|
+
break;
|
|
3068
|
+
}
|
|
3069
|
+
legs.push(leg);
|
|
3070
|
+
}
|
|
3071
|
+
if (legs.length === 0) return "Position must contain at least one leg.";
|
|
3072
|
+
const chunks = new Set();
|
|
3073
|
+
for (const leg of legs) {
|
|
3074
|
+
const chunk = `${leg.strike}:${leg.width}:${leg.tokenType}`;
|
|
3075
|
+
if (chunks.has(chunk)) return "Position contains duplicate legs sharing the same liquidity chunk.";
|
|
3076
|
+
chunks.add(chunk);
|
|
3077
|
+
if (leg.strike <= -887272n || leg.strike >= 887272n) return "Position strike must be inside the pool tick bounds.";
|
|
3078
|
+
const partner = legs[Number(leg.riskPartner)];
|
|
3079
|
+
if (!partner || partner.riskPartner !== leg.index) return "Position risk partners must reference existing legs and be mutual.";
|
|
3080
|
+
}
|
|
3081
|
+
return null;
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3053
3084
|
//#endregion
|
|
3054
3085
|
//#region src/panoptic/v2/writes/protectedSettle.ts
|
|
3055
3086
|
const POOL_ID_MASK = (1n << 64n) - 1n;
|
|
@@ -5937,4 +5968,4 @@ async function smartRepayAndWait(params) {
|
|
|
5937
5968
|
}
|
|
5938
5969
|
|
|
5939
5970
|
//#endregion
|
|
5940
|
-
export { addLegToTokenId, approve, approveAndWait, approvePool, borrow, borrowAndWait, buildBatchDispatchArgs, buildCreditSwapCall, buildOpenPositionCalldata, buildProtectedSettleDispatch, buildProtectedSettlePlan, buildSettleSequenceCalls, buildUniqueCredit, buildUniqueLoan, buildUniqueWidthZeroLeg, calculateResyncBlock, cancelTransaction, checkApproval, clearCheckpoint, closePosition, closePositionAndWait, countLegs, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllLegs, decodeLeg, decodePoolId, decodeTickSpacing$1, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveUniqueTokenId, detectReorg, dispatch, dispatchAndWait, encodeLeg, encodePoolId, encodeV4PoolId, executeBatchDispatch, executeBatchDispatchAndWait, executeSettleSequence, executeSettleSequenceAndWait, forceExercise, forceExerciseAndWait, formatBlockNumber, formatBps, formatCompact, formatDatetime, formatDuration, formatDurationSeconds, formatFeeTier, formatGas, formatGwei, formatPoolIdHex, formatRatioPercent, formatTimestamp, formatTimestampLocale, formatTokenIdHex, formatTokenIdShort, formatTxHash, formatUtilization, formatWei, generateOverlappingTokenIds, getAccountPremia, getAssetIndex, getCurrentPositionSizes, getForfeitablePremium, getPoolDeploymentBlock, getPoolDisplayId, getPoolTokensForSimulation, getPositionsWithPremia, getSimpleLoanTokenIndex, getTokenListId, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isInputListFailError, isLoan, isLoanLeg, isShortOnly, isSpread, liquidate, liquidateAndWait, loadCheckpoint, mint, mintAndWait, openPosition, openPositionAndWait, orderListForSettle, parseBps, parseTokenListId, planDeriveStrategy, pokeOracle, pokeOracleAndWait, previewBorrow, previewRepay, previewUnwrap, previewWrap, publicBroadcaster, reconstructFromEvents, redeem, redeemAndWait, repay, repayAndWait, resolveTokenIndex, rollPosition, rollPositionAndWait, saveCheckpoint, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, settlePremiumFrom, settlePremiumFromAndWait, simulateDispatch, simulateOpenPosition, simulateSettle, simulateSettlePremiumBatch, simulateSettlePremiumFrom, simulateSettleSequence, simulateWithTokenFlow, smartRepay, smartRepayAndWait, speedUpTransaction, splitTokenIdByTimescale, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, validateBatch, validatePoolId, verifyBlockContinuity, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
|
|
5971
|
+
export { addLegToTokenId, approve, approveAndWait, approvePool, borrow, borrowAndWait, buildBatchDispatchArgs, buildCreditSwapCall, buildOpenPositionCalldata, buildProtectedSettleDispatch, buildProtectedSettlePlan, buildSettleSequenceCalls, buildUniqueCredit, buildUniqueLoan, buildUniqueWidthZeroLeg, calculateResyncBlock, cancelTransaction, checkApproval, clearCheckpoint, closePosition, closePositionAndWait, countLegs, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllLegs, decodeLeg, decodePoolId, decodeTickSpacing$1, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveUniqueTokenId, detectReorg, dispatch, dispatchAndWait, encodeLeg, encodePoolId, encodeV4PoolId, executeBatchDispatch, executeBatchDispatchAndWait, executeSettleSequence, executeSettleSequenceAndWait, forceExercise, forceExerciseAndWait, formatBlockNumber, formatBps, formatCompact, formatDatetime, formatDuration, formatDurationSeconds, formatFeeTier, formatGas, formatGwei, formatPoolIdHex, formatRatioPercent, formatTimestamp, formatTimestampLocale, formatTokenIdHex, formatTokenIdShort, formatTxHash, formatUtilization, formatWei, generateOverlappingTokenIds, getAccountPremia, getAssetIndex, getCurrentPositionSizes, getForfeitablePremium, getPoolDeploymentBlock, getPoolDisplayId, getPoolTokensForSimulation, getPositionsWithPremia, getSimpleLoanTokenIndex, getTokenIdValidationError, getTokenListId, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isInputListFailError, isLoan, isLoanLeg, isShortOnly, isSpread, liquidate, liquidateAndWait, loadCheckpoint, mint, mintAndWait, openPosition, openPositionAndWait, orderListForSettle, parseBps, parseTokenListId, planDeriveStrategy, pokeOracle, pokeOracleAndWait, previewBorrow, previewRepay, previewUnwrap, previewWrap, publicBroadcaster, reconstructFromEvents, redeem, redeemAndWait, repay, repayAndWait, resolveTokenIndex, rollPosition, rollPositionAndWait, saveCheckpoint, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, settlePremiumFrom, settlePremiumFromAndWait, simulateDispatch, simulateOpenPosition, simulateSettle, simulateSettlePremiumBatch, simulateSettlePremiumFrom, simulateSettleSequence, simulateWithTokenFlow, smartRepay, smartRepayAndWait, speedUpTransaction, splitTokenIdByTimescale, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, validateBatch, validatePoolId, verifyBlockContinuity, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
|