mirror of
https://github.com/fdundjer/solana-sniper-bot.git
synced 2025-11-17 02:01:09 +10:00
Add mintable filter
Check if owner can mint tokens
This commit is contained in:
28
buy.ts
28
buy.ts
@ -199,12 +199,39 @@ export async function processRaydiumPool(
|
||||
return;
|
||||
}
|
||||
|
||||
const mintable = await checkMintable(poolState.baseMint)
|
||||
if(mintable) {
|
||||
console.log('Mintable check passed, proceding with buy');
|
||||
await buy(id, poolState);
|
||||
} else {
|
||||
console.log('Skipping, owner can mint tokens!')
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error({ ...poolState, error: e }, `Failed to process pool`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkMintable(vault: PublicKey) {
|
||||
try {
|
||||
let { data } = (await solanaConnection.getAccountInfo(vault)) || {};
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
// Deserialize Data.
|
||||
const deserialize = MintLayout.decode(data)
|
||||
const mintoption = deserialize.mintAuthorityOption
|
||||
|
||||
if (mintoption === 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function processOpenBookMarket(
|
||||
updatedAccountInfo: KeyedAccountInfo,
|
||||
) {
|
||||
@ -291,6 +318,7 @@ async function buy(
|
||||
{
|
||||
mint: accountData.baseMint,
|
||||
url: `https://solscan.io/tx/${signature}?cluster=${network}`,
|
||||
dexURL: `https://dexscreener.com/solana/${accountData.baseMint}?maker=${wallet.publicKey}`
|
||||
},
|
||||
'Buy',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user