@panoptic-eng/sdk 1.0.21 → 1.0.23

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 (60) hide show
  1. package/dist/cow/index.d.ts +4 -4
  2. package/dist/cow/index.js +3 -3
  3. package/dist/cow/types.d.ts +2 -3
  4. package/dist/{cow-C_SGXoWr.js → cow-BilQfbNT.js} +2 -2
  5. package/dist/{cow-C_SGXoWr.js.map → cow-BilQfbNT.js.map} +1 -1
  6. package/dist/{index-BuJcj5aO.d.ts → index-CIlr4SNh.d.ts} +4 -3
  7. package/dist/index-CIlr4SNh.d.ts.map +1 -0
  8. package/dist/index.d.ts +696 -5908
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1393 -579
  11. package/dist/index.js.map +1 -1
  12. package/dist/{irm-CfM383Ku.js → irm-C7EQwrga.js} +332 -3
  13. package/dist/irm-C7EQwrga.js.map +1 -0
  14. package/dist/irm-CSJX9BsU.d.ts +5694 -0
  15. package/dist/irm-CSJX9BsU.d.ts.map +1 -0
  16. package/dist/panoptic/v2/index.d.ts +438 -10
  17. package/dist/panoptic/v2/index.d.ts.map +1 -1
  18. package/dist/panoptic/v2/index.js +200 -8
  19. package/dist/panoptic/v2/index.js.map +1 -1
  20. package/dist/{position-BK4a-Yyu.js → position-CsIEneku.js} +33 -2
  21. package/dist/position-CsIEneku.js.map +1 -0
  22. package/dist/{router-CMrp245w.js → router-BM10ZWY5.js} +90 -40
  23. package/dist/router-BM10ZWY5.js.map +1 -0
  24. package/dist/simulation-4SzTI-xf.d.ts +435 -0
  25. package/dist/simulation-4SzTI-xf.d.ts.map +1 -0
  26. package/dist/test/index.d.ts +2 -2
  27. package/dist/test/index.d.ts.map +1 -1
  28. package/dist/test/index.js +1 -1
  29. package/dist/tx-Banz1S18.d.ts +367 -0
  30. package/dist/tx-Banz1S18.d.ts.map +1 -0
  31. package/dist/{types-CRvvn2ce.d.ts → types-Bzw_7NJv.d.ts} +2 -2
  32. package/dist/{types-CRvvn2ce.d.ts.map → types-Bzw_7NJv.d.ts.map} +1 -1
  33. package/dist/types-CspUPolV.d.ts +892 -0
  34. package/dist/types-CspUPolV.d.ts.map +1 -0
  35. package/dist/uniswap/index.d.ts +121 -4
  36. package/dist/uniswap/index.d.ts.map +1 -1
  37. package/dist/uniswap/index.js +228 -4
  38. package/dist/uniswap/index.js.map +1 -0
  39. package/dist/{writes-DymnVbiE.js → writes-BnO9zj-Z.js} +42 -11
  40. package/dist/writes-BnO9zj-Z.js.map +1 -0
  41. package/dist/zodiac/index.d.ts +439 -0
  42. package/dist/zodiac/index.d.ts.map +1 -0
  43. package/dist/zodiac/index.js +944 -0
  44. package/dist/zodiac/index.js.map +1 -0
  45. package/package.json +6 -1
  46. package/dist/index-BuJcj5aO.d.ts.map +0 -1
  47. package/dist/index-DVMjZi1E.d.ts +0 -1801
  48. package/dist/index-DVMjZi1E.d.ts.map +0 -1
  49. package/dist/irm-CGykVo3q.d.ts +0 -32
  50. package/dist/irm-CGykVo3q.d.ts.map +0 -1
  51. package/dist/irm-CfM383Ku.js.map +0 -1
  52. package/dist/irm-zWjtffWA.d.ts +0 -85
  53. package/dist/irm-zWjtffWA.d.ts.map +0 -1
  54. package/dist/panoptic/v2/types/index.d.ts +0 -3
  55. package/dist/panoptic/v2/types/index.js +0 -0
  56. package/dist/position-BK4a-Yyu.js.map +0 -1
  57. package/dist/router-CMrp245w.js.map +0 -1
  58. package/dist/types-BQejAFnu.d.ts +0 -245
  59. package/dist/types-BQejAFnu.d.ts.map +0 -1
  60. package/dist/writes-DymnVbiE.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-CspUPolV.d.ts","names":["tickToSqrtPriceX96","tickToPrice","tickToPriceDecimalScaled","sqrtPriceX96ToPriceDecimalScaled","priceToTick","sqrtPriceX96ToTick","formatTick","getPricesAtTick","formatTickRange","formatPriceRange","getTickSpacing","roundToTickSpacing","TickLimitsResult","tickLimits","Address","PublicClient","tickToSqrtPriceX96","BlockMeta","OracleState","Pool","RiskParameters","Utilization","PoolMetadata","GetPoolMetadataParams","getPoolMetadata","Promise","GetPoolParams","getPool","GetUtilizationParams","getUtilization","GetOracleStateParams","getOracleState","GetRiskParametersParams","getRiskParameters","validateBuilderCode","FetchPoolIdParams","FetchPoolIdResult","fetchPoolId","Address","PoolMetadata","BlockMeta","PoolHealthStatus","CollateralTracker","RiskEngine","PoolKey","Pool","Utilization","BlockMeta","SafeMode","OracleState","SafeModeState","RiskParameters","CurrentRates","Address","UniswapV4Addresses","PERMIT2_ADDRESS","UNISWAP_V4_ADDRESSES","Record","getUniswapV4Addresses","Partial","Address","PublicClient","WalletClient","PoolKey","TxOverrides","UniswapV4Addresses","SwapExactInViaRouterParams","Partial","QuoteSwapExactInViaRouterParams","SwapExactInQuote","SwapExactOutViaRouterParams","QuoteSwapExactOutViaRouterParams","SwapExactOutQuote","CheckRouterApprovalParams","RouterApprovalStatus","ApproveErc20ForPermit2Params","ApproveRouterViaPermit2Params"],"sources":["../src/panoptic/v2/formatters/tick.d.ts","../src/panoptic/v2/reads/pool.d.ts","../src/panoptic/v2/types/pool.d.ts","../src/panoptic/v2/types/oracle.d.ts","../src/uniswap/v4/addresses.d.ts","../src/uniswap/v4/router/types.d.ts"],"sourcesContent":null,"mappings":";;;;;;;;;;;;;;;;;;;iBAOwBgB,kBAAAA;;;;;AAAxB;;;;;;;;;;;;;;iBAmBwBf,WAAAA;;;;;AAAxB;;;;;;;;;;;;;;;;;;iBAuBwBC,wBAAAA;;;;;AAAxB;;;;;;;;;;;;iBAiBwBC,gCAAAA;;;;;AAAxB;;;;;;;;;;;;;iBAkBwBC,WAAAA;;;;;AAAxB;;;;;;;iBAYwBC,kBAAAA;;;;;AAAxB;;;;;;;;iBAawBC,UAAAA;;;;;AAAxB;;;;;;;;;;;;iBAiBwBC,eAAAA;;;;;AAAxB;;;;;;;;;;;iBAgBwBC,eAAAA;;AAAxB;;;;;;;;;;;;;;iBAgBw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;;UKWPmE,2BAAAA;;UAELT;;gBAEMC;;WAELF;;eAEIA;;;;ELDOxD,OAAAA,EKKXwD,OLLsB;;;;;;;;cKanBA;;gBAEEI;;ELHM3D,SAAAA,CAAAA,EKKR8D,OLLQ9D,CKKA4D,kBLLkB,CAAA;;;;;UKUzBM,gCAAAA;;UAELV;;eAEKD;;;;ELDOtD,OAAAA,EKKXsD,OLLqB;;;;;;;;cKalBO,QAAQF;;;;;UAKPO,iBAAAA;;;;ELDOjE,eAAAA,EAAAA,MAAe;;;;YKSzBqD;;WAEDG;;;;;;;ALKWvD,UKEPiE,yBAAAA,CLFsB;;UKI3BZ;;;;WAICD;;SAEFA;;;;cAIKO,QAAQF;;;;ALExB;UKGiBS,oBAAAA;;;;;;;;;;;;;;ALYjB;UKGiBC,4BAAAA;UACLd;gBACMC;WACLF;;;WAGAA;;;gBAGKI;cACFG,QAAQF;;;;ALExB;UKGiBW,6BAAAA;UACLf;gBACMC;ELDDlD,OAAAA,EKEJgD,OLFIhD;;;WKKJgD;;;;;gBAKKI;cACFG,QAAQF"}
@@ -1,6 +1,6 @@
1
- import { PanopticError, PoolKey, SimulationResult, TxReceipt, TxResult } from "../index-DVMjZi1E.js";
2
- import "../irm-CGykVo3q.js";
3
- import { ApproveErc20ForPermit2Params, ApproveRouterViaPermit2Params, CheckRouterApprovalParams, PERMIT2_ADDRESS$1 as PERMIT2_ADDRESS, QuoteSwapExactInViaRouterParams, QuoteSwapExactOutViaRouterParams, RouterApprovalStatus, SwapExactInQuote, SwapExactInViaRouterParams, SwapExactOutQuote, SwapExactOutViaRouterParams, UNISWAP_V4_ADDRESSES$1 as UNISWAP_V4_ADDRESSES, UniswapV4Addresses, getUniswapV4Addresses$1 as getUniswapV4Addresses } from "../types-BQejAFnu.js";
1
+ import { PanopticError$1 as PanopticError, SimulationResult } from "../simulation-4SzTI-xf.js";
2
+ import { ApproveErc20ForPermit2Params, ApproveRouterViaPermit2Params, CheckRouterApprovalParams, PERMIT2_ADDRESS$1 as PERMIT2_ADDRESS, PoolKey, QuoteSwapExactInViaRouterParams, QuoteSwapExactOutViaRouterParams, RouterApprovalStatus, SwapExactInQuote, SwapExactInViaRouterParams, SwapExactOutQuote, SwapExactOutViaRouterParams, UNISWAP_V4_ADDRESSES$1 as UNISWAP_V4_ADDRESSES, UniswapV4Addresses, getUniswapV4Addresses$1 as getUniswapV4Addresses } from "../types-CspUPolV.js";
3
+ import { TxReceipt, TxResult } from "../tx-Banz1S18.js";
4
4
  import { Address, Hex, PublicClient } from "viem";
5
5
 
6
6
  //#region src/uniswap/v4/router/encodeSwap.d.ts
@@ -210,6 +210,30 @@ declare function quoteSwapExactInViaRouter(params: QuoteSwapExactInViaRouterPara
210
210
  */
211
211
  declare function quoteSwapExactOutViaRouter(params: QuoteSwapExactOutViaRouterParams): Promise<SimulationResult<SwapExactOutQuote>>;
212
212
 
213
+ //#endregion
214
+ //#region src/uniswap/v4/router/quoteByPoolKey.d.ts
215
+ interface QuoteV4ExactInByPoolKeyParams {
216
+ client: PublicClient;
217
+ chainId: bigint;
218
+ poolKey: PoolKey;
219
+ zeroForOne: boolean;
220
+ amountIn: bigint;
221
+ slippageBps: bigint;
222
+ blockNumber?: bigint;
223
+ addresses?: Partial<UniswapV4Addresses>;
224
+ }
225
+ interface V4ExactInQuote {
226
+ amountOut: bigint;
227
+ amountOutMinimum: bigint;
228
+ gasEstimate: bigint;
229
+ }
230
+ /**
231
+ * Quote an exact-in v4 swap for a specific PoolKey. Returns `null` when the
232
+ * quote reverts (pool missing / no liquidity) so callers can skip that pool when
233
+ * ranking venues rather than aborting the cycle.
234
+ */
235
+ declare function quoteV4ExactInByPoolKey(params: QuoteV4ExactInByPoolKeyParams): Promise<V4ExactInQuote | null>;
236
+
213
237
  //#endregion
214
238
  //#region src/uniswap/v4/router/resolvePoolKey.d.ts
215
239
  /**
@@ -287,5 +311,98 @@ declare function swapExactOutViaRouter(params: SwapExactOutViaRouterParams): Pro
287
311
  declare function swapExactOutViaRouterAndWait(params: SwapExactOutViaRouterParams): Promise<TxReceipt>;
288
312
 
289
313
  //#endregion
290
- export { AmountExceedsUint128Error, ApproveErc20ForPermit2Params, ApproveRouterViaPermit2Params, BuildV4ExactOutSwapCalldataArgs, BuildV4SwapCalldataArgs, CheckRouterApprovalParams, InvalidSwapTokenError, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoteSwapExactInViaRouterParams, QuoteSwapExactOutViaRouterParams, QuoterUnavailableError, ResolveSwapRouteParams, ResolvedSwapRoute, RouterApprovalStatus, SETTLE_ALL, SWAP_EXACT_IN_SINGLE, SWAP_EXACT_OUT_SINGLE, SWEEP, SwapExactInQuote, SwapExactInViaRouterParams, SwapExactOutQuote, SwapExactOutViaRouterParams, TAKE_ALL, UNISWAP_V4_ADDRESSES, UniswapV4Addresses, UnsupportedChainError, V4_SWAP, approveErc20ForPermit2, approveErc20ForPermit2AndWait, approveRouterViaPermit2, approveRouterViaPermit2AndWait, buildV4ExactOutSwapExecuteArgs, buildV4ExactOutSwapExecuteCalldata, buildV4SwapExecuteArgs, buildV4SwapExecuteCalldata, checkRouterApproval, getUniswapV4Addresses, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, resolveSwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactOutViaRouter, swapExactOutViaRouterAndWait };
314
+ //#region src/uniswap/v3/addresses.d.ts
315
+ interface UniswapV3Addresses {
316
+ /** Uniswap v3 QuoterV2 — `quoteExactInputSingle` (revert/staticcall-based). */
317
+ quoterV2: Address;
318
+ }
319
+ /**
320
+ * Verified Uniswap v3 QuoterV2 addresses keyed by chainId. Add a chain only
321
+ * after verifying against the canonical Uniswap v3 deployment listing.
322
+ */
323
+ declare const UNISWAP_V3_ADDRESSES: Record<number, UniswapV3Addresses>;
324
+ /**
325
+ * Resolve Uniswap v3 addresses for a chain, applying optional overrides.
326
+ *
327
+ * @throws {UnsupportedChainError} when the chain is not listed and overrides do
328
+ * not supply every required address.
329
+ */
330
+ declare function getUniswapV3Addresses(chainId: number | bigint, overrides?: Partial<UniswapV3Addresses>): UniswapV3Addresses;
331
+
332
+ //#endregion
333
+ //#region src/uniswap/v3/router/encodeSwap.d.ts
334
+ /** Universal Router command byte for a v3 exact-in swap. */
335
+ declare const V3_SWAP_EXACT_IN = 0;
336
+ /**
337
+ * Universal Router recipient sentinel: the router maps `address(1)` to
338
+ * `msg.sender` (the `execute` caller). Uniswap `Constants.MSG_SENDER`.
339
+ */
340
+ declare const MSG_SENDER: Address;
341
+ /** Arguments for {@link buildV3SwapExecuteCalldata}. */
342
+ interface BuildV3SwapCalldataArgs {
343
+ /** Input token (funds pulled from the caller via Permit2). */
344
+ tokenIn: Address;
345
+ /** Output token. */
346
+ tokenOut: Address;
347
+ /** v3 pool fee tier (e.g. 500, 3000). */
348
+ fee: bigint;
349
+ /** Exact input amount (uint128). */
350
+ amountIn: bigint;
351
+ /** Minimum acceptable output (uint128). */
352
+ amountOutMinimum: bigint;
353
+ /**
354
+ * Absolute deadline (unix seconds) — the `execute(commands, inputs, deadline)`
355
+ * argument, enforced by the Universal Router.
356
+ */
357
+ deadline: bigint;
358
+ }
359
+ /**
360
+ * Encode the packed v3 single-hop path `tokenIn ++ fee(uint24) ++ tokenOut`.
361
+ */
362
+ declare function encodeV3Path(tokenIn: Address, fee: bigint, tokenOut: Address): Hex;
363
+ /**
364
+ * Build the typed `execute(...)` args for an exact-in single-hop v3 swap whose
365
+ * output is delivered to the `execute` caller (recipient = MSG_SENDER).
366
+ */
367
+ declare function buildV3SwapExecuteArgs(args: BuildV3SwapCalldataArgs): {
368
+ args: readonly [Hex, readonly Hex[], bigint];
369
+ value: bigint;
370
+ };
371
+ /**
372
+ * Build the `execute(commands, inputs, deadline)` calldata for an exact-in
373
+ * single-hop v3 swap.
374
+ */
375
+ declare function buildV3SwapExecuteCalldata(args: BuildV3SwapCalldataArgs): {
376
+ data: Hex;
377
+ value: bigint;
378
+ };
379
+
380
+ //#endregion
381
+ //#region src/uniswap/v3/router/quote.d.ts
382
+ interface QuoteV3ExactInParams {
383
+ client: PublicClient;
384
+ chainId: bigint;
385
+ tokenIn: Address;
386
+ tokenOut: Address;
387
+ fee: bigint;
388
+ amountIn: bigint;
389
+ /** Slippage tolerance in bps, used to compute `amountOutMinimum`. */
390
+ slippageBps: bigint;
391
+ blockNumber?: bigint;
392
+ addresses?: Partial<UniswapV3Addresses>;
393
+ }
394
+ interface V3ExactInQuote {
395
+ amountOut: bigint;
396
+ amountOutMinimum: bigint;
397
+ gasEstimate: bigint;
398
+ }
399
+ /**
400
+ * Quote an exact-in v3 swap. Returns `null` when the quote reverts (e.g. the
401
+ * pool does not exist / has no liquidity) so callers can skip that pool when
402
+ * ranking venues, rather than aborting the whole cycle.
403
+ */
404
+ declare function quoteV3ExactIn(params: QuoteV3ExactInParams): Promise<V3ExactInQuote | null>;
405
+
406
+ //#endregion
407
+ export { AmountExceedsUint128Error, ApproveErc20ForPermit2Params, ApproveRouterViaPermit2Params, BuildV3SwapCalldataArgs, BuildV4ExactOutSwapCalldataArgs, BuildV4SwapCalldataArgs, CheckRouterApprovalParams, InvalidSwapTokenError, MSG_SENDER, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoteSwapExactInViaRouterParams, QuoteSwapExactOutViaRouterParams, QuoteV3ExactInParams, QuoteV4ExactInByPoolKeyParams, QuoterUnavailableError, ResolveSwapRouteParams, ResolvedSwapRoute, RouterApprovalStatus, SETTLE_ALL, SWAP_EXACT_IN_SINGLE, SWAP_EXACT_OUT_SINGLE, SWEEP, SwapExactInQuote, SwapExactInViaRouterParams, SwapExactOutQuote, SwapExactOutViaRouterParams, TAKE_ALL, UNISWAP_V3_ADDRESSES, UNISWAP_V4_ADDRESSES, UniswapV3Addresses, UniswapV4Addresses, UnsupportedChainError, V3ExactInQuote, V3_SWAP_EXACT_IN, V4ExactInQuote, V4_SWAP, approveErc20ForPermit2, approveErc20ForPermit2AndWait, approveRouterViaPermit2, approveRouterViaPermit2AndWait, buildV3SwapExecuteArgs, buildV3SwapExecuteCalldata, buildV4ExactOutSwapExecuteArgs, buildV4ExactOutSwapExecuteCalldata, buildV4SwapExecuteArgs, buildV4SwapExecuteCalldata, checkRouterApproval, encodeV3Path, getUniswapV3Addresses, getUniswapV4Addresses, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, quoteV3ExactIn, quoteV4ExactInByPoolKey, resolveSwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactOutViaRouter, swapExactOutViaRouterAndWait };
291
408
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["Address","Hex","PoolKey","V4_SWAP","SWAP_EXACT_IN_SINGLE","SETTLE_ALL","TAKE_ALL","TAKE","SWAP_EXACT_OUT_SINGLE","SWEEP","BuildV4SwapCalldataArgs","buildV4SwapExecuteArgs","buildV4SwapExecuteCalldata","BuildV4ExactOutSwapCalldataArgs","buildV4ExactOutSwapExecuteArgs","buildV4ExactOutSwapExecuteCalldata","Address","PanopticError","UnsupportedChainError","Error","InvalidSwapTokenError","AmountExceedsUint128Error","MissingSweepRecipientError","QuoterUnavailableError","TxReceipt","TxResult","ApproveErc20ForPermit2Params","ApproveRouterViaPermit2Params","CheckRouterApprovalParams","RouterApprovalStatus","checkRouterApproval","Promise","approveErc20ForPermit2","approveErc20ForPermit2AndWait","approveRouterViaPermit2","approveRouterViaPermit2AndWait","SimulationResult","QuoteSwapExactInViaRouterParams","QuoteSwapExactOutViaRouterParams","SwapExactInQuote","SwapExactOutQuote","quoteSwapExactInViaRouter","Promise","quoteSwapExactOutViaRouter","Address","PublicClient","PoolKey","ResolvedSwapRoute","ResolveSwapRouteParams","resolveSwapRoute","Promise","TxReceipt","TxResult","SwapExactInViaRouterParams","SwapExactOutViaRouterParams","swapExactInViaRouter","Promise","swapExactInViaRouterAndWait","swapExactOutViaRouter","swapExactOutViaRouterAndWait"],"sources":["../../src/uniswap/v4/router/encodeSwap.d.ts","../../src/uniswap/v4/router/errors.d.ts","../../src/uniswap/v4/router/permit2.d.ts","../../src/uniswap/v4/router/quote.d.ts","../../src/uniswap/v4/router/resolvePoolKey.d.ts","../../src/uniswap/v4/router/swap.d.ts"],"sourcesContent":null,"mappings":";;;;;;;;;AAiEeC,cAtCME,OAAAA,GAsCNF,EAAAA;AAAG;cApCGG,oBAAAA;;cAEAC,UAAAA;;cAEAC,QAAAA;;;;cAIAE,qBAAAA;;AAwCGG,cAtCHF,KAAAA,GAsCyB,CAAA;;;;AACZR,UAnCjBS,uBAAAA,CAmCiBT;EAAG;WAjCxB6C;;;;;;EA0CWlC,gBAAAA,EAAAA,MAAAA;EAA0B;EAAA,OAAOF,EAlC5CkC,OAkC4ClC;EAAuB;EACnE,QAAA,EAjCCkC,OAiCD;;;;AAMb;;;;EAUoB,SAENA,CAAAA,EA3CEA,OA2CFA;EAAO;EAQC,QAEP3C,CAAAA,EAnDAA,GAmDAA;AAAG;;;;;;;;;;;AAYMa,iBAnDAH,sBAAAA,CAmD8B,IAAA,EAnDDD,uBAmDC,CAAA,EAAA;EAAA,IAAA,EAAA,SAAA,CAlDlCT,GAkDkC,EAAA,SAlDpBA,GAkDoB,EAAA,EAAA,MAAA,CAAA;EAAA,KAAOY,EAAAA,MAAAA;CAA+B;;AACvD;;;;;iBA1CbD,0BAAAA,OAAiCF;QAC/CT;EAkDcc,KAAAA,EAAAA,MAAAA;CAAkC;;;AAC7C;UA7CIF,+BAAAA;;WAEJiC;;;;;ECjFQ5B;EAAqB,eAAA,EAAA,MAAA;EAAA;EAGI,OAHKD,EDyFtC2B,OCzFsC3B;EAAa;YD2FlD2B;;;ECnFOxB;;;;;EAGU,SAERwB,EDsFRA,OCtFQA;EAAO;EAAoB,QAAaA,CAAAA,EDwFhD3C,GCxFgD2C;;;AALC;;;;AAUhE;;;;AAAoE;iBD+F5C9B,8BAAAA,OAAqCD;kBACzCZ,cAAcA;;;ACvFlC;;;;AAAqE;;iBDgG7Cc,kCAAAA,OAAyCF;QACvDZ;EC1FW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4ExactOutSwapExecuteArgs","buildV4ExactOutSwapExecuteCalldata","Address","PanopticError","UnsupportedChainError","Error","InvalidSwapTokenError","AmountExceedsUint128Error","MissingSweepRecipientError","QuoterUnavailableError","TxReceipt","TxResult","ApproveErc20ForPermit2Params","ApproveRouterViaPermit2Params","CheckRouterApprovalParams","RouterApprovalStatus","checkRouterApproval","Promise","approveErc20ForPermit2","approveErc20ForPermit2AndWait","approveRouterViaPermit2","approveRouterViaPermit2AndWait","SimulationResult","QuoteSwapExactInViaRouterParams","QuoteSwapExactOutViaRouterParams","SwapExactInQuote","SwapExactOutQuote","quoteSwapExactInViaRouter","Promise","quoteSwapExactOutViaRouter","PublicClient","PoolKey","UniswapV4Addresses","QuoteV4ExactInByPoolKeyParams","Partial","V4ExactInQuote","quoteV4ExactInByPoolKey","Promise","Address","PublicClient","PoolKey","ResolvedSwapRoute","ResolveSwapRouteParams","resolveSwapRoute","Promise","TxReceipt","TxResult","SwapExactInViaRouterParams","SwapExactOutViaRouterParams","swapExactInViaRouter","Promise","swapExactInViaRouterAndWait","swapExactOutViaRouter","swapExactOutViaRouterAndWait","Address","UniswapV3Addresses","UNISWAP_V3_ADDRESSES","Record","getUniswapV3Addresses","Partial","Address","Hex","V3_SWAP_EXACT_IN","MSG_SENDER","BuildV3SwapCalldataArgs","encodeV3Path","buildV3SwapExecuteArgs","buildV3SwapExecuteCalldata","Address","PublicClient","UniswapV3Addresses","QuoteV3ExactInParams","Partial","V3ExactInQuote","quoteV3ExactIn","Promise"],"sources":["../../src/uniswap/v4/router/encodeSwap.d.ts","../../src/uniswap/v4/router/errors.d.ts","../../src/uniswap/v4/router/permit2.d.ts","../../src/uniswap/v4/router/quote.d.ts","../../src/uniswap/v4/router/quoteByPoolKey.d.ts","../../src/uniswap/v4/router/resolvePoolKey.d.ts","../../src/uniswap/v4/router/swap.d.ts","../../src/uniswap/v3/addresses.d.ts","../../src/uniswap/v3/router/encodeSwap.d.ts","../../src/uniswap/v3/router/quote.d.ts"],"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;;;;;;;AAsBC,iBSrCM8E,cAAAA,CTqCN,MAAA,ESrC6BH,oBTqC7B,CAAA,ESrCoDI,OTqCpD,CSrC4DF,cTqC5D,GAAA,IAAA,CAAA"}
@@ -1,5 +1,229 @@
1
- import "../position-BK4a-Yyu.js";
2
- import "../writes-DymnVbiE.js";
3
- import { AmountExceedsUint128Error, InvalidSwapTokenError, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoterUnavailableError, SETTLE_ALL, SWAP_EXACT_IN_SINGLE, SWAP_EXACT_OUT_SINGLE, SWEEP, TAKE_ALL, UNISWAP_V4_ADDRESSES, UnsupportedChainError, V4_SWAP, approveErc20ForPermit2, approveErc20ForPermit2AndWait, approveRouterViaPermit2, approveRouterViaPermit2AndWait, buildV4ExactOutSwapExecuteArgs, buildV4ExactOutSwapExecuteCalldata, buildV4SwapExecuteArgs, buildV4SwapExecuteCalldata, checkRouterApproval, getUniswapV4Addresses, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, resolveSwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactOutViaRouter, swapExactOutViaRouterAndWait } from "../router-CMrp245w.js";
1
+ import { PanopticError } from "../position-CsIEneku.js";
2
+ import "../writes-BnO9zj-Z.js";
3
+ import { AmountExceedsUint128Error, InvalidSwapTokenError, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoterUnavailableError, SETTLE_ALL, SWAP_EXACT_IN_SINGLE, SWAP_EXACT_OUT_SINGLE, SWEEP, TAKE_ALL, UNISWAP_V4_ADDRESSES, UnsupportedChainError, V4_SWAP, approveErc20ForPermit2, approveErc20ForPermit2AndWait, approveRouterViaPermit2, approveRouterViaPermit2AndWait, buildV4ExactOutSwapExecuteArgs, buildV4ExactOutSwapExecuteCalldata, buildV4SwapExecuteArgs, buildV4SwapExecuteCalldata, checkRouterApproval, getUniswapV4Addresses, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, quoteV4ExactInByPoolKey, resolveSwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactOutViaRouter, swapExactOutViaRouterAndWait, universalRouterAbi } from "../router-BM10ZWY5.js";
4
+ import { BaseError, ContractFunctionRevertedError, encodeAbiParameters, encodeFunctionData, encodePacked, zeroAddress } from "viem";
4
5
 
5
- export { AmountExceedsUint128Error, InvalidSwapTokenError, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoterUnavailableError, SETTLE_ALL, SWAP_EXACT_IN_SINGLE, SWAP_EXACT_OUT_SINGLE, SWEEP, TAKE_ALL, UNISWAP_V4_ADDRESSES, UnsupportedChainError, V4_SWAP, approveErc20ForPermit2, approveErc20ForPermit2AndWait, approveRouterViaPermit2, approveRouterViaPermit2AndWait, buildV4ExactOutSwapExecuteArgs, buildV4ExactOutSwapExecuteCalldata, buildV4SwapExecuteArgs, buildV4SwapExecuteCalldata, checkRouterApproval, getUniswapV4Addresses, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, resolveSwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactOutViaRouter, swapExactOutViaRouterAndWait };
6
+ //#region src/uniswap/v3/addresses.ts
7
+ /**
8
+ * Verified Uniswap v3 QuoterV2 addresses keyed by chainId. Add a chain only
9
+ * after verifying against the canonical Uniswap v3 deployment listing.
10
+ */
11
+ const UNISWAP_V3_ADDRESSES = { 1: { quoterV2: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e" } };
12
+ /**
13
+ * Resolve Uniswap v3 addresses for a chain, applying optional overrides.
14
+ *
15
+ * @throws {UnsupportedChainError} when the chain is not listed and overrides do
16
+ * not supply every required address.
17
+ */
18
+ function getUniswapV3Addresses(chainId, overrides) {
19
+ const id = Number(chainId);
20
+ const base = UNISWAP_V3_ADDRESSES[id];
21
+ const merged = {
22
+ ...base,
23
+ ...overrides
24
+ };
25
+ if (!merged.quoterV2) throw new UnsupportedChainError(BigInt(id));
26
+ return merged;
27
+ }
28
+
29
+ //#endregion
30
+ //#region src/uniswap/v3/router/encodeSwap.ts
31
+ /** Universal Router command byte for a v3 exact-in swap. */
32
+ const V3_SWAP_EXACT_IN = 0;
33
+ /**
34
+ * Universal Router recipient sentinel: the router maps `address(1)` to
35
+ * `msg.sender` (the `execute` caller). Uniswap `Constants.MSG_SENDER`.
36
+ */
37
+ const MSG_SENDER = "0x0000000000000000000000000000000000000001";
38
+ const UINT128_MAX$1 = (1n << 128n) - 1n;
39
+ const v3ExactInInputAbi = [
40
+ {
41
+ name: "recipient",
42
+ type: "address"
43
+ },
44
+ {
45
+ name: "amountIn",
46
+ type: "uint256"
47
+ },
48
+ {
49
+ name: "amountOutMinimum",
50
+ type: "uint256"
51
+ },
52
+ {
53
+ name: "path",
54
+ type: "bytes"
55
+ },
56
+ {
57
+ name: "payerIsUser",
58
+ type: "bool"
59
+ }
60
+ ];
61
+ function assertUint128(amount) {
62
+ if (amount < 0n || amount > UINT128_MAX$1) throw new AmountExceedsUint128Error(amount);
63
+ }
64
+ /**
65
+ * Encode the packed v3 single-hop path `tokenIn ++ fee(uint24) ++ tokenOut`.
66
+ */
67
+ function encodeV3Path(tokenIn, fee, tokenOut) {
68
+ if (fee < 0n || fee > 0xffffffn) throw new PanopticError(`v3 fee ${fee} exceeds uint24`);
69
+ return encodePacked([
70
+ "address",
71
+ "uint24",
72
+ "address"
73
+ ], [
74
+ tokenIn,
75
+ Number(fee),
76
+ tokenOut
77
+ ]);
78
+ }
79
+ /**
80
+ * Build the typed `execute(...)` args for an exact-in single-hop v3 swap whose
81
+ * output is delivered to the `execute` caller (recipient = MSG_SENDER).
82
+ */
83
+ function buildV3SwapExecuteArgs(args) {
84
+ const { tokenIn, tokenOut, fee, amountIn, amountOutMinimum, deadline } = args;
85
+ if (tokenIn === zeroAddress || tokenOut === zeroAddress) throw new PanopticError("native ETH is not supported by the v3 exact-in router builder");
86
+ assertUint128(amountIn);
87
+ assertUint128(amountOutMinimum);
88
+ const path = encodeV3Path(tokenIn, fee, tokenOut);
89
+ const input = encodeAbiParameters(v3ExactInInputAbi, [
90
+ MSG_SENDER,
91
+ amountIn,
92
+ amountOutMinimum,
93
+ path,
94
+ true
95
+ ]);
96
+ const commands = encodePacked(["uint8"], [V3_SWAP_EXACT_IN]);
97
+ return {
98
+ args: [
99
+ commands,
100
+ [input],
101
+ deadline
102
+ ],
103
+ value: 0n
104
+ };
105
+ }
106
+ /**
107
+ * Build the `execute(commands, inputs, deadline)` calldata for an exact-in
108
+ * single-hop v3 swap.
109
+ */
110
+ function buildV3SwapExecuteCalldata(args) {
111
+ const { args: executeArgs, value } = buildV3SwapExecuteArgs(args);
112
+ const data = encodeFunctionData({
113
+ abi: universalRouterAbi,
114
+ functionName: "execute",
115
+ args: executeArgs
116
+ });
117
+ return {
118
+ data,
119
+ value
120
+ };
121
+ }
122
+
123
+ //#endregion
124
+ //#region src/uniswap/v3/abis/quoterV2.ts
125
+ /**
126
+ * Minimal Uniswap v3 QuoterV2 ABI (`quoteExactInputSingle`).
127
+ *
128
+ * QuoterV2 is revert/staticcall-based (nonpayable but intended for `eth_call` /
129
+ * `simulateContract`), so it must be simulated, not read.
130
+ * @module uniswap/v3/abis/quoterV2
131
+ */
132
+ const quoterV2Abi = [{
133
+ type: "function",
134
+ name: "quoteExactInputSingle",
135
+ stateMutability: "nonpayable",
136
+ inputs: [{
137
+ name: "params",
138
+ type: "tuple",
139
+ components: [
140
+ {
141
+ name: "tokenIn",
142
+ type: "address"
143
+ },
144
+ {
145
+ name: "tokenOut",
146
+ type: "address"
147
+ },
148
+ {
149
+ name: "amountIn",
150
+ type: "uint256"
151
+ },
152
+ {
153
+ name: "fee",
154
+ type: "uint24"
155
+ },
156
+ {
157
+ name: "sqrtPriceLimitX96",
158
+ type: "uint160"
159
+ }
160
+ ]
161
+ }],
162
+ outputs: [
163
+ {
164
+ name: "amountOut",
165
+ type: "uint256"
166
+ },
167
+ {
168
+ name: "sqrtPriceX96After",
169
+ type: "uint160"
170
+ },
171
+ {
172
+ name: "initializedTicksCrossed",
173
+ type: "uint32"
174
+ },
175
+ {
176
+ name: "gasEstimate",
177
+ type: "uint256"
178
+ }
179
+ ]
180
+ }];
181
+
182
+ //#endregion
183
+ //#region src/uniswap/v3/router/quote.ts
184
+ const BPS_DENOMINATOR = 10000n;
185
+ const UINT128_MAX = (1n << 128n) - 1n;
186
+ /**
187
+ * Quote an exact-in v3 swap. Returns `null` when the quote reverts (e.g. the
188
+ * pool does not exist / has no liquidity) so callers can skip that pool when
189
+ * ranking venues, rather than aborting the whole cycle.
190
+ */
191
+ async function quoteV3ExactIn(params) {
192
+ const { client, chainId, tokenIn, tokenOut, fee, amountIn, slippageBps, blockNumber } = params;
193
+ if (amountIn < 0n || amountIn > UINT128_MAX) throw new PanopticError(`amountIn ${amountIn} exceeds uint128 maximum`);
194
+ if (slippageBps < 0n || slippageBps > BPS_DENOMINATOR) throw new PanopticError(`invalid slippageBps ${slippageBps}, must be 0..10000`);
195
+ const { quoterV2 } = getUniswapV3Addresses(chainId, params.addresses);
196
+ try {
197
+ const { result } = await client.simulateContract({
198
+ address: quoterV2,
199
+ abi: quoterV2Abi,
200
+ functionName: "quoteExactInputSingle",
201
+ blockNumber,
202
+ args: [{
203
+ tokenIn,
204
+ tokenOut,
205
+ amountIn,
206
+ fee: Number(fee),
207
+ sqrtPriceLimitX96: 0n
208
+ }]
209
+ });
210
+ const [amountOut, , , gasEstimate] = result;
211
+ const amountOutMinimum = amountOut * (BPS_DENOMINATOR - slippageBps) / BPS_DENOMINATOR;
212
+ return {
213
+ amountOut,
214
+ amountOutMinimum,
215
+ gasEstimate
216
+ };
217
+ } catch (err) {
218
+ if (isRevert(err)) return null;
219
+ throw err;
220
+ }
221
+ }
222
+ /** True only for genuine contract reverts (missing pool / no liquidity). */
223
+ function isRevert(err) {
224
+ return err instanceof BaseError && err.walk((e) => e instanceof ContractFunctionRevertedError) instanceof ContractFunctionRevertedError;
225
+ }
226
+
227
+ //#endregion
228
+ export { AmountExceedsUint128Error, InvalidSwapTokenError, MSG_SENDER, MissingSweepRecipientError, PERMIT2_ADDRESS, QuoterUnavailableError, SETTLE_ALL, SWAP_EXACT_IN_SINGLE, SWAP_EXACT_OUT_SINGLE, SWEEP, TAKE_ALL, UNISWAP_V3_ADDRESSES, UNISWAP_V4_ADDRESSES, UnsupportedChainError, V3_SWAP_EXACT_IN, V4_SWAP, approveErc20ForPermit2, approveErc20ForPermit2AndWait, approveRouterViaPermit2, approveRouterViaPermit2AndWait, buildV3SwapExecuteArgs, buildV3SwapExecuteCalldata, buildV4ExactOutSwapExecuteArgs, buildV4ExactOutSwapExecuteCalldata, buildV4SwapExecuteArgs, buildV4SwapExecuteCalldata, checkRouterApproval, encodeV3Path, getUniswapV3Addresses, getUniswapV4Addresses, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, quoteV3ExactIn, quoteV4ExactInByPoolKey, resolveSwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactOutViaRouter, swapExactOutViaRouterAndWait };
229
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["UNISWAP_V3_ADDRESSES: Record<number, UniswapV3Addresses>","chainId: number | bigint","overrides?: Partial<UniswapV3Addresses>","MSG_SENDER: Address","UINT128_MAX","amount: bigint","tokenIn: Address","fee: bigint","tokenOut: Address","args: BuildV3SwapCalldataArgs","params: QuoteV3ExactInParams","err: unknown"],"sources":["../../src/uniswap/v3/addresses.ts","../../src/uniswap/v3/router/encodeSwap.ts","../../src/uniswap/v3/abis/quoterV2.ts","../../src/uniswap/v3/router/quote.ts"],"sourcesContent":["/**\n * Per-chain Uniswap v3 addresses needed for spot quoting via the Universal\n * Router. The Universal Router itself is shared with v4 (see\n * `uniswap/v4/addresses`); only the v3 QuoterV2 is specific to v3.\n *\n * v1 supports mainnet only; other chains throw {@link UnsupportedChainError}\n * unless the address is supplied via overrides (fork tests / new chains).\n *\n * @module uniswap/v3/addresses\n */\n\nimport type { Address } from 'viem'\n\nimport { UnsupportedChainError } from '../v4/router/errors'\n\nexport interface UniswapV3Addresses {\n /** Uniswap v3 QuoterV2 — `quoteExactInputSingle` (revert/staticcall-based). */\n quoterV2: Address\n}\n\n/**\n * Verified Uniswap v3 QuoterV2 addresses keyed by chainId. Add a chain only\n * after verifying against the canonical Uniswap v3 deployment listing.\n */\nexport const UNISWAP_V3_ADDRESSES: Record<number, UniswapV3Addresses> = {\n // Ethereum mainnet\n 1: { quoterV2: '0x61fFE014bA17989E743c5F6cB21bF9697530B21e' },\n}\n\n/**\n * Resolve Uniswap v3 addresses for a chain, applying optional overrides.\n *\n * @throws {UnsupportedChainError} when the chain is not listed and overrides do\n * not supply every required address.\n */\nexport function getUniswapV3Addresses(\n chainId: number | bigint,\n overrides?: Partial<UniswapV3Addresses>,\n): UniswapV3Addresses {\n const id = Number(chainId)\n const base = UNISWAP_V3_ADDRESSES[id]\n const merged = { ...base, ...overrides }\n if (!merged.quoterV2) {\n throw new UnsupportedChainError(BigInt(id))\n }\n return merged as UniswapV3Addresses\n}\n","/**\n * Pure calldata builder for an exact-in single-hop swap through a Uniswap **v3**\n * pool via the Universal Router.\n *\n * Opcodes verified against `@uniswap/universal-router` `Commands.sol`:\n * - Universal Router command `V3_SWAP_EXACT_IN = 0x00`.\n *\n * The v3 command input is (unlike the v4 action list) a single flat tuple:\n * `(address recipient, uint256 amountIn, uint256 amountOutMinimum,\n * bytes path, bool payerIsUser)`\n * where:\n * - `recipient` is an EXPLICIT field. We encode the Universal Router sentinel\n * `MSG_SENDER = address(1)`, which the router maps to the `execute` caller —\n * so the output is delivered to the caller (e.g. a Safe) with no literal\n * address in the calldata to redirect.\n * - `path` is `abi.encodePacked(tokenIn, fee (uint24), tokenOut)` for a single\n * hop (43 bytes). The direction lives in the path ordering, not a bool.\n * - `payerIsUser = true`: the router pulls `tokenIn` from the caller via Permit2.\n *\n * ERC20-only: native ETH is intentionally unsupported here (the native paths\n * need WRAP/UNWRAP/SWEEP commands with explicit recipients).\n *\n * @module uniswap/v3/router/encodeSwap\n */\n\nimport type { Address, Hex } from 'viem'\nimport { encodeAbiParameters, encodeFunctionData, encodePacked, zeroAddress } from 'viem'\n\nimport { PanopticError } from '../../../panoptic/v2/errors'\nimport { universalRouterAbi } from '../../v4/abis/universalRouter'\nimport { AmountExceedsUint128Error } from '../../v4/router/errors'\n\n/** Universal Router command byte for a v3 exact-in swap. */\nexport const V3_SWAP_EXACT_IN = 0x00\n\n/**\n * Universal Router recipient sentinel: the router maps `address(1)` to\n * `msg.sender` (the `execute` caller). Uniswap `Constants.MSG_SENDER`.\n */\nexport const MSG_SENDER: Address = '0x0000000000000000000000000000000000000001'\n\nconst UINT128_MAX = (1n << 128n) - 1n\n\nconst v3ExactInInputAbi = [\n { name: 'recipient', type: 'address' },\n { name: 'amountIn', type: 'uint256' },\n { name: 'amountOutMinimum', type: 'uint256' },\n { name: 'path', type: 'bytes' },\n { name: 'payerIsUser', type: 'bool' },\n] as const\n\nfunction assertUint128(amount: bigint): void {\n if (amount < 0n || amount > UINT128_MAX) {\n throw new AmountExceedsUint128Error(amount)\n }\n}\n\n/** Arguments for {@link buildV3SwapExecuteCalldata}. */\nexport interface BuildV3SwapCalldataArgs {\n /** Input token (funds pulled from the caller via Permit2). */\n tokenIn: Address\n /** Output token. */\n tokenOut: Address\n /** v3 pool fee tier (e.g. 500, 3000). */\n fee: bigint\n /** Exact input amount (uint128). */\n amountIn: bigint\n /** Minimum acceptable output (uint128). */\n amountOutMinimum: bigint\n /**\n * Absolute deadline (unix seconds) — the `execute(commands, inputs, deadline)`\n * argument, enforced by the Universal Router.\n */\n deadline: bigint\n}\n\n/**\n * Encode the packed v3 single-hop path `tokenIn ++ fee(uint24) ++ tokenOut`.\n */\nexport function encodeV3Path(tokenIn: Address, fee: bigint, tokenOut: Address): Hex {\n if (fee < 0n || fee > 0xffffffn) {\n throw new PanopticError(`v3 fee ${fee} exceeds uint24`)\n }\n return encodePacked(['address', 'uint24', 'address'], [tokenIn, Number(fee), tokenOut])\n}\n\n/**\n * Build the typed `execute(...)` args for an exact-in single-hop v3 swap whose\n * output is delivered to the `execute` caller (recipient = MSG_SENDER).\n */\nexport function buildV3SwapExecuteArgs(args: BuildV3SwapCalldataArgs): {\n args: readonly [Hex, readonly Hex[], bigint]\n value: bigint\n} {\n const { tokenIn, tokenOut, fee, amountIn, amountOutMinimum, deadline } = args\n\n if (tokenIn === zeroAddress || tokenOut === zeroAddress) {\n throw new PanopticError('native ETH is not supported by the v3 exact-in router builder')\n }\n assertUint128(amountIn)\n assertUint128(amountOutMinimum)\n\n const path = encodeV3Path(tokenIn, fee, tokenOut)\n const input = encodeAbiParameters(v3ExactInInputAbi, [\n MSG_SENDER,\n amountIn,\n amountOutMinimum,\n path,\n true, // payerIsUser: pull tokenIn from the caller via Permit2\n ])\n\n const commands = encodePacked(['uint8'], [V3_SWAP_EXACT_IN])\n return { args: [commands, [input], deadline] as const, value: 0n }\n}\n\n/**\n * Build the `execute(commands, inputs, deadline)` calldata for an exact-in\n * single-hop v3 swap.\n */\nexport function buildV3SwapExecuteCalldata(args: BuildV3SwapCalldataArgs): {\n data: Hex\n value: bigint\n} {\n const { args: executeArgs, value } = buildV3SwapExecuteArgs(args)\n const data = encodeFunctionData({\n abi: universalRouterAbi,\n functionName: 'execute',\n args: executeArgs,\n })\n return { data, value }\n}\n","/**\n * Minimal Uniswap v3 QuoterV2 ABI (`quoteExactInputSingle`).\n *\n * QuoterV2 is revert/staticcall-based (nonpayable but intended for `eth_call` /\n * `simulateContract`), so it must be simulated, not read.\n * @module uniswap/v3/abis/quoterV2\n */\n\nexport const quoterV2Abi = [\n {\n type: 'function',\n name: 'quoteExactInputSingle',\n stateMutability: 'nonpayable',\n inputs: [\n {\n name: 'params',\n type: 'tuple',\n components: [\n { name: 'tokenIn', type: 'address' },\n { name: 'tokenOut', type: 'address' },\n { name: 'amountIn', type: 'uint256' },\n { name: 'fee', type: 'uint24' },\n { name: 'sqrtPriceLimitX96', type: 'uint160' },\n ],\n },\n ],\n outputs: [\n { name: 'amountOut', type: 'uint256' },\n { name: 'sqrtPriceX96After', type: 'uint160' },\n { name: 'initializedTicksCrossed', type: 'uint32' },\n { name: 'gasEstimate', type: 'uint256' },\n ],\n },\n] as const\n","/**\n * Quote an exact-in single-hop swap against a Uniswap v3 pool via QuoterV2.\n * @module uniswap/v3/router/quote\n */\n\nimport type { Address, PublicClient } from 'viem'\nimport { BaseError, ContractFunctionRevertedError } from 'viem'\n\nimport { PanopticError } from '../../../panoptic/v2/errors'\nimport { quoterV2Abi } from '../abis/quoterV2'\nimport { type UniswapV3Addresses, getUniswapV3Addresses } from '../addresses'\n\nconst BPS_DENOMINATOR = 10_000n\nconst UINT128_MAX = (1n << 128n) - 1n\n\nexport interface QuoteV3ExactInParams {\n client: PublicClient\n chainId: bigint\n tokenIn: Address\n tokenOut: Address\n fee: bigint\n amountIn: bigint\n /** Slippage tolerance in bps, used to compute `amountOutMinimum`. */\n slippageBps: bigint\n blockNumber?: bigint\n addresses?: Partial<UniswapV3Addresses>\n}\n\nexport interface V3ExactInQuote {\n amountOut: bigint\n amountOutMinimum: bigint\n gasEstimate: bigint\n}\n\n/**\n * Quote an exact-in v3 swap. Returns `null` when the quote reverts (e.g. the\n * pool does not exist / has no liquidity) so callers can skip that pool when\n * ranking venues, rather than aborting the whole cycle.\n */\nexport async function quoteV3ExactIn(params: QuoteV3ExactInParams): Promise<V3ExactInQuote | null> {\n const { client, chainId, tokenIn, tokenOut, fee, amountIn, slippageBps, blockNumber } = params\n if (amountIn < 0n || amountIn > UINT128_MAX) {\n throw new PanopticError(`amountIn ${amountIn} exceeds uint128 maximum`)\n }\n if (slippageBps < 0n || slippageBps > BPS_DENOMINATOR) {\n throw new PanopticError(`invalid slippageBps ${slippageBps}, must be 0..10000`)\n }\n\n const { quoterV2 } = getUniswapV3Addresses(chainId, params.addresses)\n\n try {\n const { result } = await client.simulateContract({\n address: quoterV2,\n abi: quoterV2Abi,\n functionName: 'quoteExactInputSingle',\n blockNumber,\n args: [{ tokenIn, tokenOut, amountIn, fee: Number(fee), sqrtPriceLimitX96: 0n }],\n })\n const [amountOut, , , gasEstimate] = result\n const amountOutMinimum = (amountOut * (BPS_DENOMINATOR - slippageBps)) / BPS_DENOMINATOR\n return { amountOut, amountOutMinimum, gasEstimate }\n } catch (err) {\n if (isRevert(err)) return null\n // Transport/RPC/timeout errors are NOT \"no liquidity\" — rethrow so routing\n // doesn't silently treat an unreachable node as an empty pool.\n throw err\n }\n}\n\n/** True only for genuine contract reverts (missing pool / no liquidity). */\nfunction isRevert(err: unknown): boolean {\n return (\n err instanceof BaseError &&\n err.walk((e) => e instanceof ContractFunctionRevertedError) instanceof\n ContractFunctionRevertedError\n )\n}\n"],"mappings":";;;;;;;;;;AAwBA,MAAaA,uBAA2D,EAEtE,GAAG,EAAE,UAAU,6CAA8C,EAC9D;;;;;;;AAQD,SAAgB,sBACdC,SACAC,WACoB;CACpB,MAAM,KAAK,OAAO,QAAQ;CAC1B,MAAM,OAAO,qBAAqB;CAClC,MAAM,SAAS;EAAE,GAAG;EAAM,GAAG;CAAW;AACxC,MAAK,OAAO,SACV,OAAM,IAAI,sBAAsB,OAAO,GAAG;AAE5C,QAAO;AACR;;;;;ACbD,MAAa,mBAAmB;;;;;AAMhC,MAAaC,aAAsB;AAEnC,MAAMC,iBAAe,MAAM,QAAQ;AAEnC,MAAM,oBAAoB;CACxB;EAAE,MAAM;EAAa,MAAM;CAAW;CACtC;EAAE,MAAM;EAAY,MAAM;CAAW;CACrC;EAAE,MAAM;EAAoB,MAAM;CAAW;CAC7C;EAAE,MAAM;EAAQ,MAAM;CAAS;CAC/B;EAAE,MAAM;EAAe,MAAM;CAAQ;AACtC;AAED,SAAS,cAAcC,QAAsB;AAC3C,KAAI,SAAS,MAAM,SAASD,cAC1B,OAAM,IAAI,0BAA0B;AAEvC;;;;AAwBD,SAAgB,aAAaE,SAAkBC,KAAaC,UAAwB;AAClF,KAAI,MAAM,MAAM,MAAM,UACpB,OAAM,IAAI,eAAe,SAAS,IAAI;AAExC,QAAO,a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;;;ACrBD,MAAM,kBAAkB;AACxB,MAAM,eAAe,MAAM,QAAQ;;;;;;AA0BnC,eAAsB,eAAeC,QAA8D;CACjG,MAAM,EAAE,QAAQ,SAAS,SAAS,UAAU,KAAK,UAAU,aAAa,aAAa,GAAG;AACxF,KAAI,WAAW,MAAM,WAAW,YAC9B,OAAM,IAAI,eAAe,WAAW,SAAS;AAE/C,KAAI,cAAc,MAAM,cAAc,gBACpC,OAAM,IAAI,eAAe,sBAAsB,YAAY;CAG7D,MAAM,EAAE,UAAU,GAAG,sBAAsB,SAAS,OAAO,UAAU;AAErE,KAAI;EACF,MAAM,EAAE,QAAQ,GAAG,MAAM,OAAO,iBAAiB;GAC/C,SAAS;GACT,KAAK;GACL,cAAc;GACd;GACA,MAAM,CAAC;IAAE;IAAS;IAAU;IAAU,KAAK,OAAO,IAAI;IAAE,mBAAmB;GAAI,CAAC;EACjF,EAAC;EACF,MAAM,CAAC,eAAe,YAAY,GAAG;EACrC,MAAM,mBAAoB,aAAa,kBAAkB,eAAgB;AACzE,SAAO;GAAE;GAAW;GAAkB;EAAa;CACpD,SAAQ,KAAK;AACZ,MAAI,SAAS,IAAI,CAAE,QAAO;AAG1B,QAAM;CACP;AACF;;AAGD,SAAS,SAASC,KAAuB;AACvC,QACE,eAAe,aACf,IAAI,KAAK,CAAC,MAAM,aAAa,8BAA8B,YACzD;AAEL"}
@@ -1,5 +1,5 @@
1
- import { BatchValidationError, DEFAULT_VEGOID, InputListFailError, InvalidTickLimitsError, InvalidTokenIdParameterError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LoanSlotExhaustedError, MaxRetriesExceededError, MissingPositionIdsError, NoLoanPositionsError, OracleRateLimitedError, PanopticError$1 as PanopticError, ProviderLagError, REORG_DEPTH, SCHEMA_VERSION, STORAGE_PREFIX, STRIKE_CONVERSION_FACTOR, SafeModeError, StaleDataError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, UnhealthyPoolError, calculatePositionGreeks, collateralTrackerV2Abi, createTxResult, decodeLeftRightUnsigned, getBlockMeta, getPool$1 as getPool, getPoolMetadata$1 as getPoolMetadata, getPositions, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, parsePanopticError, submitWrite, tickLimits$1 as tickLimits } from "./position-BK4a-Yyu.js";
2
- import { decodeFunctionData, decodeFunctionResult, encodeFunctionData, erc20Abi, toFunctionSelector } from "viem";
1
+ import { BatchValidationError, DEFAULT_VEGOID, InputListFailError, InvalidTickLimitsError, InvalidTokenIdParameterError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LoanSlotExhaustedError, MaxRetriesExceededError, MissingPositionIdsError, NoLoanPositionsError, OracleRateLimitedError, PanopticError, ProviderLagError, REORG_DEPTH, SCHEMA_VERSION, STORAGE_PREFIX, STRIKE_CONVERSION_FACTOR, SafeModeError, StaleDataError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, UnhealthyPoolError, calculatePositionGreeks, collateralTrackerV2Abi, createTxResult, decodeLeftRightUnsigned, getBlockMeta, getPool, getPoolMetadata, getPositions, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, parsePanopticError, submitWrite, tickLimits } from "./position-CsIEneku.js";
2
+ import { decodeFunctionData, decodeFunctionResult, encodeFunctionData, erc20Abi, getAddress, parseAbi, toFunctionSelector } from "viem";
3
3
 
4
4
  //#region src/panoptic/v2/writes/broadcaster.ts
5
5
  /**
@@ -610,6 +610,7 @@ const jsonSerializer = {
610
610
  //#endregion
611
611
  //#region src/panoptic/v2/sync/snapshotRecovery.ts
612
612
  const LOG_SCAN_WINDOW = 10000n;
613
+ const rolesExecutionAbi = parseAbi(["function execTransactionWithRole(address to, uint256 value, bytes data, uint8 operation, bytes32 roleKey, bool shouldRevert)"]);
613
614
  /**
614
615
  * Recover position snapshot from the last dispatch transaction.
615
616
  * This is the primary recovery method - it finds the most recent dispatch()
@@ -841,6 +842,30 @@ async function recoverSnapshotFromEvents(params) {
841
842
  function isSnapshotCandidateEvent(event) {
842
843
  return event.transactionHash !== null && event.blockNumber !== null && event.logIndex !== null;
843
844
  }
845
+ function decodeSnapshotTransaction(params) {
846
+ const { account, pool, rolesContext } = params;
847
+ let dispatchInput = params.input;
848
+ let dispatchSender = params.from;
849
+ if (rolesContext) {
850
+ if (params.to === null || getAddress(params.to) !== getAddress(rolesContext.modifier) || getAddress(params.from) !== getAddress(rolesContext.member)) return null;
851
+ try {
852
+ const decodedRoleCall = decodeFunctionData({
853
+ abi: rolesExecutionAbi,
854
+ data: params.input
855
+ });
856
+ const [target, value, data, operation, roleKey, shouldRevert] = decodedRoleCall.args;
857
+ if (!pool || getAddress(target) !== getAddress(pool) || value !== 0n || operation !== 0 || roleKey.toLowerCase() !== rolesContext.roleKey.toLowerCase() || !shouldRevert) return null;
858
+ dispatchInput = data;
859
+ if (!account) return null;
860
+ dispatchSender = account;
861
+ } catch {
862
+ return null;
863
+ }
864
+ } else if (pool && (params.to === null || getAddress(params.to) !== getAddress(pool))) return null;
865
+ const candidates = decodeAllDispatchCalldata(dispatchInput);
866
+ if (candidates.length === 0) return null;
867
+ return account ? selectDispatchForAccount(candidates, account, dispatchSender) : candidates[candidates.length - 1];
868
+ }
844
869
  /**
845
870
  * Recover position snapshot from a specific dispatch transaction hash.
846
871
  *
@@ -864,13 +889,17 @@ function isSnapshotCandidateEvent(event) {
864
889
  * ```
865
890
  */
866
891
  async function recoverSnapshotFromTx(params) {
867
- const { client, transactionHash, account, pool } = params;
892
+ const { client, transactionHash, account, pool, rolesContext } = params;
868
893
  const tx = await client.getTransaction({ hash: transactionHash });
869
894
  if (tx.blockNumber == null) return null;
870
- if (pool && tx.to?.toLowerCase() !== pool.toLowerCase()) return null;
871
- const candidates = decodeAllDispatchCalldata(tx.input);
872
- if (candidates.length === 0) return null;
873
- const decoded = account ? selectDispatchForAccount(candidates, account, tx.from) : candidates[candidates.length - 1];
895
+ const decoded = decodeSnapshotTransaction({
896
+ input: tx.input,
897
+ from: tx.from,
898
+ to: tx.to,
899
+ account,
900
+ pool,
901
+ rolesContext
902
+ });
874
903
  if (!decoded) return null;
875
904
  const blockNumber = tx.blockNumber;
876
905
  const block = await client.getBlock({ blockNumber });
@@ -1065,14 +1094,15 @@ async function clearTrackedPositions(params) {
1065
1094
  * @returns Array of currently open position token IDs, or null if no snapshot was found
1066
1095
  */
1067
1096
  async function getOpenPositionIds(params) {
1068
- const { client, chainId, poolAddress, account, storage, lastDispatchTxHash, fromBlock } = params;
1097
+ const { client, chainId, poolAddress, account, storage, lastDispatchTxHash, fromBlock, toBlock, rolesContext } = params;
1069
1098
  let snapshot = null;
1070
1099
  if (lastDispatchTxHash) try {
1071
1100
  snapshot = await recoverSnapshotFromTx({
1072
1101
  client,
1073
1102
  transactionHash: lastDispatchTxHash,
1074
1103
  account,
1075
- pool: poolAddress
1104
+ pool: poolAddress,
1105
+ rolesContext
1076
1106
  });
1077
1107
  } catch {
1078
1108
  snapshot = null;
@@ -1081,7 +1111,8 @@ async function getOpenPositionIds(params) {
1081
1111
  client,
1082
1112
  poolAddress,
1083
1113
  account,
1084
- fromBlock
1114
+ fromBlock,
1115
+ toBlock
1085
1116
  });
1086
1117
  if (!snapshot) return null;
1087
1118
  if (storage) {
@@ -4483,4 +4514,4 @@ async function smartRepayAndWait(params) {
4483
4514
 
4484
4515
  //#endregion
4485
4516
  export { addLegToTokenId, approve, approveAndWait, approvePool, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertTradeable, borrow, borrowAndWait, buildBatchDispatchArgs, buildOpenPositionCalldata, buildUniqueLoan, calculateResyncBlock, cancelTransaction, checkApproval, clearCheckpoint, clearTrackedPositions, closePosition, closePositionAndWait, countLegs, createFileStorage, createMemoryStorage, createNonceManager, createTokenIdBuilder, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeg, decodePoolId, decodeTickSpacing as decodeTickSpacing$1, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, detectReorg, dispatch, dispatchAndWait, encodeLeg, encodePoolId, encodeV4PoolId, executeBatchDispatch, executeBatchDispatchAndWait, forceExercise, forceExerciseAndWait, getAssetIndex, getClosedPositionsKey, getOpenPositionIds, getPendingPositionsKey, getPoolMetaKey, getPoolPrefix, getPositionMetaKey, getPositionsKey, getSchemaVersionKey, getSyncCheckpointKey, getTrackedChunksKey, getTrackedPositionIds, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isGasError, isInputListFailError, isLoan, isLoanLeg, isNonceError, isPositionTracked, isRetryableRpcError, isShortOnly, isSpread, jsonSerializer, liquidate, liquidateAndWait, loadCheckpoint, mint, mintAndWait, openPosition, openPositionAndWait, pokeOracle, pokeOracleAndWait, previewBorrow, previewUnwrap, previewWrap, publicBroadcaster, recoverSnapshot, recoverSnapshotFromTx, redeem, redeemAndWait, repay, repayAndWait, resolveTokenIndex, rollPosition, rollPositionAndWait, saveCheckpoint, selectDispatchForAccount, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, simulateOpenPosition, simulateWithTokenFlow, smartRepay, smartRepayAndWait, speedUpTransaction, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, validateBatch, validatePoolId, verifyBlockContinuity, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
4486
- //# sourceMappingURL=writes-DymnVbiE.js.map
4517
+ //# sourceMappingURL=writes-BnO9zj-Z.js.map