v4.0.0
Clanker v4.0.0 SDK User Guide
Quick Start
npm install clanker-sdk viembun add clanker-sdk viemyarn add clanker-sdk viemBasic Usage
import { Clanker } from 'clanker-sdk/v4';
import { createWalletClient, createPublicClient, privateKeyToAccount, http } from 'viem';
// Viem setup
const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const client = createPublicClient({ chain: base, transport: http() });
const wallet = createWalletClient({ account, chain: base, transport: http() });
// Initialize the SDK
const clanker = new Clanker({
publicClient: client,
wallet: walletClient,
});
// Deploy a token
const { txHash, waitForTransaction, error } = await clanker.deploy({
name: "My Token",
symbol: "MTK",
tokenAdmin: account.address,
// Optional parameter. This will make a call to Clanker's vanity-address
// service to generate a salt so the token deploys with the "b07" suffix.
vanity: true,
});
// The `deploy` function attempts to not throw and instead return an error
// for you to decide how to handle
if (error) throw error;
// It also returns a function `waitForTransaction` that you may use to wait
// for the full token deployment. This also may return an error, or the address
// of the token on success.
const { address } = await waitForTransaction();
console.log(`Deployed token to ${address}`);
Advanced Configuration
Token Configuration
Adding an image, metadata, and context to your token.
Pool Configuration
To customize the paired token and starting market cap, use the pool field. The pool is configured to use WETH as the paired token by default with a 10 eth starting market cap.
If a custom starting market cap is used, custom positions must be used as well.
Fee Configuration
To customize the fees on the deployed Uniswap v4 pool, define a new fees field on the token.
If no fee configuration is provided, the SDK configures a static pool with 1% fees for both token inputs.
Rewards Configuration
To customize the reward recipients, use the rewards field. The admin receives no rewards but may change the recipient which does get the rewards. They may be set to the same address. The sum of all bps must be 100%.
If no reward configuration is provided, the tokenAdmin receives all of the LP rewards.
Vesting Vault
To vault and optionally vest a portion of the token supply, use the vault field.
Initial Dev Buy
To include a initial purchase on the pool, use the devBuy field.
For dev buys with non-weth pairs, you must provide a Uniswap v4 PoolKey for a WETH/ETH<>Paired swap.
Complete Example
Last updated