Skip to content

Instantly share code, notes, and snippets.

@mertimus
Last active August 18, 2022 03:46
Show Gist options
  • Save mertimus/3800beb3327a29e095c075c3ce618adc to your computer and use it in GitHub Desktop.
Save mertimus/3800beb3327a29e095c075c3ce618adc to your computer and use it in GitHub Desktop.
const axios = require('axios');
const apiURL = "https://api.helius.xyz/v0/addresses";
const address = "9MynErYQ5Qi6obp4YwwdoDmXkZ1hYVtPUqYmJJ3rZ9Kn"; // DeGods
const resource = "nft-events";
const options = `api-key=<your-api-key-here>&type=NFT_LISTING`;
let mostRecentTxn = "";
const listingThreshold = 200; // SOL
const LAMPORTS_PER_SOL = 1000000000;
const listingAlertBot = async () => {
while(true) {
const url = `${apiURL}/${address}/${resource}?${options}&until=${mostRecentTxn}`;
const { data } = await axios.get(url);
if (!data.length) { continue; }
const alertTxns = data.find(x => x.amount < listingThreshold * LAMPORTS_PER_SOL);
console.log("Txns: ", alertTxns);
mostRecentTxn = data[0].signature;
}
}
listingAlertBot();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment