@panoptic-eng/sdk 1.0.49 → 1.0.51

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.
Files changed (44) hide show
  1. package/dist/cow/index.js.map +1 -1
  2. package/dist/{cow-DMX9ebPk.js → cow-CSSKPknb.js} +1 -1
  3. package/dist/deployments.d.ts +12 -4
  4. package/dist/deployments.d.ts.map +1 -1
  5. package/dist/deployments.js +78 -10
  6. package/dist/deployments.js.map +1 -1
  7. package/dist/{greeks-9aTE-DwO.js → greeks-CNi1-cnp.js} +39 -16
  8. package/dist/index.d.ts +518 -71
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +724 -91
  11. package/dist/index.js.map +1 -1
  12. package/dist/{irm-mySi_YMF.js → irm-BJaJSUjF.js} +80 -12
  13. package/dist/panoptic/v2/greeks/index.d.ts +12 -1
  14. package/dist/panoptic/v2/greeks/index.d.ts.map +1 -1
  15. package/dist/panoptic/v2/greeks/index.js +39 -16
  16. package/dist/panoptic/v2/greeks/index.js.map +1 -1
  17. package/dist/panoptic/v2/index.d.ts +1336 -74
  18. package/dist/panoptic/v2/index.d.ts.map +1 -1
  19. package/dist/panoptic/v2/index.js +20322 -18660
  20. package/dist/panoptic/v2/index.js.map +1 -1
  21. package/dist/panoptic/v2/react-public.d.ts +1518 -240
  22. package/dist/panoptic/v2/react-public.d.ts.map +1 -1
  23. package/dist/panoptic/v2/react-public.js +11518 -9319
  24. package/dist/panoptic/v2/react-public.js.map +1 -1
  25. package/dist/{rates-CDLIUGDz.js → rates-COAJpKRd.js} +612 -73
  26. package/dist/{router-45ulPnWe.js → router-B-I1eACz.js} +5 -43
  27. package/dist/router-BSS7HKd2.js +837 -0
  28. package/dist/{transactionFees-DUm6ilXB.js → transactionFees-DE-Whxab.js} +24 -8
  29. package/dist/uniswap/index.d.ts +465 -215
  30. package/dist/uniswap/index.d.ts.map +1 -1
  31. package/dist/uniswap/index.js +1799 -1076
  32. package/dist/uniswap/index.js.map +1 -1
  33. package/dist/{v2-DshssxX4.js → v2-zF6b01PI.js} +2488 -1596
  34. package/dist/vault-transaction-fees.d.ts +9 -4
  35. package/dist/vault-transaction-fees.d.ts.map +1 -1
  36. package/dist/vault-transaction-fees.js +24 -8
  37. package/dist/vault-transaction-fees.js.map +1 -1
  38. package/dist/{writes-2reV_omF.js → writes-D1zN0v9x.js} +4 -3
  39. package/dist/zodiac/index.d.ts +51 -7
  40. package/dist/zodiac/index.d.ts.map +1 -1
  41. package/dist/zodiac/index.js +154 -2
  42. package/dist/zodiac/index.js.map +1 -1
  43. package/package.json +2 -1
  44. package/dist/router-B2jY9Nyb.js +0 -312
@@ -4,6 +4,7 @@ import { estimateFeesPerGas, getBlock, getFeeHistory } from "viem/actions";
4
4
  //#region src/hypoVault/transactionFees.ts
5
5
  const MIN_VAULT_PRIORITY_FEE_PER_GAS = 100000000n;
6
6
  const MAX_VAULT_PRIORITY_FEE_PER_GAS = 3000000000n;
7
+ const MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS = 8000000000n;
7
8
  const MAX_VAULT_TRANSACTION_GAS_COST = 15000000000000000n;
8
9
  const FEE_HISTORY_BLOCK_COUNT = 20;
9
10
  const FEE_HISTORY_REWARD_PERCENTILES = [90];
@@ -12,6 +13,9 @@ const BASE_FEE_BUFFER_NUMERATOR = 1125n;
12
13
  const BASE_FEE_BUFFER_DENOMINATOR = 1000n;
13
14
  const REPLACEMENT_FEE_BUMP_NUMERATOR = 1125n;
14
15
  const REPLACEMENT_FEE_BUMP_DENOMINATOR = 1000n;
16
+ const DELTA_HEDGE_PRIORITY_FEE_BUMP_NUMERATOR = 1300n;
17
+ const DELTA_HEDGE_PRIORITY_FEE_BUMP_DENOMINATOR = 1000n;
18
+ const MAX_DELTA_HEDGE_PRIORITY_FEE_PER_GAS = MAX_VAULT_PRIORITY_FEE_PER_GAS * REPLACEMENT_FEE_BUMP_DENOMINATOR / REPLACEMENT_FEE_BUMP_NUMERATOR;
15
19
  const GAS_ESTIMATE_BUFFER_NUMERATOR = 3n;
16
20
  const GAS_ESTIMATE_BUFFER_DENOMINATOR = 2n;
17
21
  var VaultTransactionFeeEstimationError = class extends Error {
@@ -115,25 +119,37 @@ function resolveRpcPriorityFeeQuote({ baseFeePerGas, rawPriorityFeePerGas }) {
115
119
  source: "rpc_priority_fee"
116
120
  };
117
121
  }
118
- function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote, gasLimit }) {
122
+ function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote, gasLimit, finalReplacement = false, staleBoundsReplacement = false }) {
119
123
  if (gasLimit <= 0n) throw new Error(`Vault transaction gas limit must be positive, received ${gasLimit.toString()}`);
120
- const bumpedPriorityFee = ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR);
124
+ 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);
121
125
  const bumpedMaxFee = ceilMultiplyFraction(originalQuote.maxFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR);
122
- const requiredMaxPriorityFeePerGas = historicalQuote.maxPriorityFeePerGas > bumpedPriorityFee ? historicalQuote.maxPriorityFeePerGas : bumpedPriorityFee;
126
+ const escalatingPriorityFee = historicalQuote.maxPriorityFeePerGas > bumpedPriorityFee ? historicalQuote.maxPriorityFeePerGas : bumpedPriorityFee;
127
+ 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;
128
+ const desiredMaxPriorityFeePerGas = finalReplacement ? MAX_VAULT_PRIORITY_FEE_PER_GAS : staleBoundsReplacement ? bumpedPriorityFee : escalatingPriorityFee;
129
+ const requiredReplacementPriorityFee = ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR);
130
+ const requiredMaxPriorityFeePerGas = desiredMaxPriorityFeePerGas < priorityFeeLimit ? desiredMaxPriorityFeePerGas : priorityFeeLimit;
131
+ if (requiredMaxPriorityFeePerGas < requiredReplacementPriorityFee) throw new VaultTransactionReplacementLimitError({
132
+ code: "PriorityFeeCapExceeded",
133
+ gasLimit,
134
+ requiredMaxFeePerGas: originalQuote.maxFeePerGas,
135
+ requiredMaxPriorityFeePerGas: requiredReplacementPriorityFee,
136
+ maximumAffordableFeePerGas: MAX_VAULT_TRANSACTION_GAS_COST / gasLimit
137
+ });
123
138
  const bufferedBaseFee = historicalQuote.minimumMaxFeePerGas - MIN_VAULT_PRIORITY_FEE_PER_GAS;
124
139
  const currentMarketMaxFee = bufferedBaseFee + requiredMaxPriorityFeePerGas;
125
- const requiredMaxFeePerGas = currentMarketMaxFee > bumpedMaxFee ? currentMarketMaxFee : bumpedMaxFee;
140
+ const desiredMaxFeePerGas = currentMarketMaxFee > bumpedMaxFee ? currentMarketMaxFee : bumpedMaxFee;
126
141
  const maximumAffordableFeePerGas = MAX_VAULT_TRANSACTION_GAS_COST / gasLimit;
127
- if (requiredMaxFeePerGas > maximumAffordableFeePerGas) throw new VaultTransactionReplacementLimitError({
142
+ if (bumpedMaxFee > maximumAffordableFeePerGas || requiredMaxPriorityFeePerGas > maximumAffordableFeePerGas) throw new VaultTransactionReplacementLimitError({
128
143
  code: "GasCostCapExceeded",
129
144
  gasLimit,
130
- requiredMaxFeePerGas,
145
+ requiredMaxFeePerGas: bumpedMaxFee,
131
146
  requiredMaxPriorityFeePerGas,
132
147
  maximumAffordableFeePerGas
133
148
  });
149
+ const maxFeePerGas = desiredMaxFeePerGas < maximumAffordableFeePerGas ? desiredMaxFeePerGas : maximumAffordableFeePerGas;
134
150
  return {
135
151
  ...historicalQuote,
136
- maxFeePerGas: requiredMaxFeePerGas,
152
+ maxFeePerGas,
137
153
  maxPriorityFeePerGas: requiredMaxPriorityFeePerGas
138
154
  };
139
155
  }
@@ -275,4 +291,4 @@ async function getVaultDeltaHedgeInitialFeeQuote(client) {
275
291
  }
276
292
 
277
293
  //#endregion
278
- export { 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 };
294
+ 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 };