Last active
August 18, 2022 03:46
-
-
Save mertimus/3800beb3327a29e095c075c3ce618adc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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