@panoptic-eng/sdk 1.0.56 → 1.0.58

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,6 +1,6 @@
1
1
  import { PanopticError, getBlockMeta, getPoolMetadata, submitWrite } from "./rates-B0uPUed1.js";
2
2
  import { tickToSqrtPriceX96 } from "./greeks-CNi1-cnp.js";
3
- import { decodeAllLegs } from "./writes-B4nGIi6h.js";
3
+ import { decodeAllLegs } from "./writes-Da5PWxJ9.js";
4
4
  import { BaseError, ContractFunctionRevertedError, encodeAbiParameters, encodeFunctionData, encodePacked, isAddressEqual, zeroAddress } from "viem";
5
5
 
6
6
  //#region src/uniswap/lpDeposit.ts
@@ -1,5 +1,5 @@
1
1
  import { PanopticError, getBlockMeta, getPool, submitWrite } from "./rates-B0uPUed1.js";
2
- import { AmountExceedsUint128Error, InvalidSwapTokenError, MissingSweepRecipientError, QuoterUnavailableError, getUniswapV4Addresses, universalRouterAbi } from "./router-BDp3WQqI.js";
2
+ import { AmountExceedsUint128Error, InvalidSwapTokenError, MissingSweepRecipientError, QuoterUnavailableError, getUniswapV4Addresses, universalRouterAbi } from "./router-C5v6J0jv.js";
3
3
  import { BaseError, ContractFunctionRevertedError, encodeAbiParameters, encodeFunctionData, encodePacked, erc20Abi, isAddressEqual, maxUint256, zeroAddress } from "viem";
4
4
 
5
5
  //#region src/uniswap/v4/router/encodeSwap.ts
@@ -1,3 +1,4 @@
1
+ import { ROBINHOOD_CHAIN_ID } from "./chainDeployments-CmDzAmZ3.js";
1
2
  import { hexToBigInt } from "viem";
2
3
  import { estimateFeesPerGas, getBlock, getFeeHistory } from "viem/actions";
3
4
 
@@ -67,12 +68,15 @@ function medianBigInt(values) {
67
68
  const lowerMiddle = sorted[upperMiddleIndex - 1];
68
69
  return lowerMiddle === void 0 ? void 0 : (lowerMiddle + upperMiddle) / 2n;
69
70
  }
70
- function clampPriorityFee(priorityFee) {
71
- if (priorityFee < MIN_VAULT_PRIORITY_FEE_PER_GAS) return MIN_VAULT_PRIORITY_FEE_PER_GAS;
71
+ function getChainPriorityFeeFloor(chainId) {
72
+ return chainId === ROBINHOOD_CHAIN_ID ? 0n : void 0;
73
+ }
74
+ function clampPriorityFee(priorityFee, minimumPriorityFeePerGas = MIN_VAULT_PRIORITY_FEE_PER_GAS) {
75
+ if (priorityFee < minimumPriorityFeePerGas) return minimumPriorityFeePerGas;
72
76
  if (priorityFee > MAX_VAULT_PRIORITY_FEE_PER_GAS) return MAX_VAULT_PRIORITY_FEE_PER_GAS;
73
77
  return priorityFee;
74
78
  }
75
- function resolveFeeHistoryQuote({ baseFeePerGas, reward }) {
79
+ function resolveFeeHistoryQuote({ baseFeePerGas, reward, minimumPriorityFeePerGas }) {
76
80
  const latestBaseFeeIndex = baseFeePerGas.length - 2;
77
81
  if (latestBaseFeeIndex < 0 || reward === void 0 || reward.length === 0) return null;
78
82
  const p90Rewards = reward.flatMap((blockRewards) => {
@@ -81,16 +85,18 @@ function resolveFeeHistoryQuote({ baseFeePerGas, reward }) {
81
85
  });
82
86
  const sampledPriorityFee = medianBigInt(p90Rewards);
83
87
  if (sampledPriorityFee === void 0) return null;
84
- const maxPriorityFeePerGas = clampPriorityFee(sampledPriorityFee);
88
+ const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
89
+ const maxPriorityFeePerGas = clampPriorityFee(sampledPriorityFee, effectivePriorityFeeFloor);
85
90
  const bufferedBaseFee = ceilMultiplyFraction(baseFeePerGas[latestBaseFeeIndex], BASE_FEE_BUFFER_NUMERATOR, BASE_FEE_BUFFER_DENOMINATOR);
86
91
  return {
87
92
  maxFeePerGas: bufferedBaseFee + maxPriorityFeePerGas,
88
93
  maxPriorityFeePerGas,
89
- minimumMaxFeePerGas: bufferedBaseFee + MIN_VAULT_PRIORITY_FEE_PER_GAS,
94
+ minimumMaxFeePerGas: bufferedBaseFee + effectivePriorityFeeFloor,
95
+ ...minimumPriorityFeePerGas === void 0 ? {} : { minimumPriorityFeePerGas },
90
96
  source: "fee_history"
91
97
  };
92
98
  }
93
- function resolveDeltaHedgeFeeHistoryQuote({ baseFeePerGas, reward }) {
99
+ function resolveDeltaHedgeFeeHistoryQuote({ baseFeePerGas, reward, minimumPriorityFeePerGas }) {
94
100
  const latestBaseFeeIndex = baseFeePerGas.length - 2;
95
101
  if (latestBaseFeeIndex < 0 || reward === void 0 || reward.length === 0) return null;
96
102
  const p25Rewards = reward.flatMap((blockRewards) => {
@@ -99,22 +105,25 @@ function resolveDeltaHedgeFeeHistoryQuote({ baseFeePerGas, reward }) {
99
105
  });
100
106
  const rawPriorityFeePerGas = medianBigInt(p25Rewards);
101
107
  if (rawPriorityFeePerGas === void 0) return null;
102
- const maxPriorityFeePerGas = clampPriorityFee(rawPriorityFeePerGas);
108
+ const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
109
+ const maxPriorityFeePerGas = clampPriorityFee(rawPriorityFeePerGas, effectivePriorityFeeFloor);
103
110
  const bufferedBaseFee = ceilMultiplyFraction(baseFeePerGas[latestBaseFeeIndex], BASE_FEE_BUFFER_NUMERATOR, BASE_FEE_BUFFER_DENOMINATOR);
104
111
  return {
105
112
  maxFeePerGas: bufferedBaseFee + maxPriorityFeePerGas,
106
113
  maxPriorityFeePerGas,
107
- minimumMaxFeePerGas: bufferedBaseFee + MIN_VAULT_PRIORITY_FEE_PER_GAS,
114
+ minimumMaxFeePerGas: bufferedBaseFee + effectivePriorityFeeFloor,
115
+ ...minimumPriorityFeePerGas === void 0 ? {} : { minimumPriorityFeePerGas },
108
116
  rawPriorityFeePerGas,
109
117
  source: "fee_history_p25"
110
118
  };
111
119
  }
112
- function resolveRpcPriorityFeeQuote({ baseFeePerGas, rawPriorityFeePerGas }) {
120
+ function resolveRpcPriorityFeeQuote({ baseFeePerGas, rawPriorityFeePerGas, minimumPriorityFeePerGas }) {
113
121
  const bufferedBaseFee = ceilMultiplyFraction(baseFeePerGas, BASE_FEE_BUFFER_NUMERATOR, BASE_FEE_BUFFER_DENOMINATOR);
114
122
  return {
115
123
  maxFeePerGas: bufferedBaseFee + rawPriorityFeePerGas,
116
124
  maxPriorityFeePerGas: rawPriorityFeePerGas,
117
- minimumMaxFeePerGas: bufferedBaseFee + rawPriorityFeePerGas,
125
+ minimumMaxFeePerGas: bufferedBaseFee + (minimumPriorityFeePerGas ?? rawPriorityFeePerGas),
126
+ ...minimumPriorityFeePerGas === void 0 ? {} : { minimumPriorityFeePerGas },
118
127
  rawPriorityFeePerGas,
119
128
  source: "rpc_priority_fee"
120
129
  };
@@ -135,7 +144,7 @@ function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote
135
144
  requiredMaxPriorityFeePerGas: requiredReplacementPriorityFee,
136
145
  maximumAffordableFeePerGas: MAX_VAULT_TRANSACTION_GAS_COST / gasLimit
137
146
  });
138
- const bufferedBaseFee = historicalQuote.minimumMaxFeePerGas - MIN_VAULT_PRIORITY_FEE_PER_GAS;
147
+ const bufferedBaseFee = historicalQuote.minimumMaxFeePerGas - (historicalQuote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
139
148
  const currentMarketMaxFee = bufferedBaseFee + requiredMaxPriorityFeePerGas;
140
149
  const desiredMaxFeePerGas = currentMarketMaxFee > bumpedMaxFee ? currentMarketMaxFee : bumpedMaxFee;
141
150
  const maximumAffordableFeePerGas = MAX_VAULT_TRANSACTION_GAS_COST / gasLimit;
@@ -153,13 +162,15 @@ function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote
153
162
  maxPriorityFeePerGas: requiredMaxPriorityFeePerGas
154
163
  };
155
164
  }
156
- function resolveFallbackQuote({ maxFeePerGas: estimatedMaxFeePerGas, maxPriorityFeePerGas: estimatedPriorityFeePerGas }) {
157
- const maxPriorityFeePerGas = clampPriorityFee(estimatedPriorityFeePerGas);
165
+ function resolveFallbackQuote({ maxFeePerGas: estimatedMaxFeePerGas, maxPriorityFeePerGas: estimatedPriorityFeePerGas, minimumPriorityFeePerGas }) {
166
+ const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
167
+ const maxPriorityFeePerGas = clampPriorityFee(estimatedPriorityFeePerGas, effectivePriorityFeeFloor);
158
168
  const estimatedBaseFeeAllowance = estimatedMaxFeePerGas > estimatedPriorityFeePerGas ? estimatedMaxFeePerGas - estimatedPriorityFeePerGas : 0n;
159
169
  return {
160
170
  maxFeePerGas: estimatedBaseFeeAllowance + maxPriorityFeePerGas,
161
171
  maxPriorityFeePerGas,
162
- minimumMaxFeePerGas: estimatedBaseFeeAllowance + MIN_VAULT_PRIORITY_FEE_PER_GAS,
172
+ minimumMaxFeePerGas: estimatedBaseFeeAllowance + effectivePriorityFeeFloor,
173
+ ...minimumPriorityFeePerGas === void 0 ? {} : { minimumPriorityFeePerGas },
163
174
  source: "viem_fallback"
164
175
  };
165
176
  }
@@ -172,7 +183,7 @@ function applyVaultTransactionGasCostLimit(quote, gasLimit) {
172
183
  minimumRequiredFeePerGas: quote.minimumMaxFeePerGas
173
184
  });
174
185
  if (quote.maxFeePerGas <= maximumAffordableFeePerGas) return quote;
175
- const bufferedBaseFee = quote.minimumMaxFeePerGas - MIN_VAULT_PRIORITY_FEE_PER_GAS;
186
+ const bufferedBaseFee = quote.minimumMaxFeePerGas - (quote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
176
187
  const affordablePriorityFee = maximumAffordableFeePerGas - bufferedBaseFee;
177
188
  return {
178
189
  ...quote,
@@ -185,7 +196,8 @@ function bufferVaultTransactionGasEstimate(gasEstimate) {
185
196
  return ceilMultiplyFraction(gasEstimate, GAS_ESTIMATE_BUFFER_NUMERATOR, GAS_ESTIMATE_BUFFER_DENOMINATOR);
186
197
  }
187
198
  function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
188
- const { gasLimit, maxFeePerGas, maxPriorityFeePerGas } = feeCaps;
199
+ const { chainId, gasLimit, maxFeePerGas, maxPriorityFeePerGas } = feeCaps;
200
+ const minimumPriorityFeePerGas = quote?.minimumPriorityFeePerGas ?? getChainPriorityFeeFloor(chainId) ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
189
201
  if (maxFeePerGas === null || maxPriorityFeePerGas === null) return {
190
202
  valid: false,
191
203
  code: "MissingEip1559Fees",
@@ -196,10 +208,10 @@ function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
196
208
  code: "InvalidFeeCaps",
197
209
  reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) cannot exceed maxFeePerGas (${maxFeePerGas.toString()} wei).`
198
210
  };
199
- if (maxPriorityFeePerGas < MIN_VAULT_PRIORITY_FEE_PER_GAS) return {
211
+ if (maxPriorityFeePerGas < minimumPriorityFeePerGas) return {
200
212
  valid: false,
201
213
  code: "PriorityFeeTooLow",
202
- reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) must be at least ${MIN_VAULT_PRIORITY_FEE_PER_GAS.toString()} wei (0.1 gwei).`
214
+ reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) must be at least ${minimumPriorityFeePerGas.toString()} wei.`
203
215
  };
204
216
  if (maxPriorityFeePerGas > MAX_VAULT_PRIORITY_FEE_PER_GAS) return {
205
217
  valid: false,
@@ -214,21 +226,27 @@ function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
214
226
  if (quote !== void 0 && maxFeePerGas < quote.minimumMaxFeePerGas) return {
215
227
  valid: false,
216
228
  code: "MaxFeeTooLow",
217
- reason: `Signed transaction maxFeePerGas (${maxFeePerGas.toString()} wei) must be at least ${quote.minimumMaxFeePerGas.toString()} wei for the buffered next-block base fee and 0.1 gwei minimum priority fee.`
229
+ reason: `Signed transaction maxFeePerGas (${maxFeePerGas.toString()} wei) must be at least ${quote.minimumMaxFeePerGas.toString()} wei for the buffered next-block base fee and configured minimum priority fee.`
218
230
  };
219
231
  return { valid: true };
220
232
  }
221
- async function resolveVaultTransactionFeeQuote({ readFeeHistory, readFallbackEstimate }) {
233
+ async function resolveVaultTransactionFeeQuote({ readFeeHistory, readFallbackEstimate, minimumPriorityFeePerGas }) {
222
234
  let feeHistoryError;
223
235
  try {
224
- const quote = resolveFeeHistoryQuote(await readFeeHistory());
236
+ const quote = resolveFeeHistoryQuote({
237
+ ...await readFeeHistory(),
238
+ minimumPriorityFeePerGas
239
+ });
225
240
  if (quote !== null) return quote;
226
241
  feeHistoryError = new Error("eth_feeHistory returned incomplete base fee or reward data");
227
242
  } catch (error) {
228
243
  feeHistoryError = error;
229
244
  }
230
245
  try {
231
- return resolveFallbackQuote(await readFallbackEstimate());
246
+ return resolveFallbackQuote({
247
+ ...await readFallbackEstimate(),
248
+ minimumPriorityFeePerGas
249
+ });
232
250
  } catch (fallbackError) {
233
251
  throw new VaultTransactionFeeEstimationError({
234
252
  feeHistoryError,
@@ -240,12 +258,13 @@ async function resolveVaultTransactionFeeQuote({ readFeeHistory, readFallbackEst
240
258
  * Resolve explicit EIP-1559 fees for operator-controlled vault transactions.
241
259
  *
242
260
  * The normal path follows the median p90 priority fee from the last 20 blocks,
243
- * with a 0.1 gwei floor and 3 gwei ceiling. If fee history is unavailable,
244
- * Viem's estimate is used while preserving those bounds and its original
245
- * base-fee allowance.
261
+ * with a 3 gwei ceiling and a 0.1 gwei floor except on chains that do not use
262
+ * tips for ordering. If fee history is unavailable, Viem's estimate is used
263
+ * while preserving those bounds and its original base-fee allowance.
246
264
  */
247
265
  async function getVaultTransactionFeeQuote(client) {
248
266
  return resolveVaultTransactionFeeQuote({
267
+ minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),
249
268
  readFeeHistory: () => getFeeHistory(client, {
250
269
  blockCount: FEE_HISTORY_BLOCK_COUNT,
251
270
  blockTag: "latest",
@@ -260,13 +279,19 @@ async function getVaultDeltaHedgeHistoricalFeeQuote(client) {
260
279
  blockTag: "latest",
261
280
  rewardPercentiles: DELTA_HEDGE_FEE_HISTORY_REWARD_PERCENTILES
262
281
  });
263
- const quote = resolveDeltaHedgeFeeHistoryQuote(feeHistory);
282
+ const quote = resolveDeltaHedgeFeeHistoryQuote({
283
+ ...feeHistory,
284
+ minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id)
285
+ });
264
286
  if (quote === null) throw new Error("eth_feeHistory returned incomplete p25 base fee or reward data");
265
287
  return quote;
266
288
  }
267
- async function resolveVaultDeltaHedgeInitialFeeQuote({ readRpcQuote, readHistoricalQuote }) {
289
+ async function resolveVaultDeltaHedgeInitialFeeQuote({ readRpcQuote, readHistoricalQuote, minimumPriorityFeePerGas }) {
268
290
  try {
269
- return resolveRpcPriorityFeeQuote(await readRpcQuote());
291
+ return resolveRpcPriorityFeeQuote({
292
+ ...await readRpcQuote(),
293
+ minimumPriorityFeePerGas
294
+ });
270
295
  } catch {
271
296
  return readHistoricalQuote();
272
297
  }
@@ -278,6 +303,7 @@ async function resolveVaultDeltaHedgeInitialFeeQuote({ readRpcQuote, readHistori
278
303
  */
279
304
  async function getVaultDeltaHedgeInitialFeeQuote(client) {
280
305
  return resolveVaultDeltaHedgeInitialFeeQuote({
306
+ minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),
281
307
  readRpcQuote: async () => {
282
308
  const [rawPriorityFee, latestBlock] = await Promise.all([client.request({ method: "eth_maxPriorityFeePerGas" }), getBlock(client, { blockTag: "latest" })]);
283
309
  if (latestBlock.baseFeePerGas === null) throw new Error("Latest block does not include an EIP-1559 base fee");
@@ -1,9 +1,9 @@
1
- import { StateViewAbi, getAccountCollateral, panopticQueryAbi$1 as panopticQueryAbi, readBlockAndAggregate, requireReturnData } from "./irm-Dwl2er4W.js";
1
+ import { StateViewAbi, getAccountCollateral, panopticQueryAbi$1 as panopticQueryAbi, readBlockAndAggregate, requireReturnData } from "./irm-BGGqQprG.js";
2
2
  import { AccountInsolventError, ChunkLimitError, DEFAULT_VEGOID, InvalidHistoryRangeError, MulticallResultMissingError, NotEnoughTokensError, PanopticError, PanopticValidationError, SafeModeError, StaleDataError, StorageDataNotFoundError, UnhealthyPoolError, WrongUniswapPoolError, applyMintBufferPerToken, availableToBorrow, collateralTrackerV2Abi, decodeLeftRightSigned, decodeLeftRightUnsigned, decodePositionBalance, getBlockMeta, getClosedPositionsKey, getPendingPositionsKey, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositionsKey, getTrackedChunksKey, getTrackedPositionIds, isPanopticErrorType, jsonSerializer, mintableAfterBuffer, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi as panopticQueryAbi$1, parsePanopticError, riskEngineAbi, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, uniswapV3PoolAbi } from "./rates-B0uPUed1.js";
3
3
  import { MAX_TICK, MAX_TRACKED_CHUNKS, MIN_TICK, NO_LOWER_LIQUIDATION_TICK, NO_UPPER_LIQUIDATION_TICK, WAD, calculatePositionDelta, calculatePositionDeltaDebtOnly, calculatePositionGamma, calculatePositionValue, priceToTick, sqrtPriceX96ToTick, tickLimits, tickToPriceDecimalScaled, tickToSqrtPriceX96, toVaultFrameAtTick } from "./greeks-CNi1-cnp.js";
4
- import { addLegToTokenId, buildBatchDispatchArgs, buildSettleSequenceCalls, buildUniqueCredit, buildUniqueLoan, countLegs, createTokenIdBuilder, decodeAllLegs, decodeTokenId, getPoolTokensForSimulation, loadCheckpoint, resolveTokenIndex, simulateOpenPosition, simulateWithTokenFlow } from "./writes-B4nGIi6h.js";
5
- import { getLpPositionFunding, getMaxLpPositionSize } from "./router-BDp3WQqI.js";
6
- import { BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, ExecutionRevertedError, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, getAddress, keccak256, parseAbi, toHex, zeroAddress } from "viem";
4
+ import { addLegToTokenId, buildBatchDispatchArgs, buildSettleSequenceCalls, buildUniqueCredit, buildUniqueLoan, countLegs, createTokenIdBuilder, decodeAllLegs, decodeTokenId, getPoolTokensForSimulation, loadCheckpoint, resolveTokenIndex, simulateOpenPosition, simulateWithTokenFlow } from "./writes-Da5PWxJ9.js";
5
+ import { getLpPositionFunding, getMaxLpPositionSize } from "./router-C5v6J0jv.js";
6
+ import { BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, ExecutionRevertedError, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, getAddress, hexToString, keccak256, parseAbi, toHex, trim, zeroAddress } from "viem";
7
7
  import { multicall } from "viem/actions";
8
8
  import Decimal from "decimal.js";
9
9
 
@@ -4703,6 +4703,44 @@ const erc20MetaAbi = [
4703
4703
  stateMutability: "view"
4704
4704
  }
4705
4705
  ];
4706
+ const erc20Bytes32MetaAbi = [{
4707
+ type: "function",
4708
+ name: "symbol",
4709
+ inputs: [],
4710
+ outputs: [{ type: "bytes32" }],
4711
+ stateMutability: "view"
4712
+ }, {
4713
+ type: "function",
4714
+ name: "name",
4715
+ inputs: [],
4716
+ outputs: [{ type: "bytes32" }],
4717
+ stateMutability: "view"
4718
+ }];
4719
+ async function readTokenText(client, blockNumber, calls) {
4720
+ const asString = await client.multicall({
4721
+ allowFailure: true,
4722
+ blockNumber,
4723
+ contracts: calls.map((call$1) => ({
4724
+ ...call$1,
4725
+ abi: erc20MetaAbi
4726
+ }))
4727
+ });
4728
+ if (asString.every((result) => result.status === "success")) return asString.map((result) => result.result);
4729
+ const asBytes32 = await client.multicall({
4730
+ allowFailure: true,
4731
+ blockNumber,
4732
+ contracts: calls.map((call$1) => ({
4733
+ ...call$1,
4734
+ abi: erc20Bytes32MetaAbi
4735
+ }))
4736
+ });
4737
+ return asString.map((result, index) => {
4738
+ if (result.status === "success") return result.result;
4739
+ const fallback = asBytes32[index];
4740
+ if (fallback.status !== "success") throw fallback.error;
4741
+ return hexToString(trim(fallback.result, { dir: "right" }));
4742
+ });
4743
+ }
4706
4744
  /**
4707
4745
  * Fetch core data for a Uniswap V3 pool directly from chain.
4708
4746
  *
@@ -4747,42 +4785,36 @@ async function getUniswapV3PoolInfo(params) {
4747
4785
  }
4748
4786
  ]
4749
4787
  });
4750
- const [t0Symbol, t0Name, t0Decimals, t1Symbol, t1Name, t1Decimals] = await client.multicall({
4788
+ const [[t0Symbol, t0Name, t1Symbol, t1Name], [t0Decimals, t1Decimals]] = await Promise.all([readTokenText(client, _meta.blockNumber, [
4789
+ {
4790
+ address: token0Addr,
4791
+ functionName: "symbol"
4792
+ },
4793
+ {
4794
+ address: token0Addr,
4795
+ functionName: "name"
4796
+ },
4797
+ {
4798
+ address: token1Addr,
4799
+ functionName: "symbol"
4800
+ },
4801
+ {
4802
+ address: token1Addr,
4803
+ functionName: "name"
4804
+ }
4805
+ ]), client.multicall({
4751
4806
  allowFailure: false,
4752
4807
  blockNumber: _meta.blockNumber,
4753
- contracts: [
4754
- {
4755
- address: token0Addr,
4756
- abi: erc20MetaAbi,
4757
- functionName: "symbol"
4758
- },
4759
- {
4760
- address: token0Addr,
4761
- abi: erc20MetaAbi,
4762
- functionName: "name"
4763
- },
4764
- {
4765
- address: token0Addr,
4766
- abi: erc20MetaAbi,
4767
- functionName: "decimals"
4768
- },
4769
- {
4770
- address: token1Addr,
4771
- abi: erc20MetaAbi,
4772
- functionName: "symbol"
4773
- },
4774
- {
4775
- address: token1Addr,
4776
- abi: erc20MetaAbi,
4777
- functionName: "name"
4778
- },
4779
- {
4780
- address: token1Addr,
4781
- abi: erc20MetaAbi,
4782
- functionName: "decimals"
4783
- }
4784
- ]
4785
- });
4808
+ contracts: [{
4809
+ address: token0Addr,
4810
+ abi: erc20MetaAbi,
4811
+ functionName: "decimals"
4812
+ }, {
4813
+ address: token1Addr,
4814
+ abi: erc20MetaAbi,
4815
+ functionName: "decimals"
4816
+ }]
4817
+ })]);
4786
4818
  return {
4787
4819
  poolAddress,
4788
4820
  token0: {
@@ -9,12 +9,14 @@ type VaultTransactionFeeQuote = {
9
9
  maxFeePerGas: bigint;
10
10
  maxPriorityFeePerGas: bigint;
11
11
  minimumMaxFeePerGas: bigint;
12
+ minimumPriorityFeePerGas?: bigint;
12
13
  source: 'fee_history' | 'viem_fallback' | 'rpc_priority_fee' | 'fee_history_p25';
13
14
  };
14
15
  type VaultDeltaHedgeFeeQuote = VaultTransactionFeeQuote & {
15
16
  rawPriorityFeePerGas: bigint;
16
17
  };
17
18
  type VaultSignedTransactionFeeCaps = {
19
+ chainId?: number;
18
20
  gasLimit?: bigint | null;
19
21
  maxFeePerGas: bigint | null;
20
22
  maxPriorityFeePerGas: bigint | null;
@@ -90,9 +92,9 @@ declare function validateVaultSignedTransactionFeeCaps(feeCaps: VaultSignedTrans
90
92
  * Resolve explicit EIP-1559 fees for operator-controlled vault transactions.
91
93
  *
92
94
  * The normal path follows the median p90 priority fee from the last 20 blocks,
93
- * with a 0.1 gwei floor and 3 gwei ceiling. If fee history is unavailable,
94
- * Viem's estimate is used while preserving those bounds and its original
95
- * base-fee allowance.
95
+ * with a 3 gwei ceiling and a 0.1 gwei floor except on chains that do not use
96
+ * tips for ordering. If fee history is unavailable, Viem's estimate is used
97
+ * while preserving those bounds and its original base-fee allowance.
96
98
  */
97
99
  declare function getVaultTransactionFeeQuote<chain extends Chain | undefined>(client: Client<Transport, chain>): Promise<VaultTransactionFeeQuote>;
98
100
  declare function getVaultDeltaHedgeHistoricalFeeQuote<chain extends Chain | undefined>(client: Client<Transport, chain>): Promise<VaultDeltaHedgeFeeQuote>;
@@ -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","clampPriorityFee","resolveFeeHistoryQuote","baseFeePerGas","reward","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,YAAAA,EAAAA,MAAAA;EACTC,oBAAAA,EAAAA,MAAwB;EAMxBC,mBAAAA,EAAAA,MAAuB;EAGvBC,MAAAA,EAAAA,aAAAA,GAAAA,eAA6B,GAAA,kBAAA,GAAA,iBAAA;AAKzC,CAAA;AAOqBE,KAfTH,uBAAAA,GAA0BD,wBAeiB,GAAA;EAAA,oBAAA,EAAA,MAAA;CAAA;AAGpBM,KAfvBJ,6BAAAA,GAeuBI;EAAa,QAHgBC,CAAAA,EAAAA,MAAAA,GAAAA,IAAAA;EAAK,YAAA,EAAA,MA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AAA,oBAAAA,GAAAA,wBAAiC;IACjCC,QAAAA,EAAAA,MAAAA;IAAqC,oBAAA,EAAA,MAAA;IAAUlC,4BAAAA,EAAAA,MAAAA;IAAuCF,0BAAAA,EAAAA,MAAAA;EAAwB,CAAA;AAA4C;AActH,iBA3BpCyB,sCAAAA,CA2BoC;EAAA,aAAA;EAAA,eAAA;EAAA,QAAA;EAAA,gBAAA;EAAA;CAAA,EAAA;EAAA,aAAehC,EA1BxDqC,IA0BwDrC,CA1BnDO,wBA0BmDP,EAAAA,cAAAA,GAAAA,sBAAAA,CAAAA;EAAK,eAA6BE,EAzBxFM,uBAyBwFN;EAAS,QAAE+C,EAAAA,MAAAA;EAAK,gBAAvBhD,CAAAA,EAAAA,OAAAA;EAAM,sBAA6BO,CAAAA,EAAAA,OAAAA;CAAuB,CAAA,EArB5JA,uBAqB6HuC;iBAhBzGN,iCAAAA,QAAyClC,6CAA6CA;iBACtFmC,iCAAAA;AA4BAY,iBA3BAX,qCAAAA,CA2BiC,OAAA,EA3BclC,6BA2Bd,EAAA,KAAA,CAAA,EA3BqDF,wBA2BrD,CAAA,EA3BgFG,yCA2BhF;;;;AAA4E;;;;;iBAd7GsC,0CAA0ChD,2BAA2BC,OAAOC,WAAW+C,SAASF,QAAQxC;iBACxG2C,mDAAmDlD,2BAA2BC,OAAOC,WAAW+C,SAASF,QAAQvC;;;;;;iBAajH8C,gDAAgDtD,2BAA2BC,OAAOC,WAAW+C,SAASF,QAAQvC"}
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,YAAAA,EAAAA,MAAAA;EACTC,oBAAAA,EAAAA,MAAwB;EAOxBC,mBAAAA,EAAAA,MAAuB;EAGvBC,wBAAAA,CAAAA,EAAAA,MAA6B;EAM7BC,MAAAA,EAAAA,aAAAA,GAAAA,eAAAA,GAAAA,kBAAyC,GAAA,iBAAA;AAOrD,CAAA;AAAuD,KAhB3CF,uBAAAA,GAA0BD,wBAgBiB,GAAA;EAAA,oBAGrCK,EAAAA,MAAAA;CAAe;AAH+BE,KAbpDL,6BAAAA,GAaoDK;EAAK,OAAA,CAAA,EAAA,MAAA;EAQhDC,QAAAA,CAAAA,EAAAA,MAA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