@panoptic-eng/sdk 1.0.31 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cow/index.d.ts +5 -5
- package/dist/cow/index.js +3 -3
- package/dist/cow/types.d.ts +2 -2
- package/dist/{cow-CLFJQ-OP.js → cow-aX6of9TS.js} +2 -2
- package/dist/{cow-CLFJQ-OP.js.map → cow-aX6of9TS.js.map} +1 -1
- package/dist/deployments.d.ts +21 -1
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +13 -1
- package/dist/deployments.js.map +1 -1
- package/dist/{index-DVtqKAH3.d.ts → index-CURXeKNy.d.ts} +440 -12
- package/dist/index-CURXeKNy.d.ts.map +1 -0
- package/dist/{index-DQS8Luef.d.ts → index-Cp-nCeV2.d.ts} +4 -4
- package/dist/index-Cp-nCeV2.d.ts.map +1 -0
- package/dist/{index-CDCAju5o.d.ts → index-Zvu-rJpV.d.ts} +2 -2
- package/dist/{index-CDCAju5o.d.ts.map → index-Zvu-rJpV.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -324
- package/dist/index.js.map +1 -1
- package/dist/{irm-BNtE1Dmg.d.ts → irm-Dw2agmGR.d.ts} +1 -1
- package/dist/{irm-BNtE1Dmg.d.ts.map → irm-Dw2agmGR.d.ts.map} +1 -1
- package/dist/{irm-iAI9hTYQ.js → irm-JPcV9ykY.js} +333 -3
- package/dist/irm-JPcV9ykY.js.map +1 -0
- package/dist/panoptic/v2/greeks/index.d.ts +2 -2
- package/dist/panoptic/v2/index.d.ts +8 -8
- package/dist/panoptic/v2/index.js +6 -5
- package/dist/panoptic/v2/react-public.d.ts +27 -13
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +44 -9
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{position-Bmd_3nzI.d.ts → position-BqIgubs5.d.ts} +1 -1
- package/dist/{position-Bmd_3nzI.d.ts.map → position-BqIgubs5.d.ts.map} +1 -1
- package/dist/{position-ClU7GrTa.js → position-C8rkkKhi.js} +10 -4
- package/dist/{position-ClU7GrTa.js.map → position-C8rkkKhi.js.map} +1 -1
- package/dist/{oracle-DaNTHk7B.d.ts → quote-BxQkPBRg.d.ts} +57 -4
- package/dist/quote-BxQkPBRg.d.ts.map +1 -0
- package/dist/{router-DKFR_vnu.js → router-CS86ptMu.js} +6 -87
- package/dist/router-CS86ptMu.js.map +1 -0
- package/dist/router-DcoU2KmV.js +313 -0
- package/dist/router-DcoU2KmV.js.map +1 -0
- package/dist/{simulation-CUqERC5Y.d.ts → simulation-zM6-YUaw.d.ts} +2 -2
- package/dist/{simulation-CUqERC5Y.d.ts.map → simulation-zM6-YUaw.d.ts.map} +1 -1
- package/dist/{tx-BXXqhBHn.d.ts → tx-CbDQ58Io.d.ts} +1 -1
- package/dist/{tx-BXXqhBHn.d.ts.map → tx-CbDQ58Io.d.ts.map} +1 -1
- package/dist/{types-DgWfno7q.d.ts → types-BHdnurYr.d.ts} +2 -2
- package/dist/{types-DgWfno7q.d.ts.map → types-BHdnurYr.d.ts.map} +1 -1
- package/dist/{types-Cy6v8iPf.d.ts → types-D_jcYss-.d.ts} +5 -4
- package/dist/types-D_jcYss-.d.ts.map +1 -0
- package/dist/uniswap/index.d.ts +53 -100
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +4 -226
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-D3B5BKml.js → v2-B68I6nwv.js} +870 -65
- package/dist/v2-B68I6nwv.js.map +1 -0
- package/dist/{writes-DQLGdkJ5.js → writes-AupZCK4M.js} +2 -2
- package/dist/{writes-DQLGdkJ5.js.map → writes-AupZCK4M.js.map} +1 -1
- package/dist/zodiac/index.d.ts +74 -1
- package/dist/zodiac/index.d.ts.map +1 -1
- package/dist/zodiac/index.js +213 -3
- package/dist/zodiac/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-DQS8Luef.d.ts.map +0 -1
- package/dist/index-DVtqKAH3.d.ts.map +0 -1
- package/dist/irm-iAI9hTYQ.js.map +0 -1
- package/dist/oracle-DaNTHk7B.d.ts.map +0 -1
- package/dist/router-DKFR_vnu.js.map +0 -1
- package/dist/types-Cy6v8iPf.d.ts.map +0 -1
- package/dist/v2-D3B5BKml.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-DcoU2KmV.js","names":["chainId: bigint","cause?: Error","token: Address","currency0: Address","currency1: Address","amount: bigint","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/v4/router/errors.ts","../src/uniswap/v3/addresses.ts","../src/uniswap/v4/abis/universalRouter.ts","../src/uniswap/v3/router/encodeSwap.ts","../src/uniswap/v3/abis/quoterV2.ts","../src/uniswap/v3/router/quote.ts"],"sourcesContent":["/**\n * Errors for the Uniswap v4 Universal Router swap module.\n *\n * All extend {@link PanopticError} so callers can keep a single\n * `instanceof PanopticError` check and so they satisfy `SimulationResult`'s\n * error type.\n *\n * @module uniswap/v4/router/errors\n */\n\nimport type { Address } from 'viem'\n\nimport { PanopticError } from '../../../panoptic/v2/errors'\n\n/**\n * The chain has no configured Uniswap v4 addresses and none were supplied via\n * overrides.\n */\nexport class UnsupportedChainError extends PanopticError {\n override readonly name = 'UnsupportedChainError'\n\n constructor(\n public readonly chainId: bigint,\n cause?: Error,\n ) {\n super(`Uniswap v4 router not configured for chain ${chainId}`, cause)\n }\n}\n\n/**\n * `tokenIn` is neither `currency0` nor `currency1` of the resolved pool.\n */\nexport class InvalidSwapTokenError extends PanopticError {\n override readonly name = 'InvalidSwapTokenError'\n\n constructor(\n public readonly token: Address,\n public readonly currency0: Address,\n public readonly currency1: Address,\n cause?: Error,\n ) {\n super(\n `Token ${token} is not part of the pool (currency0=${currency0}, currency1=${currency1})`,\n cause,\n )\n }\n}\n\n/**\n * An amount exceeds the uint128 range required by the v4 swap encoding.\n */\nexport class AmountExceedsUint128Error extends PanopticError {\n override readonly name = 'AmountExceedsUint128Error'\n\n constructor(\n public readonly amount: bigint,\n cause?: Error,\n ) {\n super(`Amount ${amount} exceeds uint128 maximum`, cause)\n }\n}\n\n/**\n * A native-ETH swap needs a trailing Universal Router SWEEP to deliver the ETH\n * output (or refund the input overpay), but no `recipient` was supplied.\n */\nexport class MissingSweepRecipientError extends PanopticError {\n override readonly name = 'MissingSweepRecipientError'\n\n constructor(cause?: Error) {\n super('A recipient is required to sweep native ETH back to the user', cause)\n }\n}\n\n/**\n * The V4Quoter is not available for the chain (no fallback in v1).\n */\nexport class QuoterUnavailableError extends PanopticError {\n override readonly name = 'QuoterUnavailableError'\n\n constructor(\n public readonly chainId: bigint,\n cause?: Error,\n ) {\n super(`V4Quoter unavailable for chain ${chainId}`, cause)\n }\n}\n","/**\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 /** Uniswap v3 NonfungiblePositionManager — ERC721 LP position NFTs. */\n nonfungiblePositionManager: 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: {\n quoterV2: '0x61fFE014bA17989E743c5F6cB21bF9697530B21e',\n nonfungiblePositionManager: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88',\n },\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 || !merged.nonfungiblePositionManager) {\n throw new UnsupportedChainError(BigInt(id))\n }\n return merged as UniswapV3Addresses\n}\n","/**\n * Minimal Universal Router ABI (only the `execute` overload we use).\n * @module uniswap/v4/abis/universalRouter\n */\n\nexport const universalRouterAbi = [\n {\n type: 'function',\n name: 'execute',\n stateMutability: 'payable',\n inputs: [\n { name: 'commands', type: 'bytes' },\n { name: 'inputs', type: 'bytes[]' },\n { name: 'deadline', type: 'uint256' },\n ],\n outputs: [],\n },\n] as const\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":";;;;;;;;AAkBA,IAAa,wBAAb,cAA2C,cAAc;CACvD,AAAkB,OAAO;CAEzB,YACkBA,SAChBC,OACA;AACA,SAAO,6CAA6C,QAAQ,GAAG,MAAM;EA8DxE,KAjEmB;CAIjB;AACF;;;;AAKD,IAAa,wBAAb,cAA2C,cAAc;CACvD,AAAkB,OAAO;CAEzB,YACkBC,OACAC,WACAC,WAChBH,OACA;AACA,SACG,QAAQ,MAAM,sCAAsC,UAAU,cAAc,UAAU,IACvF,MACD;EA2CH,KAnDkB;EAmDjB,KAlDiB;EAkDhB,KAjDgB;CAOjB;AACF;;;;AAKD,IAAa,4BAAb,cAA+C,cAAc;CAC3D,AAAkB,OAAO;CAEzB,YACkBI,QAChBJ,OACA;AACA,SAAO,SAAS,OAAO,2BAA2B,MAAM;EA6BvD,KAhCe;CAIjB;AACF;;;;;AAMD,IAAa,6BAAb,cAAgD,cAAc;CAC5D,AAAkB,OAAO;CAEzB,YAAYA,OAAe;AACzB,QAAM,gEAAgE,MAAM;CAC7E;AACF;;;;AAKD,IAAa,yBAAb,cAA4C,cAAc;CACxD,AAAkB,OAAO;CAEzB,YAC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D;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,4 +1,4 @@
|
|
|
1
|
-
import { BlockMeta, Position, PositionGreeks } from "./position-
|
|
1
|
+
import { BlockMeta, Position, PositionGreeks } from "./position-BqIgubs5.js";
|
|
2
2
|
|
|
3
3
|
//#region src/panoptic/v2/errors/base.d.ts
|
|
4
4
|
/**
|
|
@@ -255,4 +255,4 @@ interface DispatchSimulation {
|
|
|
255
255
|
preMarginExcess1: bigint | null;
|
|
256
256
|
} //#endregion
|
|
257
257
|
export { ClosePositionSimulation, DepositSimulation, DispatchSimulation, ForceExerciseSimulation, LiquidateSimulation, OpenPositionSimulation, PanopticError as PanopticError$1, SettleSimulation, SimulationResult, TokenFlow, WithdrawSimulation };
|
|
258
|
-
//# sourceMappingURL=simulation-
|
|
258
|
+
//# sourceMappingURL=simulation-zM6-YUaw.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulation-
|
|
1
|
+
{"version":3,"file":"simulation-zM6-YUaw.d.ts","names":["PanopticError","Error","PanopticError","BlockMeta","Position","PositionGreeks","TokenFlow","SimulationResult","T","OpenPositionSimulation","ClosePositionSimulation","ForceExerciseSimulation","LiquidateSimulation","SettleSimulation","DepositSimulation","WithdrawSimulation","DispatchSimulation"],"sources":["../src/panoptic/v2/errors/base.d.ts","../src/panoptic/v2/types/simulation.d.ts"],"sourcesContent":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoBqBE,aAAAA,SAAsBD,KAAAA;mBACtBA;;EADAC;EAAa,SAAA,CAAA,EAAA,MAAA;EAAA;;;AAAc;;;uCAWPD;;;;;;;;UCnBxBK,SAAAA;;;;;;;;;;;EDQIJ;EAAa,aAAA,EAAA,MAAA;EAAA;EACR,UAUeD,EAAAA,MAAAA,GAAAA,IAAAA;EAAK;EAXE,SAAA,EAAA,MAAA,GAAA,IAAA;;;;;;;;;ACR/BK,KAyBLC,gBAzBc,CAAA,CAAA,CAAA,GAAA;;QA2BhBC;;cAEMF;SACLH;;;EALCI,KAAAA,EAQDL,aARiB;EAAA,KAAA,EASjBC,SATiB;CAAA;;;;AASjBA,UAKMM,sBAAAA,CALNN;EAAS;YAONC;;UAEFC;EAJKI;EAAsB,eAAA,EAAA,MAAA;EAAA;EAEjB,eAEVJ,EAAAA,MAAAA;EAAc;;;;EAmCTK;;;;EAqBAC,2BAAuB,EAAA,MAAA;;;;AAaxC;;;;AAiBA;;;;IAeiBG,MAAAA,EAAAA,MAAAA;;;;EAWAC;;;;AAiBjB;;UA9FiBL,uBAAAA;;;;;;;;;;;;;;;;;;;;;UAqBAC,uBAAAA;;;;;;;;;;;;;UAaAC,mBAAAA;;;;;;;;;;;;;;;;;UAiBAC,gBAAAA;;;;;;;;;;;;;;;UAeAC,iBAAAA;;;;;;;;;;;UAWAC,kBAAAA;;;;;;;;;;;;;;;;;UAiBAC,kBAAAA"}
|
|
@@ -364,4 +364,4 @@ interface DispatchCall {
|
|
|
364
364
|
|
|
365
365
|
//#endregion
|
|
366
366
|
export { AccountLiquidatedEvent, BaseEvent, DepositEvent, DispatchCall, EventSubscription, ForcedExercisedEvent, LegUpdate, NonceManager, OptionBurntEvent, OptionMintedEvent, PanopticEvent, PanopticEventType, PremiumSettledEvent, SyncEvent, TxBroadcaster, TxOverrides, TxReceipt, TxResult, TxResultWithReceipt, WithdrawEvent };
|
|
367
|
-
//# sourceMappingURL=tx-
|
|
367
|
+
//# sourceMappingURL=tx-CbDQ58Io.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx-
|
|
1
|
+
{"version":3,"file":"tx-CbDQ58Io.d.ts","names":["Address","Hash","PanopticEventType","BaseEvent","OptionMintedEvent","OptionBurntEvent","AccountLiquidatedEvent","ForcedExercisedEvent","PremiumSettledEvent","DepositEvent","WithdrawEvent","BorrowRateUpdatedEvent","LiquidityChunkUpdatedEvent","ProtocolLossRealizedEvent","ModifyLiquidityEvent","SwapEvent","DonateEvent","PanopticEvent","LegUpdate","EventSubscription","SyncEvent","Address","Hash","PanopticEvent","TxResult","TxReceipt","Promise","TxResultWithReceipt","TxBroadcaster","TxOverrides","NonceManager","DispatchCall"],"sources":["../src/panoptic/v2/types/events.d.ts","../src/panoptic/v2/types/tx.d.ts"],"sourcesContent":null,"mappings":";;;;;;;;AAQA;;KAAYE,iBAAAA;;AAIZ;;AAEUA,UAFOC,SAAAA,CAEPD;EAAiB;EAEF,IAIVoB,EANLpB,iBAMKoB;EAAI;mBAJEA;;;EAWJlB;EAAiB,SAAA,EAPnBkB,IAOmB;EAAA;EAGZ,QAHqBnB,EAAAA,MAAAA;AAAS;;;;AAwBnCE,UAxBAD,iBAAAA,SAA0BD,SAwBV,CAAA;EAAA,IAAA,EAAA,cAAA;EAAA;E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 -1,4 +1,4 @@
|
|
|
1
|
-
import { TxOverrides } from "./tx-
|
|
1
|
+
import { TxOverrides } from "./tx-CbDQ58Io.js";
|
|
2
2
|
import { Address, Hex, PublicClient, WalletClient } from "viem";
|
|
3
3
|
|
|
4
4
|
//#region src/cow/types.d.ts
|
|
@@ -125,4 +125,4 @@ interface ApproveErc20ForCowParams {
|
|
|
125
125
|
txOverrides?: TxOverrides;
|
|
126
126
|
} //#endregion
|
|
127
127
|
export { ApproveErc20ForCowParams, CancelCowOrderParams, CheckCowApprovalParams, CowApprovalStatus, CowOrderKind, CowOrderResult, CowOrderState, CowOrderStatus, CowQuote, GetCowOrderStatusParams, QuoteCowSwapParams, SignAndSubmitCowOrderParams };
|
|
128
|
-
//# sourceMappingURL=types-
|
|
128
|
+
//# sourceMappingURL=types-BHdnurYr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-BHdnurYr.d.ts","names":["Address","Hex","PublicClient","WalletClient","TxOverrides","CowOrderKind","CowOrderStatus","QuoteCowSwapParams","CowQuote","SignAndSubmitCowOrderParams","CowOrderResult","CancelCowOrderParams","GetCowOrderStatusParams","CowOrderState","CheckCowApprovalParams","CowApprovalStatus","ApproveErc20ForCowParams"],"sources":["../src/cow/types.d.ts"],"sourcesContent":null,"mappings":";;;;;;;AASYM,KAFAD,YAAAA,GAEc,MAAA,GAAA,KAAA;;AAETE,KAFLD,cAAAA,GAEuB,qBAAA,GAAA,MAAA,GAAA,WAAA,GAAA,WAAA,GAAA,SAAA;;AAIpBN,UAJEO,kBAAAA,CAIFP;EAAO;EAED,OAEXK,EAAAA,MAAAA;EAAY;EAIL,SAAA,EARFL,OAQE;;YANHA;;QAEJK;;;;EAmBOG,IAAAA,EAfPR,OAee;EAAA;EAAA,WACfK,EAAAA,MAAAA;EAAY;EACA,eACRL,CAAAA,EAAAA,MAAAA;EAAO;;AAmBrB;;;;;;AAQsB;;AAKLU,UAnCAF,QAAAA,CAmCc;QAlCrBH;EAsCOM,SAAAA,EArCFX,OAqCEW;EAAoB,QAAA,EApCvBX,OAoCuB;EAAA;EACP,UACjBA,EAAAA,MAAAA;EAAO;EAEH,SAAA,EAAA,MAAA;;EAIAY,SAAAA,EAAAA,MAAAA;;EAMAC,eAAAA,EAAa,MAAA;EAAA;EAAA,eAClBP,EAAAA,MAAAA;EAAc;EAKA,cAAA,EAAA,MAAA;;EAGTQ,OAAAA,EAAAA,MAAAA;EAAsB;EAAA,OAC3BZ,EAAAA,MAAAA,GAAAA,IAAAA;;;AAIM,UA7CDO,2BAAAA,CA6CC;gBA5CAN;EAiDDY;WA/CJf;EAqDIgB,OAAAA,EAAAA,MAAAA;EAAwB;EAAA,KAC7Bd,EAnDDM,QAmDCN;EAAY;EACM,QACjBF,CAAAA,EAnDEA,OAmDFA;EAAO;EAEE,MAGJI,CAAAA,EAAAA,MAAAA;AAAW;;UAnDZM,cAAAA;YACHT;;;UAGGU,oBAAAA;gBACCR;WACLH;;YAECC;;;;UAIGW,uBAAAA;;YAEHX;;;;UAIGY,aAAAA;UACLP;;;;;qBAKWL;;;UAGNa,sBAAAA;UACLZ;;aAEGF;;SAEJA;;;;;UAKMe,iBAAAA;;;;;;UAMAC,wBAAAA;UACLd;gBACMC;WACLH;;aAEEA;;;gBAGGI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PoolKey } from "./
|
|
2
|
-
import { TxOverrides } from "./tx-
|
|
1
|
+
import { PoolKey } from "./quote-BxQkPBRg.js";
|
|
2
|
+
import { TxOverrides } from "./tx-CbDQ58Io.js";
|
|
3
3
|
import { Address, PublicClient, WalletClient } from "viem";
|
|
4
4
|
|
|
5
5
|
//#region src/uniswap/v4/addresses.d.ts
|
|
@@ -17,6 +17,8 @@ interface UniswapV4Addresses {
|
|
|
17
17
|
v4Quoter: Address;
|
|
18
18
|
/** Uniswap v4 PoolManager (singleton). */
|
|
19
19
|
poolManager: Address;
|
|
20
|
+
/** Uniswap v4 PositionManager (posm) — ERC721 LP position NFTs. */
|
|
21
|
+
positionManager: Address;
|
|
20
22
|
/** Canonical Permit2 (same address on every chain). */
|
|
21
23
|
permit2: Address;
|
|
22
24
|
}
|
|
@@ -42,7 +44,6 @@ declare const UNISWAP_V4_ADDRESSES: Record<number, UniswapV4Addresses>;
|
|
|
42
44
|
* overrides do not supply every required address.
|
|
43
45
|
*/
|
|
44
46
|
declare function getUniswapV4Addresses(chainId: bigint, overrides?: Partial<UniswapV4Addresses>): UniswapV4Addresses;
|
|
45
|
-
|
|
46
47
|
//#endregion
|
|
47
48
|
//#region src/uniswap/v4/router/types.d.ts
|
|
48
49
|
/**
|
|
@@ -244,4 +245,4 @@ interface ApproveRouterViaPermit2Params {
|
|
|
244
245
|
addresses?: Partial<UniswapV4Addresses>;
|
|
245
246
|
} //#endregion
|
|
246
247
|
export { ApproveErc20ForPermit2Params, ApproveRouterViaPermit2Params, CheckRouterApprovalParams, PERMIT2_ADDRESS as PERMIT2_ADDRESS$1, QuoteSwapExactInViaRouterParams, QuoteSwapExactOutViaRouterParams, RouterApprovalStatus, SwapExactInQuote, SwapExactInViaRouterParams, SwapExactOutQuote, SwapExactOutViaRouterParams, UNISWAP_V4_ADDRESSES as UNISWAP_V4_ADDRESSES$1, UniswapV4Addresses, getUniswapV4Addresses as getUniswapV4Addresses$1 };
|
|
247
|
-
//# sourceMappingURL=types-
|
|
248
|
+
//# sourceMappingURL=types-D_jcYss-.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-D_jcYss-.d.ts","names":["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/uniswap/v4/addresses.d.ts","../src/uniswap/v4/router/types.d.ts"],"sourcesContent":null,"mappings":";;;;;;;;;;;;AAwBaO,UAVIK,kBAAAA,CAUJL;EAAO;mBARCA;;YAEPA;EAWOL;eATJK;;mBAEIA;;WAERA;;;AAab;;AAA0DK,cARrCV,eAQqCU,EARpBL,OAQoBK;;AAAT;;;;;;cAA5BT,sBAAsBC,eAAeQ;;;;AAU1D;;;;;AAA2H;iBAAnGP,qBAAAA,8BAAmDS,QAAQF,sBAAsBA;;;;AAjCzG;;AAEqBL,UCNJM,0BAAAA,CDMIN;EAAO;EAEP,MAEJA,ECRLC,YDQKD;EAAO;EAEI,YAEfA,ECVKE,YDULF;EAAO;WCRPA;;eAEIA;EDWIL;;;WCPRK;;;;;EDeQJ;EAAwD,QAAA,CAAA,EAAA,MAAA;EAAA;EAAD,SAAjCC,CAAAA,ECP3BG,ODO2BH;EAAM;gBCL/BO;;cAEFG,QAAQF;;;;;UAKPG,+BAAAA;;EDQOV,MAAAA,ECNZG,YDMYH;EAAqB;EAAA,WAAsCO,ECJlEL,ODIkEK;EAAkB;EAAnB,OAAuBA,EAAAA,MAAAA;EAAkB;WCA9GL;;;;;;EArCIM,WAAAA,CAAAA,EAAAA,MAAAA;EAA0B;EAAA,SAE/BL,CAAAA,EA2CIM,OA3CJN,CA2CYI,kBA3CZJ,CAAAA;;;;;AAkBID,UA8BCS,gBAAAA,CA9BDT;EAAO;EAEM,SAELK,EAAAA,MAAAA;EAAkB;EAAnB,gBAAA,EAAA,MAAA;;;;EAKNG,QAAAA,EA6BHR,OA7BGQ;EAA+B;EAAA,OAEpCP,EA6BCE,OA7BDF;EAAY;EAEA,WAIXD,EAAAA,MAAAA;;;AAQU;;UAsBNU,2BAAAA;;EAjBAD,MAAAA,EAmBLR,YAnBqB;EAAA;EAAA,YAQnBD,EAaIE,YAbJF;EAAO;EAED,OAAA,EAaPA,OAbO;;eAeHA;;EARAU,OAAAA,EAAAA,MAAAA;EAA2B;EAAA,OAEhCT,EAUCD,OAVDC;EAAY;EAEM,SAEjBD,EAAAA,MAAAA;EAAO;EAEI,WAIXA,EAAAA,MAAAA;EAAO;EAQG,QAELI,CAAAA,EAAAA,MAAAA;EAAW;EAEa,SAA1BG,CAAAA,EAJAP,OAIAO;EAAO;gBAFLH;;cAEFG,QAAQF;AAKxB;;;;AAQaL,UARIW,gCAAAA,CAQJX;EAAO;EAQsB,MAA1BO,EAdJN,YAcIM;EAAO;eAZNP;;;EAiBAY;EAAiB,OAAA,EAbrBZ,OAaqB;EAAA;EAQb,SAERG,EAAAA,MAAAA;EAAO;;;;EAOHU;EAAyB,SAAA,CAAA,EAtB1BN,OAsB0B,CAtBlBF,kBAsBkB,CAAA;;;;;AAY1BE,UA7BCK,iBAAAA,CA6BDL;EAAO;;;;EAKNO;;;YA1BHd;EAyCGe;EAA4B,OAAA,EAvChCZ,OAuCgC;EAAA;EACrB,WACND,EAAAA,MAAAA;;;;;AAQFK,UA1CCM,yBAAAA,CA0CDN;EAAO;UAxCXN;;;EA6CKe;EAA6B,OAAA,EAzCjChB,OAyCiC;EAAA;EACtB,KACNE,EAzCPF,OAyCOE;EAAY;EACV,MAGPF,EAAAA,MAAAA;EAAO;EAKS,SACLK,CAAAA,EA/CRE,OA+CQF,CA/CAA,kBA+CAA,CAAAA;;AAAD;;;UA1CNS,oBAAAA;;;;;;;;;;;;;;;UAeAC,4BAAAA;UACLd;gBACMC;WACLF;;;WAGAA;;;gBAGKI;cACFG,QAAQF;;;;;UAKPW,6BAAAA;UACLf;gBACMC;WACLF;;;WAGAA;;;;;gBAKKI;cACFG,QAAQF"}
|
package/dist/uniswap/index.d.ts
CHANGED
|
@@ -1,13 +1,59 @@
|
|
|
1
|
-
import "../position-
|
|
2
|
-
import { PoolKey } from "../
|
|
3
|
-
import { TxReceipt, TxResult } from "../tx-
|
|
4
|
-
import { PanopticError$1 as PanopticError, SimulationResult } from "../simulation-
|
|
5
|
-
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-
|
|
1
|
+
import "../position-BqIgubs5.js";
|
|
2
|
+
import { PoolKey, QuoteV3ExactInParams, UNISWAP_V3_ADDRESSES$1 as UNISWAP_V3_ADDRESSES, UniswapV3Addresses, V3ExactInQuote, getUniswapV3Addresses$1 as getUniswapV3Addresses, quoteV3ExactIn$1 as quoteV3ExactIn } from "../quote-BxQkPBRg.js";
|
|
3
|
+
import { TxReceipt, TxResult } from "../tx-CbDQ58Io.js";
|
|
4
|
+
import { PanopticError$1 as PanopticError, SimulationResult } from "../simulation-zM6-YUaw.js";
|
|
5
|
+
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-D_jcYss-.js";
|
|
6
6
|
import { Address, Hex, PublicClient } from "viem";
|
|
7
7
|
|
|
8
|
-
//#region src/uniswap/
|
|
9
|
-
/** Universal Router command byte for a
|
|
8
|
+
//#region src/uniswap/v3/router/encodeSwap.d.ts
|
|
9
|
+
/** Universal Router command byte for a v3 exact-in swap. */
|
|
10
10
|
|
|
11
|
+
/** Universal Router command byte for a v3 exact-in swap. */
|
|
12
|
+
declare const V3_SWAP_EXACT_IN = 0;
|
|
13
|
+
/**
|
|
14
|
+
* Universal Router recipient sentinel: the router maps `address(1)` to
|
|
15
|
+
* `msg.sender` (the `execute` caller). Uniswap `Constants.MSG_SENDER`.
|
|
16
|
+
*/
|
|
17
|
+
declare const MSG_SENDER: Address;
|
|
18
|
+
/** Arguments for {@link buildV3SwapExecuteCalldata}. */
|
|
19
|
+
interface BuildV3SwapCalldataArgs {
|
|
20
|
+
/** Input token (funds pulled from the caller via Permit2). */
|
|
21
|
+
tokenIn: Address;
|
|
22
|
+
/** Output token. */
|
|
23
|
+
tokenOut: Address;
|
|
24
|
+
/** v3 pool fee tier (e.g. 500, 3000). */
|
|
25
|
+
fee: bigint;
|
|
26
|
+
/** Exact input amount (uint128). */
|
|
27
|
+
amountIn: bigint;
|
|
28
|
+
/** Minimum acceptable output (uint128). */
|
|
29
|
+
amountOutMinimum: bigint;
|
|
30
|
+
/**
|
|
31
|
+
* Absolute deadline (unix seconds) — the `execute(commands, inputs, deadline)`
|
|
32
|
+
* argument, enforced by the Universal Router.
|
|
33
|
+
*/
|
|
34
|
+
deadline: bigint;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Encode the packed v3 single-hop path `tokenIn ++ fee(uint24) ++ tokenOut`.
|
|
38
|
+
*/
|
|
39
|
+
declare function encodeV3Path(tokenIn: Address, fee: bigint, tokenOut: Address): Hex;
|
|
40
|
+
/**
|
|
41
|
+
* Build the typed `execute(...)` args for an exact-in single-hop v3 swap whose
|
|
42
|
+
* output is delivered to the `execute` caller (recipient = MSG_SENDER).
|
|
43
|
+
*/
|
|
44
|
+
declare function buildV3SwapExecuteArgs(args: BuildV3SwapCalldataArgs): {
|
|
45
|
+
args: readonly [Hex, readonly Hex[], bigint];
|
|
46
|
+
value: bigint;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Build the `execute(commands, inputs, deadline)` calldata for an exact-in
|
|
50
|
+
* single-hop v3 swap.
|
|
51
|
+
*/
|
|
52
|
+
declare function buildV3SwapExecuteCalldata(args: BuildV3SwapCalldataArgs): {
|
|
53
|
+
data: Hex;
|
|
54
|
+
value: bigint;
|
|
55
|
+
}; //#endregion
|
|
56
|
+
//#region src/uniswap/v4/router/encodeSwap.d.ts
|
|
11
57
|
/** Universal Router command byte for a v4 swap. */
|
|
12
58
|
declare const V4_SWAP = 16;
|
|
13
59
|
/** v4 action: exact-in single-hop swap. */
|
|
@@ -381,99 +427,6 @@ declare function getAmountsForLiquidity(sqrtPriceX96: bigint, sqrtRatioAX96: big
|
|
|
381
427
|
*/
|
|
382
428
|
declare function getLpGreeks(input: LpGreeksInput): LpGreeks;
|
|
383
429
|
|
|
384
|
-
//#endregion
|
|
385
|
-
//#region src/uniswap/v3/addresses.d.ts
|
|
386
|
-
interface UniswapV3Addresses {
|
|
387
|
-
/** Uniswap v3 QuoterV2 — `quoteExactInputSingle` (revert/staticcall-based). */
|
|
388
|
-
quoterV2: Address;
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Verified Uniswap v3 QuoterV2 addresses keyed by chainId. Add a chain only
|
|
392
|
-
* after verifying against the canonical Uniswap v3 deployment listing.
|
|
393
|
-
*/
|
|
394
|
-
declare const UNISWAP_V3_ADDRESSES: Record<number, UniswapV3Addresses>;
|
|
395
|
-
/**
|
|
396
|
-
* Resolve Uniswap v3 addresses for a chain, applying optional overrides.
|
|
397
|
-
*
|
|
398
|
-
* @throws {UnsupportedChainError} when the chain is not listed and overrides do
|
|
399
|
-
* not supply every required address.
|
|
400
|
-
*/
|
|
401
|
-
declare function getUniswapV3Addresses(chainId: number | bigint, overrides?: Partial<UniswapV3Addresses>): UniswapV3Addresses;
|
|
402
|
-
|
|
403
|
-
//#endregion
|
|
404
|
-
//#region src/uniswap/v3/router/encodeSwap.d.ts
|
|
405
|
-
/** Universal Router command byte for a v3 exact-in swap. */
|
|
406
|
-
declare const V3_SWAP_EXACT_IN = 0;
|
|
407
|
-
/**
|
|
408
|
-
* Universal Router recipient sentinel: the router maps `address(1)` to
|
|
409
|
-
* `msg.sender` (the `execute` caller). Uniswap `Constants.MSG_SENDER`.
|
|
410
|
-
*/
|
|
411
|
-
declare const MSG_SENDER: Address;
|
|
412
|
-
/** Arguments for {@link buildV3SwapExecuteCalldata}. */
|
|
413
|
-
interface BuildV3SwapCalldataArgs {
|
|
414
|
-
/** Input token (funds pulled from the caller via Permit2). */
|
|
415
|
-
tokenIn: Address;
|
|
416
|
-
/** Output token. */
|
|
417
|
-
tokenOut: Address;
|
|
418
|
-
/** v3 pool fee tier (e.g. 500, 3000). */
|
|
419
|
-
fee: bigint;
|
|
420
|
-
/** Exact input amount (uint128). */
|
|
421
|
-
amountIn: bigint;
|
|
422
|
-
/** Minimum acceptable output (uint128). */
|
|
423
|
-
amountOutMinimum: bigint;
|
|
424
|
-
/**
|
|
425
|
-
* Absolute deadline (unix seconds) — the `execute(commands, inputs, deadline)`
|
|
426
|
-
* argument, enforced by the Universal Router.
|
|
427
|
-
*/
|
|
428
|
-
deadline: bigint;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Encode the packed v3 single-hop path `tokenIn ++ fee(uint24) ++ tokenOut`.
|
|
432
|
-
*/
|
|
433
|
-
declare function encodeV3Path(tokenIn: Address, fee: bigint, tokenOut: Address): Hex;
|
|
434
|
-
/**
|
|
435
|
-
* Build the typed `execute(...)` args for an exact-in single-hop v3 swap whose
|
|
436
|
-
* output is delivered to the `execute` caller (recipient = MSG_SENDER).
|
|
437
|
-
*/
|
|
438
|
-
declare function buildV3SwapExecuteArgs(args: BuildV3SwapCalldataArgs): {
|
|
439
|
-
args: readonly [Hex, readonly Hex[], bigint];
|
|
440
|
-
value: bigint;
|
|
441
|
-
};
|
|
442
|
-
/**
|
|
443
|
-
* Build the `execute(commands, inputs, deadline)` calldata for an exact-in
|
|
444
|
-
* single-hop v3 swap.
|
|
445
|
-
*/
|
|
446
|
-
declare function buildV3SwapExecuteCalldata(args: BuildV3SwapCalldataArgs): {
|
|
447
|
-
data: Hex;
|
|
448
|
-
value: bigint;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
//#endregion
|
|
452
|
-
//#region src/uniswap/v3/router/quote.d.ts
|
|
453
|
-
interface QuoteV3ExactInParams {
|
|
454
|
-
client: PublicClient;
|
|
455
|
-
chainId: bigint;
|
|
456
|
-
tokenIn: Address;
|
|
457
|
-
tokenOut: Address;
|
|
458
|
-
fee: bigint;
|
|
459
|
-
amountIn: bigint;
|
|
460
|
-
/** Slippage tolerance in bps, used to compute `amountOutMinimum`. */
|
|
461
|
-
slippageBps: bigint;
|
|
462
|
-
blockNumber?: bigint;
|
|
463
|
-
addresses?: Partial<UniswapV3Addresses>;
|
|
464
|
-
}
|
|
465
|
-
interface V3ExactInQuote {
|
|
466
|
-
amountOut: bigint;
|
|
467
|
-
amountOutMinimum: bigint;
|
|
468
|
-
gasEstimate: bigint;
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Quote an exact-in v3 swap. Returns `null` when the quote reverts (e.g. the
|
|
472
|
-
* pool does not exist / has no liquidity) so callers can skip that pool when
|
|
473
|
-
* ranking venues, rather than aborting the whole cycle.
|
|
474
|
-
*/
|
|
475
|
-
declare function quoteV3ExactIn(params: QuoteV3ExactInParams): Promise<V3ExactInQuote | null>;
|
|
476
|
-
|
|
477
430
|
//#endregion
|
|
478
431
|
export { AmountExceedsUint128Error, ApproveErc20ForPermit2Params, ApproveRouterViaPermit2Params, BuildV3SwapCalldataArgs, BuildV4ExactOutSwapCalldataArgs, BuildV4SwapCalldataArgs, CheckRouterApprovalParams, InvalidSwapTokenError, LpAmounts, LpGreeks, LpGreeksInput, 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, getAmountsForLiquidity, getLpGreeks, getUniswapV3Addresses, getUniswapV4Addresses, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, quoteV3ExactIn, quoteV4ExactInByPoolKey, resolveSwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactOutViaRouter, swapExactOutViaRouterAndWait };
|
|
479
432
|
//# 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","PublicClient","PoolKey","UniswapV4Addresses","QuoteV4ExactInByPoolKeyParams","Partial","V4ExactInQuote","quoteV4ExactInByPoolKey","Promise","Address","PublicClient","PoolKey","ResolvedSwapRoute","ResolveSwapRouteParams","resolveSwapRoute","Promise","TxReceipt","TxResult","SwapExactInViaRouterParams","SwapExactOutViaRouterParams","swapExactInViaRouter","Promise","swapExactInViaRouterAndWait","swapExactOutViaRouter","swapExactOutViaRouterAndWait","LpAmounts","LpGreeks","LpGreeksInput","getAmountsForLiquidity","getLpGreeks"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["Address","Hex","V3_SWAP_EXACT_IN","MSG_SENDER","BuildV3SwapCalldataArgs","encodeV3Path","buildV3SwapExecuteArgs","buildV3SwapExecuteCalldata","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","PublicClient","PoolKey","UniswapV4Addresses","QuoteV4ExactInByPoolKeyParams","Partial","V4ExactInQuote","quoteV4ExactInByPoolKey","Promise","Address","PublicClient","PoolKey","ResolvedSwapRoute","ResolveSwapRouteParams","resolveSwapRoute","Promise","TxReceipt","TxResult","SwapExactInViaRouterParams","SwapExactOutViaRouterParams","swapExactInViaRouter","Promise","swapExactInViaRouterAndWait","swapExactOutViaRouter","swapExactOutViaRouterAndWait","LpAmounts","LpGreeks","LpGreeksInput","getAmountsForLiquidity","getLpGreeks"],"sources":["../../src/uniswap/v3/router/encodeSwap.d.ts","../../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/lpGreeks.d.ts"],"sourcesContent":null,"mappings":";;;;;;;;;;;AAqD8C4D,cA3BzB1D,gBAAAA,GA2ByB0D,CAAAA;;;AAA6C;;cAtBtEzD,YAAYyD;;UAEhBxD,uBAAAA;EAyBOE;EAAsB,OAAA,EAvBjCsD,OAuBiC;EAAA;EAA8B,QACxDnD,EAtBNmD,OAsBMnD;EAAG;EAAc,GAAA,EAAA,MAAA;;;;;EAObF;;;;EACX,QAAA,EAAA,MAAA;;;;;ACxCQI,iBD0BGN,YAAAA,CC1BI,OAAA,ED0BkBuD,OC1BlB,EAAA,GAAA,EAAA,MAAA,EAAA,QAAA,ED0BkDA,OC1BlD,CAAA,ED0B4DnD,GC1B5D;;AAE5B;;AAEA;iBD2BwBH,sBAAAA,OAA6BF;ECzBhCU,IAAAA,EAAAA,SAAQ,CD0BTL,GC1BS,EAAA,SD0BKA,GC1BL,EAAA,EAAA,MAAA,CAAA;;AAI7B,CAAA;;AAEA;;;iBD2BwBF,0BAA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AA3BrD;;AAEA;;;;AAIqB;;;;AAgBrB;;;;;AAA2F,iBOxBnEmE,oBAAAA,CPwBmE,MAAA,EOxBtCF,0BPwBsC,CAAA,EOxBTG,OPwBS,COxBDJ,QPwBC,CAAA;;;;iBOpBnEK,2BAAAA,SAAoCJ,6BAA6BG,QAAQL;APyBjG;;;;;AACqC;;;;;AAOrC;AAAkD,iBOrB1BO,qBAAAA,CPqB0B,MAAA,EOrBIJ,2BPqBJ,CAAA,EOrBkCE,OPqBlC,COrB0CJ,QPqB1C,CAAA;;;AACrC;iBOlBWO,4BAAAA,SAAqCL,8BAA8BE,QAAQL;;;;;;;;;;;;;APvBnG;;;;;AAKA;;AAEA;;;AAIcP,UQlBGgB,SAAAA,CRkBHhB;EAAO;;;;AAgBrB;;AAA8CA,UQ3B7BiB,QAAAA,CR2B6BjB;EAAO;EAAgC,KAAGnD,EAAAA,MAAAA;EAAG;;;;;AAK3F;AAA8C,UQvB7BqE,aAAAA,CRuB6B;EAAA;EAA8B,SACxDrE,EAAAA,MAAAA;EAAG;EAAc,SAAA,EAAA,MAAA;;;;;EAObF;EAA0B,UAAA,EAAA,CAAA,GAAA,CAAA;;;AACrC;;;;;ACxCQI,iBO0BGoE,sBAAAA,CP1BI,YAAA,EAAA,MAAA,EAAA,aAAA,EAAA,MAAA,EAAA,aAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,CAAA,EO0B2GH,SP1B3G;;AAE5B;;AAEA;;AAEA;;AAIA;;AAEA;;iBO0BwBI,WAAAA,QAAmBF,gBAAgBD"}
|
package/dist/uniswap/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../position-C8rkkKhi.js";
|
|
2
2
|
import { tickToSqrtPriceX96 } from "../greeks-GysWXct-.js";
|
|
3
|
-
import "../writes-
|
|
4
|
-
import { AmountExceedsUint128Error, InvalidSwapTokenError,
|
|
5
|
-
import {
|
|
3
|
+
import "../writes-AupZCK4M.js";
|
|
4
|
+
import { AmountExceedsUint128Error, InvalidSwapTokenError, MSG_SENDER, MissingSweepRecipientError, QuoterUnavailableError, UNISWAP_V3_ADDRESSES, UnsupportedChainError, V3_SWAP_EXACT_IN, buildV3SwapExecuteArgs, buildV3SwapExecuteCalldata, encodeV3Path, getUniswapV3Addresses, quoteV3ExactIn } from "../router-DcoU2KmV.js";
|
|
5
|
+
import { PERMIT2_ADDRESS, SETTLE_ALL, SWAP_EXACT_IN_SINGLE, SWAP_EXACT_OUT_SINGLE, SWEEP, TAKE_ALL, UNISWAP_V4_ADDRESSES, V4_SWAP, approveErc20ForPermit2, approveErc20ForPermit2AndWait, approveRouterViaPermit2, approveRouterViaPermit2AndWait, buildV4ExactOutSwapExecuteArgs, buildV4ExactOutSwapExecuteCalldata, buildV4SwapExecuteArgs, buildV4SwapExecuteCalldata, checkRouterApproval, getUniswapV4Addresses, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, quoteV4ExactInByPoolKey, resolveSwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactOutViaRouter, swapExactOutViaRouterAndWait } from "../router-CS86ptMu.js";
|
|
6
6
|
|
|
7
7
|
//#region src/uniswap/lpGreeks.ts
|
|
8
8
|
const Q96 = 1n << 96n;
|
|
@@ -62,228 +62,6 @@ function getLpGreeks(input) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/uniswap/v3/addresses.ts
|
|
67
|
-
/**
|
|
68
|
-
* Verified Uniswap v3 QuoterV2 addresses keyed by chainId. Add a chain only
|
|
69
|
-
* after verifying against the canonical Uniswap v3 deployment listing.
|
|
70
|
-
*/
|
|
71
|
-
const UNISWAP_V3_ADDRESSES = { 1: { quoterV2: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e" } };
|
|
72
|
-
/**
|
|
73
|
-
* Resolve Uniswap v3 addresses for a chain, applying optional overrides.
|
|
74
|
-
*
|
|
75
|
-
* @throws {UnsupportedChainError} when the chain is not listed and overrides do
|
|
76
|
-
* not supply every required address.
|
|
77
|
-
*/
|
|
78
|
-
function getUniswapV3Addresses(chainId, overrides) {
|
|
79
|
-
const id = Number(chainId);
|
|
80
|
-
const base = UNISWAP_V3_ADDRESSES[id];
|
|
81
|
-
const merged = {
|
|
82
|
-
...base,
|
|
83
|
-
...overrides
|
|
84
|
-
};
|
|
85
|
-
if (!merged.quoterV2) throw new UnsupportedChainError(BigInt(id));
|
|
86
|
-
return merged;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/uniswap/v3/router/encodeSwap.ts
|
|
91
|
-
/** Universal Router command byte for a v3 exact-in swap. */
|
|
92
|
-
const V3_SWAP_EXACT_IN = 0;
|
|
93
|
-
/**
|
|
94
|
-
* Universal Router recipient sentinel: the router maps `address(1)` to
|
|
95
|
-
* `msg.sender` (the `execute` caller). Uniswap `Constants.MSG_SENDER`.
|
|
96
|
-
*/
|
|
97
|
-
const MSG_SENDER = "0x0000000000000000000000000000000000000001";
|
|
98
|
-
const UINT128_MAX$1 = (1n << 128n) - 1n;
|
|
99
|
-
const v3ExactInInputAbi = [
|
|
100
|
-
{
|
|
101
|
-
name: "recipient",
|
|
102
|
-
type: "address"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: "amountIn",
|
|
106
|
-
type: "uint256"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "amountOutMinimum",
|
|
110
|
-
type: "uint256"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: "path",
|
|
114
|
-
type: "bytes"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "payerIsUser",
|
|
118
|
-
type: "bool"
|
|
119
|
-
}
|
|
120
|
-
];
|
|
121
|
-
function assertUint128(amount) {
|
|
122
|
-
if (amount < 0n || amount > UINT128_MAX$1) throw new AmountExceedsUint128Error(amount);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Encode the packed v3 single-hop path `tokenIn ++ fee(uint24) ++ tokenOut`.
|
|
126
|
-
*/
|
|
127
|
-
function encodeV3Path(tokenIn, fee, tokenOut) {
|
|
128
|
-
if (fee < 0n || fee > 0xffffffn) throw new PanopticError(`v3 fee ${fee} exceeds uint24`);
|
|
129
|
-
return encodePacked([
|
|
130
|
-
"address",
|
|
131
|
-
"uint24",
|
|
132
|
-
"address"
|
|
133
|
-
], [
|
|
134
|
-
tokenIn,
|
|
135
|
-
Number(fee),
|
|
136
|
-
tokenOut
|
|
137
|
-
]);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Build the typed `execute(...)` args for an exact-in single-hop v3 swap whose
|
|
141
|
-
* output is delivered to the `execute` caller (recipient = MSG_SENDER).
|
|
142
|
-
*/
|
|
143
|
-
function buildV3SwapExecuteArgs(args) {
|
|
144
|
-
const { tokenIn, tokenOut, fee, amountIn, amountOutMinimum, deadline } = args;
|
|
145
|
-
if (tokenIn === zeroAddress || tokenOut === zeroAddress) throw new PanopticError("native ETH is not supported by the v3 exact-in router builder");
|
|
146
|
-
assertUint128(amountIn);
|
|
147
|
-
assertUint128(amountOutMinimum);
|
|
148
|
-
const path = encodeV3Path(tokenIn, fee, tokenOut);
|
|
149
|
-
const input = encodeAbiParameters(v3ExactInInputAbi, [
|
|
150
|
-
MSG_SENDER,
|
|
151
|
-
amountIn,
|
|
152
|
-
amountOutMinimum,
|
|
153
|
-
path,
|
|
154
|
-
true
|
|
155
|
-
]);
|
|
156
|
-
const commands = encodePacked(["uint8"], [V3_SWAP_EXACT_IN]);
|
|
157
|
-
return {
|
|
158
|
-
args: [
|
|
159
|
-
commands,
|
|
160
|
-
[input],
|
|
161
|
-
deadline
|
|
162
|
-
],
|
|
163
|
-
value: 0n
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Build the `execute(commands, inputs, deadline)` calldata for an exact-in
|
|
168
|
-
* single-hop v3 swap.
|
|
169
|
-
*/
|
|
170
|
-
function buildV3SwapExecuteCalldata(args) {
|
|
171
|
-
const { args: executeArgs, value } = buildV3SwapExecuteArgs(args);
|
|
172
|
-
const data = encodeFunctionData({
|
|
173
|
-
abi: universalRouterAbi,
|
|
174
|
-
functionName: "execute",
|
|
175
|
-
args: executeArgs
|
|
176
|
-
});
|
|
177
|
-
return {
|
|
178
|
-
data,
|
|
179
|
-
value
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
//#endregion
|
|
184
|
-
//#region src/uniswap/v3/abis/quoterV2.ts
|
|
185
|
-
/**
|
|
186
|
-
* Minimal Uniswap v3 QuoterV2 ABI (`quoteExactInputSingle`).
|
|
187
|
-
*
|
|
188
|
-
* QuoterV2 is revert/staticcall-based (nonpayable but intended for `eth_call` /
|
|
189
|
-
* `simulateContract`), so it must be simulated, not read.
|
|
190
|
-
* @module uniswap/v3/abis/quoterV2
|
|
191
|
-
*/
|
|
192
|
-
const quoterV2Abi = [{
|
|
193
|
-
type: "function",
|
|
194
|
-
name: "quoteExactInputSingle",
|
|
195
|
-
stateMutability: "nonpayable",
|
|
196
|
-
inputs: [{
|
|
197
|
-
name: "params",
|
|
198
|
-
type: "tuple",
|
|
199
|
-
components: [
|
|
200
|
-
{
|
|
201
|
-
name: "tokenIn",
|
|
202
|
-
type: "address"
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
name: "tokenOut",
|
|
206
|
-
type: "address"
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: "amountIn",
|
|
210
|
-
type: "uint256"
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
name: "fee",
|
|
214
|
-
type: "uint24"
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
name: "sqrtPriceLimitX96",
|
|
218
|
-
type: "uint160"
|
|
219
|
-
}
|
|
220
|
-
]
|
|
221
|
-
}],
|
|
222
|
-
outputs: [
|
|
223
|
-
{
|
|
224
|
-
name: "amountOut",
|
|
225
|
-
type: "uint256"
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: "sqrtPriceX96After",
|
|
229
|
-
type: "uint160"
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: "initializedTicksCrossed",
|
|
233
|
-
type: "uint32"
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
name: "gasEstimate",
|
|
237
|
-
type: "uint256"
|
|
238
|
-
}
|
|
239
|
-
]
|
|
240
|
-
}];
|
|
241
|
-
|
|
242
|
-
//#endregion
|
|
243
|
-
//#region src/uniswap/v3/router/quote.ts
|
|
244
|
-
const BPS_DENOMINATOR = 10000n;
|
|
245
|
-
const UINT128_MAX = (1n << 128n) - 1n;
|
|
246
|
-
/**
|
|
247
|
-
* Quote an exact-in v3 swap. Returns `null` when the quote reverts (e.g. the
|
|
248
|
-
* pool does not exist / has no liquidity) so callers can skip that pool when
|
|
249
|
-
* ranking venues, rather than aborting the whole cycle.
|
|
250
|
-
*/
|
|
251
|
-
async function quoteV3ExactIn(params) {
|
|
252
|
-
const { client, chainId, tokenIn, tokenOut, fee, amountIn, slippageBps, blockNumber } = params;
|
|
253
|
-
if (amountIn < 0n || amountIn > UINT128_MAX) throw new PanopticError(`amountIn ${amountIn} exceeds uint128 maximum`);
|
|
254
|
-
if (slippageBps < 0n || slippageBps > BPS_DENOMINATOR) throw new PanopticError(`invalid slippageBps ${slippageBps}, must be 0..10000`);
|
|
255
|
-
const { quoterV2 } = getUniswapV3Addresses(chainId, params.addresses);
|
|
256
|
-
try {
|
|
257
|
-
const { result } = await client.simulateContract({
|
|
258
|
-
address: quoterV2,
|
|
259
|
-
abi: quoterV2Abi,
|
|
260
|
-
functionName: "quoteExactInputSingle",
|
|
261
|
-
blockNumber,
|
|
262
|
-
args: [{
|
|
263
|
-
tokenIn,
|
|
264
|
-
tokenOut,
|
|
265
|
-
amountIn,
|
|
266
|
-
fee: Number(fee),
|
|
267
|
-
sqrtPriceLimitX96: 0n
|
|
268
|
-
}]
|
|
269
|
-
});
|
|
270
|
-
const [amountOut, , , gasEstimate] = result;
|
|
271
|
-
const amountOutMinimum = amountOut * (BPS_DENOMINATOR - slippageBps) / BPS_DENOMINATOR;
|
|
272
|
-
return {
|
|
273
|
-
amountOut,
|
|
274
|
-
amountOutMinimum,
|
|
275
|
-
gasEstimate
|
|
276
|
-
};
|
|
277
|
-
} catch (err) {
|
|
278
|
-
if (isRevert(err)) return null;
|
|
279
|
-
throw err;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
/** True only for genuine contract reverts (missing pool / no liquidity). */
|
|
283
|
-
function isRevert(err) {
|
|
284
|
-
return err instanceof BaseError && err.walk((e) => e instanceof ContractFunctionRevertedError) instanceof ContractFunctionRevertedError;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
65
|
//#endregion
|
|
288
66
|
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, getAmountsForLiquidity, getLpGreeks, getUniswapV3Addresses, getUniswapV4Addresses, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, quoteV3ExactIn, quoteV4ExactInByPoolKey, resolveSwapRoute, swapExactInViaRouter, swapExactInViaRouterAndWait, swapExactOutViaRouter, swapExactOutViaRouterAndWait };
|
|
289
67
|
//# sourceMappingURL=index.js.map
|