@clawnch/clawncher-sdk 2.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,331 @@
1
+ # @clawnch/sdk
2
+
3
+ TypeScript SDK for [Clawnch](https://clawn.ch) - deploy tokens on Base with Uniswap V4 pools, earn trading fees.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @clawnch/sdk
9
+ ```
10
+
11
+ ## Quick Start - Token Deployment
12
+
13
+ ```typescript
14
+ import { ClawnchDeployer } from '@clawnch/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
+ ### With Vested Dev Buy (Lockup + Vesting)
110
+
111
+ Buy tokens at launch with ETH - tokens held with lockup and linear vesting:
112
+
113
+ ```typescript
114
+ const result = await deployer.deploy({
115
+ // ... basic options ...
116
+ vestedDevBuy: {
117
+ ethAmount: parseEther('0.1'),
118
+ recipient: account.address,
119
+ lockupDuration: 7 * 24 * 60 * 60, // 7 days minimum
120
+ vestingDuration: 90 * 24 * 60 * 60, // 90 days (30-365 days allowed)
121
+ },
122
+ });
123
+ ```
124
+
125
+ ### Multiple Reward Recipients
126
+
127
+ ```typescript
128
+ const result = await deployer.deploy({
129
+ // ... basic options ...
130
+ rewards: {
131
+ recipients: [
132
+ {
133
+ recipient: creatorAddress,
134
+ admin: creatorAddress,
135
+ bps: 8000, // 80%
136
+ feePreference: 'Paired',
137
+ },
138
+ {
139
+ recipient: platformAddress,
140
+ admin: platformAddress,
141
+ bps: 2000, // 20%
142
+ feePreference: 'Paired',
143
+ },
144
+ ],
145
+ },
146
+ });
147
+ ```
148
+
149
+ ## Fee Structure
150
+
151
+ **1% LP fee per swap**
152
+ - **80%** → Deployer/reward recipients (default: in token)
153
+ - **20%** → Protocol (Clawncher, in WETH)
154
+
155
+ ### Fee Preferences
156
+
157
+ - `'Clawnch'` - Receive fees in the deployed token (default)
158
+ - `'Paired'` - Receive fees in WETH
159
+ - `'Both'` - Receive fees in both tokens
160
+
161
+ ## Vanity Addresses
162
+
163
+ By default, all tokens are deployed with addresses starting with `0xccc`:
164
+
165
+ ```typescript
166
+ // Default: mines for 0xccc... address
167
+ const result = await deployer.deploy({
168
+ name: 'My Token',
169
+ symbol: 'MYTKN',
170
+ // ... other options
171
+ });
172
+
173
+ // Custom prefix
174
+ const result = await deployer.deploy({
175
+ // ... other options
176
+ vanity: {
177
+ prefix: 'dead', // Will be 0xdead...
178
+ onProgress: (attempts, rate) => {
179
+ console.log(`Mining: ${attempts} attempts, ${rate}/sec`);
180
+ },
181
+ },
182
+ });
183
+
184
+ // Disable vanity mining
185
+ const result = await deployer.deploy({
186
+ // ... other options
187
+ vanity: { enabled: false },
188
+ });
189
+
190
+ // Result includes vanity mining stats
191
+ console.log(result.vanityResult?.attempts); // Number of attempts
192
+ console.log(result.vanityResult?.timeMs); // Time taken in ms
193
+ console.log(result.vanityResult?.address); // Predicted address
194
+ ```
195
+
196
+ ## Extension Constraints
197
+
198
+ | Extension | Min | Max | Notes |
199
+ |-----------|-----|-----|-------|
200
+ | Vault | 1% | 90% | Lockup min 7 days |
201
+ | Vested Dev Buy | - | - | Lockup min 7 days, vesting 30-365 days |
202
+ | Dev Buy | > 0 ETH | - | Instant transfer |
203
+ | Airdrop | 1% | 90% | Lockup min 1 day |
204
+
205
+ ## Reading On-Chain Data
206
+
207
+ Use `ClawnchReader` to read token data directly from the blockchain:
208
+
209
+ ```typescript
210
+ import { ClawnchReader } from '@clawnch/sdk';
211
+ import { createPublicClient, http } from 'viem';
212
+ import { base } from 'viem/chains';
213
+
214
+ const publicClient = createPublicClient({
215
+ chain: base,
216
+ transport: http(),
217
+ });
218
+
219
+ const reader = new ClawnchReader({
220
+ publicClient,
221
+ network: 'mainnet', // or 'sepolia'
222
+ });
223
+
224
+ // Get full token details (deployment, rewards, vault, vesting, MEV config)
225
+ const details = await reader.getTokenDetails('0xTokenAddress');
226
+
227
+ // Get vault allocation (lockup + vesting)
228
+ const vault = await reader.getVaultAllocation('0xTokenAddress');
229
+
230
+ // Get vested dev buy allocation
231
+ const vested = await reader.getVestedDevBuyAllocation('0xTokenAddress');
232
+
233
+ // Get MEV protection config
234
+ const mev = await reader.getMevConfig('0xTokenAddress');
235
+
236
+ // Get available fees for a wallet
237
+ const fees = await reader.getAvailableFees('0xWallet', '0xToken');
238
+
239
+ // Check if token was deployed via Clawnch
240
+ const isClawnch = await reader.isClawnchToken('0xTokenAddress');
241
+ ```
242
+
243
+ ## API Client (Optional)
244
+
245
+ For API-based operations (tokens list, launches, analytics):
246
+
247
+ ```typescript
248
+ import { ClawnchClient } from '@clawnch/sdk';
249
+
250
+ const client = new ClawnchClient();
251
+
252
+ // Get all tokens from API
253
+ const tokens = await client.getTokens();
254
+
255
+ // Get launch history
256
+ const launches = await client.getLaunches({ limit: 10 });
257
+
258
+ // Get market stats
259
+ const stats = await client.getStats();
260
+ ```
261
+
262
+ ## Contract Addresses
263
+
264
+ ```typescript
265
+ import { getAddresses } from '@clawnch/sdk';
266
+
267
+ const addresses = getAddresses('sepolia'); // or 'mainnet'
268
+ console.log(addresses.clawnch.factory);
269
+ console.log(addresses.clawnch.vestedDevBuy);
270
+ ```
271
+
272
+ ### Base Mainnet
273
+
274
+ | Contract | Address |
275
+ |----------|---------|
276
+ | Factory | `0xe31CD9ED1fF67ba51B337C17C2f7da57f7be0166` |
277
+ | Hook | `0x194Ba81CBfd2a7d7E3dFb58969D5E82da31a28CC` |
278
+ | Locker | `0x1c0FF3bB6aBb661e108Ab5A1C003a64316ca20B9` |
279
+ | FeeLocker | `0x3325a1BDc3d28510761bA51Ac9A6995911B183ec` |
280
+ | MevModule | `0xe835EC85aA00195d4AF865a31500bF50da63A715` |
281
+ | Vault | `0xf9e53eCB6221B052ba32595449633dAf5cbe14e2` |
282
+ | AirdropV2 | `0x0DF681a4895853a45Fe08729db034B270445226c` |
283
+ | DevBuy | `0x34722dAf010EB0a5BD70Fb4f660D3C0080879208` |
284
+ | VestedDevBuy | `0x699bcd1df91571F4B150E07B7A1b042Fc8616b8C` |
285
+
286
+ ### Base Sepolia (Testnet)
287
+
288
+ | Contract | Address |
289
+ |----------|---------|
290
+ | Factory | `0xC5F06159BBFfb0eBEA6354fE5fD442329C064138` |
291
+ | Hook | `0x63CFA9D50828d9bC54e089D9f2fC24B423bD28cC` |
292
+ | Locker | `0xE60dCA4727A18e8D5b4BFd05E1cd22bad447DEf3` |
293
+ | FeeLocker | `0x52f90A2Eb0a61cc0e91D5C49F37370de3BC32D73` |
294
+ | MevModule | `0x0270f63E75646eB7E2CbCA41a1140314b312005A` |
295
+ | Vault | `0x106654Cd164c7aFE673CA998987418fb94b7F85f` |
296
+ | AirdropV2 | `0x8F4aD2EE724Ed79C570f99F8A5716A04053beC15` |
297
+ | DevBuy | `0xBF75163C21a044AA06130d22bFb26bF5eD2af0Cc` |
298
+ | VestedDevBuy | `0x06A192ef88cAc5eF4b11fE039346406cA32f8C34` |
299
+
300
+ ## Types
301
+
302
+ ```typescript
303
+ import type {
304
+ // Deployer types
305
+ DeployOptions,
306
+ DeployResult,
307
+ VaultConfig,
308
+ DevBuyConfig,
309
+ VestedDevBuyConfig,
310
+ RewardRecipient,
311
+ FeePreference,
312
+ NetworkName,
313
+ // Reader types
314
+ TokenDetails,
315
+ VaultAllocation,
316
+ VestedDevBuyAllocation,
317
+ MevConfigInfo,
318
+ TokenRewardInfo,
319
+ WalletFeeInfo,
320
+ } from '@clawnch/sdk';
321
+ ```
322
+
323
+ ## Links
324
+
325
+ - **Website:** https://clawn.ch
326
+ - **CLI:** `npm install -g clawnch`
327
+ - **Docs:** https://clawn.ch/docs
328
+
329
+ ## License
330
+
331
+ MIT