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

@b3dotfun/bondkit

v0.1.21

Published

SDK to interact with Bondkit smart contract

Readme

@b3dotfun/bondkit SDK

npm version

SDK for interacting with Bondkit smart contracts, allowing you to deploy and manage Bondkit tokens.

Installation

Install the package using npm or yarn:

npm install @b3dotfun/bondkit
# or
yarn add @b3dotfun/bondkit

Dependencies

This SDK uses viem as a peer dependency for interacting with the Ethereum blockchain. You will need to have viem installed in your project.

npm install viem
# or
yarn add viem

Basic Usage

Here's a quick example of how to use the SDK:

import {
  BondkitTokenFactory,
  BondkitToken,
  getConfig,
  // sepolia, // Example chain from viem/chains if you re-export it or guide users to import it
} from '@b3dotfun/bondkit';
import { sepolia } from 'viem/chains'; // Or import directly
import type { EIP1193Provider } from 'viem';

// Ensure you have an EIP-1193 provider (e.g., from MetaMask or WalletConnect)
// declare let window: any; // For browser environment
// const provider: EIP1193Provider = window.ethereum;

async function main() {
  // --- Configuration ---
  const chainId = sepolia.id; // Example: Sepolia testnet
  // Get chain-specific configuration (RPC URL, factory addresses)
  const sdkConfig = getConfig(chainId);
  console.log(`Using factory: ${sdkConfig.factoryAddress} on chain ${sdkConfig.chain.name}`);

  // --- Initialize Factory ---
  // For read-only operations or if walletKey is managed internally by provider:
  const factory = new BondkitTokenFactory(chainId);
  
  // For write operations, connect with a provider (e.g., from a browser wallet)
  // if (provider) {
  //   const connected = factory.connect(provider);
  //   if (!connected) {
  //     console.error("Failed to connect factory to provider");
  //     return;
  //   }
  //   console.log("Factory connected to provider.");
  // } else {
  //   console.log("No provider found. Factory initialized with default RPC for read-only operations.");
  // }

  // Example: Get deployed tokens (read operation)
  try {
    const deployedTokens = await factory.getDeployedBondkitTokens();
    console.log("Deployed Bondkit Tokens:", deployedTokens);

    if (deployedTokens.length > 0) {
      const firstTokenAddress = deployedTokens[0];
      console.log(`\n--- Interacting with token: ${firstTokenAddress} ---`);
      
      const token = new BondkitToken(chainId, firstTokenAddress as string);
      // if (provider) token.connect(provider);

      const name = await token.name();
      const symbol = await token.symbol();
      const totalSupply = await token.totalSupply();
      console.log(`Token Name: ${name}`);
      console.log(`Token Symbol: ${symbol}`);
      console.log(`Total Supply: ${totalSupply}`);
      
      // Further interactions (buy, sell, etc.) would require a connected wallet with funds.
      // Example: const buyTxHash = await token.buy(parseEther("1"), parseEther("0.01"));
      // console.log("Buy transaction hash:", buyTxHash);
    }
  } catch (error) {
    console.error("Error fetching deployed tokens or token details:", error);
  }

  // --- Deploying a new token (example, requires connected wallet with factory owner/deployer privileges) ---
  /*
  if (provider && factory.getOwner() === YOUR_DEPLOYER_ADDRESS) { // Pseudo-code for owner check
    try {
      const newTokenConfig = {
        name: "My New Bondkit Token",
        symbol: "MBNT",
        artist: "0xYourArtistAddressHere", // Replace with actual artist address
        finalTokenSupply: 1000000n * (10n ** 18n), // 1 million tokens with 18 decimals
        aggressivenessFactor: 50, // Example value (0-100)
        lpSplitRatioArtistBps: 1000n, // Example: 10% to artist in BPS (1000 / 10000)
        dexTriggerThresholdEth: 1n * (10n ** 18n), // Example: 1 ETH
        uniswapV2RouterAddress: "0xYourRouterAddressHere", // Replace with actual Uniswap V2 compatible router
        migrationAdminAddress: "0xYourMigrationAdminAddressHere", // Replace with actual admin address
      };
      console.log("\nAttempting to deploy new token...");
      const newTokenAddress = await factory.deployBondkitToken(newTokenConfig);
      console.log(`New token deployed at: ${newTokenAddress}`);
    } catch (error) {
      console.error("Error deploying new token:", error);
    }
  }
  */
}

main().catch(console.error);

Examples

Detailed examples can be found in the examples directory of this repository:

  • examples/01-read-operations.ts: Demonstrates read-only interactions, such as fetching token details, factory information, and bonding curve data.
  • examples/02-transactions-buy-sell.ts: Shows how to perform transactions like buying and selling tokens. Requires a private key with test funds.
  • examples/03-deploy-token.ts: Illustrates deploying a new Bondkit token using the factory. Requires a private key with deployer permissions and funds for gas.

To run these examples, you'll typically use a tool like ts-node:

# Ensure you are in the root of the bondkit-sdk project
# You might need to install ts-node globally or as a dev dependency
# npm install -g ts-node
# or
# npm install --save-dev ts-node

# Before running, ensure you have:
# 1. Installed dependencies: npm install
# 2. Replaced placeholder values (like YOUR_INFURA_PROJECT_ID, private keys, etc.) within the example files.
# 3. Updated src/constants.ts with your Infura Project ID and correct contract addresses.

ts-node examples/01-read-operations.ts
ts-node examples/02-transactions-buy-sell.ts
ts-node examples/03-deploy-token.ts

Key Features

  • Deploy New Tokens: Use BondkitTokenFactory.deployBondkitToken().
  • Manage Existing Tokens: Interact with token instances using the BondkitToken class.
    • Read token details (name, symbol, totalSupply, owner, etc.).
    • ERC20 operations: balanceOf, transfer, approve, allowance.
    • Bonding curve interactions: buy, sell, getAmountOfTokensToBuy, getAmountOfEthToSell.
    • Lifecycle management: migrateToDex, transferOwnership.
  • Configuration: Get chain-specific configurations using getConfig().

Remember to replace placeholder addresses and values in the usage example with actual data for testing.