
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
solana-swap
Advanced tools
Easiest way to add Solana based swaps to your project. Uses the Solana Swap api from https://docs.solanatracker.io
You can now use "auto" on amount to automatically set the amount to the Balance of that token in the wallet. Only for Swap not for Rate endpoints! Jito has been added to the library with example below.
Volume Bot: https://github.com/YZYLAB/solana-volume-bot Trading Bot: https://github.com/YZYLAB/solana-trade-bot More coming soon
Install Solana Swap with NPM
npm install solana-swap
Or
git clone https://github.com/YZYLAB/solana-swap.git
Swap API is used live on: https://www.solanatracker.io
Add your site here
import { Keypair } from "@solana/web3.js";
import bs58 from "bs58";
import { SolanaTracker } from "../";
async function swap() {
const keypair = Keypair.fromSecretKey(
bs58.decode(
"YOUR_SECRET_KEY_HERE"
)
);
const solanaTracker = new SolanaTracker(
keypair,
"https://rpc.solanatracker.io/public?advancedTx=true"
);
const swapResponse = await solanaTracker.getSwapInstructions(
"So11111111111111111111111111111111111111112", // From Token
"4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R", // To Token
0.0001, // Amount to swap
30, // Slippage
keypair.publicKey.toBase58(), // Payer public key
0.0005, // Priority fee (Recommended while network is congested)
);
// Regular transaction
try {
const txid = await solanaTracker.performSwap(swapResponse, {
sendOptions: { skipPreflight: true },
confirmationRetries: 30,
confirmationRetryTimeout: 500,
lastValidBlockHeightBuffer: 150,
resendInterval: 1000,
confirmationCheckInterval: 1000,
commitment: "processed",
skipConfirmationCheck: false // Set to true if you want to skip confirmation checks and return txid immediately
});
// Returns txid when the swap is successful or throws an error if the swap fails
console.log("Transaction ID:", txid);
console.log("Transaction URL:", `https://solscan.io/tx/${txid}`);
} catch (error: any) {
const {signature, message} = error;
console.error("Error performing swap:", message, signature);
}
// Jito transaction
try {
const txid = await solanaTracker.performSwap(swapResponse, {
sendOptions: { skipPreflight: true },
confirmationRetries: 30,
confirmationCheckInterval: 500,
commitment: "processed",
jito: {
enabled: true,
tip: 0.0001,
},
});
// Returns txid when the swap is successful or throws an error if the swap fails
console.log("Transaction ID:", txid);
console.log("Transaction URL:", `https://solscan.io/tx/${txid}`);
} catch (error: any) {
const {signature, message} = error;
console.error("Error performing swap:", message, signature);
}
}
swap();
ES5 Example Import
const { SolanaTracker } = require("solana-swap")
We retrieve all Solana (raydium, pumpfun, etc) tokens the second they are available, so you can perform fast snipes. We also provide our own hosted Jupiter Swap API with no rate limits and faster market updates.
We charge a 0.5% fee on each successful transaction . Using this for a bot or site with a high processing volume? Contact us via Discord or email (swap-api@solanatracker.io) and get the fee reduced (down to 0.1% only if accepted.)
FAQs
Solana Swap Library for Solana Tracker Swap API
The npm package solana-swap receives a total of 165 weekly downloads. As such, solana-swap popularity was classified as not popular.
We found that solana-swap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.