@panoptic-eng/sdk 1.0.75 → 1.0.76

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.
@@ -1,5 +1,5 @@
1
1
  import { StateViewAbi } from "./StateView-q4yMpBY6.js";
2
- import { PanopticError, decodeAllLegs, decodeTokenId, getBlockMeta, getPool, getPoolMetadata, stateViewAbi, submitWrite, uniswapV3PoolAbi } from "./rates-c9XVKm3m.js";
2
+ import { PanopticError, decodeAllLegs, decodeTokenId, getBlockMeta, getPool, getPoolMetadata, stateViewAbi, submitWrite, uniswapV3PoolAbi } from "./tokenFlow-6Ec9Hz48.js";
3
3
  import { getLegLiquidityRange, tickToSqrtPriceX96 } from "./greeks-CEv-Uex1.js";
4
4
  import { BaseError, ContractFunctionRevertedError, ExecutionRevertedError, encodeAbiParameters, encodeFunctionData, encodePacked, erc20Abi, isAddressEqual, maxUint256, toHex, zeroAddress } from "viem";
5
5
  import Decimal from "decimal.js";
@@ -1,5 +1,5 @@
1
1
  import { ORACLE_EPOCH_SECONDS, SCHEMA_VERSION, STORAGE_PREFIX, calculatePositionGreeks, tickToSqrtPriceX96 } from "./greeks-CEv-Uex1.js";
2
- import { BaseError, decodeAbiParameters, decodeErrorResult, decodeEventLog, decodeFunctionData, encodeFunctionData, getAddress, keccak256, parseAbi, toFunctionSelector, zeroAddress } from "viem";
2
+ import { BaseError, decodeAbiParameters, decodeErrorResult, decodeEventLog, decodeFunctionData, decodeFunctionResult, encodeFunctionData, getAddress, keccak256, parseAbi, toFunctionSelector, zeroAddress } from "viem";
3
3
 
4
4
  //#region src/generated.ts
5
5
  const collateralTrackerV2Abi = [
@@ -12694,4 +12694,288 @@ function formatPerSecondRateWadAsAprPct(ratePerSecondWad, precision) {
12694
12694
  }
12695
12695
 
12696
12696
  //#endregion
12697
- export { AccountInsolventError, AlreadyInitializedError, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTickLimitsError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MaxRetriesExceededError, MissingPositionIdsError, MulticallNoDataError, MulticallResultFailedError, MulticallResultMissingError, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NoLoanPositionsError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, ReentrancyError, RpcError, RpcResponseError, STANDARD_TICK_WIDTHS, SafeModeError, StaleDataError, StaleOracleError, StorageDataNotFoundError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, WrongPoolIdError, WrongUniswapPoolError, ZeroAddressError, ZeroCollateralRequirementError, addLegToTokenId, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, availableToBorrow, clearTrackedPositions, collateralTrackerV2Abi, countLegs, createFileStorage, createMemoryStorage, createTxResult, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeLeg, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePoolId, decodePositionBalance$1 as decodePositionBalance, decodeSnapshotTransaction, decodeTickSpacing, decodeTokenId, decodeVegoid, diagnoseOracleSafeMode, encodeLeg, encodePoolId, encodeV4PoolId, fetchPoolId, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatRateWad, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatWad, formatWadPercent, formatWadSigned, getAccountPremia, getAssetIndex, getBlockMeta, getClosedPositionsKey, getForfeitablePremium, getOpenPositionIds, getOracleRiskParameters, getOracleState, getPendingPositionsKey, getPool, getPoolCurrentTick, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPosition, getPositionGreeks, getPositionMetaKey, getPositions, getPositionsKey, getPositionsWithPremia, getRiskParameters, getSchemaVersionKey, getSimpleLoanTokenIndex, getSyncCheckpointKey, getTrackedChunksKey, getTrackedPositionIds, getUtilization, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isLoan, isLoanLeg, isPanopticErrorType, isPositionTracked, isShortOnly, isSpread, jsonSerializer, mintableAfterBuffer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi, parsePanopticError, parseTokenAmount, parseWad, recoverSnapshot, recoverSnapshotFromTx, riskEngineAbi, riskEngineMulticall, selectDispatchForAccount, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, submitWrite, uniswapV3PoolAbi, validateBuilderCode, validatePoolId };
12697
+ //#region src/panoptic/v2/simulations/tokenFlow.ts
12698
+ /**
12699
+ * PanopticPool getAssetsOf ABI.
12700
+ * Returns collateral assets (shares converted to underlying) for an account.
12701
+ */
12702
+ const getAssetsOfAbi = [{
12703
+ type: "function",
12704
+ name: "getAssetsOf",
12705
+ inputs: [{
12706
+ name: "account",
12707
+ type: "address"
12708
+ }],
12709
+ outputs: [{
12710
+ name: "assets0",
12711
+ type: "uint256"
12712
+ }, {
12713
+ name: "assets1",
12714
+ type: "uint256"
12715
+ }],
12716
+ stateMutability: "view"
12717
+ }];
12718
+ /**
12719
+ * PanopticPool multicall ABI (inherited from Uniswap).
12720
+ * Uses delegatecall, preserving msg.sender throughout the chain.
12721
+ */
12722
+ const multicallAbi = [{
12723
+ type: "function",
12724
+ name: "multicall",
12725
+ inputs: [{
12726
+ name: "data",
12727
+ type: "bytes[]"
12728
+ }],
12729
+ outputs: [{
12730
+ name: "results",
12731
+ type: "bytes[]"
12732
+ }],
12733
+ stateMutability: "nonpayable"
12734
+ }, ...panopticErrorsAbi];
12735
+ const collateralTrackersByClient = new WeakMap();
12736
+ const readCollateralTrackers = (client, poolAddress) => {
12737
+ const collateralTrackersByPool = collateralTrackersByClient.get(client) ?? new Map();
12738
+ collateralTrackersByClient.set(client, collateralTrackersByPool);
12739
+ const cached = collateralTrackersByPool.get(poolAddress);
12740
+ if (cached) return cached;
12741
+ const trackers = client.multicall({
12742
+ contracts: [{
12743
+ address: poolAddress,
12744
+ abi: panopticPoolV2Abi,
12745
+ functionName: "collateralToken0"
12746
+ }, {
12747
+ address: poolAddress,
12748
+ abi: panopticPoolV2Abi,
12749
+ functionName: "collateralToken1"
12750
+ }],
12751
+ allowFailure: false
12752
+ });
12753
+ collateralTrackersByPool.set(poolAddress, trackers);
12754
+ trackers.catch(() => collateralTrackersByPool.delete(poolAddress));
12755
+ return trackers;
12756
+ };
12757
+ const readInterestOwed = async (client, poolAddress, user, blockNumber) => {
12758
+ try {
12759
+ const [tracker0, tracker1] = await readCollateralTrackers(client, poolAddress);
12760
+ const read = {
12761
+ abi: collateralTrackerV2Abi,
12762
+ functionName: "owedInterest",
12763
+ args: [user]
12764
+ };
12765
+ const [interestOwed0, interestOwed1] = await client.multicall({
12766
+ contracts: [{
12767
+ ...read,
12768
+ address: tracker0
12769
+ }, {
12770
+ ...read,
12771
+ address: tracker1
12772
+ }],
12773
+ allowFailure: false,
12774
+ blockNumber
12775
+ });
12776
+ return {
12777
+ interestOwed0,
12778
+ interestOwed1
12779
+ };
12780
+ } catch {
12781
+ return void 0;
12782
+ }
12783
+ };
12784
+ /**
12785
+ * Simulate a contract call and measure token flow using PanopticPool.multicall.
12786
+ *
12787
+ * This function uses PanopticPool's inherited multicall (delegatecall-based) to chain:
12788
+ * 1. getAssetsOf(user) - read collateral assets before
12789
+ * 2. getCurrentTick() - read pool tick before
12790
+ * 3. Execute the target call (e.g., dispatch)
12791
+ * 4. getCurrentTick() - read pool tick after
12792
+ * 5. getAssetsOf(user) - read collateral assets after
12793
+ *
12794
+ * ## Why PanopticPool.multicall instead of Multicall3?
12795
+ * - Measures **collateral assets** (shares → underlying), not raw wallet balances
12796
+ * - Uses **delegatecall**, preserving msg.sender throughout the chain
12797
+ * - Single contract interaction with PanopticPool
12798
+ * - Correctly reflects what happens during position operations
12799
+ *
12800
+ * ## Same-Block Guarantee
12801
+ * All operations execute within a single eth_call, ensuring atomic consistency.
12802
+ *
12803
+ * @param params - Simulation parameters
12804
+ * @returns Token flow result
12805
+ *
12806
+ * @example
12807
+ * ```typescript
12808
+ * const callData = encodeFunctionData({
12809
+ * abi: panopticPoolV2Abi,
12810
+ * functionName: 'dispatch',
12811
+ * args: [positionIdList, finalPositionIdList, positionSizes, tickAndSpreadLimits, false, 0n],
12812
+ * })
12813
+ *
12814
+ * const result = await simulateWithTokenFlow({
12815
+ * client,
12816
+ * poolAddress,
12817
+ * user: userAddress,
12818
+ * callData,
12819
+ * })
12820
+ *
12821
+ * if (result.success) {
12822
+ * console.log('Token 0 change:', result.tokenFlow.delta0)
12823
+ * console.log('Token 1 change:', result.tokenFlow.delta1)
12824
+ * }
12825
+ * ```
12826
+ */
12827
+ async function simulateWithTokenFlow(params) {
12828
+ const { client, poolAddress, user, callData, blockNumber, postCallData, preCallData } = params;
12829
+ const getAssetsOfCallData = encodeFunctionData({
12830
+ abi: getAssetsOfAbi,
12831
+ functionName: "getAssetsOf",
12832
+ args: [user]
12833
+ });
12834
+ const getCurrentTickCallData = encodeFunctionData({
12835
+ abi: panopticPoolV2Abi,
12836
+ functionName: "getCurrentTick"
12837
+ });
12838
+ const preLen = preCallData?.length ?? 0;
12839
+ const multicallData = [
12840
+ getAssetsOfCallData,
12841
+ getCurrentTickCallData,
12842
+ ...preCallData ?? [],
12843
+ callData,
12844
+ getCurrentTickCallData,
12845
+ getAssetsOfCallData,
12846
+ ...postCallData ?? []
12847
+ ];
12848
+ try {
12849
+ const [{ result }, interestOwed] = await Promise.all([client.simulateContract({
12850
+ address: poolAddress,
12851
+ abi: multicallAbi,
12852
+ functionName: "multicall",
12853
+ args: [multicallData],
12854
+ account: user,
12855
+ blockNumber
12856
+ }), readInterestOwed(client, poolAddress, user, blockNumber)]);
12857
+ const decodeAssets = (data) => {
12858
+ const decoded = decodeFunctionResult({
12859
+ abi: getAssetsOfAbi,
12860
+ functionName: "getAssetsOf",
12861
+ data
12862
+ });
12863
+ return {
12864
+ assets0: decoded[0],
12865
+ assets1: decoded[1]
12866
+ };
12867
+ };
12868
+ const decodeTick = (data) => {
12869
+ return BigInt(decodeFunctionResult({
12870
+ abi: panopticPoolV2Abi,
12871
+ functionName: "getCurrentTick",
12872
+ data
12873
+ }));
12874
+ };
12875
+ const assetsBefore = decodeAssets(result[0]);
12876
+ const tickBefore = decodeTick(result[1]);
12877
+ const tickAfter = decodeTick(result[3 + preLen]);
12878
+ const assetsAfter = decodeAssets(result[4 + preLen]);
12879
+ const preCallResults = preLen > 0 ? result.slice(2, 2 + preLen) : void 0;
12880
+ const postCallResults = postCallData && postCallData.length > 0 ? result.slice(5 + preLen) : void 0;
12881
+ const delta0 = assetsAfter.assets0 - assetsBefore.assets0;
12882
+ const delta1 = assetsAfter.assets1 - assetsBefore.assets1;
12883
+ let gasEstimate = 0n;
12884
+ try {
12885
+ if (params.estimateGas !== false) gasEstimate = await client.estimateGas({
12886
+ account: user,
12887
+ to: poolAddress,
12888
+ data: callData,
12889
+ blockNumber
12890
+ });
12891
+ } catch {}
12892
+ return {
12893
+ success: true,
12894
+ tokenFlow: {
12895
+ delta0,
12896
+ delta1,
12897
+ balanceBefore0: assetsBefore.assets0,
12898
+ balanceBefore1: assetsBefore.assets1,
12899
+ balanceAfter0: assetsAfter.assets0,
12900
+ balanceAfter1: assetsAfter.assets1,
12901
+ tickBefore,
12902
+ tickAfter,
12903
+ ...interestOwed
12904
+ },
12905
+ gasEstimate,
12906
+ postCallResults,
12907
+ preCallResults
12908
+ };
12909
+ } catch (error) {
12910
+ return {
12911
+ success: false,
12912
+ error: error instanceof Error ? error.message : "Simulation failed",
12913
+ rawError: error instanceof Error ? error : void 0,
12914
+ gasEstimate: 0n
12915
+ };
12916
+ }
12917
+ }
12918
+ /**
12919
+ * Get pool token addresses for reference.
12920
+ *
12921
+ * @param params - Parameters
12922
+ * @returns Pool token addresses
12923
+ */
12924
+ async function getPoolTokensForSimulation(params) {
12925
+ const { client, poolAddress, blockNumber } = params;
12926
+ const poolAbi = [{
12927
+ type: "function",
12928
+ name: "collateralToken0",
12929
+ inputs: [],
12930
+ outputs: [{ type: "address" }],
12931
+ stateMutability: "view"
12932
+ }, {
12933
+ type: "function",
12934
+ name: "collateralToken1",
12935
+ inputs: [],
12936
+ outputs: [{ type: "address" }],
12937
+ stateMutability: "view"
12938
+ }];
12939
+ const collateralAbi = [{
12940
+ type: "function",
12941
+ name: "asset",
12942
+ inputs: [],
12943
+ outputs: [{ type: "address" }],
12944
+ stateMutability: "view"
12945
+ }];
12946
+ const [ct0, ct1] = await client.multicall({
12947
+ contracts: [{
12948
+ address: poolAddress,
12949
+ abi: poolAbi,
12950
+ functionName: "collateralToken0"
12951
+ }, {
12952
+ address: poolAddress,
12953
+ abi: poolAbi,
12954
+ functionName: "collateralToken1"
12955
+ }],
12956
+ blockNumber,
12957
+ allowFailure: false
12958
+ });
12959
+ const [token0, token1] = await client.multicall({
12960
+ contracts: [{
12961
+ address: ct0,
12962
+ abi: collateralAbi,
12963
+ functionName: "asset"
12964
+ }, {
12965
+ address: ct1,
12966
+ abi: collateralAbi,
12967
+ functionName: "asset"
12968
+ }],
12969
+ blockNumber,
12970
+ allowFailure: false
12971
+ });
12972
+ return {
12973
+ token0,
12974
+ token1,
12975
+ collateralTracker0: ct0,
12976
+ collateralTracker1: ct1
12977
+ };
12978
+ }
12979
+
12980
+ //#endregion
12981
+ export { AccountInsolventError, AlreadyInitializedError, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTickLimitsError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MaxRetriesExceededError, MissingPositionIdsError, MulticallNoDataError, MulticallResultFailedError, MulticallResultMissingError, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NoLoanPositionsError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, ReentrancyError, RpcError, RpcResponseError, STANDARD_TICK_WIDTHS, SafeModeError, StaleDataError, StaleOracleError, StorageDataNotFoundError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, WrongPoolIdError, WrongUniswapPoolError, ZeroAddressError, ZeroCollateralRequirementError, addLegToTokenId, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, availableToBorrow, clearTrackedPositions, collateralTrackerV2Abi, countLegs, createFileStorage, createMemoryStorage, createTxResult, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeLeg, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePoolId, decodePositionBalance$1 as decodePositionBalance, decodeSnapshotTransaction, decodeTickSpacing, decodeTokenId, decodeVegoid, diagnoseOracleSafeMode, encodeLeg, encodePoolId, encodeV4PoolId, fetchPoolId, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatRateWad, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatWad, formatWadPercent, formatWadSigned, getAccountPremia, getAssetIndex, getBlockMeta, getClosedPositionsKey, getForfeitablePremium, getOpenPositionIds, getOracleRiskParameters, getOracleState, getPendingPositionsKey, getPool, getPoolCurrentTick, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPoolTokensForSimulation, getPosition, getPositionGreeks, getPositionMetaKey, getPositions, getPositionsKey, getPositionsWithPremia, getRiskParameters, getSchemaVersionKey, getSimpleLoanTokenIndex, getSyncCheckpointKey, getTrackedChunksKey, getTrackedPositionIds, getUtilization, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isLoan, isLoanLeg, isPanopticErrorType, isPositionTracked, isShortOnly, isSpread, jsonSerializer, mintableAfterBuffer, oracleEpochAt, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi, parsePanopticError, parseTokenAmount, parseWad, recoverSnapshot, recoverSnapshotFromTx, riskEngineAbi, riskEngineMulticall, selectDispatchForAccount, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, simulateWithTokenFlow, stateViewAbi, submitWrite, uniswapV3PoolAbi, validateBuilderCode, validatePoolId };
@@ -33,8 +33,8 @@ var VaultTransactionGasCostLimitError = class extends Error {
33
33
  gasLimit;
34
34
  maximumAffordableFeePerGas;
35
35
  minimumRequiredFeePerGas;
36
- constructor({ gasLimit, maximumAffordableFeePerGas, minimumRequiredFeePerGas }) {
37
- super(`Vault transaction cannot fit the ${MAX_VAULT_TRANSACTION_GAS_COST.toString()} wei gas-cost limit: gasLimit=${gasLimit.toString()}, maximumAffordableFeePerGas=${maximumAffordableFeePerGas.toString()}, minimumRequiredFeePerGas=${minimumRequiredFeePerGas.toString()}`);
36
+ constructor({ gasLimit, maximumAffordableFeePerGas, minimumRequiredFeePerGas, maximumGasCost = MAX_VAULT_TRANSACTION_GAS_COST }) {
37
+ super(`Vault transaction cannot fit the ${maximumGasCost.toString()} wei gas-cost limit: gasLimit=${gasLimit.toString()}, maximumAffordableFeePerGas=${maximumAffordableFeePerGas.toString()}, minimumRequiredFeePerGas=${minimumRequiredFeePerGas.toString()}`);
38
38
  this.name = "VaultTransactionGasCostLimitError";
39
39
  this.gasLimit = gasLimit;
40
40
  this.maximumAffordableFeePerGas = maximumAffordableFeePerGas;
@@ -55,6 +55,11 @@ var VaultTransactionReplacementLimitError = class extends Error {
55
55
  this.maximumAffordableFeePerGas = maximumAffordableFeePerGas;
56
56
  }
57
57
  };
58
+ function resolveMaximumGasCost(feePolicy) {
59
+ const maximum = feePolicy?.maxTransactionGasCost ?? MAX_VAULT_TRANSACTION_GAS_COST;
60
+ if (maximum <= 0n) throw new Error("Vault transaction gas budget must be positive");
61
+ return maximum;
62
+ }
58
63
  function ceilMultiplyFraction(value, numerator, denominator) {
59
64
  return (value * numerator + denominator - 1n) / denominator;
60
65
  }
@@ -129,30 +134,32 @@ function resolveRpcPriorityFeeQuote({ baseFeePerGas, rawPriorityFeePerGas, minim
129
134
  source: "rpc_priority_fee"
130
135
  };
131
136
  }
132
- function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote, gasLimit, finalReplacement = false, staleBoundsReplacement = false }) {
137
+ function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote, gasLimit, finalReplacement = false, staleBoundsReplacement = false, feePolicy }) {
133
138
  if (gasLimit <= 0n) throw new Error(`Vault transaction gas limit must be positive, received ${gasLimit.toString()}`);
134
- const bumpedPriorityFee = staleBoundsReplacement ? ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR) : ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, DELTA_HEDGE_PRIORITY_FEE_BUMP_NUMERATOR, DELTA_HEDGE_PRIORITY_FEE_BUMP_DENOMINATOR);
139
+ const bumpedPriorityFee = staleBoundsReplacement || feePolicy?.marketPriorityFees ? ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR) : ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, DELTA_HEDGE_PRIORITY_FEE_BUMP_NUMERATOR, DELTA_HEDGE_PRIORITY_FEE_BUMP_DENOMINATOR);
135
140
  const bumpedMaxFee = ceilMultiplyFraction(originalQuote.maxFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR);
136
141
  const escalatingPriorityFee = historicalQuote.maxPriorityFeePerGas > bumpedPriorityFee ? historicalQuote.maxPriorityFeePerGas : bumpedPriorityFee;
137
- const priorityFeeLimit = staleBoundsReplacement ? MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS : finalReplacement ? MAX_VAULT_PRIORITY_FEE_PER_GAS : MAX_DELTA_HEDGE_PRIORITY_FEE_PER_GAS;
138
- const desiredMaxPriorityFeePerGas = finalReplacement ? MAX_VAULT_PRIORITY_FEE_PER_GAS : staleBoundsReplacement ? bumpedPriorityFee : escalatingPriorityFee;
142
+ const maximumGasCost = resolveMaximumGasCost(feePolicy);
143
+ const priorityFeeLimit = feePolicy?.marketPriorityFees ? maximumGasCost / gasLimit : staleBoundsReplacement ? MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS : finalReplacement ? MAX_VAULT_PRIORITY_FEE_PER_GAS : MAX_DELTA_HEDGE_PRIORITY_FEE_PER_GAS;
144
+ const desiredMaxPriorityFeePerGas = feePolicy?.marketPriorityFees ? escalatingPriorityFee : finalReplacement ? MAX_VAULT_PRIORITY_FEE_PER_GAS : staleBoundsReplacement ? bumpedPriorityFee : escalatingPriorityFee;
139
145
  const requiredReplacementPriorityFee = ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR);
140
146
  const requiredMaxPriorityFeePerGas = desiredMaxPriorityFeePerGas < priorityFeeLimit ? desiredMaxPriorityFeePerGas : priorityFeeLimit;
141
147
  if (requiredMaxPriorityFeePerGas < requiredReplacementPriorityFee) throw new VaultTransactionReplacementLimitError({
142
- code: "PriorityFeeCapExceeded",
148
+ code: feePolicy?.marketPriorityFees ? "GasCostCapExceeded" : "PriorityFeeCapExceeded",
143
149
  gasLimit,
144
150
  requiredMaxFeePerGas: originalQuote.maxFeePerGas,
145
151
  requiredMaxPriorityFeePerGas: requiredReplacementPriorityFee,
146
- maximumAffordableFeePerGas: MAX_VAULT_TRANSACTION_GAS_COST / gasLimit
152
+ maximumAffordableFeePerGas: maximumGasCost / gasLimit
147
153
  });
148
- const bufferedBaseFee = historicalQuote.minimumMaxFeePerGas - (historicalQuote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
154
+ const bufferedBaseFee = feePolicy?.marketPriorityFees ? historicalQuote.maxFeePerGas - historicalQuote.maxPriorityFeePerGas : historicalQuote.minimumMaxFeePerGas - (historicalQuote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
149
155
  const currentMarketMaxFee = bufferedBaseFee + requiredMaxPriorityFeePerGas;
150
156
  const desiredMaxFeePerGas = currentMarketMaxFee > bumpedMaxFee ? currentMarketMaxFee : bumpedMaxFee;
151
- const maximumAffordableFeePerGas = MAX_VAULT_TRANSACTION_GAS_COST / gasLimit;
152
- if (bumpedMaxFee > maximumAffordableFeePerGas || requiredMaxPriorityFeePerGas > maximumAffordableFeePerGas) throw new VaultTransactionReplacementLimitError({
157
+ const maximumAffordableFeePerGas = maximumGasCost / gasLimit;
158
+ const minimumMarketFeePerGas = (historicalQuote.currentBaseFeePerGas ?? bufferedBaseFee) + requiredMaxPriorityFeePerGas;
159
+ if (bumpedMaxFee > maximumAffordableFeePerGas || requiredMaxPriorityFeePerGas > maximumAffordableFeePerGas || feePolicy?.marketPriorityFees && minimumMarketFeePerGas > maximumAffordableFeePerGas) throw new VaultTransactionReplacementLimitError({
153
160
  code: "GasCostCapExceeded",
154
161
  gasLimit,
155
- requiredMaxFeePerGas: bumpedMaxFee,
162
+ requiredMaxFeePerGas: feePolicy?.marketPriorityFees && minimumMarketFeePerGas > bumpedMaxFee ? minimumMarketFeePerGas : bumpedMaxFee,
156
163
  requiredMaxPriorityFeePerGas,
157
164
  maximumAffordableFeePerGas
158
165
  });
@@ -175,13 +182,15 @@ function resolveFallbackQuote({ maxFeePerGas: estimatedMaxFeePerGas, maxPriority
175
182
  source: "viem_fallback"
176
183
  };
177
184
  }
178
- function applyVaultTransactionGasCostLimit(quote, gasLimit) {
185
+ function applyVaultTransactionGasCostLimit(quote, gasLimit, feePolicy) {
179
186
  if (gasLimit <= 0n) throw new Error(`Vault transaction gas limit must be positive, received ${gasLimit.toString()}`);
180
- const maximumAffordableFeePerGas = MAX_VAULT_TRANSACTION_GAS_COST / gasLimit;
187
+ const maximumGasCost = resolveMaximumGasCost(feePolicy);
188
+ const maximumAffordableFeePerGas = maximumGasCost / gasLimit;
181
189
  if (maximumAffordableFeePerGas < quote.minimumMaxFeePerGas) throw new VaultTransactionGasCostLimitError({
182
190
  gasLimit,
183
191
  maximumAffordableFeePerGas,
184
- minimumRequiredFeePerGas: quote.minimumMaxFeePerGas
192
+ minimumRequiredFeePerGas: quote.minimumMaxFeePerGas,
193
+ maximumGasCost
185
194
  });
186
195
  if (quote.maxFeePerGas <= maximumAffordableFeePerGas) return quote;
187
196
  const bufferedBaseFee = quote.minimumMaxFeePerGas - (quote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
@@ -196,8 +205,9 @@ function bufferVaultTransactionGasEstimate(gasEstimate) {
196
205
  if (gasEstimate <= 0n) throw new Error(`Vault transaction gas estimate must be positive, received ${gasEstimate.toString()}`);
197
206
  return ceilMultiplyFraction(gasEstimate, GAS_ESTIMATE_BUFFER_NUMERATOR, GAS_ESTIMATE_BUFFER_DENOMINATOR);
198
207
  }
199
- function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
208
+ function validateVaultSignedTransactionFeeCaps(feeCaps, quote, feePolicy) {
200
209
  const { chainId, gasLimit, maxFeePerGas, maxPriorityFeePerGas } = feeCaps;
210
+ const maximumGasCost = resolveMaximumGasCost(feePolicy);
201
211
  const minimumPriorityFeePerGas = quote?.minimumPriorityFeePerGas ?? getChainPriorityFeeFloor(chainId) ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
202
212
  if (maxFeePerGas === null || maxPriorityFeePerGas === null) return {
203
213
  valid: false,
@@ -214,15 +224,15 @@ function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
214
224
  code: "PriorityFeeTooLow",
215
225
  reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) must be at least ${minimumPriorityFeePerGas.toString()} wei.`
216
226
  };
217
- if (maxPriorityFeePerGas > MAX_VAULT_PRIORITY_FEE_PER_GAS) return {
227
+ if (!feePolicy?.marketPriorityFees && maxPriorityFeePerGas > MAX_VAULT_PRIORITY_FEE_PER_GAS) return {
218
228
  valid: false,
219
229
  code: "PriorityFeeTooHigh",
220
230
  reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) must not exceed ${MAX_VAULT_PRIORITY_FEE_PER_GAS.toString()} wei (3 gwei).`
221
231
  };
222
- if (gasLimit !== void 0 && gasLimit !== null && gasLimit * maxFeePerGas > MAX_VAULT_TRANSACTION_GAS_COST) return {
232
+ if (gasLimit !== void 0 && gasLimit !== null && gasLimit * maxFeePerGas > maximumGasCost) return {
223
233
  valid: false,
224
234
  code: "GasCostTooHigh",
225
- reason: `Signed transaction maximum gas cost (${(gasLimit * maxFeePerGas).toString()} wei) must not exceed ${MAX_VAULT_TRANSACTION_GAS_COST.toString()} wei (0.015 ETH).`
235
+ reason: `Signed transaction maximum gas cost (${(gasLimit * maxFeePerGas).toString()} wei) must not exceed ${maximumGasCost.toString()} wei.`
226
236
  };
227
237
  if (quote !== void 0) {
228
238
  const feeRequirementDescription = quote.currentBaseFeePerGas === void 0 ? "buffered next-block base fee" : "current base fee";
@@ -322,4 +332,4 @@ async function getVaultDeltaHedgeInitialFeeQuote(client) {
322
332
  }
323
333
 
324
334
  //#endregion
325
- export { MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS, MAX_VAULT_PRIORITY_FEE_PER_GAS, MAX_VAULT_TRANSACTION_GAS_COST, MIN_VAULT_PRIORITY_FEE_PER_GAS, VaultTransactionFeeEstimationError, VaultTransactionGasCostLimitError, VaultTransactionReplacementLimitError, applyVaultTransactionGasCostLimit, bufferVaultTransactionGasEstimate, getVaultDeltaHedgeHistoricalFeeQuote, getVaultDeltaHedgeInitialFeeQuote, getVaultTransactionFeeQuote, getVaultTransactionReplacementFeeQuote, validateVaultSignedTransactionFeeCaps };
335
+ export { MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS, MAX_VAULT_PRIORITY_FEE_PER_GAS, MAX_VAULT_TRANSACTION_GAS_COST, MIN_VAULT_PRIORITY_FEE_PER_GAS, REPLACEMENT_FEE_BUMP_DENOMINATOR, REPLACEMENT_FEE_BUMP_NUMERATOR, VaultTransactionFeeEstimationError, VaultTransactionGasCostLimitError, VaultTransactionReplacementLimitError, applyVaultTransactionGasCostLimit, bufferVaultTransactionGasEstimate, getVaultDeltaHedgeHistoricalFeeQuote, getVaultDeltaHedgeInitialFeeQuote, getVaultTransactionFeeQuote, getVaultTransactionReplacementFeeQuote, validateVaultSignedTransactionFeeCaps };
@@ -1,8 +1,8 @@
1
- import { UniswapV3PoolAbi, applyOwedInterest, getAccountBuyingPower, getAccountCollateral, getNetLiquidationValue, panopticQueryAbi$1 as panopticQueryAbi, readBlockAndAggregate, requireReturnData } from "./irm-BntFNP1P.js";
2
- import { AccountInsolventError, ChunkLimitError, DEFAULT_VEGOID, InvalidHistoryRangeError, MulticallResultMissingError, NotEnoughTokensError, PanopticError, PanopticValidationError, SafeModeError, StaleDataError, StorageDataNotFoundError, UnhealthyPoolError, WrongUniswapPoolError, addLegToTokenId, applyMintBufferPerToken, availableToBorrow, collateralTrackerV2Abi, countLegs, decodeAllLegs, decodeLeftRightSigned, decodeLeftRightUnsigned, decodePositionBalance, decodeTokenId, getBlockMeta, getClosedPositionsKey, getPendingPositionsKey, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositionsKey, getTrackedChunksKey, getTrackedPositionIds, isPanopticErrorType, jsonSerializer, mintableAfterBuffer, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi as panopticQueryAbi$1, parsePanopticError, riskEngineAbi, riskEngineMulticall, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, uniswapV3PoolAbi } from "./rates-c9XVKm3m.js";
1
+ import { UniswapV3PoolAbi, applyOwedInterest, getAccountBuyingPower, getAccountCollateral, getNetLiquidationValue, panopticQueryAbi$1 as panopticQueryAbi, readBlockAndAggregate, requireReturnData } from "./irm-CGuYhr-C.js";
2
+ import { AccountInsolventError, ChunkLimitError, DEFAULT_VEGOID, InvalidHistoryRangeError, MulticallResultMissingError, NotEnoughTokensError, PanopticError, PanopticValidationError, SafeModeError, StaleDataError, StorageDataNotFoundError, UnhealthyPoolError, WrongUniswapPoolError, addLegToTokenId, applyMintBufferPerToken, availableToBorrow, collateralTrackerV2Abi, countLegs, decodeAllLegs, decodeLeftRightSigned, decodeLeftRightUnsigned, decodePositionBalance, decodeTokenId, getBlockMeta, getClosedPositionsKey, getPendingPositionsKey, getPool, getPoolMetaKey, getPoolMetadata, getPoolTokensForSimulation, getPositionMetaKey, getPositionsKey, getTrackedChunksKey, getTrackedPositionIds, isPanopticErrorType, jsonSerializer, mintableAfterBuffer, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi as panopticQueryAbi$1, parsePanopticError, riskEngineAbi, riskEngineMulticall, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, simulateWithTokenFlow, stateViewAbi, uniswapV3PoolAbi } from "./tokenFlow-6Ec9Hz48.js";
3
3
  import { MAX_TICK, MAX_TRACKED_CHUNKS, MIN_TICK, NO_LOWER_LIQUIDATION_TICK, NO_UPPER_LIQUIDATION_TICK, WAD, calculatePositionDelta, calculatePositionDeltaDebtOnly, calculatePositionGamma, calculatePositionValue, getLegLiquidityRange, priceToTick, sqrtPriceX96ToTick, tickLimits, tickToPriceDecimalScaled, tickToSqrtPriceX96, toVaultFrameAtTick } from "./greeks-CEv-Uex1.js";
4
- import { buildBatchDispatchArgs, buildProtectedSettlePlan, buildSettleSequenceCalls, buildUniqueCredit, buildUniqueLoan, createTokenIdBuilder, ensureUniqueTokenId, getCurrentPositionSizes, getPoolTokensForSimulation, loadCheckpoint, resolveTokenIndex, simulateDispatch, simulateOpenPosition, simulateWithTokenFlow } from "./writes-CDTpO4OY.js";
5
- import { feesFromFeeGrowthDelta, getLpPositionFunding, getMaxLpPositionSize, getPriceHistory, preparePositionGamma, quoteSwapExactOutViaRouter, quoteSwapExactOutViaV3Router } from "./router-lUA1kp8A.js";
4
+ import { buildBatchDispatchArgs, buildProtectedSettlePlan, buildSettleSequenceCalls, buildUniqueCredit, buildUniqueLoan, createTokenIdBuilder, ensureUniqueTokenId, getCurrentPositionSizes, loadCheckpoint, resolveTokenIndex, simulateDispatch, simulateOpenPosition } from "./writes-DKpVWZkE.js";
5
+ import { feesFromFeeGrowthDelta, getLpPositionFunding, getMaxLpPositionSize, getPriceHistory, preparePositionGamma, quoteSwapExactOutViaRouter, quoteSwapExactOutViaV3Router } from "./router-DL_cDCzG.js";
6
6
  import { ContractFunctionExecutionError, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, getAddress, hexToString, isAddress, isAddressEqual, isHex, keccak256, parseEventLogs, trim, zeroAddress } from "viem";
7
7
  import Decimal from "decimal.js";
8
8
  import { multicall } from "viem/actions";
@@ -5546,6 +5546,72 @@ async function getHedgeLimits({ client, poolAddress, account, positionIds, asset
5546
5546
  };
5547
5547
  }
5548
5548
 
5549
+ //#endregion
5550
+ //#region src/panoptic/v2/reads/legCapacity.ts
5551
+ async function getAccountLegCapacity({ client, poolAddress, account, positionIds, blockNumber }) {
5552
+ if (new Set(positionIds).size !== positionIds.length) throw new Error("Leg capacity requires distinct open positions");
5553
+ const metadata = await getPoolMetadata({
5554
+ client,
5555
+ poolAddress
5556
+ });
5557
+ const [maximumLegs, currentLegs, full] = await riskEngineMulticall(client, {
5558
+ contracts: [
5559
+ {
5560
+ address: metadata.riskEngineAddress,
5561
+ abi: riskEngineAbi,
5562
+ functionName: "MAX_OPEN_LEGS"
5563
+ },
5564
+ {
5565
+ address: poolAddress,
5566
+ abi: panopticPoolV2Abi,
5567
+ functionName: "numberOfLegs",
5568
+ args: [account]
5569
+ },
5570
+ {
5571
+ address: poolAddress,
5572
+ abi: panopticPoolV2Abi,
5573
+ functionName: "getFullPositionsData",
5574
+ args: [
5575
+ account,
5576
+ false,
5577
+ positionIds
5578
+ ]
5579
+ }
5580
+ ],
5581
+ allowFailure: false,
5582
+ blockNumber
5583
+ });
5584
+ const decodedLegs = positionIds.reduce((sum$1, id) => sum$1 + BigInt(decodeTokenId(id).legs.length), 0n);
5585
+ if (decodedLegs !== currentLegs || full[2].length !== positionIds.length || full[2].some((balance) => (balance & (1n << 128n) - 1n) === 0n)) throw new Error("Account leg snapshot does not match the complete open position list");
5586
+ return {
5587
+ maximumLegs: BigInt(maximumLegs),
5588
+ currentLegs: BigInt(currentLegs),
5589
+ positionIds,
5590
+ blockNumber
5591
+ };
5592
+ }
5593
+ /** Validate peak active legs in dispatch order, including existing-position resizes. */
5594
+ function fitsAccountLegCapacity({ capacity, tokenIds, positionSizes }) {
5595
+ if (tokenIds.length !== positionSizes.length) return false;
5596
+ const active = new Set(capacity.positionIds);
5597
+ let count = capacity.currentLegs;
5598
+ if (count > capacity.maximumLegs) return false;
5599
+ for (let i = 0; i < tokenIds.length; i += 1) {
5600
+ const id = tokenIds[i];
5601
+ const size = positionSizes[i];
5602
+ if (id === void 0 || size === void 0 || size < 0n) return false;
5603
+ const legs = BigInt(decodeTokenId(id).legs.length);
5604
+ if (legs === 0n) return false;
5605
+ if (size === 0n && active.delete(id)) count -= legs;
5606
+ if (size > 0n && !active.has(id)) {
5607
+ active.add(id);
5608
+ count += legs;
5609
+ }
5610
+ if (count > capacity.maximumLegs) return false;
5611
+ }
5612
+ return true;
5613
+ }
5614
+
5549
5615
  //#endregion
5550
5616
  //#region src/panoptic/v2/reads/positionMintFunding.ts
5551
5617
  const Q96 = 1n << 96n;
@@ -10526,4 +10592,4 @@ async function getPositionVolatilityHistory({ client, poolAddress, account, toke
10526
10592
  }
10527
10593
 
10528
10594
  //#endregion
10529
- export { DEFAULT_MIN_SWAP_RATIO_BPS, DEFAULT_RECONNECT_CONFIG, MARKET_INDICATOR_PERIODS, REQUIRED_BASE_ERROR_SENTINEL, STRIKE_LADDER_TARGET_STRIKES, VARIANCE_RATIO_LAG, addPendingPosition, addTrackedChunks, apportion, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertLpPositionFunded, assertTradeable, buildCreditWrappedDispatch, buildSfpmSwapCalldata, buildSfpmSwapPlan, buildTemporaryLoanRecoveryDispatch, buildTokenShortfallRecoveryDispatch, calculateAccountGreeksPure, calculateMarketIndicator, calculateSpreadWad, calculateVarianceProfile, checkCollateralAcrossTicks, classifyStrategyGroups, classifyStrike, cleanupStalePendingPositions, clearPendingPositions, clearTrackedChunks, clearTradeHistory, collateralCurveTicks, collateralRuleKindFor, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, createEventPoller, createEventSubscription, createFlowNeutralTokenId, decodePanopticTokenURI, emptyLiquidateParams, encodePoolKeyBytes, encodeV3PoolKeyBytes, ensureSfpmV3PoolInitialized, estimateBlockNumbers, estimateCloseZapSwap, estimateCollateralBreakdown, estimateCollateralRequired, failPendingPosition, feeGrowthInsideX128, fetchPoolSwaps, fetchSfpmV3PoolId, fetchUniswapFeeData, getAccountGreeks, getAccountHistory, getChunkLiquidities, getChunkSpreads, getClosePositionTransferEstimate, getClosedPositions, getCollateralCurve, getCollateralCurveInputs, getCollateralRequiredBase, getCollateralSharePrices, getCollateralTotalAssetsBatch, getDeltaHedgeParams, getEnforcedTickLimits, getExecutableLpMaxSize, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getGuardianUnlockState, getHedgeLimits, getItmAmounts, getMarginBuffer, getMaxPositionSize, getMaxRedeem, getMaxWithdrawable, getNativeTokenPrice, getNotEnoughTokensError, getOpenPositionPreview, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPoolLiquidities, getPortfolioValue, getPositionChunkData, getPositionEnrichmentData, getPositionMintFunding, getPositionVolatilityHistory, getRealizedPnL, getRequiredCreditForITM, getSafeMode, getStreamiaHistory, getSyncStatus, getTrackedChunks, getTradeHistory, getUniswapFeeHistory, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, interpolateBlocks, isGasError, isNonceError, isRetryableRpcError, isolateGroupTokenId, ladderStrikeSequence, logReturns, marketPnlInQuote, marketRiskFromValues, marketScenario, minePoolAddress, minePoolAddressLocalAsync, multicallRead, netLiquidationValueInQuote, optimizeTokenIdRiskPartners, parseCollateralLog, parsePoolLog, parseStreamedKey, parseStreamedSwap, parseSwapLog, prepareIndicatorCandles, previewDeposit, previewMint, previewRedeem, previewWithdraw, quoteLiquidation, quoteOneTokenFlow, quoteSfpmSwap, quoteTemporaryLoanRecovery, quoteTokenShortfallRecovery, quoteTokenShortfallSwap, realizedBeta, removeTrackedChunks, resolveBlockNumbers, resolveLadderStrike, resolvePanopticPoolFromPoolId, resolveUniswapV4PoolKey, saveClosedPosition, scaleCollateralRequired, scanChunks, screenAccountExact, simulateBatchDispatch, simulateClosePosition, simulateClosePremiumProtection, simulateDeployNewPool, simulateDeposit, simulateForceExercise, simulateLiquidate, simulateSFPMBurn, simulateSFPMMint, simulateSwapExactIn, simulateSwapExactOut, simulateWithdraw, slippageBpsToTickDistance, streamPoolSwaps, subscribePoolSwaps, watchEvents, watchPoolSwaps };
10595
+ export { DEFAULT_MIN_SWAP_RATIO_BPS, DEFAULT_RECONNECT_CONFIG, MARKET_INDICATOR_PERIODS, REQUIRED_BASE_ERROR_SENTINEL, STRIKE_LADDER_TARGET_STRIKES, VARIANCE_RATIO_LAG, addPendingPosition, addTrackedChunks, apportion, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertLpPositionFunded, assertTradeable, buildCreditWrappedDispatch, buildSfpmSwapCalldata, buildSfpmSwapPlan, buildTemporaryLoanRecoveryDispatch, buildTokenShortfallRecoveryDispatch, calculateAccountGreeksPure, calculateMarketIndicator, calculateSpreadWad, calculateVarianceProfile, checkCollateralAcrossTicks, classifyStrategyGroups, classifyStrike, cleanupStalePendingPositions, clearPendingPositions, clearTrackedChunks, clearTradeHistory, collateralCurveTicks, collateralRuleKindFor, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, createEventPoller, createEventSubscription, createFlowNeutralTokenId, decodePanopticTokenURI, emptyLiquidateParams, encodePoolKeyBytes, encodeV3PoolKeyBytes, ensureSfpmV3PoolInitialized, estimateBlockNumbers, estimateCloseZapSwap, estimateCollateralBreakdown, estimateCollateralRequired, failPendingPosition, feeGrowthInsideX128, fetchPoolSwaps, fetchSfpmV3PoolId, fetchUniswapFeeData, fitsAccountLegCapacity, getAccountGreeks, getAccountHistory, getAccountLegCapacity, getChunkLiquidities, getChunkSpreads, getClosePositionTransferEstimate, getClosedPositions, getCollateralCurve, getCollateralCurveInputs, getCollateralRequiredBase, getCollateralSharePrices, getCollateralTotalAssetsBatch, getDeltaHedgeParams, getEnforcedTickLimits, getExecutableLpMaxSize, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getGuardianUnlockState, getHedgeLimits, getItmAmounts, getMarginBuffer, getMaxPositionSize, getMaxRedeem, getMaxWithdrawable, getNativeTokenPrice, getNotEnoughTokensError, getOpenPositionPreview, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPoolLiquidities, getPortfolioValue, getPositionChunkData, getPositionEnrichmentData, getPositionMintFunding, getPositionVolatilityHistory, getRealizedPnL, getRequiredCreditForITM, getSafeMode, getStreamiaHistory, getSyncStatus, getTrackedChunks, getTradeHistory, getUniswapFeeHistory, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, interpolateBlocks, isGasError, isNonceError, isRetryableRpcError, isolateGroupTokenId, ladderStrikeSequence, logReturns, marketPnlInQuote, marketRiskFromValues, marketScenario, minePoolAddress, minePoolAddressLocalAsync, multicallRead, netLiquidationValueInQuote, optimizeTokenIdRiskPartners, parseCollateralLog, parsePoolLog, parseStreamedKey, parseStreamedSwap, parseSwapLog, prepareIndicatorCandles, previewDeposit, previewMint, previewRedeem, previewWithdraw, quoteLiquidation, quoteOneTokenFlow, quoteSfpmSwap, quoteTemporaryLoanRecovery, quoteTokenShortfallRecovery, quoteTokenShortfallSwap, realizedBeta, removeTrackedChunks, resolveBlockNumbers, resolveLadderStrike, resolvePanopticPoolFromPoolId, resolveUniswapV4PoolKey, saveClosedPosition, scaleCollateralRequired, scanChunks, screenAccountExact, simulateBatchDispatch, simulateClosePosition, simulateClosePremiumProtection, simulateDeployNewPool, simulateDeposit, simulateForceExercise, simulateLiquidate, simulateSFPMBurn, simulateSFPMMint, simulateSwapExactIn, simulateSwapExactOut, simulateWithdraw, slippageBpsToTickDistance, streamPoolSwaps, subscribePoolSwaps, watchEvents, watchPoolSwaps };
@@ -5,16 +5,21 @@ declare const MIN_VAULT_PRIORITY_FEE_PER_GAS = 100000000n;
5
5
  declare const MAX_VAULT_PRIORITY_FEE_PER_GAS = 3000000000n;
6
6
  declare const MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS = 8000000000n;
7
7
  declare const MAX_VAULT_TRANSACTION_GAS_COST = 15000000000000000n;
8
+ type VaultTransactionFeePolicy = Readonly<{
9
+ maxTransactionGasCost: bigint;
10
+ marketPriorityFees: boolean;
11
+ }>;
8
12
  type VaultTransactionFeeQuote = {
9
13
  currentBaseFeePerGas?: bigint;
10
14
  maxFeePerGas: bigint;
11
15
  maxPriorityFeePerGas: bigint;
12
16
  minimumMaxFeePerGas: bigint;
13
17
  minimumPriorityFeePerGas?: bigint;
14
- source: 'fee_history' | 'viem_fallback' | 'rpc_priority_fee' | 'fee_history_p25';
18
+ source: 'fee_history' | 'viem_fallback' | 'rpc_priority_fee' | 'fee_history_p25' | 'adaptive_hedge';
15
19
  };
16
20
  type VaultDeltaHedgeFeeQuote = VaultTransactionFeeQuote & {
17
21
  rawPriorityFeePerGas: bigint;
22
+ competitivePriorityFeePerGas?: bigint;
18
23
  };
19
24
  type VaultSignedTransactionFeeCaps = {
20
25
  chainId?: number;
@@ -47,11 +52,13 @@ declare class VaultTransactionGasCostLimitError extends Error {
47
52
  constructor({
48
53
  gasLimit,
49
54
  maximumAffordableFeePerGas,
50
- minimumRequiredFeePerGas
55
+ minimumRequiredFeePerGas,
56
+ maximumGasCost
51
57
  }: {
52
58
  gasLimit: bigint;
53
59
  maximumAffordableFeePerGas: bigint;
54
60
  minimumRequiredFeePerGas: bigint;
61
+ maximumGasCost?: bigint;
55
62
  });
56
63
  }
57
64
  declare class VaultTransactionReplacementLimitError extends Error {
@@ -78,17 +85,19 @@ declare function getVaultTransactionReplacementFeeQuote({
78
85
  historicalQuote,
79
86
  gasLimit,
80
87
  finalReplacement,
81
- staleBoundsReplacement
88
+ staleBoundsReplacement,
89
+ feePolicy
82
90
  }: {
83
91
  originalQuote: Pick<VaultTransactionFeeQuote, 'maxFeePerGas' | 'maxPriorityFeePerGas'>;
84
92
  historicalQuote: VaultDeltaHedgeFeeQuote;
85
93
  gasLimit: bigint;
86
94
  finalReplacement?: boolean;
87
95
  staleBoundsReplacement?: boolean;
96
+ feePolicy?: VaultTransactionFeePolicy;
88
97
  }): VaultDeltaHedgeFeeQuote;
89
- declare function applyVaultTransactionGasCostLimit(quote: VaultTransactionFeeQuote, gasLimit: bigint): VaultTransactionFeeQuote;
98
+ declare function applyVaultTransactionGasCostLimit(quote: VaultTransactionFeeQuote, gasLimit: bigint, feePolicy?: VaultTransactionFeePolicy): VaultTransactionFeeQuote;
90
99
  declare function bufferVaultTransactionGasEstimate(gasEstimate: bigint): bigint;
91
- declare function validateVaultSignedTransactionFeeCaps(feeCaps: VaultSignedTransactionFeeCaps, quote?: VaultTransactionFeeQuote): VaultSignedTransactionFeeValidationResult;
100
+ declare function validateVaultSignedTransactionFeeCaps(feeCaps: VaultSignedTransactionFeeCaps, quote?: VaultTransactionFeeQuote, feePolicy?: VaultTransactionFeePolicy): VaultSignedTransactionFeeValidationResult;
92
101
  /**
93
102
  * Resolve explicit EIP-1559 fees for operator-controlled vault transactions.
94
103
  *
@@ -105,5 +114,5 @@ declare function getVaultDeltaHedgeHistoricalFeeQuote<chain extends Chain | unde
105
114
  * back immediately to the rolling historical p25 quote.
106
115
  */
107
116
  declare function getVaultDeltaHedgeInitialFeeQuote<chain extends Chain | undefined>(client: Client<Transport, chain>): Promise<VaultDeltaHedgeFeeQuote>; //#endregion
108
- export { MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS, MAX_VAULT_PRIORITY_FEE_PER_GAS, MAX_VAULT_TRANSACTION_GAS_COST, MIN_VAULT_PRIORITY_FEE_PER_GAS, VaultDeltaHedgeFeeQuote, VaultSignedTransactionFeeCaps, VaultSignedTransactionFeeValidationResult, VaultTransactionFeeEstimationError, VaultTransactionFeeQuote, VaultTransactionGasCostLimitError, VaultTransactionReplacementLimitError, applyVaultTransactionGasCostLimit, bufferVaultTransactionGasEstimate, getVaultDeltaHedgeHistoricalFeeQuote, getVaultDeltaHedgeInitialFeeQuote, getVaultTransactionFeeQuote, getVaultTransactionReplacementFeeQuote, validateVaultSignedTransactionFeeCaps };
117
+ export { MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS, MAX_VAULT_PRIORITY_FEE_PER_GAS, MAX_VAULT_TRANSACTION_GAS_COST, MIN_VAULT_PRIORITY_FEE_PER_GAS, VaultDeltaHedgeFeeQuote, VaultSignedTransactionFeeCaps, VaultSignedTransactionFeeValidationResult, VaultTransactionFeeEstimationError, VaultTransactionFeePolicy, VaultTransactionFeeQuote, VaultTransactionGasCostLimitError, VaultTransactionReplacementLimitError, applyVaultTransactionGasCostLimit, bufferVaultTransactionGasEstimate, getVaultDeltaHedgeHistoricalFeeQuote, getVaultDeltaHedgeInitialFeeQuote, getVaultTransactionFeeQuote, getVaultTransactionReplacementFeeQuote, validateVaultSignedTransactionFeeCaps };
109
118
  //# sourceMappingURL=vault-transaction-fees.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vault-transaction-fees.d.ts","names":["Chain","Client","Transport","MIN_VAULT_PRIORITY_FEE_PER_GAS","MAX_VAULT_PRIORITY_FEE_PER_GAS","MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS","MAX_VAULT_TRANSACTION_GAS_COST","VaultTransactionFeeQuote","VaultDeltaHedgeFeeQuote","VaultSignedTransactionFeeCaps","VaultSignedTransactionFeeValidationResult","VaultTransactionFeeEstimationError","feeHistoryError","fallbackError","Error","VaultTransactionGasCostLimitError","gasLimit","maximumAffordableFeePerGas","minimumRequiredFeePerGas","VaultTransactionReplacementLimitError","code","requiredMaxFeePerGas","requiredMaxPriorityFeePerGas","FeeHistorySnapshot","FallbackFeeEstimate","getChainPriorityFeeFloor","clampPriorityFee","resolveFeeHistoryQuote","baseFeePerGas","reward","minimumPriorityFeePerGas","resolveDeltaHedgeFeeHistoryQuote","resolveRpcPriorityFeeQuote","rawPriorityFeePerGas","getVaultTransactionReplacementFeeQuote","originalQuote","historicalQuote","finalReplacement","staleBoundsReplacement","Pick","resolveFallbackQuote","estimatedMaxFeePerGas","estimatedPriorityFeePerGas","applyVaultTransactionGasCostLimit","bufferVaultTransactionGasEstimate","validateVaultSignedTransactionFeeCaps","resolveVaultTransactionFeeQuote","readFeeHistory","readFallbackEstimate","Promise","getVaultTransactionFeeQuote","chain","getVaultDeltaHedgeHistoricalFeeQuote","resolveVaultDeltaHedgeInitialFeeQuote","readRpcQuote","readHistoricalQuote","getVaultDeltaHedgeInitialFeeQuote","__transactionFeeTestUtils"],"sources":["../src/hypoVault/transactionFees.d.ts"],"sourcesContent":null,"mappings":";;;cACqBG,8BAAAA;cACAC,8BAAAA;AADAD,cAEAE,0CAAAA,GAF8B,WAAA;AAC9BD,cAEAE,8BAAAA,GAF8B,kBAAA;AAC9BD,KAETE,wBAAAA,GAFSF;EACAC,oBAAAA,CAAAA,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DxD,2BAA2BC,OAAOC,WAAWiD,SAASF,QAAQzC"}
1
+ {"version":3,"file":"vault-transaction-fees.d.ts","names":["Chain","Client","Transport","MIN_VAULT_PRIORITY_FEE_PER_GAS","MAX_VAULT_PRIORITY_FEE_PER_GAS","MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS","MAX_VAULT_TRANSACTION_GAS_COST","REPLACEMENT_FEE_BUMP_NUMERATOR","REPLACEMENT_FEE_BUMP_DENOMINATOR","VaultTransactionFeePolicy","Readonly","VaultTransactionFeeQuote","VaultDeltaHedgeFeeQuote","VaultSignedTransactionFeeCaps","VaultSignedTransactionFeeValidationResult","VaultTransactionFeeEstimationError","feeHistoryError","fallbackError","Error","VaultTransactionGasCostLimitError","gasLimit","maximumAffordableFeePerGas","minimumRequiredFeePerGas","maximumGasCost","VaultTransactionReplacementLimitError","code","requiredMaxFeePerGas","requiredMaxPriorityFeePerGas","FeeHistorySnapshot","FallbackFeeEstimate","getChainPriorityFeeFloor","clampPriorityFee","resolveFeeHistoryQuote","baseFeePerGas","reward","minimumPriorityFeePerGas","resolveDeltaHedgeFeeHistoryQuote","resolveRpcPriorityFeeQuote","rawPriorityFeePerGas","getVaultTransactionReplacementFeeQuote","originalQuote","historicalQuote","finalReplacement","staleBoundsReplacement","feePolicy","Pick","resolveFallbackQuote","estimatedMaxFeePerGas","estimatedPriorityFeePerGas","applyVaultTransactionGasCostLimit","bufferVaultTransactionGasEstimate","validateVaultSignedTransactionFeeCaps","resolveVaultTransactionFeeQuote","readFeeHistory","readFallbackEstimate","Promise","getVaultTransactionFeeQuote","chain","getVaultDeltaHedgeHistoricalFeeQuote","resolveVaultDeltaHedgeInitialFeeQuote","readRpcQuote","readHistoricalQuote","getVaultDeltaHedgeInitialFeeQuote","__transactionFeeTestUtils"],"sources":["../src/hypoVault/transactionFees.d.ts"],"sourcesContent":null,"mappings":";;;cACqBG,8BAAAA;cACAC,8BAAAA;AADAD,cAEAE,0CAAAA,GAF8B,WAAA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