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

coinflict-kit

v1.0.6

Published

SDK for coinflict.fun - A Solana token launchpad platform

Readme

coinflict-kit

A TypeScript SDK for coinflict.fun - A Solana token launchpad platform.

Installation

npm install coinflict-kit

Quick Start

import { CoinFlictSdk } from 'coinflict-kit';
import { Connection, clusterApiUrl } from '@solana/web3.js';

const connection = new Connection(clusterApiUrl('devnet'));
const sdk = new CoinFlictSdk(connection);

// Create a new token
const mint = Keypair.generate();
const createTx = await sdk.getCreateTxs(
  mint.publicKey,
  "My Token",
  "MTK",
  "https://your-metadata-uri.com",
  user.publicKey
);

// Buy tokens
const buyTx = await sdk.getBuyTxs(
  mint.publicKey,
  user.publicKey,
  10, // slippage percentage
  new BN(tokenAmount),
  new BN(solAmount * LAMPORTS_PER_SOL)
);

// Sell tokens
const sellTx = await sdk.getSellTxs(
  mint.publicKey,
  user.publicKey,
  10, // slippage percentage
  new BN(tokenAmount),
  new BN(solAmount * LAMPORTS_PER_SOL)
);

Features

  • Token Creation: Create new tokens with metadata
  • Token Trading: Buy and sell tokens using bonding curve mechanics
  • Price Calculations: Get buy/sell prices based on bonding curve
  • PDA Management: Handle Program Derived Addresses for vaults and bonding curves
  • TypeScript Support: Full TypeScript support with type definitions

API Reference

CoinFlictSdk

The main SDK class for interacting with the coinflict.fun platform.

Constructor

constructor(connection: Connection)

Methods

getCreateTxs

Creates transaction instructions for token creation.

async getCreateTxs(
  mint: PublicKey,
  name: string,
  symbol: string,
  uri: string,
  user: PublicKey
): Promise<CoinFlictResult<TransactionInstruction>>
getBuyTxs

Creates transaction instructions for buying tokens.

async getBuyTxs(
  mint: PublicKey,
  user: PublicKey,
  slippage: number,
  amount: BN,
  solAmount: BN
): Promise<CoinFlictResult<TransactionInstruction[]>>
getSellTxs

Creates transaction instructions for selling tokens.

async getSellTxs(
  mint: PublicKey,
  user: PublicKey,
  slippage: number,
  amount: BN,
  solAmount: BN
): Promise<CoinFlictResult<TransactionInstruction[]>>
fetchBondingCurve

Fetches bonding curve data for a token.

async fetchBondingCurve(mint: PublicKeyInitData): Promise<BondingCurve>
getTokenAmount

Calculates token amount for a given SOL amount.

getTokenAmount(bondingCurve: BondingCurve, solAmount: number): number
getSolAmount

Calculates SOL amount for a given token amount.

getSolAmount(bondingCurve: BondingCurve, tokenAmount: number): number

Types

BondingCurve

interface BondingCurve {
  mint: PublicKey;
  virtualTokenReserve: BN;
  virtualSolReserve: BN;
  realTokenReserve: BN;
  realSolReserve: BN;
  tokenTotalSupply: BN;
  complete: boolean;
  initializer: PublicKey;
  bump: number;
  vaultBump: number;
}

CoinFlictResult

type CoinFlictResult<T> = 
  | { success: true; data: T }
  | { success: false; error: CoinFlictError };

CoinFlictError

interface CoinFlictError {
  type: CoinFlictErrors;
  message: string;
  details?: any;
}

Error Types

enum CoinFlictErrors {
  BONDING_CURVE_NOT_FOUND = "BONDING_CURVE_NOT_FOUND",
  GLOBAL_DATA_NOT_FOUND = "GLOBAL_DATA_NOT_FOUND",
  INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
  NETWORK_ERROR = "NETWORK_ERROR",
  INVALID_PARAMETERS = "INVALID_PARAMETERS",
  UNKNOWN_ERROR = "UNKNOWN_ERROR"
}

Examples

Complete Token Creation Example

import { CoinFlictSdk } from 'coinflict-kit';
import { Connection, clusterApiUrl, Keypair, Transaction } from '@solana/web3.js';
import { BN } from 'bn.js';

const connection = new Connection(clusterApiUrl('devnet'));
const sdk = new CoinFlictSdk(connection);
const user = Keypair.generate(); // Your wallet keypair

async function createToken() {
  const mint = Keypair.generate();
  
  const createTx = await sdk.getCreateTxs(
    mint.publicKey,
    "My Awesome Token",
    "MAT",
    "https://arweave.net/your-metadata-uri",
    user.publicKey
  );

  if (createTx.success) {
    const transaction = new Transaction().add(createTx.data);
    transaction.feePayer = user.publicKey;
    
    const { blockhash } = await connection.getLatestBlockhash();
    transaction.recentBlockhash = blockhash;
    
    transaction.sign(user, mint);
    const signature = await connection.sendRawTransaction(transaction.serialize());
    
    console.log('Token created:', signature);
  } else {
    console.error('Failed to create token:', createTx.error);
  }
}

Token Trading Example

async function buyTokens(mint: PublicKey, solAmount: number) {
  const bondingCurve = await sdk.fetchBondingCurve(mint);
  const tokenAmount = sdk.getTokenAmount(bondingCurve, solAmount);
  
  const buyTx = await sdk.getBuyTxs(
    mint,
    user.publicKey,
    10, // 10% slippage
    new BN(tokenAmount.toString()),
    new BN(solAmount * LAMPORTS_PER_SOL)
  );

  if (buyTx.success) {
    const transaction = new Transaction().add(...buyTx.data);
    transaction.feePayer = user.publicKey;
    
    const { blockhash } = await connection.getLatestBlockhash();
    transaction.recentBlockhash = blockhash;
    
    transaction.sign(user);
    const signature = await connection.sendRawTransaction(transaction.serialize());
    
    console.log('Tokens bought:', signature);
  }
}

Dependencies

  • @coral-xyz/anchor: ^0.31.1
  • @solana/spl-token: ^0.4.13
  • @solana/web3.js: ^1.87.0 (peer dependency)
  • bn.js: ^5.2.2

License

MIT

Links

Support

For support, please visit coinflict.fun or open an issue on GitHub.