npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@coinbarrel/sdk

v3.2.7

Published

SDK for launching and trading tokens on CoinBarrel - instant Meteora DAMM V2 pools on Solana

Readme

@coinbarrel/sdk

SDK for launching and trading tokens on CoinBarrel — instant Meteora DAMM V2 pools on Solana.

Installation

npm install @coinbarrel/sdk @solana/web3.js @solana/spl-token

Quick Start

import { Connection, Keypair, PublicKey, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
import { CoinBarrel, solToLamports, InstantTokenVariant, LaunchTier } from '@coinbarrel/sdk';

const connection = new Connection('https://api.mainnet-beta.solana.com');
const sdk = new CoinBarrel({
	connection,
	network: 'mainnet', // or 'devnet'
});

Launch a Token

Tokens launch directly to Meteora DAMM V2 pools using Token2022 with native metadata — no bonding curve, no graduation.

const { instructions, mintKeypair, adminTokenAccount } = sdk.buildCreateInstantTokenV2Instruction({
	payer: wallet.publicKey,
	creator: wallet.publicKey,
	name: 'My Token',
	symbol: 'MTK',
	uri: 'https://arweave.net/...', // Metadata JSON URI
	variant: InstantTokenVariant.Standard,
	traderRewardsShareBps: 2500, // 25% of fees to holders
	launchTier: LaunchTier.Standard,
});

const tx = new Transaction().add(...instructions);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet, mintKeypair]);

console.log(`Token created: ${mintKeypair.publicKey.toBase58()}`);

The token is created with:

  • Token Program: Token2022 (with native metadata extension — no Metaplex)
  • Mint authority: Revoked immediately after minting 1B tokens
  • Freeze authority: Never set
  • Total supply: 1,000,000,000 tokens (6 decimals)
  • Creation fee: 0.03 SOL
  • Pool creation: Backend automatically creates the Meteora pool after token creation

Variants

| Variant | Virtual Liquidity | Use Case | |---------|------------------|----------| | Standard (0) | 90 SOL | Normal launches | | Deep (1) | 120 SOL | Lower price impact |

Launch Tiers

| Tier | Trading Fee | Use Case | |------|-------------|----------| | Standard (0) | 1.25% | Default, lower fees | | Premium (1) | 5% | Higher creator revenue |

Advanced Options

sdk.buildCreateInstantTokenV2Instruction({
	payer: wallet.publicKey,
	creator: wallet.publicKey,
	name: 'My Token',
	symbol: 'MTK',
	uri: 'https://arweave.net/...',
	variant: InstantTokenVariant.Deep,      // 120 SOL virtual liquidity
	traderRewardsShareBps: 3000,            // 30% of fees to holders
	launchTier: LaunchTier.Premium,         // 5% trading fee
	burnFeeBps: 1000,                       // 10% burn fee
	devBuyAmountLamports: solToLamports(1), // 1 SOL dev buy
	recipients: [                           // Multi-recipient fee split (up to 25)
		{ recipientType: 0, twitterId: 0n, wallet: wallet1, bps: 7000 },
		{ recipientType: 0, twitterId: 0n, wallet: wallet2, bps: 3000 },
	],
});

Trading

Once the Meteora pool is live, use pool methods to trade.

Get a Buy Quote

const quote = await sdk.pool.getSwapSolToTokenQuote(
	tokenMint,
	solToLamports(1.0) // 1 SOL
);

if (quote) {
	console.log(`Tokens out: ${quote.amountOut}`);
	console.log(`Fee: ${quote.fee} lamports`);
	console.log(`Price impact: ${quote.priceImpactBps / 100}%`);
}

Buy Tokens (SOL -> Token)

const quote = await sdk.pool.getSwapSolToTokenQuote(tokenMint, solToLamports(1.0));
const slippageBps = 100; // 1%
const minimumAmountOut = quote
	? (quote.amountOut * BigInt(10000 - slippageBps)) / 10000n
	: 0n;

const instructions = await sdk.pool.buildSwapSolToTokenInstruction({
	tokenMint,
	user: wallet.publicKey,
	lamportsIn: solToLamports(1.0),
	minimumAmountOut,
});

const tx = new Transaction().add(...instructions);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);

Get a Sell Quote

const quote = await sdk.pool.getSwapTokenToSolQuote(
	tokenMint,
	BigInt(1_000_000) // 1 token (6 decimals)
);

if (quote) {
	console.log(`SOL out: ${quote.amountOut} lamports`);
	console.log(`Fee: ${quote.fee} lamports`);
}

Sell Tokens (Token -> SOL)

const quote = await sdk.pool.getSwapTokenToSolQuote(tokenMint, BigInt(1_000_000));
const slippageBps = 100; // 1%
const minimumLamportsOut = quote
	? (quote.amountOut * BigInt(10000 - slippageBps)) / 10000n
	: 0n;

const instructions = await sdk.pool.buildSwapTokenToSolInstruction({
	tokenMint,
	user: wallet.publicKey,
	amountIn: BigInt(1_000_000),
	minimumLamportsOut,
});

const tx = new Transaction().add(...instructions);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);

Sell All Tokens

const instructions = await sdk.pool.buildSwapTokenToSolMaxInstruction({
	tokenMint,
	user: wallet.publicKey,
});

const tx = new Transaction().add(...instructions);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);

Holder Rewards

Token holders earn a share of trading fees. The SDK handles claiming automatically.

Check Pending Rewards

const pending = await sdk.getPendingHolderRewards(tokenMint, wallet.publicKey);

if (pending) {
	console.log(`Pending: ${Number(pending.pendingLamports) / 1e9} SOL`);
	console.log(`Token balance: ${pending.tokenBalance}`);
}

Claim Rewards

const pending = await sdk.getPendingHolderRewards(tokenMint, wallet.publicKey);

if (pending && pending.pendingLamports > 0n) {
	const instructions = await sdk.buildClaimInstructions(pending);
	const tx = new Transaction().add(...instructions);
	const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
}

Claim Creator Trading Fees

Token creators can claim their accumulated trading fee share:

import { buildClaimCreatorTraderFeesInstruction } from '@coinbarrel/sdk';

const instructions = await buildClaimCreatorTraderFeesInstruction(
	connection,
	{ tokenMint, creator: wallet.publicKey },
	sdk.programId
);

const tx = new Transaction().add(...instructions);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);

Market Info

const info = await sdk.getMarketInfo(tokenMint);

if (info) {
	console.log(`Price: ${info.price} lamports/token`);
	console.log(`Market Cap: ${info.marketCapSol} lamports`);
	console.log(`Fee: ${info.feeBps / 100}%`);
	console.log(`SOL reserve: ${info.solReserve}`);
	console.log(`Token reserve: ${info.tokenReserve}`);
	console.log(`Circulating supply: ${info.circulatingSupply}`);
}

Token Metadata

The SDK supports both Token2022 native metadata and Metaplex metadata. Use the universal methods to handle either automatically:

// Auto-detects Token2022 vs SPL Token
const metadata = await sdk.getUniversalTokenMetadata(tokenMint);
if (metadata) {
	console.log(metadata.name);   // "My Token"
	console.log(metadata.symbol); // "MTK"
	console.log(metadata.uri);    // "https://..."
}

// Full metadata including off-chain JSON (image, socials)
const full = await sdk.getUniversalTokenMetadataJson(tokenMint);
if (full) {
	console.log(full.image);       // "https://..."
	console.log(full.description); // "A cool token"
	console.log(full.twitter);     // "@mytoken"
	console.log(full.website);     // "https://..."
}

// Check if a token is Token2022
const isT22 = await sdk.isToken2022Mint(tokenMint);

// Batch fetch for multiple tokens
const metadataMap = await sdk.batchGetTokenMetadata([mint1, mint2, mint3]);

Networks

// Devnet
const devnetSdk = new CoinBarrel({
	connection: new Connection('https://api.devnet.solana.com'),
	network: 'devnet',
});

// Mainnet
const mainnetSdk = new CoinBarrel({
	connection: new Connection('https://api.mainnet-beta.solana.com'),
	network: 'mainnet',
});

Utility Functions

import { solToLamports, lamportsToSol, toRawAmount, toUiAmount } from '@coinbarrel/sdk';

// SOL conversions
const lamports = solToLamports(1.5);          // 1_500_000_000n
const sol = lamportsToSol(1_500_000_000n);    // 1.5

// Token amount conversions (default 6 decimals)
const raw = toRawAmount(100);                 // 100_000_000n
const ui = toUiAmount(100_000_000n);          // 100

Fee Structure

Fees are enforced on-chain and cannot be bypassed:

  • Platform: 50% of total fee (fixed)
  • Holder rewards: 0–50% of total fee (set at launch via traderRewardsShareBps)
  • Creator: remainder after platform + holders
  • Burn (optional): 0–50% of creator portion (set at launch via burnFeeBps)

The trading fee rate depends on the launch tier:

| Tier | Fee Rate | |------|----------| | Standard | 1.25% | | Premium | 5% |

Example with traderRewardsShareBps = 3000 (30%) on a Standard tier (1.25% fee):

  • Platform: 50% of fee
  • Holders: 30% of fee
  • Creator: 20% of fee

TypeScript

The SDK is fully typed:

import type {
	MarketInfo,
	SwapQuote,
	PoolState,
	Network,
	TokenMetadata,
	TokenMetadataJson,
	CreateInstantTokenV2Params,
	InstantTokenV2State,
	SwapSolToTokenParams,
	SwapTokenToSolParams,
	SwapTokenToSolMaxParams,
	PendingHolderRewards,
	FeeRecipient,
} from '@coinbarrel/sdk';

import { InstantTokenVariant, LaunchTier } from '@coinbarrel/sdk';

License

MIT