🦆 Website 🦆 Twitter 🦆 Discord 🦆
Powering the Secret Duck Society Twitter sales bot https://twitter.com/Secretducksales.
The is a javascript implementation for a Twitter Solana NFT collection sales bot. It monitors secondary marketplaces for sales from a given collection and tweets about them. As of now, the bot only monitors Magic Eden and Alpha Art, but functionality for other marketplaces is on the way.
Along with the bot comes a Collection Fetcher that will generate a json file of the metadata from your NFT collection. Here is an example of the format the metadata for each NFT comes in.
"id": 1968,
"updateAuthority": "8yvshU8TYtg3c5TwmvJEzRRUgRGZSuWkghv1ZXP9UQUb",
"mint": "Ezp7t9Mg1yuAu37AV7WAKTVjEGDhmF2beZm31imTdoR4",
"name": "Duck #1968",
"uri": "https://arweave.net/jZiFIUvG8cS9nAgiJ34mKxjGmvO8mfdKHsNaD4hEjhA",
"address": "376bvNdBLagKgqmL7RcWnL3DeCUgk1ND2b4GRnc5NAKj"
The scanner works by monitoring the addresses of secondary marketplaces. It continously uses the function getConfirmedSignaturesForAddress2 to pull a list of the recent transactions for each marketplace address, and then filters these for transactions that are sales involving the desired NFT collection.
If the scanner detects a sale from the collection, it passes the appropriate information to tweet.js to handle Twitter functionality.
You must download some prerequisite software to be able to run this code:
And set up Twitter Developer Accounts
git clone https://github.com/SecretDuckSociety/TwitterNFTSalesBot.git
yarn install
- Fill in your .env file with the appropriate values. Note that due to rate limits, if you try to use the public endpoints (https://api.mainnet-beta.solana.com) for RPC_ENDPOINT you will likely be throttled. To use the current iteration of the code you need to use a custom endpoint that doesn't include rate limits.
- Visit the constants file and change the NUM_CREATORS variable to match the number of creators for your collection. Your candy machine counts as a creator.
- Run
node -r dotenv/config CollectionFetcher.js
to fetch the metadata associated with your collection. - Run
node -r dotenv/config Scanner.js
to fire up the bot. It will keep running until the process is killed (ctrl-c). Using tmux to run your bot is recommended. Alternatively, you could run it as a Heroku app (see Heroku Remote).