liquid-sdk 1.5.9 → 1.6.1

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 CHANGED
@@ -8,9 +8,10 @@ The SDK ships with **agent skill files** — self-contained markdown guides that
8
8
 
9
9
  | Skill | File | What it teaches |
10
10
  |-------|------|-----------------|
11
- | **Deploy Token** | `skills/deploy-token.md` | Full deployment workflows minimal deploy, dev buy, custom fees, custom positions, reward splits, validation rules |
11
+ | **SDK Overview** | `skills/sdk-overview.md` | Full capabilities, data schemas (metadata, context, rewards, vault, airdrop), default config load this first |
12
+ | **Deploy Token** | `skills/deploy-token.md` | Deployment workflows — minimal deploy, dev buy, custom fees, custom positions, reward splits |
12
13
  | **Bid in Auction** | `skills/bid-in-auction.md` | MEV sniper auction — WETH handling, gas price encoding, block timing, automated sniper example |
13
- | **Index Tokens** | `skills/index-tokens.md` | Token discovery — bulk queries, single lookup, pagination, real-time monitoring, data enrichment |
14
+ | **Index Tokens** | `skills/index-tokens.md` | Token discovery — bulk queries, single lookup, pagination, real-time monitoring |
14
15
 
15
16
  ### Using Skills with Your Agent
16
17
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "liquid-sdk",
3
- "version": "1.5.9",
3
+ "version": "1.6.1",
4
4
  "description": "TypeScript SDK to deploy ERC-20 tokens with Uniswap V4 liquidity on Base — zero API keys, one dependency (viem)",
5
5
  "author": "Liquid Protocol",
6
- "homepage": "https://github.com/craigbots/liquid-sdk#readme",
6
+ "homepage": "https://github.com/Liquid-Protocol-Ops/SDK#readme",
7
7
  "bugs": {
8
- "url": "https://github.com/craigbots/liquid-sdk/issues"
8
+ "url": "https://github.com/Liquid-Protocol-Ops/SDK/issues"
9
9
  },
10
10
  "main": "dist/index.js",
11
11
  "module": "dist/index.mjs",
@@ -49,7 +49,7 @@
49
49
  "license": "MIT",
50
50
  "repository": {
51
51
  "type": "git",
52
- "url": "https://github.com/craigbots/liquid-sdk"
52
+ "url": "https://github.com/Liquid-Protocol-Ops/SDK"
53
53
  },
54
54
  "keywords": [
55
55
  "liquid",
@@ -2,6 +2,33 @@
2
2
 
3
3
  You are an AI agent that participates in Liquid Protocol's sniper auction system. This skill teaches you how to bid for early access to newly launched tokens through the MEV auction mechanism on Base.
4
4
 
5
+ ## IMPORTANT: Risk Disclosure
6
+
7
+ **Before executing any auction bid, you MUST inform the user of the following risks and obtain explicit confirmation to proceed.**
8
+
9
+ Sniper auction participation involves significant financial risk:
10
+
11
+ 1. **High fees (up to 80%)**: During the auction window, swap fees start at 80% and decay to 40%. This means up to 80% of your swap input is taken as fees — you receive far fewer tokens than the input amount suggests.
12
+
13
+ 2. **Bid amount is non-refundable**: The ETH bid (`msg.value`) is paid to the protocol/LP holders regardless of whether the swap is profitable. If the token price drops, you lose both the bid and the trade.
14
+
15
+ 3. **Failed transactions still cost gas**: If your bid loses (outbid by higher gas price, wrong round, missed block), the transaction reverts but you still pay gas fees. On Base, gas is cheap, but repeated failures add up.
16
+
17
+ 4. **Tokens may have no liquidity or value**: Newly launched tokens are unaudited, may have no community, and can go to zero. The auction gives you early access — it does not guarantee the token has any value.
18
+
19
+ 5. **MEV competition**: Other bots and agents are competing in the same auction. You may be consistently outbid by more sophisticated actors with faster infrastructure.
20
+
21
+ 6. **Timing is critical and unreliable**: The auction is valid for exactly one block (~2 seconds on Base). Network latency, RPC delays, or block reorgs can cause your transaction to land in the wrong block and revert.
22
+
23
+ 7. **Smart contract risk**: The auction contracts are unaudited for this specific deployment. Bugs or misconfigurations could result in loss of funds.
24
+
25
+ **As an agent, you MUST:**
26
+ - Clearly present these risks to the user before their first auction bid
27
+ - Ask for explicit confirmation (e.g., "I understand the risks of auction sniping and want to proceed")
28
+ - Never execute auction bids autonomously without user approval for each bid, unless the user has explicitly granted standing permission
29
+ - Display the fee percentage and total cost (bid + swap + fees) before execution
30
+ - Recommend small amounts for initial bids until the user understands the mechanics
31
+
5
32
  ## How the Sniper Auction Works
6
33
 
7
34
  When a new token is deployed on Liquid Protocol, a **sniper auction** activates to price early trading activity and capture MEV. Here's the mechanism:
@@ -0,0 +1,332 @@
1
+ # Skill: Liquid SDK Overview
2
+
3
+ You are an AI agent working with the `liquid-sdk` package. This file gives you a complete picture of what the SDK can do, the data schemas it uses, and how all the pieces fit together. Load a specific skill file (`deploy-token.md`, `bid-in-auction.md`, `index-tokens.md`) when you need step-by-step instructions for a task.
4
+
5
+ ## What Liquid Protocol Does
6
+
7
+ Liquid Protocol deploys ERC-20 tokens on Base (chain ID 8453) with:
8
+ - **Uniswap V4 pools** created and funded automatically
9
+ - **Permanently locked LP** — liquidity cannot be rugged
10
+ - **Configurable fee splits** — reward recipients earn LP fees in ETH
11
+ - **MEV protection** — sniper auction prices early trading activity
12
+ - **Extensions** — dev buy, vault lockup/vesting, merkle airdrops
13
+
14
+ Every token gets 100 billion supply (18 decimals), a Uniswap V4 pool paired with WETH, and locked liquidity.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ npm install liquid-sdk viem
20
+ ```
21
+
22
+ ## SDK Capabilities at a Glance
23
+
24
+ | Category | What you can do |
25
+ |----------|----------------|
26
+ | **Deploy** | Launch tokens with custom fees, positions, reward splits, dev buys |
27
+ | **Snipe** | Bid in MEV auctions for early access to new tokens |
28
+ | **Index** | Discover all tokens, query by deployer, paginate by block range |
29
+ | **Fees** | Check and claim accumulated LP fees (converted to ETH) |
30
+ | **Rewards** | Collect LP rewards, update reward recipients |
31
+ | **Vault** | Check vesting schedules, claim unlocked tokens |
32
+ | **Airdrop** | Check allocations, claim with merkle proofs |
33
+ | **Pool reads** | Fee config, fee state, creation time, token sort order |
34
+ | **MEV reads** | Auction state, fee decay, gas peg, block delay |
35
+ | **Metadata** | Update token image and metadata on-chain (admin only) |
36
+
37
+ ## Data Schemas
38
+
39
+ ### Token Identity (set at deployment)
40
+
41
+ These fields define how the token appears in wallets, aggregators, and explorers:
42
+
43
+ ```typescript
44
+ const result = await sdk.deployToken({
45
+ name: "My Project Token", // Token name (required)
46
+ symbol: "MPT", // Token symbol (required)
47
+ image: "https://example.com/logo.png", // Logo URL (shown in wallets)
48
+ metadata: buildMetadata({ // Rich metadata (JSON, on-chain)
49
+ description: "A community token for builders on Base",
50
+ socialMediaUrls: [
51
+ { platform: "Website", url: "https://myproject.xyz" },
52
+ { platform: "Twitter", url: "https://x.com/myproject" },
53
+ { platform: "Discord", url: "https://discord.gg/myproject" },
54
+ { platform: "Telegram", url: "https://t.me/myproject" },
55
+ { platform: "GitHub", url: "https://github.com/myproject" },
56
+ ],
57
+ auditUrls: [
58
+ "https://audits.example.com/myproject-audit.pdf",
59
+ ],
60
+ }),
61
+ context: buildContext({ // Deployment provenance
62
+ interface: "My App",
63
+ platform: "Farcaster",
64
+ }),
65
+ });
66
+ ```
67
+
68
+ **After deployment, you can update image and metadata (admin only):**
69
+ ```typescript
70
+ await sdk.updateImage(tokenAddress, "https://new-logo.example.com/v2.png");
71
+ await sdk.updateMetadata(tokenAddress, buildMetadata({
72
+ description: "Updated description",
73
+ socialMediaUrls: [
74
+ { platform: "Website", url: "https://myproject.xyz" },
75
+ { platform: "Twitter", url: "https://x.com/myproject_new" },
76
+ ],
77
+ }));
78
+ ```
79
+
80
+ ### Token Metadata Schema
81
+
82
+ Stored in the `tokenMetadata` field of the `TokenCreated` event. Wallets (Rainbow, Coinbase Wallet) and aggregators (Matcha, 0x) read this.
83
+
84
+ ```typescript
85
+ import { buildMetadata, parseMetadata } from "liquid-sdk";
86
+
87
+ // Build
88
+ const metadata = buildMetadata({
89
+ description: "A community token for builders on Base",
90
+ socialMediaUrls: [
91
+ { platform: "Twitter", url: "https://x.com/myproject" },
92
+ { platform: "Discord", url: "https://discord.gg/myproject" },
93
+ { platform: "Telegram", url: "https://t.me/myproject" },
94
+ { platform: "Website", url: "https://myproject.xyz" },
95
+ ],
96
+ auditUrls: [
97
+ "https://audits.example.com/myproject-audit.pdf",
98
+ ],
99
+ });
100
+
101
+ // Parse (from on-chain event data)
102
+ const parsed = parseMetadata(tokenEvent.tokenMetadata);
103
+ // parsed.description — string
104
+ // parsed.socialMediaUrls — { platform: string, url: string }[]
105
+ // parsed.auditUrls — string[]
106
+ ```
107
+
108
+ **Schema:**
109
+ ```typescript
110
+ interface LiquidMetadata {
111
+ description?: string; // Token/project description
112
+ socialMediaUrls?: SocialMediaUrl[];// Links shown by wallets & aggregators
113
+ auditUrls?: string[]; // Audit report URLs
114
+ }
115
+
116
+ interface SocialMediaUrl {
117
+ platform: string; // "Website", "Twitter", "Discord", "Telegram", "GitHub", etc.
118
+ url: string; // Full URL
119
+ }
120
+ ```
121
+
122
+ **Common platform values:** `"Website"`, `"Twitter"`, `"Discord"`, `"Telegram"`, `"GitHub"`, `"Farcaster"`, `"Instagram"`, `"YouTube"`
123
+
124
+ ### Token Context (deployment provenance)
125
+
126
+ Stored in the `tokenContext` field. Tracks where/how the token was launched.
127
+
128
+ ```typescript
129
+ import { buildContext, parseContext } from "liquid-sdk";
130
+
131
+ // Build
132
+ const context = buildContext({
133
+ interface: "My Agent", // what system deployed it
134
+ platform: "Farcaster", // social platform (optional)
135
+ messageId: "0xabc123", // cast/post ID (optional)
136
+ id: "user-12345", // user ID on platform (optional)
137
+ });
138
+
139
+ // Parse
140
+ const parsed = parseContext(tokenEvent.tokenContext);
141
+ // parsed.interface — "My Agent"
142
+ // parsed.platform — "Farcaster"
143
+ // parsed.messageId — "0xabc123"
144
+ ```
145
+
146
+ **Schema:**
147
+ ```typescript
148
+ interface LiquidContext {
149
+ interface: string; // Required. System that deployed ("SDK", "Rainbow Wallet", etc.)
150
+ platform?: string; // Social platform origin
151
+ messageId?: string; // Social post/message ID
152
+ id?: string; // User ID on platform
153
+ }
154
+ ```
155
+
156
+ ### Reward Configuration
157
+
158
+ Set at deployment. Controls who receives LP fees and in what proportion.
159
+
160
+ ```typescript
161
+ // Deploy with custom reward splits
162
+ const result = await sdk.deployToken({
163
+ name: "Split Token",
164
+ symbol: "SPLIT",
165
+ rewardAdmins: [walletA, walletB, treasury],
166
+ rewardRecipients: [walletA, walletB, treasury],
167
+ rewardBps: [5000, 3000, 2000], // 50% / 30% / 20%
168
+ });
169
+
170
+ // Read reward config for any token
171
+ const rewards = await sdk.getTokenRewards(tokenAddress);
172
+ rewards.rewardRecipients // Address[] — who gets paid
173
+ rewards.rewardBps // number[] — basis points per recipient (sum = 10000)
174
+ rewards.rewardAdmins // Address[] — who can update each recipient
175
+ rewards.poolKey // PoolKey — the Uniswap V4 pool
176
+ rewards.positionId // bigint — LP position NFT ID
177
+ rewards.numPositions // bigint — number of LP positions
178
+
179
+ // Update a recipient (only the admin at that index can do this)
180
+ await sdk.updateRewardRecipient(tokenAddress, 0n, newWalletAddress);
181
+
182
+ // Collect rewards (distributes to all recipients per their bps)
183
+ await sdk.collectRewards(tokenAddress);
184
+ ```
185
+
186
+ **Rules:**
187
+ - `rewardRecipients`, `rewardAdmins`, and `rewardBps` arrays must be the same length
188
+ - `rewardBps` must sum to 10000 (100%)
189
+ - BPS splits are **immutable** after deployment — only recipient addresses can change
190
+ - Each admin can only update the recipient at their own index
191
+ - All fees are converted to ETH before distribution (default `FeePreference.Paired`)
192
+
193
+ ### Dev Buy (buy tokens at launch)
194
+
195
+ Buys tokens with ETH in the same transaction as deployment. The ETH is swapped through the Uniswap V4 pool atomically.
196
+
197
+ ```typescript
198
+ const result = await sdk.deployToken({
199
+ name: "My Token",
200
+ symbol: "MTK",
201
+ devBuy: {
202
+ ethAmount: parseEther("0.01"), // ETH to spend buying tokens
203
+ recipient: account.address, // who receives the purchased tokens
204
+ },
205
+ });
206
+ ```
207
+
208
+ **Schema:**
209
+ ```typescript
210
+ interface DevBuyParams {
211
+ ethAmount: bigint; // ETH to swap for tokens (sent as msg.value)
212
+ recipient: Address; // Address that receives the purchased tokens
213
+ }
214
+ ```
215
+
216
+ ### Vault (token lockup + vesting)
217
+
218
+ Lock tokens with a lockup period followed by linear vesting.
219
+
220
+ ```typescript
221
+ // Read vault state
222
+ const vault = await sdk.getVaultAllocation(tokenAddress);
223
+ vault.amountTotal // bigint — total tokens locked
224
+ vault.amountClaimed // bigint — already claimed
225
+ vault.lockupEndTime // bigint — unix timestamp when lockup ends
226
+ vault.vestingEndTime // bigint — unix timestamp when fully vested
227
+ vault.admin // Address — who can claim
228
+ vault.token // Address — the token
229
+
230
+ // Check claimable now
231
+ const claimable = await sdk.getVaultClaimable(tokenAddress);
232
+
233
+ // Claim
234
+ if (claimable > 0n) {
235
+ await sdk.claimVault(tokenAddress);
236
+ }
237
+ ```
238
+
239
+ ### Airdrop (merkle distribution)
240
+
241
+ Distribute tokens to a list of recipients via merkle proof claims.
242
+
243
+ ```typescript
244
+ // Read airdrop state
245
+ const info = await sdk.getAirdropInfo(tokenAddress);
246
+ info.merkleRoot // Hex — merkle root
247
+ info.totalSupply // bigint — total airdrop supply
248
+ info.totalClaimed // bigint — already claimed
249
+ info.lockupEndTime // bigint — when claims begin
250
+ info.vestingEndTime // bigint — when vesting completes
251
+ info.admin // Address — airdrop admin
252
+
253
+ // Check claimable for a recipient
254
+ const claimable = await sdk.getAirdropClaimable(tokenAddress, recipientAddress, allocatedAmount);
255
+
256
+ // Claim (proof must be generated off-chain from the merkle tree)
257
+ await sdk.claimAirdrop(tokenAddress, recipientAddress, allocatedAmount, merkleProof);
258
+ ```
259
+
260
+ ### Fee Claims
261
+
262
+ LP fees accrue from trading activity. The LP Locker Fee Conversion contract converts all fees to ETH before distributing.
263
+
264
+ ```typescript
265
+ // Check fees
266
+ const available = await sdk.getAvailableFees(ownerAddress, tokenAddress); // total unlocked
267
+ const claimable = await sdk.getFeesToClaim(ownerAddress, tokenAddress); // ready to claim
268
+
269
+ // Claim
270
+ if (claimable > 0n) {
271
+ await sdk.claimFees(ownerAddress, tokenAddress);
272
+ }
273
+ ```
274
+
275
+ ### Token Metadata Updates (post-deploy)
276
+
277
+ Only the token admin can update image and metadata after deployment.
278
+
279
+ ```typescript
280
+ // Update image
281
+ await sdk.updateImage(tokenAddress, "https://new-image.example.com/logo.png");
282
+
283
+ // Update metadata
284
+ await sdk.updateMetadata(tokenAddress, buildMetadata({
285
+ description: "Updated description",
286
+ socialMediaUrls: [
287
+ { platform: "Twitter", url: "https://twitter.com/updated" },
288
+ ],
289
+ }));
290
+ ```
291
+
292
+ ## Default Configuration
293
+
294
+ | Parameter | Default | Notes |
295
+ |-----------|---------|-------|
296
+ | Fee | 1% buy + 1% sell | Static, hook-controlled via `0x800000` flag |
297
+ | Fee conversion | All → ETH | `FeePreference.Paired` per recipient |
298
+ | Positions | 5-position Liquid layout | 10%/50%/15%/20%/5% from ~$20K to ~$1.2B |
299
+ | MEV module | Sniper Auction V2 | 80%→40% over 20s, 5 rounds, 2-block interval |
300
+ | Tick spacing | 200 | |
301
+ | Starting tick | -230400 | ~10 ETH / ~$20K market cap |
302
+ | Token supply | 100 billion (18 decimals) | Fixed for all tokens |
303
+ | Reward split | 100% to deployer | Customizable at deploy |
304
+ | Context | `{"interface":"SDK"}` | Auto-set, customizable |
305
+
306
+ ## Skill Files
307
+
308
+ For step-by-step instructions, load the relevant skill:
309
+
310
+ | Task | Skill file |
311
+ |------|-----------|
312
+ | Deploy a token | `skills/deploy-token.md` |
313
+ | Bid in a sniper auction | `skills/bid-in-auction.md` |
314
+ | Index/discover tokens | `skills/index-tokens.md` |
315
+
316
+ ## Exported Constants
317
+
318
+ ```typescript
319
+ import { ADDRESSES, EXTERNAL, FEE, TOKEN, DEFAULTS, POOL_POSITIONS } from "liquid-sdk";
320
+
321
+ // Key addresses
322
+ ADDRESSES.FACTORY // Token factory
323
+ ADDRESSES.HOOK_STATIC_FEE_V2 // Default hook (1% both ways)
324
+ ADDRESSES.LP_LOCKER_FEE_CONVERSION // Default locker (fees → ETH)
325
+ ADDRESSES.SNIPER_AUCTION_V2 // Default MEV module
326
+
327
+ // Fee constants
328
+ FEE.DENOMINATOR // 1,000,000
329
+ FEE.BPS // 10,000
330
+ TOKEN.SUPPLY // 100B * 10^18
331
+ TOKEN.DECIMALS // 18
332
+ ```