pamp-launchpad-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Pamp Token Trading Class

Description

A Solana blockchain utility for token trading, creation, and interaction with a custom bonding curve mechanism.

Table of Contents

Installation

Install the required dependencies:

npm install @solana/web3.js @coral-xyz/anchor

Usage

Initialization

const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
const cluster = "devnet"; // or 'mainnet'
const authority = Keypair.generate(); // Optional

const pamp = new Pamp(connection, cluster, authority);

Buying Tokens

await pamp.buyToken(
  wallet.publicKey, // Buyer's wallet
  tokenMint, // Token mint address
  amount, // Amount to spend
  slippage, // Slippage tolerance
  priorityFee, // Network priority fee
  "sol" // Purchase currency
);

Selling Tokens

await pamp.sellToken(
  wallet.publicKey, // Seller's wallet
  tokenMint, // Token mint address
  amount, // Amount to sell
  slippage, // Slippage tolerance
  priorityFee, // Network priority fee
  "token" // Sell currency type
);

Creating a Token

await pamp.createToken(
  wallet.publicKey, // Creator's wallet
  "TokenName", // Token name
  "Symbol", // Token symbol
  "https://metadata.uri", // Metadata URI
  priorityFee, // Network priority fee
  mintKeypairSecret, // Mint keypair secret
  requiredLiquidity // Optional liquidity requirement
);

Methods

Method Description Parameters
buyToken() Purchase tokens wallet, tokenMint, amount, slippage, priorityFee, purchaseCurrency
sellToken() Sell tokens wallet, tokenMint, amount, slippage, priorityFee, sellCurrency
createToken() Launch new token wallet, name, symbol, uri, priorityFee, mintKeypair, requiredLiquidity
getGlobalData() Retrieve global contract data -
getBondingCurve() Get bonding curve details tokenMint

Configuration

  • Supports devnet and mainnet clusters
  • Configurable priority fees
  • Slippage control
  • Multiple purchase/sell currencies

Dependencies

  • @solana/web3.js
  • @coral-xyz/anchor
  • Solana Token Metadata Program

Error Handling

try {
  const transaction = await pamp.buyToken(...);
  // Send and confirm transaction
} catch (error) {
  console.error('Transaction failed:', error);
}

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the [Your License]. See LICENSE for more information.

Contact

[Your Name] - [Your Email]

Project Link: [Repository URL]

Package Sidebar

Install

npm i pamp-launchpad-sdk

Weekly Downloads

12

Version

0.0.3

License

MIT

Unpacked Size

301 kB

Total Files

28

Last publish

Collaborators

  • goran999