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

@trends-fun/bonding-curve-solana-sdk

v1.0.0-beta.2

Published

TypeScript SDK for interacting with:

Readme

Bonding Curve Solana SDK

TypeScript SDK for interacting with:

  • BondingCurve (pool creation, quotes, buy/sell tx building)
    Program ID: CURVEmPpijXDTNdqrA9PGP1io2rkgiVXH26xdXVGLLfz
  • CreatorFeeDistributor (coin creator / fee recipient reward claim tx building)
    Program ID: FEEsRsTdRJWECQDJJ4XghT7YUY8AVVoEnZQVipg7JGwB

This SDK builds transactions and quotes. It does not sign or send transactions for you.

What makes this SDK different: it uses a stateless, function-first API (client.*) so you do not need to instantiate a client with new; tx builders expose optional compute budget controls (computeUnitLimit, computeUnitPriceMicroLamports) for congestion-aware execution tuning; and quote APIs support optional pool caching via poolCacheTtlMs, so you can choose between maximum freshness and reduced RPC load based on your use case.

Features

  • Quote APIs:
    • buy by SOL / token out
    • sell by token in / SOL out
    • unified quote route (quoteSwap)
  • Transaction builders:
    • buildBuyTx
    • buildSellTx
    • buildSwapTx (quote + tx builder wrapper)
    • buildInitializePoolTx
    • buildInitializePoolAndBuyTx (single transaction)
  • Reward claim builders:
    • buildCoinCreatorClaimRewardTx
    • buildFeeRecipientClaimRewardTx (supports multiple mints)
  • Pool readers:
    • getPoolInfo
    • getMarketCap

Installation

Local development

bun install

From NPM

npm install @trends-fun/bonding-curve-solana-sdk

Quick Start

import BN from "bn.js";
import { PublicKey } from "@solana/web3.js";
import { client } from "@trends-fun/bonding-curve-solana-sdk";

const rpcEndpoint = "http://127.0.0.1:8899";
const baseMint = new PublicKey("<BASE_MINT>");
const trader = new PublicKey("<TRADER>");

const quote = await client.swap.quoteBuyBySol({
  baseMint,
  amountInLamports: new BN(1_000_000_000), // 1 SOL
  slippageBps: 100,
  rpcEndpoint,
});

const tx = await client.swap.buildBuyTx({
  baseMint,
  amountInLamports: new BN(1_000_000_000),
  minAmountOut: quote.minAmountOut,
  trader,
  rpcEndpoint,
});

// sign/send in your app:
// const sig = await provider.sendAndConfirm(tx, [signers...]);

API Usage

1) Quote

await client.swap.quoteBuyBySol({ ... });
await client.swap.quoteBuyByToken({ ... });
await client.swap.quoteSellByToken({ ... });
await client.swap.quoteSellBySol({ ... });
await client.swap.quoteSwap({ ... }); // unified

All quote methods require rpcEndpoint and baseMint.

2) Build Swap Transactions

await client.swap.buildBuyTx({
  baseMint,
  amountInLamports,
  minAmountOut,
  trader,
  rpcEndpoint,
});

await client.swap.buildSellTx({
  baseMint,
  tokenAmountIn,
  minAmountOut,
  trader,
  rpcEndpoint,
});

await client.swap.buildSwapTx({
  baseMint,
  side: "buy" | "sell",
  amountAsset: "sol" | "token",
  amount,
  trader,
  slippageBps,
  rpcEndpoint,
});

3) Initialize Pool

// initialize only
const { tx, poolPDA, baseVaultPDA, quoteVaultPDA } =
  await client.pool.buildInitializePoolTx({
    baseMint, // PublicKey
    params: { name, symbol, uri },
    creator,
    rpcEndpoint,
  });

// initialize + first buy in one tx (minAmountOut fixed to 0)
const createAndBuy = await client.pool.buildInitializePoolAndBuyTx({
  baseMint,
  params: { name, symbol, uri },
  creator,
  amountInLamports,
  trader, // optional, defaults to creator
  rpcEndpoint,
});

4) Claim Distributor Rewards

// A.1) Read current coin creator reward account state first (recommended)
const coinCreatorReward =
  await client.reward.getCoinCreatorRewardAccountByCreator({
    coinCreator,
    rpcEndpoint,
  });

// A.2) Build claim tx only when reward account exists and reward > 0
await client.reward.buildCoinCreatorClaimRewardTx({
  coinCreator,
  rpcEndpoint,
});

// B.1) Read current fee recipient reward account state first (recommended)
const feeRecipientReward =
  await client.reward.getFeeRecipientRewardAccountByMint({
    mint,
    rpcEndpoint,
  });

// B.2) Build claim tx only when reward account exists and reward > 0
await client.reward.buildFeeRecipientClaimRewardTx({
  feeRecipient,
  mint,
  additionalMints: [mintB, mintC], // optional
  rpcEndpoint,
});

Why read (get*) before claim:

  • To confirm the reward account exists (uninitialized accounts return null).
  • To avoid unnecessary claim attempts when reward is 0.
  • To validate account binding (feeRecipient / mint) before sending a transaction.

Build

bun run build

Artifacts:

  • dist/index.js (ESM)
  • dist/index.cjs (CJS)
  • dist/index.d.ts (types)

Test (Anchor)

This workspace uses Anchor's test runner with the script configured in Anchor.toml:

  • test = "bash ./scripts/run-anchor-tests.sh"

Run full SDK test suite

anchor test --skip-local-validator

Run specific test files

anchor test --skip-local-validator tests/sdk_client_test.ts
anchor test --skip-local-validator tests/reward_client_test.ts

Direct script usage (no Anchor wrapper)

bash ./scripts/run-anchor-tests.sh tests/sdk_client_test.ts
bash ./scripts/run-anchor-tests.sh tests/*_test.ts