Usage

Usage

SDK usage examples

SDK Usage

Examples for common operations with the cc0strategy SDK.

Deploy a Token

typescript
import { CC0Strategy } from 'cc0strategy-sdk';

const cc0 = new CC0Strategy({ chainId: 8453, signer });

const result = await sdk.deployToken({
    name: 'My Token',
    symbol: 'MTK',
    nftCollection: '0x...',
    image: 'ipfs://...',
});

// 1% airdrop is automatic
console.log('Token deployed:', result.tokenAddress);

Check Claimable Rewards

typescript
const rewards = await cc0.getClaimable({
    token: '0x...',
    tokenIds: [1, 42, 100],
});

console.log('Claimable:', rewards.formatted, 'WETH');

Claim Rewards

typescript
const tx = await cc0.claim({
    token: '0x...',
    tokenIds: [1, 42, 100],
});

const receipt = await tx.wait();
console.log('Claimed:', receipt.amount, 'WETH');

Get Token Info

typescript
const info = await cc0.getTokenInfo('0x...');

console.log({
    name: info.name,
    symbol: info.symbol,
    nftCollection: info.nftCollection,
    totalRewards: info.totalRewards,
    holders: info.holders,
});

List All Tokens

typescript
const tokens = await cc0.listTokens({
    chainId: 8453,
    limit: 50,
    offset: 0,
});

tokens.forEach(t => console.log(t.symbol, t.address));
Note: SDK is currently in development. API may change.