A Solana blockchain utility for token trading, creation, and interaction with a custom bonding curve mechanism.
Install the required dependencies:
npm install @solana/web3.js @coral-xyz/anchor
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
const cluster = "devnet"; // or 'mainnet'
const authority = Keypair.generate(); // Optional
const pamp = new Pamp(connection, cluster, authority);
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
);
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
);
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
);
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 |
- Supports devnet and mainnet clusters
- Configurable priority fees
- Slippage control
- Multiple purchase/sell currencies
@solana/web3.js
@coral-xyz/anchor
- Solana Token Metadata Program
try {
const transaction = await pamp.buyToken(...);
// Send and confirm transaction
} catch (error) {
console.error('Transaction failed:', error);
}
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the [Your License]. See LICENSE
for more information.
[Your Name] - [Your Email]
Project Link: [Repository URL]