liquid-sdk 1.5.1 → 1.5.3

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/AGENT_README.md CHANGED
@@ -511,19 +511,18 @@ All addresses are exported as `ADDRESSES` and `EXTERNAL`:
511
511
  import { ADDRESSES, EXTERNAL } from "liquid-sdk";
512
512
 
513
513
  // Liquid Protocol contracts
514
- ADDRESSES.FACTORY // 0x0000003482fe299E72d4908368044A8A173BE576
515
- ADDRESSES.LP_LOCKER // 0x00000548732DfA56Be1257cE44D0CFc3B46dDb2A
516
- ADDRESSES.FEE_LOCKER // 0x000008B9242b7e4432f6c4b1EeAD93562f9Cc94d
517
- ADDRESSES.VAULT // 0x000001c5263F4d64CdC343cDA9C8bF961CF8376c
518
- ADDRESSES.HOOK_DYNAMIC_FEE_V2 // 0x2A2F73CDDa098d639bd8Bbcd7dF2bf24E06728cC
519
- ADDRESSES.HOOK_STATIC_FEE_V2 // 0xb2401c5369AaCF62F8d615623C7F68F84da428Cc
520
- ADDRESSES.AIRDROP_V2 // 0x00000C222442512b08446D33dd9754a7F260BE79
521
- ADDRESSES.SNIPER_AUCTION_V2 // 0x000007b64003ee07a69576F98859a0a36b854260
522
- ADDRESSES.SNIPER_UTIL_V2 // 0x000003Ee0cb9B0C82C6C7FCB7b81a9883F285270
523
- ADDRESSES.MEV_BLOCK_DELAY // 0x0000035D83588954F3c581c3A66251b3F06AD5e4
524
- ADDRESSES.UNIV4_ETH_DEV_BUY // 0x00000d7DE1f0A3FA7957F5d8A2b97B0E24e5783D
525
- ADDRESSES.POOL_EXTENSION_ALLOWLIST // 0x000003Afb1b070F037D2871eE0A6b8c8f53F7B77
526
- ADDRESSES.LIQUID_DEPLOYER_LIB // 0x00000f88b2d37A2006F2F0C8552d22E0b8945202
514
+ ADDRESSES.FACTORY // 0x04F1a284168743759BE6554f607a10CEBdB77760
515
+ ADDRESSES.LP_LOCKER_FEE_CONVERSION // 0x77247fCD1d5e34A3703AcA898A591Dc7422435f3
516
+ ADDRESSES.FEE_LOCKER // 0xF7d3BE3FC0de76fA5550C29A8F6fa53667B876FF
517
+ ADDRESSES.VAULT // 0xdFCCC93257c20519A9005A2281CFBdF84836d50E
518
+ ADDRESSES.HOOK_DYNAMIC_FEE_V2 // 0x80E2F7dC8C2C880BbC4BDF80A5Fb0eB8B1DB68CC
519
+ ADDRESSES.HOOK_STATIC_FEE_V2 // 0x9811f10Cd549c754Fa9E5785989c422A762c28cc
520
+ ADDRESSES.AIRDROP_V2 // 0x1423974d48f525462f1c087cBFdCC20BDBc33CdD
521
+ ADDRESSES.SNIPER_AUCTION_V2 // 0x187e8627c02c58F31831953C1268e157d3BfCefd
522
+ ADDRESSES.SNIPER_UTIL_V2 // 0x2B6cd5Be183c388Dd0074d53c52317df1414cd9f
523
+ ADDRESSES.MEV_DESCENDING_FEES // 0x8D6B080e48756A99F3893491D556B5d6907b6910
524
+ ADDRESSES.UNIV4_ETH_DEV_BUY // 0x5934097864dC487D21A7B4e4EEe201A39ceF728D
525
+ ADDRESSES.POOL_EXTENSION_ALLOWLIST // 0xb614167d79aDBaA9BA35d05fE1d5542d7316Ccaa
527
526
 
528
527
  // External (Uniswap V4 / Base)
529
528
  EXTERNAL.POOL_MANAGER // 0x498581fF718922c3f8e6A244956aF099B2652b2b
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Liquid Protocol
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -246,18 +246,18 @@ All contracts are deployed on **Base** (chain ID 8453):
246
246
 
247
247
  | Contract | Address |
248
248
  |----------|---------|
249
- | Factory | `0x0000003482fe299E72d4908368044A8A173BE576` |
250
- | Hook Dynamic Fee V2 | `0x2A2F73CDDa098d639bd8Bbcd7dF2bf24E06728cC` |
251
- | Hook Static Fee V2 | `0xb2401c5369AaCF62F8d615623C7F68F84da428Cc` |
252
- | Fee Locker | `0x000008B9242b7e4432f6c4b1EeAD93562f9Cc94d` |
253
- | LP Locker | `0x00000548732DfA56Be1257cE44D0CFc3B46dDb2A` |
254
- | LP Locker Fee Conversion | `0x00000547518784420CEeF761fb18D884bb908102` |
255
- | Vault | `0x000001c5263F4d64CdC343cDA9C8bF961CF8376c` |
256
- | Sniper Auction V2 | `0x000007b64003ee07a69576F98859a0a36b854260` |
257
- | Sniper Util V2 | `0x000003Ee0cb9B0C82C6C7FCB7b81a9883F285270` |
258
- | MEV Block Delay | `0x0000035D83588954F3c581c3A66251b3F06AD5e4` |
259
- | Airdrop V2 | `0x00000C222442512b08446D33dd9754a7F260BE79` |
260
- | Pool Extension Allowlist | `0x000003Afb1b070F037D2871eE0A6b8c8f53F7B77` |
249
+ | Factory | `0x04F1a284168743759BE6554f607a10CEBdB77760` |
250
+ | Hook Dynamic Fee V2 | `0x80E2F7dC8C2C880BbC4BDF80A5Fb0eB8B1DB68CC` |
251
+ | Hook Static Fee V2 | `0x9811f10Cd549c754Fa9E5785989c422A762c28cc` |
252
+ | Fee Locker | `0xF7d3BE3FC0de76fA5550C29A8F6fa53667B876FF` |
253
+ | LP Locker Fee Conversion | `0x77247fCD1d5e34A3703AcA898A591Dc7422435f3` |
254
+ | Vault | `0xdFCCC93257c20519A9005A2281CFBdF84836d50E` |
255
+ | Sniper Auction V2 | `0x187e8627c02c58F31831953C1268e157d3BfCefd` |
256
+ | Sniper Util V2 | `0x2B6cd5Be183c388Dd0074d53c52317df1414cd9f` |
257
+ | MEV Descending Fees | `0x8D6B080e48756A99F3893491D556B5d6907b6910` |
258
+ | Airdrop V2 | `0x1423974d48f525462f1c087cBFdCC20BDBc33CdD` |
259
+ | Pool Extension Allowlist | `0xb614167d79aDBaA9BA35d05fE1d5542d7316Ccaa` |
260
+ | Univ4 ETH Dev Buy | `0x5934097864dC487D21A7B4e4EEe201A39ceF728D` |
261
261
 
262
262
  ## License
263
263
 
package/dist/index.d.mts CHANGED
@@ -200,9 +200,16 @@ interface LiquidSDKConfig {
200
200
  interface BidInAuctionParams {
201
201
  /** The pool key identifying the token's Uniswap V4 pool */
202
202
  poolKey: PoolKey;
203
- /** True if swapping token0 → token1 (typically ETH → token) */
203
+ /**
204
+ * Swap direction. Set `true` when WETH is currency0 (buying token with ETH).
205
+ * Determine via: `poolKey.currency0.toLowerCase() === WETH.toLowerCase()`
206
+ */
204
207
  zeroForOne: boolean;
205
- /** Amount of input token (in wei) */
208
+ /**
209
+ * Amount of WETH to swap (in wei). Pulled from caller's WETH balance via
210
+ * `transferFrom` — separate from the bid. The SDK auto-wraps ETH → WETH
211
+ * and approves SniperUtilV2 if balance or allowance is insufficient.
212
+ */
206
213
  amountIn: bigint;
207
214
  /** Minimum output tokens to receive (slippage protection) */
208
215
  amountOutMinimum: bigint;
@@ -267,22 +274,30 @@ declare class LiquidSDK {
267
274
  * The auction lets bidders compete via gas price — the bid amount is
268
275
  * determined by how much your tx.gasprice exceeds the pool's gasPeg.
269
276
  *
277
+ * **Important:** The `amountIn` (swap input) is pulled from the caller's
278
+ * WETH balance via `transferFrom`. The SDK automatically wraps ETH → WETH
279
+ * and approves the SniperUtilV2 if needed. The `bidAmount` is sent as
280
+ * `msg.value` (separate from the swap).
281
+ *
282
+ * Gas price must exceed the pool's `gasPeg` — the delta encodes the bid.
283
+ * Both `maxFeePerGas` and `maxPriorityFeePerGas` are set to ensure the
284
+ * effective gas price matches on Base (EIP-1559). Gas estimation is skipped
285
+ * because `eth_estimateGas` simulates at `baseFee` which is below `gasPeg`.
286
+ *
270
287
  * @example
271
288
  * ```typescript
272
- * // 1. Get auction state
289
+ * // 1. Get auction state & pool key
273
290
  * const state = await sdk.getAuctionState(poolId);
291
+ * const rewards = await sdk.getTokenRewards(tokenAddress);
274
292
  *
275
293
  * // 2. Calculate gas price for desired bid
276
294
  * const gasPrice = await sdk.getAuctionGasPriceForBid(state.gasPeg, bidAmount);
277
295
  *
278
- * // 3. Get pool key from token rewards
279
- * const rewards = await sdk.getTokenRewards(tokenAddress);
280
- *
281
- * // 4. Bid
296
+ * // 3. Bid (SDK auto-wraps WETH + approves if needed)
282
297
  * const result = await sdk.bidInAuction({
283
298
  * poolKey: rewards.poolKey,
284
299
  * zeroForOne: true, // ETH → token
285
- * amountIn: parseEther("0.1"), // swap 0.1 ETH
300
+ * amountIn: parseEther("0.1"), // swap 0.1 ETH (pulled from WETH balance)
286
301
  * amountOutMinimum: 0n, // set slippage
287
302
  * round: state.round,
288
303
  * bidAmount: parseEther("0.01"),
package/dist/index.d.ts CHANGED
@@ -200,9 +200,16 @@ interface LiquidSDKConfig {
200
200
  interface BidInAuctionParams {
201
201
  /** The pool key identifying the token's Uniswap V4 pool */
202
202
  poolKey: PoolKey;
203
- /** True if swapping token0 → token1 (typically ETH → token) */
203
+ /**
204
+ * Swap direction. Set `true` when WETH is currency0 (buying token with ETH).
205
+ * Determine via: `poolKey.currency0.toLowerCase() === WETH.toLowerCase()`
206
+ */
204
207
  zeroForOne: boolean;
205
- /** Amount of input token (in wei) */
208
+ /**
209
+ * Amount of WETH to swap (in wei). Pulled from caller's WETH balance via
210
+ * `transferFrom` — separate from the bid. The SDK auto-wraps ETH → WETH
211
+ * and approves SniperUtilV2 if balance or allowance is insufficient.
212
+ */
206
213
  amountIn: bigint;
207
214
  /** Minimum output tokens to receive (slippage protection) */
208
215
  amountOutMinimum: bigint;
@@ -267,22 +274,30 @@ declare class LiquidSDK {
267
274
  * The auction lets bidders compete via gas price — the bid amount is
268
275
  * determined by how much your tx.gasprice exceeds the pool's gasPeg.
269
276
  *
277
+ * **Important:** The `amountIn` (swap input) is pulled from the caller's
278
+ * WETH balance via `transferFrom`. The SDK automatically wraps ETH → WETH
279
+ * and approves the SniperUtilV2 if needed. The `bidAmount` is sent as
280
+ * `msg.value` (separate from the swap).
281
+ *
282
+ * Gas price must exceed the pool's `gasPeg` — the delta encodes the bid.
283
+ * Both `maxFeePerGas` and `maxPriorityFeePerGas` are set to ensure the
284
+ * effective gas price matches on Base (EIP-1559). Gas estimation is skipped
285
+ * because `eth_estimateGas` simulates at `baseFee` which is below `gasPeg`.
286
+ *
270
287
  * @example
271
288
  * ```typescript
272
- * // 1. Get auction state
289
+ * // 1. Get auction state & pool key
273
290
  * const state = await sdk.getAuctionState(poolId);
291
+ * const rewards = await sdk.getTokenRewards(tokenAddress);
274
292
  *
275
293
  * // 2. Calculate gas price for desired bid
276
294
  * const gasPrice = await sdk.getAuctionGasPriceForBid(state.gasPeg, bidAmount);
277
295
  *
278
- * // 3. Get pool key from token rewards
279
- * const rewards = await sdk.getTokenRewards(tokenAddress);
280
- *
281
- * // 4. Bid
296
+ * // 3. Bid (SDK auto-wraps WETH + approves if needed)
282
297
  * const result = await sdk.bidInAuction({
283
298
  * poolKey: rewards.poolKey,
284
299
  * zeroForOne: true, // ETH → token
285
- * amountIn: parseEther("0.1"), // swap 0.1 ETH
300
+ * amountIn: parseEther("0.1"), // swap 0.1 ETH (pulled from WETH balance)
286
301
  * amountOutMinimum: 0n, // set slippage
287
302
  * round: state.round,
288
303
  * bidAmount: parseEther("0.01"),
package/dist/index.js CHANGED
@@ -1631,22 +1631,30 @@ var LiquidSDK = class {
1631
1631
  * The auction lets bidders compete via gas price — the bid amount is
1632
1632
  * determined by how much your tx.gasprice exceeds the pool's gasPeg.
1633
1633
  *
1634
+ * **Important:** The `amountIn` (swap input) is pulled from the caller's
1635
+ * WETH balance via `transferFrom`. The SDK automatically wraps ETH → WETH
1636
+ * and approves the SniperUtilV2 if needed. The `bidAmount` is sent as
1637
+ * `msg.value` (separate from the swap).
1638
+ *
1639
+ * Gas price must exceed the pool's `gasPeg` — the delta encodes the bid.
1640
+ * Both `maxFeePerGas` and `maxPriorityFeePerGas` are set to ensure the
1641
+ * effective gas price matches on Base (EIP-1559). Gas estimation is skipped
1642
+ * because `eth_estimateGas` simulates at `baseFee` which is below `gasPeg`.
1643
+ *
1634
1644
  * @example
1635
1645
  * ```typescript
1636
- * // 1. Get auction state
1646
+ * // 1. Get auction state & pool key
1637
1647
  * const state = await sdk.getAuctionState(poolId);
1648
+ * const rewards = await sdk.getTokenRewards(tokenAddress);
1638
1649
  *
1639
1650
  * // 2. Calculate gas price for desired bid
1640
1651
  * const gasPrice = await sdk.getAuctionGasPriceForBid(state.gasPeg, bidAmount);
1641
1652
  *
1642
- * // 3. Get pool key from token rewards
1643
- * const rewards = await sdk.getTokenRewards(tokenAddress);
1644
- *
1645
- * // 4. Bid
1653
+ * // 3. Bid (SDK auto-wraps WETH + approves if needed)
1646
1654
  * const result = await sdk.bidInAuction({
1647
1655
  * poolKey: rewards.poolKey,
1648
1656
  * zeroForOne: true, // ETH → token
1649
- * amountIn: parseEther("0.1"), // swap 0.1 ETH
1657
+ * amountIn: parseEther("0.1"), // swap 0.1 ETH (pulled from WETH balance)
1650
1658
  * amountOutMinimum: 0n, // set slippage
1651
1659
  * round: state.round,
1652
1660
  * bidAmount: parseEther("0.01"),
@@ -1657,6 +1665,44 @@ var LiquidSDK = class {
1657
1665
  if (!this.walletClient?.account) {
1658
1666
  throw new Error("walletClient with account required for bidInAuction");
1659
1667
  }
1668
+ const account = this.walletClient.account;
1669
+ const weth = EXTERNAL.WETH;
1670
+ const wethBalance = await this.publicClient.readContract({
1671
+ address: weth,
1672
+ abi: ERC20Abi,
1673
+ functionName: "balanceOf",
1674
+ args: [account.address]
1675
+ });
1676
+ if (wethBalance < params.amountIn) {
1677
+ const wrapAmount = params.amountIn - wethBalance;
1678
+ const wrapTx = await this.walletClient.writeContract({
1679
+ address: weth,
1680
+ abi: [{ type: "function", name: "deposit", inputs: [], outputs: [], stateMutability: "payable" }],
1681
+ functionName: "deposit",
1682
+ args: [],
1683
+ value: wrapAmount,
1684
+ chain: import_chains2.base,
1685
+ account
1686
+ });
1687
+ await this.publicClient.waitForTransactionReceipt({ hash: wrapTx });
1688
+ }
1689
+ const allowance = await this.publicClient.readContract({
1690
+ address: weth,
1691
+ abi: ERC20Abi,
1692
+ functionName: "allowance",
1693
+ args: [account.address, ADDRESSES.SNIPER_UTIL_V2]
1694
+ });
1695
+ if (allowance < params.amountIn) {
1696
+ const approveTx = await this.walletClient.writeContract({
1697
+ address: weth,
1698
+ abi: ERC20Abi,
1699
+ functionName: "approve",
1700
+ args: [ADDRESSES.SNIPER_UTIL_V2, params.amountIn * 10n],
1701
+ chain: import_chains2.base,
1702
+ account
1703
+ });
1704
+ await this.publicClient.waitForTransactionReceipt({ hash: approveTx });
1705
+ }
1660
1706
  const hookData = (0, import_viem2.encodeAbiParameters)(
1661
1707
  [
1662
1708
  {
@@ -1693,8 +1739,10 @@ var LiquidSDK = class {
1693
1739
  ],
1694
1740
  value: params.bidAmount,
1695
1741
  chain: import_chains2.base,
1696
- account: this.walletClient.account,
1697
- maxFeePerGas
1742
+ account,
1743
+ gas: 500000n,
1744
+ maxFeePerGas,
1745
+ maxPriorityFeePerGas: maxFeePerGas
1698
1746
  });
1699
1747
  return { txHash };
1700
1748
  }