clanker-sdk 3.4.0 → 3.6.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 +105 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,9 +66,46 @@ async function deployToken() {
|
|
|
66
66
|
deployToken().catch(console.error);
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
### Using with OnchainKit (Frontend)
|
|
70
|
+
|
|
71
|
+
For frontend applications using OnchainKit, you can use the `prepareDeployToken` method to get the transaction data without executing it:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { Clanker } from 'clanker-sdk';
|
|
75
|
+
import { createPublicClient, http } from 'viem';
|
|
76
|
+
import { base } from 'viem/chains';
|
|
77
|
+
|
|
78
|
+
// Initialize SDK without wallet for frontend use
|
|
79
|
+
const publicClient = createPublicClient({
|
|
80
|
+
chain: base,
|
|
81
|
+
transport: http(),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const clanker = new Clanker({
|
|
85
|
+
publicClient,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// In your component/hook:
|
|
89
|
+
async function prepareTokenDeployment() {
|
|
90
|
+
// Get transaction data
|
|
91
|
+
const tx = await clanker.prepareDeployToken({
|
|
92
|
+
name: "Clanker Test Token",
|
|
93
|
+
symbol: "TEST",
|
|
94
|
+
image: "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi",
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Use with OnchainKit
|
|
98
|
+
return {
|
|
99
|
+
to: tx.to,
|
|
100
|
+
data: tx.data,
|
|
101
|
+
value: tx.value, // For dev-buy (0 if none)
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
69
106
|
## Configuration Options
|
|
70
107
|
|
|
71
|
-
### Token Configuration
|
|
108
|
+
### Basic Token Configuration
|
|
72
109
|
- `name`: Token name
|
|
73
110
|
- `symbol`: Token symbol
|
|
74
111
|
- `salt`: Randomly generated bytes32 value
|
|
@@ -77,15 +114,82 @@ deployToken().catch(console.error);
|
|
|
77
114
|
- `context`: Deployment context string
|
|
78
115
|
- `originatingChainId`: Chain ID where token is deployed (8453 for Base)
|
|
79
116
|
|
|
117
|
+
### Advanced Configuration Options
|
|
118
|
+
|
|
119
|
+
For more advanced deployments, you can use additional configuration options as shown below:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
const tokenAddress = await clanker.deployToken({
|
|
123
|
+
// Basic configuration (required)
|
|
124
|
+
name: "Test Token",
|
|
125
|
+
symbol: "TEST",
|
|
126
|
+
|
|
127
|
+
// Metadata configuration
|
|
128
|
+
metadata: {
|
|
129
|
+
description: "Test token deployment",
|
|
130
|
+
socialMediaUrls: [],
|
|
131
|
+
auditUrls: [],
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
// Deployment context
|
|
135
|
+
context: {
|
|
136
|
+
interface: "Clanker SDK Test",
|
|
137
|
+
platform: "Clanker",
|
|
138
|
+
messageId: "Test Deploy",
|
|
139
|
+
id: "TEST-1",
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
// Pool configuration with custom quote token
|
|
143
|
+
pool: {
|
|
144
|
+
quoteToken: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base
|
|
145
|
+
initialMarketCap: "100", // Note: For custom quote tokens, market cap should be >$100 USD for better routing
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
// Vesting configuration
|
|
149
|
+
vault: {
|
|
150
|
+
percentage: 10, // 10% of tokens vested
|
|
151
|
+
durationInDays: 30, // 30-day vesting period
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
// Initial buy configuration
|
|
155
|
+
devBuy: {
|
|
156
|
+
ethAmount: "0.00001", // Initial buy amount in ETH
|
|
157
|
+
maxSlippage: 5, // Maximum 5% slippage
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
80
162
|
### Pool Configuration
|
|
81
163
|
- Pool fee tier is fixed at 1%
|
|
82
164
|
- Initial market cap in WETH (e.g., 10 WETH)
|
|
83
165
|
- Paired with WETH on Base (`0x4200000000000000000000000000000000000006`)
|
|
166
|
+
- Custom quote tokens supported (e.g., USDC)
|
|
167
|
+
- **Important**: When using custom quote tokens, set initial market cap >$100 USD to ensure better routing options
|
|
168
|
+
- Lower market caps may limit trading to direct quote token pairs only
|
|
169
|
+
|
|
170
|
+
### Vault Configuration
|
|
171
|
+
- `percentage`: Percentage of tokens to be vested
|
|
172
|
+
- `durationInDays`: Duration of the vesting period in days
|
|
173
|
+
|
|
174
|
+
### Dev Buy Configuration
|
|
175
|
+
- `ethAmount`: Amount of ETH for initial buy
|
|
176
|
+
- `maxSlippage`: Maximum allowed slippage percentage for the initial buy
|
|
84
177
|
|
|
85
178
|
## Examples
|
|
86
179
|
|
|
87
180
|
See the [examples](./examples) directory for more deployment scenarios.
|
|
88
181
|
|
|
182
|
+
## Development Methods
|
|
183
|
+
|
|
184
|
+
### `deployToken(config: SimpleTokenConfig): Promise<Address>`
|
|
185
|
+
Deploys a new token with the specified configuration. Requires a wallet to be configured.
|
|
186
|
+
|
|
187
|
+
### `prepareDeployToken(config: SimpleTokenConfig): Promise<PreparedDeployTx>`
|
|
188
|
+
Prepares the transaction data for deploying a token without executing it. Perfect for frontend integrations with OnchainKit or similar tools. Returns:
|
|
189
|
+
- `to`: Contract address to call
|
|
190
|
+
- `data`: Encoded calldata
|
|
191
|
+
- `value`: ETH value to send (for dev-buy, 0 if none)
|
|
192
|
+
|
|
89
193
|
## Development
|
|
90
194
|
|
|
91
195
|
```bash
|