Skip to content

Commit

Permalink
dfdsfdsfds
Browse files Browse the repository at this point in the history
  • Loading branch information
kryptobrah committed Nov 26, 2024
1 parent 46a0a05 commit 8d4de84
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 51 deletions.
7 changes: 0 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ BUY_AMOUNT=0.01
# The time interval in seconds in which tokens are bought
BUY_INTERVAL=15

# Treshold when the tokens are sold. to not crash the chart too much. If you set it to 0.1 for example and you had 0.2 SOL initially in your wallet, the bot will buy until it has only 0.1 SOL left and then it sells.
SELL_TRESHOLD=3

# The amount in Solana you want to add as priorioty fee for each transaction.
# In my tests i didn't need any priority fees.
PRIORITY_FEE=0
Expand All @@ -15,7 +12,3 @@ PRIORITY_FEE=0
SLIPPAGE=0.25

# The url to your solana node. Helius, quiknode, etc. should all be fine in free tier. Just not the solana default one.
RPC_URL="https://api.mainnet-beta.solana.com"

# Your exported private key phrase
PRIVATE_KEY="1234abcde1234abcde12345abcde"
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ __Advanced version of this bot for sale in [discord](https://discord.gg/HUVAbet2
* __Buy&Sell in same transaction__
* __Bump in random intervalls__
* __Bump for random amount__
* __Jito Bundles__
* __Stealth sells__
* __Multiple wallet support__
* __I can add any feature you like__

__Advanced pump.fun bundler for sale in [discord](https://discord.gg/HUVAbet2Dp)!__

> [!CAUTION]
> Do not use your main wallet with this bot, since you have to expose your private key to your command line and if your computer gets/is compromissed, attackers can read your private key from the command line history or the environment variables.
Expand Down Expand Up @@ -54,8 +57,6 @@ The settings are documented, so it shouldn't be a problem for you to set it up a
BUY_AMOUNT=0.0001
# The time interval in seconds in which tokens are bought
BUY_INTERVAL=15
# Treshold when the tokens are sold. to not crash the chart too much.
SELL_TRESHOLD=0.2
# The amount in Solana you want to add as priorioty fee for each transaction.
PRIORITY_FEE=0.00003
# Slipage in decimals. 0.1 = 10%
Expand Down
39 changes: 19 additions & 20 deletions dist/command/bump-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
//import PumpFunTrader from '@degenfrends/solana-pumpfun-trader';
const get_balance_1 = __importDefault(require("../solana/get-balance"));
const get_token_account_1 = __importDefault(require("../solana/get-token-account"));
const get_token_balance_1 = __importDefault(require("../solana/get-token-balance"));
const pumpdotfun_sdk_1 = require("pumpdotfun-sdk");
Expand All @@ -20,18 +18,26 @@ class BumpCommand {
walletAddress;
provider;
sdk;
counter = 1;
SLIPPAGE_BASIS_POINTS = 100n;
buyTokens = async (sdk, testAccount, mint, solAmount) => {
const buyResults = await sdk.buy(testAccount, mint, BigInt(solAmount * web3_js_1.LAMPORTS_PER_SOL), this.SLIPPAGE_BASIS_POINTS);
const buyResults = await sdk.buy(testAccount, mint, BigInt(solAmount * web3_js_1.LAMPORTS_PER_SOL), this.SLIPPAGE_BASIS_POINTS, {
unitLimit: 250000,
unitPrice: 250000
});
console.log('Buy results:', buyResults);
if (buyResults.success) {
console.log('Buy successful');
console.log('Buy successful', buyResults);
}
else {
console.log('Buy failed');
}
};
sellTokens = async (sdk, testAccount, mint, tokenAmount) => {
const sellResults = await sdk.sell(testAccount, mint, BigInt(tokenAmount * Math.pow(10, pumpdotfun_sdk_1.DEFAULT_DECIMALS)), this.SLIPPAGE_BASIS_POINTS);
const sellResults = await sdk.sell(testAccount, mint, BigInt(tokenAmount * Math.pow(10, pumpdotfun_sdk_1.DEFAULT_DECIMALS)), this.SLIPPAGE_BASIS_POINTS, {
unitLimit: 250000,
unitPrice: 250000
});
if (sellResults.success) {
console.log('Sell successful');
}
Expand Down Expand Up @@ -63,31 +69,24 @@ class BumpCommand {
}
async bump(tokenAccount) {
console.log('Bumping token:', tokenAccount);
const solIn = Number(process.env.BUY_AMOUNT);
console.log('Sol in:', solIn);
const slippageDecimal = Number(process.env.SLIPPAGE);
console.log('Slippage:', slippageDecimal);
const priorityFeeInSol = Number(process.env.PRIORITY_FEE);
console.log('Priority fee:', priorityFeeInSol);
const sellThreshold = Number(process.env.SELL_THRESHOLD);
console.log('Sell threshold:', sellThreshold);
const walletPrivateKey = await web3_js_1.Keypair.fromSecretKey(new Uint8Array(bs58_1.default.decode(this.bumperPrivateKey)));
let solIn = Number(process.env.BUY_AMOUNT);
try {
let tokenBalance = 0;
if (tokenAccount) {
tokenBalance = await (0, get_token_balance_1.default)(tokenAccount);
}
console.log('Token balance:', tokenBalance);
const solBalance = await (0, get_balance_1.default)(this.walletAddress);
console.log('Sol balance:', solBalance);
if (solBalance < solIn + sellThreshold && tokenBalance > 0) {
if (this.counter >= 2) {
if (tokenAccount) {
tokenBalance = await (0, get_token_balance_1.default)(tokenAccount);
console.log('Token balance:', tokenBalance);
this.counter = 0;
}
console.log('Selling token');
const sellRespponse = await this.sellTokens(this.sdk, walletPrivateKey, new web3_js_1.PublicKey(this.mintAddress), tokenBalance);
console.log('sold token: ', sellRespponse);
}
console.log('Buying token');
const buyResponse = await this.buyTokens(this.sdk, walletPrivateKey, new web3_js_1.PublicKey(this.mintAddress), solIn);
console.log('Bump successful: ', buyResponse);
this.counter++;
}
catch (error) {
console.error('Error in main function:', error);
Expand Down
1 change: 0 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ else {
}
const tokenAddress = argv.tokenAddress;
const walletAddress = argv.walletAddress;
const transactionMode = argv.transactionMode;
const bumper = new bump_command_1.default(privateKey, tokenAddress, walletAddress);
bumper.main();
39 changes: 19 additions & 20 deletions src/command/bump-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,25 @@ export default class BumpCommand {
private walletAddress: string;
private provider: any;
private sdk: PumpFunSDK;
private counter: number = 1;
SLIPPAGE_BASIS_POINTS = 100n;
buyTokens = async (sdk: PumpFunSDK, testAccount: Keypair, mint: PublicKey, solAmount: number) => {
const buyResults = await sdk.buy(testAccount, mint, BigInt(solAmount * LAMPORTS_PER_SOL), this.SLIPPAGE_BASIS_POINTS);

const buyResults = await sdk.buy(testAccount, mint, BigInt(solAmount * LAMPORTS_PER_SOL), this.SLIPPAGE_BASIS_POINTS, {
unitLimit: 250000,
unitPrice: 250000
});
console.log('Buy results:', buyResults);
if (buyResults.success) {
console.log('Buy successful');
console.log('Buy successful', buyResults);
} else {
console.log('Buy failed');
}
};
sellTokens = async (sdk: PumpFunSDK, testAccount: Keypair, mint: PublicKey, tokenAmount: number) => {
const sellResults = await sdk.sell(testAccount, mint, BigInt(tokenAmount * Math.pow(10, DEFAULT_DECIMALS)), this.SLIPPAGE_BASIS_POINTS);
const sellResults = await sdk.sell(testAccount, mint, BigInt(tokenAmount * Math.pow(10, DEFAULT_DECIMALS)), this.SLIPPAGE_BASIS_POINTS, {
unitLimit: 250000,
unitPrice: 250000
});

if (sellResults.success) {
console.log('Sell successful');
Expand Down Expand Up @@ -60,33 +67,25 @@ export default class BumpCommand {
}
async bump(tokenAccount: string | undefined) {
console.log('Bumping token:', tokenAccount);
const solIn = Number(process.env.BUY_AMOUNT);
console.log('Sol in:', solIn);
const slippageDecimal = Number(process.env.SLIPPAGE);
console.log('Slippage:', slippageDecimal);
const priorityFeeInSol = Number(process.env.PRIORITY_FEE);
console.log('Priority fee:', priorityFeeInSol);
const sellThreshold = Number(process.env.SELL_THRESHOLD);
console.log('Sell threshold:', sellThreshold);
const walletPrivateKey = await Keypair.fromSecretKey(new Uint8Array(bs58.decode(this.bumperPrivateKey)));
let solIn = Number(process.env.BUY_AMOUNT);

try {
let tokenBalance = 0;

if (tokenAccount) {
tokenBalance = await getTokenBalance(tokenAccount);
}
console.log('Token balance:', tokenBalance);
const solBalance = await getBalance(this.walletAddress);
console.log('Sol balance:', solBalance);
if (solBalance < solIn + sellThreshold && tokenBalance > 0) {
if (this.counter >= 2) {
if (tokenAccount) {
tokenBalance = await getTokenBalance(tokenAccount);
console.log('Token balance:', tokenBalance);
this.counter = 0;
}
console.log('Selling token');
const sellRespponse = await this.sellTokens(this.sdk, walletPrivateKey, new PublicKey(this.mintAddress), tokenBalance);
console.log('sold token: ', sellRespponse);
}
console.log('Buying token');
const buyResponse = await this.buyTokens(this.sdk, walletPrivateKey, new PublicKey(this.mintAddress), solIn);
console.log('Bump successful: ', buyResponse);
this.counter++;
} catch (error) {
console.error('Error in main function:', error);
this.bump(tokenAccount);
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ if (process.env.PRIVATE_KEY) {
}
const tokenAddress = argv.tokenAddress;
const walletAddress = argv.walletAddress;
const transactionMode = argv.transactionMode;
const bumper = new BumpCommand(privateKey, tokenAddress, walletAddress);
bumper.main();

0 comments on commit 8d4de84

Please sign in to comment.