liquid-sdk 1.4.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.d.mts CHANGED
@@ -197,6 +197,23 @@ interface LiquidSDKConfig {
197
197
  publicClient?: any;
198
198
  walletClient?: any;
199
199
  }
200
+ interface BidInAuctionParams {
201
+ /** The pool key identifying the token's Uniswap V4 pool */
202
+ poolKey: PoolKey;
203
+ /** True if swapping token0 → token1 (typically ETH → token) */
204
+ zeroForOne: boolean;
205
+ /** Amount of input token (in wei) */
206
+ amountIn: bigint;
207
+ /** Minimum output tokens to receive (slippage protection) */
208
+ amountOutMinimum: bigint;
209
+ /** The auction round to bid in (must match current round on-chain) */
210
+ round: bigint;
211
+ /** ETH bid amount — sent as msg.value, must equal (gasPrice - gasPeg) × paymentPerGasUnit */
212
+ bidAmount: bigint;
213
+ }
214
+ interface BidInAuctionResult {
215
+ txHash: Hash;
216
+ }
200
217
  interface DeployTokenResult {
201
218
  tokenAddress: Address;
202
219
  txHash: Hash;
@@ -244,6 +261,35 @@ declare class LiquidSDK {
244
261
  getAuctionDecayStartTime(poolId: Hex): Promise<bigint>;
245
262
  getAuctionMaxRounds(): Promise<bigint>;
246
263
  getAuctionGasPriceForBid(auctionGasPeg: bigint, desiredBidAmount: bigint): Promise<bigint>;
264
+ /**
265
+ * Bid in a sniper auction for early access to a newly launched token.
266
+ *
267
+ * The auction lets bidders compete via gas price — the bid amount is
268
+ * determined by how much your tx.gasprice exceeds the pool's gasPeg.
269
+ *
270
+ * @example
271
+ * ```typescript
272
+ * // 1. Get auction state
273
+ * const state = await sdk.getAuctionState(poolId);
274
+ *
275
+ * // 2. Calculate gas price for desired bid
276
+ * const gasPrice = await sdk.getAuctionGasPriceForBid(state.gasPeg, bidAmount);
277
+ *
278
+ * // 3. Get pool key from token rewards
279
+ * const rewards = await sdk.getTokenRewards(tokenAddress);
280
+ *
281
+ * // 4. Bid
282
+ * const result = await sdk.bidInAuction({
283
+ * poolKey: rewards.poolKey,
284
+ * zeroForOne: true, // ETH → token
285
+ * amountIn: parseEther("0.1"), // swap 0.1 ETH
286
+ * amountOutMinimum: 0n, // set slippage
287
+ * round: state.round,
288
+ * bidAmount: parseEther("0.01"),
289
+ * }, gasPrice);
290
+ * ```
291
+ */
292
+ bidInAuction(params: BidInAuctionParams, maxFeePerGas: bigint): Promise<BidInAuctionResult>;
247
293
  getAirdropInfo(tokenAddress: Address): Promise<AirdropInfo>;
248
294
  getAirdropClaimable(tokenAddress: Address, recipient: Address, allocatedAmount: bigint): Promise<bigint>;
249
295
  claimAirdrop(tokenAddress: Address, recipient: Address, allocatedAmount: bigint, proof: Hex[]): Promise<Hash>;
@@ -362,7 +408,7 @@ interface PoolPosition {
362
408
  declare const POOL_POSITIONS: {
363
409
  /** Single position, 100% of liquidity in one range */
364
410
  readonly Standard: PoolPosition[];
365
- /** 3-tranche Liquid default (hardcoded for ~10 ETH start, ~$2070/ETH) */
411
+ /** 5-position layout with concentrated mid-range liquidity */
366
412
  readonly Liquid: PoolPosition[];
367
413
  };
368
414
  /**
@@ -2421,4 +2467,4 @@ declare function parseContext(contextString: string): LiquidContext | null;
2421
2467
  */
2422
2468
  declare function parseMetadata(metadataString: string): LiquidMetadata | null;
2423
2469
 
2424
- export { ADDRESSES, type AirdropInfo, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, FeePreference, type GetTokensOptions, LiquidAirdropV2Abi, type LiquidContext, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, type LiquidMetadata, LiquidMevBlockDelayAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidTokenAbi, LiquidUniv4EthDevBuyAbi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, type SocialMediaUrl, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, buildContext, buildMetadata, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeFeeConversionLockerData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
2470
+ export { ADDRESSES, type AirdropInfo, type BidInAuctionParams, type BidInAuctionResult, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, FeePreference, type GetTokensOptions, LiquidAirdropV2Abi, type LiquidContext, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, type LiquidMetadata, LiquidMevBlockDelayAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidTokenAbi, LiquidUniv4EthDevBuyAbi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, type SocialMediaUrl, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, buildContext, buildMetadata, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeFeeConversionLockerData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
package/dist/index.d.ts CHANGED
@@ -197,6 +197,23 @@ interface LiquidSDKConfig {
197
197
  publicClient?: any;
198
198
  walletClient?: any;
199
199
  }
200
+ interface BidInAuctionParams {
201
+ /** The pool key identifying the token's Uniswap V4 pool */
202
+ poolKey: PoolKey;
203
+ /** True if swapping token0 → token1 (typically ETH → token) */
204
+ zeroForOne: boolean;
205
+ /** Amount of input token (in wei) */
206
+ amountIn: bigint;
207
+ /** Minimum output tokens to receive (slippage protection) */
208
+ amountOutMinimum: bigint;
209
+ /** The auction round to bid in (must match current round on-chain) */
210
+ round: bigint;
211
+ /** ETH bid amount — sent as msg.value, must equal (gasPrice - gasPeg) × paymentPerGasUnit */
212
+ bidAmount: bigint;
213
+ }
214
+ interface BidInAuctionResult {
215
+ txHash: Hash;
216
+ }
200
217
  interface DeployTokenResult {
201
218
  tokenAddress: Address;
202
219
  txHash: Hash;
@@ -244,6 +261,35 @@ declare class LiquidSDK {
244
261
  getAuctionDecayStartTime(poolId: Hex): Promise<bigint>;
245
262
  getAuctionMaxRounds(): Promise<bigint>;
246
263
  getAuctionGasPriceForBid(auctionGasPeg: bigint, desiredBidAmount: bigint): Promise<bigint>;
264
+ /**
265
+ * Bid in a sniper auction for early access to a newly launched token.
266
+ *
267
+ * The auction lets bidders compete via gas price — the bid amount is
268
+ * determined by how much your tx.gasprice exceeds the pool's gasPeg.
269
+ *
270
+ * @example
271
+ * ```typescript
272
+ * // 1. Get auction state
273
+ * const state = await sdk.getAuctionState(poolId);
274
+ *
275
+ * // 2. Calculate gas price for desired bid
276
+ * const gasPrice = await sdk.getAuctionGasPriceForBid(state.gasPeg, bidAmount);
277
+ *
278
+ * // 3. Get pool key from token rewards
279
+ * const rewards = await sdk.getTokenRewards(tokenAddress);
280
+ *
281
+ * // 4. Bid
282
+ * const result = await sdk.bidInAuction({
283
+ * poolKey: rewards.poolKey,
284
+ * zeroForOne: true, // ETH → token
285
+ * amountIn: parseEther("0.1"), // swap 0.1 ETH
286
+ * amountOutMinimum: 0n, // set slippage
287
+ * round: state.round,
288
+ * bidAmount: parseEther("0.01"),
289
+ * }, gasPrice);
290
+ * ```
291
+ */
292
+ bidInAuction(params: BidInAuctionParams, maxFeePerGas: bigint): Promise<BidInAuctionResult>;
247
293
  getAirdropInfo(tokenAddress: Address): Promise<AirdropInfo>;
248
294
  getAirdropClaimable(tokenAddress: Address, recipient: Address, allocatedAmount: bigint): Promise<bigint>;
249
295
  claimAirdrop(tokenAddress: Address, recipient: Address, allocatedAmount: bigint, proof: Hex[]): Promise<Hash>;
@@ -362,7 +408,7 @@ interface PoolPosition {
362
408
  declare const POOL_POSITIONS: {
363
409
  /** Single position, 100% of liquidity in one range */
364
410
  readonly Standard: PoolPosition[];
365
- /** 3-tranche Liquid default (hardcoded for ~10 ETH start, ~$2070/ETH) */
411
+ /** 5-position layout with concentrated mid-range liquidity */
366
412
  readonly Liquid: PoolPosition[];
367
413
  };
368
414
  /**
@@ -2421,4 +2467,4 @@ declare function parseContext(contextString: string): LiquidContext | null;
2421
2467
  */
2422
2468
  declare function parseMetadata(metadataString: string): LiquidMetadata | null;
2423
2469
 
2424
- export { ADDRESSES, type AirdropInfo, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, FeePreference, type GetTokensOptions, LiquidAirdropV2Abi, type LiquidContext, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, type LiquidMetadata, LiquidMevBlockDelayAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidTokenAbi, LiquidUniv4EthDevBuyAbi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, type SocialMediaUrl, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, buildContext, buildMetadata, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeFeeConversionLockerData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
2470
+ export { ADDRESSES, type AirdropInfo, type BidInAuctionParams, type BidInAuctionResult, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, FeePreference, type GetTokensOptions, LiquidAirdropV2Abi, type LiquidContext, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, type LiquidMetadata, LiquidMevBlockDelayAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidTokenAbi, LiquidUniv4EthDevBuyAbi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, type SocialMediaUrl, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, buildContext, buildMetadata, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeFeeConversionLockerData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
package/dist/index.js CHANGED
@@ -124,31 +124,37 @@ var POOL_POSITIONS = {
124
124
  positionBps: 1e4
125
125
  }
126
126
  ],
127
- /** 3-tranche Liquid default (hardcoded for ~10 ETH start, ~$2070/ETH) */
127
+ /** 5-position layout with concentrated mid-range liquidity */
128
128
  Liquid: [
129
129
  {
130
130
  tickLower: -230400,
131
- // ~$20K starting
132
- tickUpper: -198600,
133
- // ~$500K
134
- positionBps: 4e3
135
- // 40%
131
+ tickUpper: -216e3,
132
+ positionBps: 1e3
133
+ // 10%
136
134
  },
137
135
  {
138
- tickLower: -198600,
139
- // ~$500K
140
- tickUpper: -168600,
141
- // ~$10M
136
+ tickLower: -216e3,
137
+ tickUpper: -155e3,
142
138
  positionBps: 5e3
143
139
  // 50%
144
140
  },
145
141
  {
146
- tickLower: -168600,
147
- // ~$10M
148
- tickUpper: -122600,
149
- // ~$1B
150
- positionBps: 1e3
151
- // 10%
142
+ tickLower: -202e3,
143
+ tickUpper: -155e3,
144
+ positionBps: 1500
145
+ // 15%
146
+ },
147
+ {
148
+ tickLower: -155e3,
149
+ tickUpper: -12e4,
150
+ positionBps: 2e3
151
+ // 20%
152
+ },
153
+ {
154
+ tickLower: -141e3,
155
+ tickUpper: -12e4,
156
+ positionBps: 500
157
+ // 5%
152
158
  }
153
159
  ]
154
160
  };
@@ -1619,6 +1625,79 @@ var LiquidSDK = class {
1619
1625
  args: [auctionGasPeg, desiredBidAmount]
1620
1626
  });
1621
1627
  }
1628
+ /**
1629
+ * Bid in a sniper auction for early access to a newly launched token.
1630
+ *
1631
+ * The auction lets bidders compete via gas price — the bid amount is
1632
+ * determined by how much your tx.gasprice exceeds the pool's gasPeg.
1633
+ *
1634
+ * @example
1635
+ * ```typescript
1636
+ * // 1. Get auction state
1637
+ * const state = await sdk.getAuctionState(poolId);
1638
+ *
1639
+ * // 2. Calculate gas price for desired bid
1640
+ * const gasPrice = await sdk.getAuctionGasPriceForBid(state.gasPeg, bidAmount);
1641
+ *
1642
+ * // 3. Get pool key from token rewards
1643
+ * const rewards = await sdk.getTokenRewards(tokenAddress);
1644
+ *
1645
+ * // 4. Bid
1646
+ * const result = await sdk.bidInAuction({
1647
+ * poolKey: rewards.poolKey,
1648
+ * zeroForOne: true, // ETH → token
1649
+ * amountIn: parseEther("0.1"), // swap 0.1 ETH
1650
+ * amountOutMinimum: 0n, // set slippage
1651
+ * round: state.round,
1652
+ * bidAmount: parseEther("0.01"),
1653
+ * }, gasPrice);
1654
+ * ```
1655
+ */
1656
+ async bidInAuction(params, maxFeePerGas) {
1657
+ if (!this.walletClient?.account) {
1658
+ throw new Error("walletClient with account required for bidInAuction");
1659
+ }
1660
+ const hookData = (0, import_viem2.encodeAbiParameters)(
1661
+ [
1662
+ {
1663
+ type: "tuple",
1664
+ components: [
1665
+ { type: "bytes", name: "mevModuleSwapData" },
1666
+ { type: "bytes", name: "poolExtensionSwapData" }
1667
+ ]
1668
+ }
1669
+ ],
1670
+ [
1671
+ {
1672
+ mevModuleSwapData: (0, import_viem2.encodeAbiParameters)(
1673
+ [{ type: "address" }],
1674
+ [ADDRESSES.SNIPER_UTIL_V2]
1675
+ ),
1676
+ poolExtensionSwapData: "0x"
1677
+ }
1678
+ ]
1679
+ );
1680
+ const txHash = await this.walletClient.writeContract({
1681
+ address: ADDRESSES.SNIPER_UTIL_V2,
1682
+ abi: LiquidSniperUtilV2Abi,
1683
+ functionName: "bidInAuction",
1684
+ args: [
1685
+ {
1686
+ poolKey: params.poolKey,
1687
+ zeroForOne: params.zeroForOne,
1688
+ amountIn: params.amountIn,
1689
+ amountOutMinimum: params.amountOutMinimum,
1690
+ hookData
1691
+ },
1692
+ params.round
1693
+ ],
1694
+ value: params.bidAmount,
1695
+ chain: import_chains2.base,
1696
+ account: this.walletClient.account,
1697
+ maxFeePerGas
1698
+ });
1699
+ return { txHash };
1700
+ }
1622
1701
  // ── Airdrop ─────────────────────────────────────────────────────────
1623
1702
  async getAirdropInfo(tokenAddress) {
1624
1703
  const result = await this.publicClient.readContract({