mirror of
https://github.com/fdundjer/solana-sniper-bot.git
synced 2025-11-17 10:11:08 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mintable = await checkMintable(poolState.baseMint)
|
||||||
|
if(mintable) {
|
||||||
|
console.log('Mintable check passed, proceding with buy');
|
||||||
await buy(id, poolState);
|
await buy(id, poolState);
|
||||||
|
} else {
|
||||||
|
console.log('Skipping, owner can mint tokens!')
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error({ ...poolState, error: e }, `Failed to process pool`);
|
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(
|
export async function processOpenBookMarket(
|
||||||
updatedAccountInfo: KeyedAccountInfo,
|
updatedAccountInfo: KeyedAccountInfo,
|
||||||
) {
|
) {
|
||||||
@ -291,6 +318,7 @@ async function buy(
|
|||||||
{
|
{
|
||||||
mint: accountData.baseMint,
|
mint: accountData.baseMint,
|
||||||
url: `https://solscan.io/tx/${signature}?cluster=${network}`,
|
url: `https://solscan.io/tx/${signature}?cluster=${network}`,
|
||||||
|
dexURL: `https://dexscreener.com/solana/${accountData.baseMint}?maker=${wallet.publicKey}`
|
||||||
},
|
},
|
||||||
'Buy',
|
'Buy',
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user