@clawnch/clawncher-sdk 0.1.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 +603 -0
- package/dist/abis.d.ts +935 -0
- package/dist/abis.d.ts.map +1 -0
- package/dist/abis.js +486 -0
- package/dist/abis.js.map +1 -0
- package/dist/addresses.d.ts +51 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +80 -0
- package/dist/addresses.js.map +1 -0
- package/dist/api-deployer-types.d.ts +165 -0
- package/dist/api-deployer-types.d.ts.map +1 -0
- package/dist/api-deployer-types.js +9 -0
- package/dist/api-deployer-types.js.map +1 -0
- package/dist/api-deployer.d.ts +114 -0
- package/dist/api-deployer.d.ts.map +1 -0
- package/dist/api-deployer.js +309 -0
- package/dist/api-deployer.js.map +1 -0
- package/dist/claimer.d.ts +197 -0
- package/dist/claimer.d.ts.map +1 -0
- package/dist/claimer.js +311 -0
- package/dist/claimer.js.map +1 -0
- package/dist/deployer.d.ts +229 -0
- package/dist/deployer.d.ts.map +1 -0
- package/dist/deployer.js +305 -0
- package/dist/deployer.js.map +1 -0
- package/dist/erc8004-types.d.ts +94 -0
- package/dist/erc8004-types.d.ts.map +1 -0
- package/dist/erc8004-types.js +8 -0
- package/dist/erc8004-types.js.map +1 -0
- package/dist/errors.d.ts +62 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +75 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +204 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +358 -0
- package/dist/index.js.map +1 -0
- package/dist/liquidity-types.d.ts +198 -0
- package/dist/liquidity-types.d.ts.map +1 -0
- package/dist/liquidity-types.js +8 -0
- package/dist/liquidity-types.js.map +1 -0
- package/dist/liquidity.d.ts +111 -0
- package/dist/liquidity.d.ts.map +1 -0
- package/dist/liquidity.js +608 -0
- package/dist/liquidity.js.map +1 -0
- package/dist/molten-types.d.ts +282 -0
- package/dist/molten-types.d.ts.map +1 -0
- package/dist/molten-types.js +8 -0
- package/dist/molten-types.js.map +1 -0
- package/dist/molten.d.ts +336 -0
- package/dist/molten.d.ts.map +1 -0
- package/dist/molten.js +560 -0
- package/dist/molten.js.map +1 -0
- package/dist/portfolio.d.ts +129 -0
- package/dist/portfolio.d.ts.map +1 -0
- package/dist/portfolio.js +218 -0
- package/dist/portfolio.js.map +1 -0
- package/dist/reader.d.ts +249 -0
- package/dist/reader.d.ts.map +1 -0
- package/dist/reader.js +488 -0
- package/dist/reader.js.map +1 -0
- package/dist/swap-types.d.ts +159 -0
- package/dist/swap-types.d.ts.map +1 -0
- package/dist/swap-types.js +22 -0
- package/dist/swap-types.js.map +1 -0
- package/dist/swap.d.ts +762 -0
- package/dist/swap.d.ts.map +1 -0
- package/dist/swap.js +345 -0
- package/dist/swap.js.map +1 -0
- package/dist/token-verification-data.d.ts +4 -0
- package/dist/token-verification-data.d.ts.map +1 -0
- package/dist/token-verification-data.js +6 -0
- package/dist/token-verification-data.js.map +1 -0
- package/dist/types.d.ts +244 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/uniswap-abis.d.ts +470 -0
- package/dist/uniswap-abis.d.ts.map +1 -0
- package/dist/uniswap-abis.js +322 -0
- package/dist/uniswap-abis.js.map +1 -0
- package/dist/uniswap-addresses.d.ts +38 -0
- package/dist/uniswap-addresses.d.ts.map +1 -0
- package/dist/uniswap-addresses.js +67 -0
- package/dist/uniswap-addresses.js.map +1 -0
- package/dist/vanity.d.ts +115 -0
- package/dist/vanity.d.ts.map +1 -0
- package/dist/vanity.js +166 -0
- package/dist/vanity.js.map +1 -0
- package/dist/verify.d.ts +88 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +181 -0
- package/dist/verify.js.map +1 -0
- package/dist/watcher.d.ts +112 -0
- package/dist/watcher.d.ts.map +1 -0
- package/dist/watcher.js +132 -0
- package/dist/watcher.js.map +1 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
# @clawnch/clawncher-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for [Clawncher](https://clawn.ch/er) - deploy tokens on Base with Uniswap V4 pools, MEV protection, and configurable fee distribution.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @clawnch/clawncher-sdk viem
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start - Token Deployment
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { ClawnchDeployer } from '@clawnch/clawncher-sdk';
|
|
15
|
+
import { createWalletClient, createPublicClient, http } from 'viem';
|
|
16
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
17
|
+
import { baseSepolia } from 'viem/chains';
|
|
18
|
+
|
|
19
|
+
const account = privateKeyToAccount('0x...');
|
|
20
|
+
const wallet = createWalletClient({
|
|
21
|
+
account,
|
|
22
|
+
chain: baseSepolia,
|
|
23
|
+
transport: http(),
|
|
24
|
+
});
|
|
25
|
+
const publicClient = createPublicClient({
|
|
26
|
+
chain: baseSepolia,
|
|
27
|
+
transport: http(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const deployer = new ClawnchDeployer({
|
|
31
|
+
wallet,
|
|
32
|
+
publicClient,
|
|
33
|
+
network: 'sepolia', // or 'mainnet'
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const result = await deployer.deploy({
|
|
37
|
+
name: 'My Token',
|
|
38
|
+
symbol: 'MYTKN',
|
|
39
|
+
tokenAdmin: account.address,
|
|
40
|
+
rewards: {
|
|
41
|
+
recipients: [{
|
|
42
|
+
recipient: account.address,
|
|
43
|
+
admin: account.address,
|
|
44
|
+
bps: 10000, // 100%
|
|
45
|
+
feePreference: 'Paired', // Receive fees in WETH
|
|
46
|
+
}],
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const { address } = await result.waitForTransaction();
|
|
51
|
+
console.log('Token deployed:', address);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Deployment Options
|
|
55
|
+
|
|
56
|
+
### Basic Deployment
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
const result = await deployer.deploy({
|
|
60
|
+
name: 'My Token',
|
|
61
|
+
symbol: 'MYTKN',
|
|
62
|
+
tokenAdmin: account.address,
|
|
63
|
+
image: 'https://example.com/logo.png',
|
|
64
|
+
metadata: {
|
|
65
|
+
description: 'A great token',
|
|
66
|
+
socialMediaUrls: [{ platform: 'twitter', url: 'https://twitter.com/mytoken' }],
|
|
67
|
+
},
|
|
68
|
+
rewards: {
|
|
69
|
+
recipients: [{
|
|
70
|
+
recipient: account.address,
|
|
71
|
+
admin: account.address,
|
|
72
|
+
bps: 10000,
|
|
73
|
+
feePreference: 'Paired',
|
|
74
|
+
}],
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### With Vault (Token Lockup + Vesting)
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const result = await deployer.deploy({
|
|
83
|
+
// ... basic options ...
|
|
84
|
+
vault: {
|
|
85
|
+
percentage: 10, // 10% of supply
|
|
86
|
+
lockupDuration: 7 * 24 * 60 * 60, // 7 days (minimum)
|
|
87
|
+
vestingDuration: 30 * 24 * 60 * 60, // 30 days linear vesting after lockup
|
|
88
|
+
recipient: account.address,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### With Dev Buy (Instant)
|
|
94
|
+
|
|
95
|
+
Buy tokens at launch with ETH - tokens sent directly to recipient:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { parseEther } from 'viem';
|
|
99
|
+
|
|
100
|
+
const result = await deployer.deploy({
|
|
101
|
+
// ... basic options ...
|
|
102
|
+
devBuy: {
|
|
103
|
+
ethAmount: parseEther('0.1'), // Spend 0.1 ETH
|
|
104
|
+
recipient: account.address, // Tokens sent immediately
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Multiple Reward Recipients
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
const result = await deployer.deploy({
|
|
113
|
+
// ... basic options ...
|
|
114
|
+
rewards: {
|
|
115
|
+
recipients: [
|
|
116
|
+
{
|
|
117
|
+
recipient: creatorAddress,
|
|
118
|
+
admin: creatorAddress,
|
|
119
|
+
bps: 8000, // 80%
|
|
120
|
+
feePreference: 'Paired',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
recipient: platformAddress,
|
|
124
|
+
admin: platformAddress,
|
|
125
|
+
bps: 2000, // 20%
|
|
126
|
+
feePreference: 'Paired',
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Fee Structure
|
|
134
|
+
|
|
135
|
+
**1% LP fee per swap**
|
|
136
|
+
- **80%** to deployer/reward recipients
|
|
137
|
+
- **20%** protocol (in WETH)
|
|
138
|
+
|
|
139
|
+
### Fee Preferences
|
|
140
|
+
|
|
141
|
+
- `'Clawnch'` - Receive fees in the deployed token (default)
|
|
142
|
+
- `'Paired'` - Receive fees in WETH
|
|
143
|
+
- `'Both'` - Receive fees in both tokens
|
|
144
|
+
|
|
145
|
+
## Vanity Addresses
|
|
146
|
+
|
|
147
|
+
Vanity addresses (0xb07 suffix) are handled by Clanker's remote service. Pass `vanity: true` (default) or `vanity: false` to disable.
|
|
148
|
+
|
|
149
|
+
## Extension Constraints
|
|
150
|
+
|
|
151
|
+
| Extension | Min | Max | Notes |
|
|
152
|
+
|-----------|-----|-----|-------|
|
|
153
|
+
| Vault | 1% | 90% | Lockup min 7 days |
|
|
154
|
+
| Dev Buy | > 0 ETH | - | Instant transfer |
|
|
155
|
+
| Airdrop | 1% | 90% | Lockup min 1 day |
|
|
156
|
+
|
|
157
|
+
## Reading On-Chain Data
|
|
158
|
+
|
|
159
|
+
Use `ClawnchReader` to read token data directly from the blockchain:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import { ClawnchReader } from '@clawnch/clawncher-sdk';
|
|
163
|
+
import { createPublicClient, http } from 'viem';
|
|
164
|
+
import { base } from 'viem/chains';
|
|
165
|
+
|
|
166
|
+
const publicClient = createPublicClient({
|
|
167
|
+
chain: base,
|
|
168
|
+
transport: http(),
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const reader = new ClawnchReader({
|
|
172
|
+
publicClient,
|
|
173
|
+
network: 'mainnet', // or 'sepolia'
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Get full token details (deployment, rewards, vault, vesting, MEV config)
|
|
177
|
+
const details = await reader.getTokenDetails('0xTokenAddress');
|
|
178
|
+
|
|
179
|
+
// Get vault allocation (lockup + vesting)
|
|
180
|
+
const vault = await reader.getVaultAllocation('0xTokenAddress');
|
|
181
|
+
|
|
182
|
+
// Get MEV protection config
|
|
183
|
+
const mev = await reader.getMevConfig('0xTokenAddress');
|
|
184
|
+
|
|
185
|
+
// Get available fees for a wallet
|
|
186
|
+
const fees = await reader.getAvailableFees('0xWallet', '0xToken');
|
|
187
|
+
|
|
188
|
+
// Check if token was deployed via Clawncher
|
|
189
|
+
const isClawnch = await reader.isClawnchToken('0xTokenAddress');
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Claiming Fees
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
import { ClawncherClaimer } from '@clawnch/clawncher-sdk';
|
|
196
|
+
|
|
197
|
+
const claimer = new ClawncherClaimer({ wallet, publicClient, network: 'mainnet' });
|
|
198
|
+
|
|
199
|
+
// Collect LP rewards (triggers fee collection from positions)
|
|
200
|
+
await claimer.collectRewards('0xToken...');
|
|
201
|
+
|
|
202
|
+
// Claim fees from FeeLocker
|
|
203
|
+
await claimer.claimFees('0xWallet...', '0xToken...');
|
|
204
|
+
|
|
205
|
+
// Claim vault allocation
|
|
206
|
+
await claimer.claimVault('0xToken...');
|
|
207
|
+
|
|
208
|
+
// Claim everything at once
|
|
209
|
+
await claimer.claimAll('0xToken...', { claimVault: true });
|
|
210
|
+
|
|
211
|
+
// Batch claim across multiple tokens
|
|
212
|
+
const result = await claimer.claimBatch(tokens, feeOwner, {
|
|
213
|
+
onProgress: (token, step) => console.log(`${token}: ${step}`),
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Dry Run
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
const result = await deployer.deploy({
|
|
221
|
+
...options,
|
|
222
|
+
dryRun: true,
|
|
223
|
+
});
|
|
224
|
+
// result.translatedConfig - the Clanker config (for inspection)
|
|
225
|
+
// result.estimatedGas - estimated gas
|
|
226
|
+
// result.estimatedCostEth - estimated cost in ETH
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Error Handling
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import { ClawnchDeployError, ClawnchErrorCode, isClawnchError } from '@clawnch/clawncher-sdk';
|
|
233
|
+
|
|
234
|
+
const result = await deployer.deploy(options);
|
|
235
|
+
if (isClawnchError(result.error)) {
|
|
236
|
+
console.log(result.error.code); // e.g. ClawnchErrorCode.INSUFFICIENT_FUNDS
|
|
237
|
+
console.log(result.error.cause); // original error if any
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Portfolio Tracking
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
import { ClawnchPortfolio } from '@clawnch/clawncher-sdk';
|
|
245
|
+
|
|
246
|
+
const portfolio = new ClawnchPortfolio({ publicClient, network: 'mainnet' });
|
|
247
|
+
const tokens = await portfolio.getTokensForWallet(wallet, knownTokens);
|
|
248
|
+
const claimable = await portfolio.getTotalClaimable(wallet, knownTokens);
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Live Watching
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import { ClawnchWatcher } from '@clawnch/clawncher-sdk';
|
|
255
|
+
|
|
256
|
+
const watcher = new ClawnchWatcher({ publicClient, network: 'mainnet' });
|
|
257
|
+
const unwatch = watcher.watchDeployments((event) => {
|
|
258
|
+
console.log(`New: ${event.tokenSymbol} at ${event.tokenAddress}`);
|
|
259
|
+
});
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Batch Fee Claiming
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
const result = await claimer.claimBatch(tokens, feeOwner, {
|
|
266
|
+
onProgress: (token, step) => console.log(`${token}: ${step}`),
|
|
267
|
+
});
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Token Swaps
|
|
271
|
+
|
|
272
|
+
Execute token swaps via 0x aggregation for best price across all Base DEXes.
|
|
273
|
+
Swaps are routed through the Clawnch API — no API key needed.
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
import { ClawnchSwapper, NATIVE_TOKEN_ADDRESS } from '@clawnch/clawncher-sdk';
|
|
277
|
+
import { parseEther } from 'viem';
|
|
278
|
+
|
|
279
|
+
const swapper = new ClawnchSwapper({
|
|
280
|
+
wallet,
|
|
281
|
+
publicClient,
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
// Get indicative price (read-only, no commitment)
|
|
285
|
+
const price = await swapper.getPrice({
|
|
286
|
+
sellToken: NATIVE_TOKEN_ADDRESS, // ETH
|
|
287
|
+
buyToken: '0xTokenAddress...',
|
|
288
|
+
sellAmount: parseEther('0.01'),
|
|
289
|
+
});
|
|
290
|
+
console.log('You would receive:', price.buyAmount);
|
|
291
|
+
console.log('Liquidity:', price.liquidityAvailable);
|
|
292
|
+
|
|
293
|
+
// Get firm quote (market makers commit assets)
|
|
294
|
+
const quote = await swapper.getQuote({
|
|
295
|
+
sellToken: NATIVE_TOKEN_ADDRESS,
|
|
296
|
+
buyToken: '0xTokenAddress...',
|
|
297
|
+
sellAmount: parseEther('0.01'),
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// Full swap execution: quote → approve → send → wait
|
|
301
|
+
const result = await swapper.swap({
|
|
302
|
+
sellToken: NATIVE_TOKEN_ADDRESS,
|
|
303
|
+
buyToken: '0xTokenAddress...',
|
|
304
|
+
sellAmount: parseEther('0.01'),
|
|
305
|
+
slippageBps: 100, // 1% (default)
|
|
306
|
+
});
|
|
307
|
+
console.log('Tx:', result.txHash);
|
|
308
|
+
console.log('Received:', result.buyAmount);
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Swap Helpers
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
// Token balance (ETH or ERC20)
|
|
315
|
+
const balance = await swapper.getBalance(tokenAddress);
|
|
316
|
+
|
|
317
|
+
// Token metadata
|
|
318
|
+
const decimals = await swapper.getDecimals(tokenAddress);
|
|
319
|
+
const symbol = await swapper.getSymbol(tokenAddress);
|
|
320
|
+
|
|
321
|
+
// Allowance management
|
|
322
|
+
const allowance = await swapper.getAllowance(token, owner, spender);
|
|
323
|
+
await swapper.approveToken(token, spender);
|
|
324
|
+
|
|
325
|
+
// Format amount to human-readable
|
|
326
|
+
const formatted = await swapper.formatAmount(tokenAddress, rawAmount);
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Swap Constants
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
import {
|
|
333
|
+
NATIVE_TOKEN_ADDRESS, // 0xEeee...eEEeE (0x representation of native ETH)
|
|
334
|
+
BASE_WETH, // 0x4200...0006
|
|
335
|
+
BASE_CHAIN_ID, // 8453
|
|
336
|
+
ZEROX_API_BASE, // https://api.0x.org
|
|
337
|
+
} from '@clawnch/clawncher-sdk';
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Liquidity Management
|
|
341
|
+
|
|
342
|
+
Manage Uniswap V3 and V4 liquidity positions on Base.
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
import { ClawnchLiquidity } from '@clawnch/clawncher-sdk';
|
|
346
|
+
|
|
347
|
+
const liquidity = new ClawnchLiquidity({ wallet, publicClient });
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### V3 Positions (Full CRUD)
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
// List all positions for a wallet
|
|
354
|
+
const positions = await liquidity.v3GetPositionsForWallet('0xWallet...');
|
|
355
|
+
|
|
356
|
+
// Get single position
|
|
357
|
+
const pos = await liquidity.v3GetPosition(tokenId);
|
|
358
|
+
console.log(pos.liquidity, pos.unclaimedFees);
|
|
359
|
+
|
|
360
|
+
// Mint new position
|
|
361
|
+
const result = await liquidity.v3MintPosition({
|
|
362
|
+
token0: '0xTokenA...',
|
|
363
|
+
token1: '0xTokenB...',
|
|
364
|
+
fee: 3000,
|
|
365
|
+
tickLower: -887220,
|
|
366
|
+
tickUpper: 887220,
|
|
367
|
+
amount0Desired: parseEther('1'),
|
|
368
|
+
amount1Desired: parseUnits('2000', 6),
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// Add liquidity to existing position
|
|
372
|
+
await liquidity.v3AddLiquidity(tokenId, {
|
|
373
|
+
amount0Desired: parseEther('0.5'),
|
|
374
|
+
amount1Desired: parseUnits('1000', 6),
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
// Remove 50% of liquidity
|
|
378
|
+
await liquidity.v3RemoveLiquidity(tokenId, {
|
|
379
|
+
percentageToRemove: 0.5,
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
// Remove 100% and burn NFT
|
|
383
|
+
await liquidity.v3RemoveLiquidity(tokenId, {
|
|
384
|
+
percentageToRemove: 1.0,
|
|
385
|
+
burnToken: true,
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// Collect unclaimed fees
|
|
389
|
+
const fees = await liquidity.v3CollectFees(tokenId);
|
|
390
|
+
|
|
391
|
+
// Filter positions by token
|
|
392
|
+
const tokenPositions = await liquidity.getPositionsForToken('0xToken...');
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### V4 Pool Reading
|
|
396
|
+
|
|
397
|
+
```typescript
|
|
398
|
+
// Read V4 pool state
|
|
399
|
+
const state = await liquidity.v4GetPoolState({
|
|
400
|
+
currency0: '0xTokenA...',
|
|
401
|
+
currency1: '0xTokenB...',
|
|
402
|
+
fee: 3000,
|
|
403
|
+
tickSpacing: 60,
|
|
404
|
+
hooks: '0x0000000000000000000000000000000000000000',
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
// Read V4 position
|
|
408
|
+
const pos = await liquidity.v4GetPosition(tokenId);
|
|
409
|
+
|
|
410
|
+
// Execute V4 multicall (use with @uniswap/v4-sdk calldata)
|
|
411
|
+
const { txHash, receipt } = await liquidity.v4ExecuteMulticall(calldata, ethValue);
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Uniswap Addresses
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
import {
|
|
418
|
+
getUniswapV4Addresses,
|
|
419
|
+
getUniswapV3Addresses,
|
|
420
|
+
getCommonAddresses,
|
|
421
|
+
} from '@clawnch/clawncher-sdk';
|
|
422
|
+
|
|
423
|
+
const v4 = getUniswapV4Addresses('mainnet');
|
|
424
|
+
// v4.poolManager, v4.positionManager, v4.stateView, v4.quoter, v4.permit2, ...
|
|
425
|
+
|
|
426
|
+
const v3 = getUniswapV3Addresses('mainnet');
|
|
427
|
+
// v3.factory, v3.nonfungiblePositionManager, v3.swapRouter, v3.quoterV2
|
|
428
|
+
|
|
429
|
+
const common = getCommonAddresses('mainnet');
|
|
430
|
+
// common.weth, common.usdc
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## API Client (Optional)
|
|
434
|
+
|
|
435
|
+
For API-based operations (tokens list, launches, analytics):
|
|
436
|
+
|
|
437
|
+
```typescript
|
|
438
|
+
import { ClawnchClient } from '@clawnch/clawncher-sdk';
|
|
439
|
+
|
|
440
|
+
const client = new ClawnchClient();
|
|
441
|
+
|
|
442
|
+
// Get all tokens from API
|
|
443
|
+
const tokens = await client.getTokens();
|
|
444
|
+
|
|
445
|
+
// Get launch history
|
|
446
|
+
const launches = await client.getLaunches({ limit: 10 });
|
|
447
|
+
|
|
448
|
+
// Get market stats
|
|
449
|
+
const stats = await client.getStats();
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
## Contract Addresses
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
import { getAddresses } from '@clawnch/clawncher-sdk';
|
|
456
|
+
|
|
457
|
+
const addresses = getAddresses('mainnet'); // or 'sepolia'
|
|
458
|
+
console.log(addresses.clawnch.factory);
|
|
459
|
+
console.log(addresses.clawnch.devBuy);
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Base Mainnet (v3 via Clanker)
|
|
463
|
+
|
|
464
|
+
| Contract | Address |
|
|
465
|
+
|----------|---------|
|
|
466
|
+
| Factory | `0xE85A59c628F7d27878ACeB4bf3b35733630083a9` |
|
|
467
|
+
| Hook | `0x6F5e57a4e81E93b8235710E3aA14E8c1d3d3bcb8` |
|
|
468
|
+
| LP Locker | `0x63D2DfEA64b3433F4071A98665bcD7Ca14d93496` |
|
|
469
|
+
| FeeLocker | `0x42A95190B4088C88Dd904d930c79deC1158bF09D` |
|
|
470
|
+
| Vault | `0xcC80d1226F899a78fC2E459a1500A13C373CE0A5` |
|
|
471
|
+
| DevBuy | `0x97fd42fcc8c4E2A5a45d0e28E14EC60FF7c10D9C` |
|
|
472
|
+
|
|
473
|
+
### Base Sepolia (v3 via Clanker)
|
|
474
|
+
|
|
475
|
+
| Contract | Address |
|
|
476
|
+
|----------|---------|
|
|
477
|
+
| Factory | `0xE85A59c628F7d27878ACeB4bf3b35733630083a9` |
|
|
478
|
+
| Hook | `0x6F5e57a4e81E93b8235710E3aA14E8c1d3d3bcb8` |
|
|
479
|
+
| LP Locker | `0x63D2DfEA64b3433F4071A98665bcD7Ca14d93496` |
|
|
480
|
+
| FeeLocker | `0x42A95190B4088C88Dd904d930c79deC1158bF09D` |
|
|
481
|
+
| Vault | `0xcC80d1226F899a78fC2E459a1500A13C373CE0A5` |
|
|
482
|
+
| DevBuy | `0x97fd42fcc8c4E2A5a45d0e28E14EC60FF7c10D9C` |
|
|
483
|
+
|
|
484
|
+
## Types
|
|
485
|
+
|
|
486
|
+
```typescript
|
|
487
|
+
import type {
|
|
488
|
+
// Deployer types
|
|
489
|
+
DeployOptions,
|
|
490
|
+
DeployResult,
|
|
491
|
+
VaultConfig,
|
|
492
|
+
DevBuyConfig,
|
|
493
|
+
RewardRecipient,
|
|
494
|
+
FeePreference,
|
|
495
|
+
NetworkName,
|
|
496
|
+
// Reader types
|
|
497
|
+
TokenDetails,
|
|
498
|
+
VaultAllocation,
|
|
499
|
+
MevConfigInfo,
|
|
500
|
+
TokenRewardInfo,
|
|
501
|
+
WalletFeeInfo,
|
|
502
|
+
// Error types
|
|
503
|
+
ClawnchErrorCode,
|
|
504
|
+
ClawnchDeployError,
|
|
505
|
+
// Dry run
|
|
506
|
+
DryRunResult,
|
|
507
|
+
// Batch claiming
|
|
508
|
+
BatchClaimResult,
|
|
509
|
+
// Portfolio
|
|
510
|
+
PortfolioToken,
|
|
511
|
+
// Watcher
|
|
512
|
+
NewTokenEvent,
|
|
513
|
+
// Swap types
|
|
514
|
+
SwapperConfig,
|
|
515
|
+
SwapParams,
|
|
516
|
+
SwapPriceResult,
|
|
517
|
+
SwapQuoteResult,
|
|
518
|
+
SwapResult,
|
|
519
|
+
SwapTransaction,
|
|
520
|
+
// Liquidity types
|
|
521
|
+
LiquidityConfig,
|
|
522
|
+
V4PoolKey,
|
|
523
|
+
V4PoolState,
|
|
524
|
+
V3MintParams,
|
|
525
|
+
V3AddLiquidityParams,
|
|
526
|
+
V3RemoveLiquidityParams,
|
|
527
|
+
PositionInfo,
|
|
528
|
+
MintResult,
|
|
529
|
+
ModifyLiquidityResult,
|
|
530
|
+
CollectFeesResult,
|
|
531
|
+
// Uniswap address types
|
|
532
|
+
UniswapV4Addresses,
|
|
533
|
+
UniswapV3Addresses,
|
|
534
|
+
CommonAddresses,
|
|
535
|
+
// Verified agent launch types
|
|
536
|
+
ClawnchApiDeployer,
|
|
537
|
+
ApiDeployerConfig,
|
|
538
|
+
RegisterConfig,
|
|
539
|
+
RegisterRequest,
|
|
540
|
+
VerifyResponse,
|
|
541
|
+
AgentStatus,
|
|
542
|
+
ApiDeployRequest,
|
|
543
|
+
ApiDeployResponse,
|
|
544
|
+
ApprovalResult,
|
|
545
|
+
CaptchaChallenge,
|
|
546
|
+
CaptchaSolution,
|
|
547
|
+
} from '@clawnch/clawncher-sdk';
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
## Verified Agent Launches
|
|
551
|
+
|
|
552
|
+
Deploy tokens via the Clawnch API to receive a verified badge. The `ClawnchApiDeployer` handles registration, captcha solving, and deployment.
|
|
553
|
+
|
|
554
|
+
> **Note:** Server-side API endpoints are pending deployment. The SDK client is ready.
|
|
555
|
+
|
|
556
|
+
```typescript
|
|
557
|
+
import { ClawnchApiDeployer } from '@clawnch/clawncher-sdk';
|
|
558
|
+
|
|
559
|
+
// One-time registration (returns API key)
|
|
560
|
+
const { apiKey } = await ClawnchApiDeployer.register(
|
|
561
|
+
{ wallet, publicClient },
|
|
562
|
+
{ name: 'MyAgent', wallet: account.address, description: 'AI trading agent' }
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
// Create deployer with API key
|
|
566
|
+
const apiDeployer = new ClawnchApiDeployer({
|
|
567
|
+
apiKey,
|
|
568
|
+
wallet,
|
|
569
|
+
publicClient,
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
// One-time $CLAWNCH approval
|
|
573
|
+
await apiDeployer.approveClawnch();
|
|
574
|
+
|
|
575
|
+
// Deploy a verified token
|
|
576
|
+
const result = await apiDeployer.deploy({
|
|
577
|
+
name: 'My Token',
|
|
578
|
+
symbol: 'MYTKN',
|
|
579
|
+
image: 'https://example.com/logo.png',
|
|
580
|
+
});
|
|
581
|
+
console.log('Token:', result.tokenAddress);
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
**Methods:**
|
|
585
|
+
|
|
586
|
+
| Method | Description |
|
|
587
|
+
|--------|-------------|
|
|
588
|
+
| `ClawnchApiDeployer.register(config, request)` | Register agent, receive API key |
|
|
589
|
+
| `getStatus()` | Agent verification status and balance |
|
|
590
|
+
| `approveClawnch(spender?)` | One-time $CLAWNCH max approval |
|
|
591
|
+
| `getClawnchAllowance(spender)` | Check $CLAWNCH allowance |
|
|
592
|
+
| `getClawnchBalance()` | Check $CLAWNCH balance |
|
|
593
|
+
| `deploy(request)` | Full verified deploy flow |
|
|
594
|
+
|
|
595
|
+
## Links
|
|
596
|
+
|
|
597
|
+
- **Website:** https://clawn.ch/er
|
|
598
|
+
- **CLI:** `npm install -g clawncher`
|
|
599
|
+
- **Documentation:** https://clawn.ch/er/docs
|
|
600
|
+
|
|
601
|
+
## License
|
|
602
|
+
|
|
603
|
+
MIT
|