liquid-sdk 1.0.0 → 1.2.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/README.md +71 -31
- package/dist/index.d.mts +645 -7
- package/dist/index.d.ts +645 -7
- package/dist/index.js +686 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +664 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,16 +5,18 @@ TypeScript SDK for the Liquid Protocol token launcher on Base. Deploy tokens, ma
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install liquid-
|
|
8
|
+
npm install liquid-sdk viem
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
> **Defaults**: Static 1% fee, 3-tranche liquidity (40%/50%/10% at $500K/$10M/$1B), Sniper Auction MEV (80%→40% over 32s), tick spacing 200, starting tick -230400 (~10 ETH market cap).
|
|
12
|
+
|
|
11
13
|
## Quick Start
|
|
12
14
|
|
|
13
15
|
```typescript
|
|
14
16
|
import { createPublicClient, createWalletClient, http } from "viem";
|
|
15
17
|
import { privateKeyToAccount } from "viem/accounts";
|
|
16
18
|
import { base } from "viem/chains";
|
|
17
|
-
import { LiquidSDK } from "liquid-
|
|
19
|
+
import { LiquidSDK } from "liquid-sdk";
|
|
18
20
|
|
|
19
21
|
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
|
|
20
22
|
|
|
@@ -47,33 +49,54 @@ console.log("Pool ID:", result.event.poolId);
|
|
|
47
49
|
console.log("Tx:", result.txHash);
|
|
48
50
|
```
|
|
49
51
|
|
|
50
|
-
### Deploy with Custom
|
|
52
|
+
### Deploy with Custom Market Cap Positions
|
|
51
53
|
|
|
52
54
|
```typescript
|
|
53
|
-
import {
|
|
55
|
+
import { createDefaultPositions, createPositionsUSD } from "liquid-sdk";
|
|
56
|
+
|
|
57
|
+
// Use default 3-tranche split ($500K / $10M / $1B) at current ETH price
|
|
58
|
+
const positions = createDefaultPositions(20_000, 2070); // $20K start, $2070/ETH
|
|
54
59
|
|
|
55
60
|
const result = await liquid.deployToken({
|
|
56
|
-
name: "
|
|
57
|
-
symbol: "
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
name: "My Token",
|
|
62
|
+
symbol: "MTK",
|
|
63
|
+
...positions, // tickLower, tickUpper, positionBps, tickIfToken0IsLiquid
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Or define fully custom tranches
|
|
67
|
+
const custom = createPositionsUSD(50_000, 2070, [
|
|
68
|
+
{ upperMarketCapUSD: 1_000_000, supplyPct: 30 },
|
|
69
|
+
{ upperMarketCapUSD: 50_000_000, supplyPct: 50 },
|
|
70
|
+
{ upperMarketCapUSD: 500_000_000, supplyPct: 20 },
|
|
71
|
+
]);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Deploy with Custom Fees
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { ADDRESSES, encodeStaticFeePoolData, encodeDynamicFeePoolData } from "liquid-sdk";
|
|
78
|
+
|
|
79
|
+
// Static 2% fee
|
|
80
|
+
const result = await liquid.deployToken({
|
|
81
|
+
name: "Custom Fee Token",
|
|
82
|
+
symbol: "CFT",
|
|
83
|
+
poolData: encodeStaticFeePoolData(200, 200), // 2% both directions
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Dynamic fee (1%-5% range)
|
|
87
|
+
const result2 = await liquid.deployToken({
|
|
88
|
+
name: "Dynamic Token",
|
|
89
|
+
symbol: "DYN",
|
|
90
|
+
hook: ADDRESSES.HOOK_DYNAMIC_FEE_V2,
|
|
91
|
+
poolData: encodeDynamicFeePoolData({
|
|
92
|
+
baseFeeBps: 100,
|
|
93
|
+
maxFeeBps: 500,
|
|
94
|
+
referenceTickFilterPeriod: 30,
|
|
95
|
+
resetPeriod: 120,
|
|
96
|
+
resetTickFilter: 200,
|
|
97
|
+
feeControlNumerator: 500000000n,
|
|
98
|
+
decayFilterBps: 7500,
|
|
99
|
+
}),
|
|
77
100
|
});
|
|
78
101
|
```
|
|
79
102
|
|
|
@@ -156,20 +179,37 @@ All production addresses, fee parameters, and contract ABIs are exported:
|
|
|
156
179
|
|
|
157
180
|
```typescript
|
|
158
181
|
import {
|
|
159
|
-
ADDRESSES,
|
|
160
|
-
EXTERNAL,
|
|
161
|
-
FEE,
|
|
162
|
-
TOKEN,
|
|
163
|
-
|
|
182
|
+
ADDRESSES, // Liquid Protocol contract addresses
|
|
183
|
+
EXTERNAL, // External protocol addresses (PoolManager, WETH, etc.)
|
|
184
|
+
FEE, // Fee constants (denominator, protocol fee, max fees)
|
|
185
|
+
TOKEN, // Token constants (supply, decimals, max extensions)
|
|
186
|
+
DEFAULTS, // Default deploy config (hook, fees, MEV, ticks)
|
|
187
|
+
POOL_POSITIONS, // Position presets (Standard, Liquid)
|
|
188
|
+
DEFAULT_CHAIN, // base chain object
|
|
164
189
|
DEFAULT_CHAIN_ID, // 8453
|
|
165
190
|
|
|
191
|
+
// Tick math & positions
|
|
192
|
+
getTickFromMarketCapETH,
|
|
193
|
+
getTickFromMarketCapUSD,
|
|
194
|
+
marketCapFromTickETH,
|
|
195
|
+
marketCapFromTickUSD,
|
|
196
|
+
createPositions,
|
|
197
|
+
createPositionsUSD,
|
|
198
|
+
createDefaultPositions,
|
|
199
|
+
describePositions,
|
|
200
|
+
|
|
201
|
+
// Encoding helpers
|
|
202
|
+
encodeStaticFeePoolData,
|
|
203
|
+
encodeDynamicFeePoolData,
|
|
204
|
+
encodeSniperAuctionData,
|
|
205
|
+
|
|
166
206
|
// ABIs for direct contract interaction
|
|
167
207
|
LiquidFactoryAbi,
|
|
168
208
|
LiquidFeeLockerAbi,
|
|
169
209
|
LiquidHookDynamicFeeV2Abi,
|
|
170
210
|
LiquidVaultAbi,
|
|
171
211
|
ERC20Abi,
|
|
172
|
-
} from "liquid-
|
|
212
|
+
} from "liquid-sdk";
|
|
173
213
|
```
|
|
174
214
|
|
|
175
215
|
## API Reference
|