liquid-sdk 1.3.2 → 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.mjs CHANGED
@@ -15,20 +15,21 @@ import { base as base2 } from "viem/chains";
15
15
  // src/constants.ts
16
16
  import { base } from "viem/chains";
17
17
  var ADDRESSES = {
18
- FACTORY: "0x0000003482fe299E72d4908368044A8A173BE576",
19
- POOL_EXTENSION_ALLOWLIST: "0x000003Afb1b070F037D2871eE0A6b8c8f53F7B77",
20
- FEE_LOCKER: "0x000008B9242b7e4432f6c4b1EeAD93562f9Cc94d",
21
- LP_LOCKER: "0x00000548732DfA56Be1257cE44D0CFc3B46dDb2A",
22
- LP_LOCKER_FEE_CONVERSION: "0x00000547518784420CEeF761fb18D884bb908102",
23
- VAULT: "0x000001c5263F4d64CdC343cDA9C8bF961CF8376c",
24
- HOOK_DYNAMIC_FEE_V2: "0x2A2F73CDDa098d639bd8Bbcd7dF2bf24E06728cC",
25
- HOOK_STATIC_FEE_V2: "0xb2401c5369AaCF62F8d615623C7F68F84da428Cc",
26
- SNIPER_AUCTION_V2: "0x000007b64003ee07a69576F98859a0a36b854260",
27
- SNIPER_UTIL_V2: "0x000003Ee0cb9B0C82C6C7FCB7b81a9883F285270",
28
- MEV_BLOCK_DELAY: "0x0000035D83588954F3c581c3A66251b3F06AD5e4",
29
- AIRDROP_V2: "0x00000C222442512b08446D33dd9754a7F260BE79",
30
- UNIV4_ETH_DEV_BUY: "0x00000d7DE1f0A3FA7957F5d8A2b97B0E24e5783D",
31
- LIQUID_DEPLOYER_LIB: "0x00000f88b2d37A2006F2F0C8552d22E0b8945202"
18
+ FACTORY: "0x04F1a284168743759BE6554f607a10CEBdB77760",
19
+ POOL_EXTENSION_ALLOWLIST: "0xb614167d79aDBaA9BA35d05fE1d5542d7316Ccaa",
20
+ FEE_LOCKER: "0xF7d3BE3FC0de76fA5550C29A8F6fa53667B876FF",
21
+ LP_LOCKER_FEE_CONVERSION: "0x77247fCD1d5e34A3703AcA898A591Dc7422435f3",
22
+ VAULT: "0xdFCCC93257c20519A9005A2281CFBdF84836d50E",
23
+ HOOK_DYNAMIC_FEE_V2: "0x80E2F7dC8C2C880BbC4BDF80A5Fb0eB8B1DB68CC",
24
+ HOOK_STATIC_FEE_V2: "0x9811f10Cd549c754Fa9E5785989c422A762c28cc",
25
+ SNIPER_AUCTION_V2: "0x187e8627c02c58F31831953C1268e157d3BfCefd",
26
+ SNIPER_UTIL_V2: "0x2B6cd5Be183c388Dd0074d53c52317df1414cd9f",
27
+ MEV_DESCENDING_FEES: "0x8D6B080e48756A99F3893491D556B5d6907b6910",
28
+ AIRDROP_V2: "0x1423974d48f525462f1c087cBFdCC20BDBc33CdD",
29
+ UNIV4_ETH_DEV_BUY: "0x5934097864dC487D21A7B4e4EEe201A39ceF728D",
30
+ UNIV3_ETH_DEV_BUY: "0x376028cfb6b9A120E24Aa14c3FAc4205179c0025",
31
+ PRESALE_ETH_TO_CREATOR: "0x3bca63EcB49d5f917092d10fA879Fdb422740163",
32
+ PRESALE_ALLOWLIST: "0xCBb4ccC4B94E23233c14759f4F9629F7dD01f10B"
32
33
  };
33
34
  var EXTERNAL = {
34
35
  POOL_MANAGER: "0x498581fF718922c3f8e6A244956aF099B2652b2b",
@@ -66,31 +67,37 @@ var POOL_POSITIONS = {
66
67
  positionBps: 1e4
67
68
  }
68
69
  ],
69
- /** 3-tranche Liquid default (hardcoded for ~10 ETH start, ~$2070/ETH) */
70
+ /** 5-position layout with concentrated mid-range liquidity */
70
71
  Liquid: [
71
72
  {
72
73
  tickLower: -230400,
73
- // ~$20K starting
74
- tickUpper: -198600,
75
- // ~$500K
76
- positionBps: 4e3
77
- // 40%
74
+ tickUpper: -216e3,
75
+ positionBps: 1e3
76
+ // 10%
78
77
  },
79
78
  {
80
- tickLower: -198600,
81
- // ~$500K
82
- tickUpper: -168600,
83
- // ~$10M
79
+ tickLower: -216e3,
80
+ tickUpper: -155e3,
84
81
  positionBps: 5e3
85
82
  // 50%
86
83
  },
87
84
  {
88
- tickLower: -168600,
89
- // ~$10M
90
- tickUpper: -122600,
91
- // ~$1B
92
- positionBps: 1e3
93
- // 10%
85
+ tickLower: -202e3,
86
+ tickUpper: -155e3,
87
+ positionBps: 1500
88
+ // 15%
89
+ },
90
+ {
91
+ tickLower: -155e3,
92
+ tickUpper: -12e4,
93
+ positionBps: 2e3
94
+ // 20%
95
+ },
96
+ {
97
+ tickLower: -141e3,
98
+ tickUpper: -12e4,
99
+ positionBps: 500
100
+ // 5%
94
101
  }
95
102
  ]
96
103
  };
@@ -1561,6 +1568,79 @@ var LiquidSDK = class {
1561
1568
  args: [auctionGasPeg, desiredBidAmount]
1562
1569
  });
1563
1570
  }
1571
+ /**
1572
+ * Bid in a sniper auction for early access to a newly launched token.
1573
+ *
1574
+ * The auction lets bidders compete via gas price — the bid amount is
1575
+ * determined by how much your tx.gasprice exceeds the pool's gasPeg.
1576
+ *
1577
+ * @example
1578
+ * ```typescript
1579
+ * // 1. Get auction state
1580
+ * const state = await sdk.getAuctionState(poolId);
1581
+ *
1582
+ * // 2. Calculate gas price for desired bid
1583
+ * const gasPrice = await sdk.getAuctionGasPriceForBid(state.gasPeg, bidAmount);
1584
+ *
1585
+ * // 3. Get pool key from token rewards
1586
+ * const rewards = await sdk.getTokenRewards(tokenAddress);
1587
+ *
1588
+ * // 4. Bid
1589
+ * const result = await sdk.bidInAuction({
1590
+ * poolKey: rewards.poolKey,
1591
+ * zeroForOne: true, // ETH → token
1592
+ * amountIn: parseEther("0.1"), // swap 0.1 ETH
1593
+ * amountOutMinimum: 0n, // set slippage
1594
+ * round: state.round,
1595
+ * bidAmount: parseEther("0.01"),
1596
+ * }, gasPrice);
1597
+ * ```
1598
+ */
1599
+ async bidInAuction(params, maxFeePerGas) {
1600
+ if (!this.walletClient?.account) {
1601
+ throw new Error("walletClient with account required for bidInAuction");
1602
+ }
1603
+ const hookData = encodeAbiParameters2(
1604
+ [
1605
+ {
1606
+ type: "tuple",
1607
+ components: [
1608
+ { type: "bytes", name: "mevModuleSwapData" },
1609
+ { type: "bytes", name: "poolExtensionSwapData" }
1610
+ ]
1611
+ }
1612
+ ],
1613
+ [
1614
+ {
1615
+ mevModuleSwapData: encodeAbiParameters2(
1616
+ [{ type: "address" }],
1617
+ [ADDRESSES.SNIPER_UTIL_V2]
1618
+ ),
1619
+ poolExtensionSwapData: "0x"
1620
+ }
1621
+ ]
1622
+ );
1623
+ const txHash = await this.walletClient.writeContract({
1624
+ address: ADDRESSES.SNIPER_UTIL_V2,
1625
+ abi: LiquidSniperUtilV2Abi,
1626
+ functionName: "bidInAuction",
1627
+ args: [
1628
+ {
1629
+ poolKey: params.poolKey,
1630
+ zeroForOne: params.zeroForOne,
1631
+ amountIn: params.amountIn,
1632
+ amountOutMinimum: params.amountOutMinimum,
1633
+ hookData
1634
+ },
1635
+ params.round
1636
+ ],
1637
+ value: params.bidAmount,
1638
+ chain: base2,
1639
+ account: this.walletClient.account,
1640
+ maxFeePerGas
1641
+ });
1642
+ return { txHash };
1643
+ }
1564
1644
  // ── Airdrop ─────────────────────────────────────────────────────────
1565
1645
  async getAirdropInfo(tokenAddress) {
1566
1646
  const result = await this.publicClient.readContract({
@@ -1680,14 +1760,14 @@ var LiquidSDK = class {
1680
1760
  // ── MEV Block Delay ─────────────────────────────────────────────────
1681
1761
  async getMevBlockDelay() {
1682
1762
  return await this.publicClient.readContract({
1683
- address: ADDRESSES.MEV_BLOCK_DELAY,
1763
+ address: ADDRESSES.MEV_DESCENDING_FEES,
1684
1764
  abi: LiquidMevBlockDelayAbi,
1685
1765
  functionName: "blockDelay"
1686
1766
  });
1687
1767
  }
1688
1768
  async getPoolUnlockTime(poolId) {
1689
1769
  return await this.publicClient.readContract({
1690
- address: ADDRESSES.MEV_BLOCK_DELAY,
1770
+ address: ADDRESSES.MEV_DESCENDING_FEES,
1691
1771
  abi: LiquidMevBlockDelayAbi,
1692
1772
  functionName: "poolUnlockTime",
1693
1773
  args: [poolId]