@seer-pm/lens 1.3.0 → 1.5.0

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/index.js CHANGED
@@ -4,16 +4,20 @@ import {
4
4
  CHAINS,
5
5
  ETH,
6
6
  GNOSIS_sDAI,
7
+ InsufficientLiquidityError,
7
8
  LENS_QUOTER_ABI,
9
+ SwapRevertsError,
8
10
  defaultDeadline
9
- } from "./chunk-W6IFHZ77.js";
11
+ } from "./chunk-STF3B72X.js";
10
12
  export {
11
13
  AMM,
12
14
  AMM_NAMES,
13
15
  CHAINS,
14
16
  ETH,
15
17
  GNOSIS_sDAI,
18
+ InsufficientLiquidityError,
16
19
  LENS_QUOTER_ABI,
20
+ SwapRevertsError,
17
21
  defaultDeadline
18
22
  };
19
23
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seer-pm/lens",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "TypeScript SDK for Seer market swaps (collateral ↔ outcome) via LensQuoter",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Lens SDK — Core constants, ABIs, types, token list (zero dependencies)\n\n// ---- Chain config ----\n\n/** Unified AMM enum (same ordinals on every chain). */\nexport enum AMM {\n UNI_V3 = 0,\n UNI_V4 = 1,\n UNI_V4_HOOKED = 2,\n SWAPR_V3 = 3,\n}\n\nexport const AMM_NAMES: Record<AMM, string> = {\n [AMM.UNI_V3]: \"Uniswap V3\",\n [AMM.UNI_V4]: \"Uniswap V4\",\n [AMM.UNI_V4_HOOKED]: \"Uniswap V4 Hooked\",\n [AMM.SWAPR_V3]: \"Swapr V3\",\n};\n\n/** Shared LensQuoter ABI for the unified contract on all chains. */\nexport const LENS_QUOTER_ABI = [\n \"function buildBestSwapViaETH(address to, bool exactOut, address tokenIn, address tokenOut, uint256 swapAmount, uint256 slippageBps, uint256 deadline, uint24 hookPoolFee, int24 hookTickSpacing, address hookAddress) returns (tuple(uint8 source, uint256 feeBps, uint256 amountIn, uint256 amountOut) a, tuple(uint8 source, uint256 feeBps, uint256 amountIn, uint256 amountOut) b, address target, bytes data, uint256 msgValue)\",\n \"function buildBestSwapViaToken(address to, bool exactOut, address tokenIn, address tokenOut, uint256 swapAmount, uint256 slippageBps, uint256 deadline, uint24 hookPoolFee, int24 hookTickSpacing, address hookAddress, address mid) returns (tuple(uint8 source, uint256 feeBps, uint256 amountIn, uint256 amountOut) a, tuple(uint8 source, uint256 feeBps, uint256 amountIn, uint256 amountOut) b, address target, bytes data, uint256 msgValue)\",\n \"function buildBestSwap(address to, bool exactOut, address tokenIn, address tokenOut, uint256 swapAmount, uint256 slippageBps, uint256 deadline, uint24 hookPoolFee, int24 hookTickSpacing, address hookAddress) returns (tuple(uint8 source, uint256 feeBps, uint256 amountIn, uint256 amountOut) best, address target, bytes callData, uint256 amountLimit, uint256 msgValue)\",\n \"function V3_SWAP_ROUTER() view returns (address)\",\n \"function V4_ROUTER() view returns (address)\",\n \"function SWAPR_SWAP_ROUTER() view returns (address)\",\n \"function V4_QUOTER() view returns (address)\",\n] as const;\n\n/** Per-chain LensQuoter, official DEX routers, and wrapped native. */\nexport const CHAINS = {\n 1: {\n lensQuoter: \"0xaCE2C61E250c2d019b9Ed7FEf6A441022D6Ec7d2\",\n v3SwapRouter: \"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45\",\n v4Router: \"0x00000000000044a361Ae3cAc094c9D1b14Eece97\",\n swaprSwapRouter: \"0x0000000000000000000000000000000000000000\",\n wnative: \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\",\n },\n 10: {\n lensQuoter: \"0x591aF101cAf2b7351C74c25F5E64bC2E062D2843\",\n v3SwapRouter: \"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45\",\n v4Router: \"0x00000000000044a361Ae3cAc094c9D1b14Eece97\",\n swaprSwapRouter: \"0x0000000000000000000000000000000000000000\",\n wnative: \"0x4200000000000000000000000000000000000006\",\n },\n 100: {\n lensQuoter: \"0xE8E3d230C1c17C7249126036F170027a664d1FbA\",\n v3SwapRouter: \"0x0000000000000000000000000000000000000000\",\n v4Router: \"0x0000000000000000000000000000000000000000\",\n swaprSwapRouter: \"0xfFB643E73f280B97809A8b41f7232AB401a04ee1\",\n wnative: \"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d\",\n },\n 8453: {\n lensQuoter: \"0x591aF101cAf2b7351C74c25F5E64bC2E062D2843\",\n v3SwapRouter: \"0x2626664c2603336E57B271c5C0b26F421741e481\",\n v4Router: \"0x00000000000044a361Ae3cAc094c9D1b14Eece97\",\n swaprSwapRouter: \"0x0000000000000000000000000000000000000000\",\n wnative: \"0x4200000000000000000000000000000000000006\",\n },\n} as const;\n\nexport type ChainId = keyof typeof CHAINS;\n\nexport const ETH = \"0x0000000000000000000000000000000000000000\" as const;\n\n/** Gnosis sDAI — default ViaToken mid for native/WXDAI↔ERC20 on Gnosis (Seer). */\nexport const GNOSIS_sDAI = \"0xaf204776c7245bF4147c2612BF6e5972Ee483701\" as const;\n\n// ---- Types ----\n\nexport interface QuoteResult {\n amountIn: bigint;\n amountOut: bigint;\n /** Official DEX router to call. */\n target: string;\n /** Ready-to-send calldata for `target`. */\n data: string;\n msgValue: bigint;\n isTwoHop: boolean;\n sourceA: string;\n sourceB: string | null;\n}\n\nexport interface BaseQuoteParams {\n tokenIn: string;\n tokenOut: string;\n amount: bigint;\n}\n\nexport interface QuoteParams extends BaseQuoteParams {\n recipient: string;\n slippageBps?: number;\n deadline?: bigint;\n /** false = exactIn (default); true = exactOut. `amount` is amountIn or desired amountOut accordingly. */\n exactOut?: boolean;\n /** Optional V4 hooked-pool candidate (exactIn/exactOut; can beat the primary route). */\n hookPoolFee?: number;\n hookTickSpacing?: number;\n hookAddress?: string;\n /**\n * Intermediate token for two-hop routes (`buildBestSwapViaToken`).\n * When set, skips the native/ERC20 cascade. On Gnosis, native/WXDAI↔ERC20\n * already defaults to ViaToken(sDAI); use this only to force a different mid.\n */\n intermediate?: string;\n}\n\n// ---- Helpers ----\n\nexport function defaultDeadline(): bigint {\n return BigInt(Math.trunc(Date.now() / 1000) + 300);\n}\n"],"mappings":";AAKO,IAAK,MAAL,kBAAKA,SAAL;AACL,EAAAA,UAAA,YAAS,KAAT;AACA,EAAAA,UAAA,YAAS,KAAT;AACA,EAAAA,UAAA,mBAAgB,KAAhB;AACA,EAAAA,UAAA,cAAW,KAAX;AAJU,SAAAA;AAAA,GAAA;AAOL,IAAM,YAAiC;AAAA,EAC5C,CAAC,cAAU,GAAG;AAAA,EACd,CAAC,cAAU,GAAG;AAAA,EACd,CAAC,qBAAiB,GAAG;AAAA,EACrB,CAAC,gBAAY,GAAG;AAClB;AAGO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,SAAS;AAAA,EACpB,GAAG;AAAA,IACD,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,SAAS;AAAA,EACX;AAAA,EACA,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,SAAS;AAAA,EACX;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,SAAS;AAAA,EACX;AAAA,EACA,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,SAAS;AAAA,EACX;AACF;AAIO,IAAM,MAAM;AAGZ,IAAM,cAAc;AA2CpB,SAAS,kBAA0B;AACxC,SAAO,OAAO,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI,IAAI,GAAG;AACnD;","names":["AMM"]}