liquid-sdk 1.0.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 ADDED
@@ -0,0 +1,229 @@
1
+ # Liquid Protocol SDK
2
+
3
+ TypeScript SDK for the Liquid Protocol token launcher on Base. Deploy tokens, manage pools, and claim fees using [viem](https://viem.sh).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install liquid-protocol-sdk viem
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { createPublicClient, createWalletClient, http } from "viem";
15
+ import { privateKeyToAccount } from "viem/accounts";
16
+ import { base } from "viem/chains";
17
+ import { LiquidSDK } from "liquid-protocol-sdk";
18
+
19
+ const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
20
+
21
+ const publicClient = createPublicClient({
22
+ chain: base,
23
+ transport: http(),
24
+ });
25
+
26
+ const walletClient = createWalletClient({
27
+ account,
28
+ chain: base,
29
+ transport: http(),
30
+ });
31
+
32
+ const liquid = new LiquidSDK({ publicClient, walletClient });
33
+ ```
34
+
35
+ ## Deploy a Token
36
+
37
+ ```typescript
38
+ const result = await liquid.deployToken({
39
+ name: "My Token",
40
+ symbol: "MTK",
41
+ image: "ipfs://QmYourImageHash",
42
+ metadata: '{"description": "My token description"}',
43
+ });
44
+
45
+ console.log("Token deployed at:", result.tokenAddress);
46
+ console.log("Pool ID:", result.event.poolId);
47
+ console.log("Tx:", result.txHash);
48
+ ```
49
+
50
+ ### Deploy with Custom Configuration
51
+
52
+ ```typescript
53
+ import { ADDRESSES, EXTERNAL } from "liquid-protocol-sdk";
54
+
55
+ const result = await liquid.deployToken({
56
+ name: "Custom Token",
57
+ symbol: "CTK",
58
+
59
+ // Pool config
60
+ hook: ADDRESSES.HOOK_STATIC_FEE_V2, // use static fee hook
61
+ pairedToken: EXTERNAL.WETH,
62
+ tickSpacing: 60,
63
+ tickIfToken0IsLiquid: -198720,
64
+
65
+ // LP rewards: split 70/30 between creator and platform
66
+ rewardAdmins: [creatorAddress, platformAddress],
67
+ rewardRecipients: [creatorAddress, platformAddress],
68
+ rewardBps: [7000, 3000],
69
+
70
+ // Full-range single position
71
+ tickLower: [-887220],
72
+ tickUpper: [887220],
73
+ positionBps: [10000],
74
+
75
+ // MEV protection
76
+ mevModule: ADDRESSES.MEV_BLOCK_DELAY,
77
+ });
78
+ ```
79
+
80
+ ## Read Token Info
81
+
82
+ ```typescript
83
+ // Get ERC20 info + deployment details
84
+ const info = await liquid.getTokenInfo(tokenAddress);
85
+ console.log(info.name, info.symbol, info.decimals);
86
+ console.log("Hook:", info.deployment.hook);
87
+ console.log("Locker:", info.deployment.locker);
88
+
89
+ // Get deployment info only
90
+ const deployment = await liquid.getDeploymentInfo(tokenAddress);
91
+ ```
92
+
93
+ ## Pool Information
94
+
95
+ ```typescript
96
+ // Get pool fee configuration (dynamic fee hook)
97
+ const config = await liquid.getPoolConfig(poolId);
98
+ console.log("Base fee:", config.baseFee);
99
+ console.log("Max LP fee:", config.maxLpFee);
100
+
101
+ // Get current fee state
102
+ const feeState = await liquid.getPoolFeeState(poolId);
103
+ console.log("Reference tick:", feeState.referenceTick);
104
+ console.log("Last swap:", feeState.lastSwapTimestamp);
105
+
106
+ // Check pool creation time
107
+ const created = await liquid.getPoolCreationTimestamp(poolId);
108
+
109
+ // Check token ordering
110
+ const isToken0 = await liquid.isLiquidToken0(poolId);
111
+ ```
112
+
113
+ ## Claim Fees
114
+
115
+ ```typescript
116
+ // Check available fees
117
+ const available = await liquid.getAvailableFees(ownerAddress, tokenAddress);
118
+ const claimable = await liquid.getFeesToClaim(ownerAddress, tokenAddress);
119
+
120
+ console.log("Available:", available);
121
+ console.log("Claimable:", claimable);
122
+
123
+ // Claim fees
124
+ const txHash = await liquid.claimFees(ownerAddress, tokenAddress);
125
+ ```
126
+
127
+ ## Vault (Token Vesting)
128
+
129
+ ```typescript
130
+ // Check vault allocation
131
+ const allocation = await liquid.getVaultAllocation(tokenAddress);
132
+ console.log("Total:", allocation.amountTotal);
133
+ console.log("Claimed:", allocation.amountClaimed);
134
+ console.log("Lockup ends:", new Date(Number(allocation.lockupEndTime) * 1000));
135
+
136
+ // Check claimable amount
137
+ const claimable = await liquid.getVaultClaimable(tokenAddress);
138
+
139
+ // Claim vested tokens
140
+ const txHash = await liquid.claimVault(tokenAddress);
141
+ ```
142
+
143
+ ## Factory Status
144
+
145
+ ```typescript
146
+ // Check if factory is accepting new deployments
147
+ const deprecated = await liquid.isFactoryDeprecated();
148
+
149
+ // Check if a locker/hook pair is enabled
150
+ const enabled = await liquid.isLockerEnabled(lockerAddress, hookAddress);
151
+ ```
152
+
153
+ ## Constants & ABIs
154
+
155
+ All production addresses, fee parameters, and contract ABIs are exported:
156
+
157
+ ```typescript
158
+ import {
159
+ ADDRESSES, // Liquid Protocol contract addresses
160
+ EXTERNAL, // External protocol addresses (PoolManager, WETH, etc.)
161
+ FEE, // Fee constants (denominator, protocol fee, max fees)
162
+ TOKEN, // Token constants (supply, decimals, max extensions)
163
+ DEFAULT_CHAIN, // base chain object
164
+ DEFAULT_CHAIN_ID, // 8453
165
+
166
+ // ABIs for direct contract interaction
167
+ LiquidFactoryAbi,
168
+ LiquidFeeLockerAbi,
169
+ LiquidHookDynamicFeeV2Abi,
170
+ LiquidVaultAbi,
171
+ ERC20Abi,
172
+ } from "liquid-protocol-sdk";
173
+ ```
174
+
175
+ ## API Reference
176
+
177
+ ### `LiquidSDK`
178
+
179
+ #### Constructor
180
+
181
+ ```typescript
182
+ new LiquidSDK({ publicClient, walletClient? })
183
+ ```
184
+
185
+ - `publicClient` (required) - viem `PublicClient` connected to Base
186
+ - `walletClient` (optional) - viem `WalletClient` for write operations
187
+
188
+ #### Methods
189
+
190
+ | Method | Description | Requires Wallet |
191
+ |--------|-------------|:-:|
192
+ | `deployToken(params)` | Deploy a new token + pool | Yes |
193
+ | `getDeploymentInfo(token)` | Get deployment info (hook, locker, extensions) | No |
194
+ | `getTokenInfo(token)` | Get ERC20 info + deployment details | No |
195
+ | `getPoolConfig(poolId, hook?)` | Get dynamic fee pool configuration | No |
196
+ | `getPoolFeeState(poolId, hook?)` | Get current fee state variables | No |
197
+ | `getPoolCreationTimestamp(poolId, hook?)` | Get pool creation timestamp | No |
198
+ | `isLiquidToken0(poolId, hook?)` | Check if Liquid token is currency0 | No |
199
+ | `getAvailableFees(owner, token)` | Get available fee balance | No |
200
+ | `getFeesToClaim(owner, token)` | Get claimable fee balance | No |
201
+ | `claimFees(owner, token)` | Claim accumulated fees | Yes |
202
+ | `getVaultAllocation(token)` | Get vault vesting allocation | No |
203
+ | `getVaultClaimable(token)` | Get vested amount available to claim | No |
204
+ | `claimVault(token)` | Claim vested tokens from vault | Yes |
205
+ | `isFactoryDeprecated()` | Check if factory is deprecated | No |
206
+ | `isLockerEnabled(locker, hook)` | Check if locker/hook pair is enabled | No |
207
+
208
+ ## Production Addresses
209
+
210
+ All contracts are deployed on **Base** (chain ID 8453):
211
+
212
+ | Contract | Address |
213
+ |----------|---------|
214
+ | Factory | `0x0000003482fe299E72d4908368044A8A173BE576` |
215
+ | Hook Dynamic Fee V2 | `0x2A2F73CDDa098d639bd8Bbcd7dF2bf24E06728cC` |
216
+ | Hook Static Fee V2 | `0xb2401c5369AaCF62F8d615623C7F68F84da428Cc` |
217
+ | Fee Locker | `0x000008B9242b7e4432f6c4b1EeAD93562f9Cc94d` |
218
+ | LP Locker | `0x00000548732DfA56Be1257cE44D0CFc3B46dDb2A` |
219
+ | LP Locker Fee Conversion | `0x00000547518784420CEeF761fb18D884bb908102` |
220
+ | Vault | `0x000001c5263F4d64CdC343cDA9C8bF961CF8376c` |
221
+ | Sniper Auction V2 | `0x000007b64003ee07a69576F98859a0a36b854260` |
222
+ | Sniper Util V2 | `0x000003Ee0cb9B0C82C6C7FCB7b81a9883F285270` |
223
+ | MEV Block Delay | `0x0000035D83588954F3c581c3A66251b3F06AD5e4` |
224
+ | Airdrop V2 | `0x00000C222442512b08446D33dd9754a7F260BE79` |
225
+ | Pool Extension Allowlist | `0x000003Afb1b070F037D2871eE0A6b8c8f53F7B77` |
226
+
227
+ ## License
228
+
229
+ MIT