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 +48 -2
- package/dist/index.d.ts +48 -2
- package/dist/index.js +95 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -67,31 +67,37 @@ var POOL_POSITIONS = {
|
|
|
67
67
|
positionBps: 1e4
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
|
-
/**
|
|
70
|
+
/** 5-position layout with concentrated mid-range liquidity */
|
|
71
71
|
Liquid: [
|
|
72
72
|
{
|
|
73
73
|
tickLower: -230400,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
//
|
|
77
|
-
positionBps: 4e3
|
|
78
|
-
// 40%
|
|
74
|
+
tickUpper: -216e3,
|
|
75
|
+
positionBps: 1e3
|
|
76
|
+
// 10%
|
|
79
77
|
},
|
|
80
78
|
{
|
|
81
|
-
tickLower: -
|
|
82
|
-
|
|
83
|
-
tickUpper: -168600,
|
|
84
|
-
// ~$10M
|
|
79
|
+
tickLower: -216e3,
|
|
80
|
+
tickUpper: -155e3,
|
|
85
81
|
positionBps: 5e3
|
|
86
82
|
// 50%
|
|
87
83
|
},
|
|
88
84
|
{
|
|
89
|
-
tickLower: -
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
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%
|
|
95
101
|
}
|
|
96
102
|
]
|
|
97
103
|
};
|
|
@@ -1562,6 +1568,79 @@ var LiquidSDK = class {
|
|
|
1562
1568
|
args: [auctionGasPeg, desiredBidAmount]
|
|
1563
1569
|
});
|
|
1564
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
|
+
}
|
|
1565
1644
|
// ── Airdrop ─────────────────────────────────────────────────────────
|
|
1566
1645
|
async getAirdropInfo(tokenAddress) {
|
|
1567
1646
|
const result = await this.publicClient.readContract({
|