Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/william-versatile/nft-bot-sol
https://github.com/william-versatile/nft-bot-sol
bot nft solana typescript
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/william-versatile/nft-bot-sol
- Owner: William-versatile
- License: mit
- Created: 2024-02-29T20:16:39.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-29T20:17:11.000Z (12 months ago)
- Last Synced: 2024-12-18T13:12:12.067Z (about 2 months ago)
- Topics: bot, nft, solana, typescript
- Language: TypeScript
- Homepage:
- Size: 184 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Solana NFT Bot
Solana NFT bot is a helpful bot for your Solana NFT projects.
## Sponsor
This project is proudly sponsored by [milktoast.world](https://milktoast.world):
An NFT project that aims to spread happiness and cheer.
If you find this project useful, please support us by give Milktoast a shoutout on [twitter](https://twitter.com/milktoastnft)!
## Features
- [x] Notify discord channel on each purchase in marketplaces.
- [x] [Support major marketplaces](#marketplace-support)
## Running using docker
### Requirement
* [Docker](https://www.docker.com/products/docker-desktop) >= v20.10
* If you're new to Docker, we recommend going through their [get started page](https://docs.docker.com/get-started/) to gain a basic understanding of Docker before moving forward.
* A Solana RPC node/server - This is needed so the bot know where to call to fetch solana transactions.
Here are some potential routes to get a node:
* https://quicknode.com/
* [Run your own](https://medium.com/@MisterKevin_js/how-to-run-your-own-solana-rpc-endpoint-on-figments-datahub-e9ca881bebb7)### Instructions
#### Run bot locally using docker in the terminal
If you're new to docker, before starting I recommend
Run the following command with your own secrets replaced with your own configuration:
```
docker run --name nftbot -d -p 4000:4000 -e SOLANA_RPC=YOURRPCURL -e DISCORD_BOT_TOKEN=YOURDISCORDTOKEN -e SUBSCRIPTION_DISCORD_CHANNEL_ID=YOURCHANNELID -e SUBSCRIPTION_MINT_ADDRESS=YOURMINTADDRESS milktoastlab/solananftbot
```
Note: The command above is tested in linux/unix env only. You may have a different experience in Windows.
Please check the [documentation on how to run docker command in windows](https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/run-your-first-container) if you need any help.View logs
```
docker logs ntfbot
```To make sure the bot is working properly, use [/test-sale-tx](src/server.ts#L47) endpoint
```
curl "http://localhost:4000/test-sale-tx?signature={sale_transaction_signature}&channelId={discord_channel_id}"
```In case of *DiscordAPIError: Missing Access* error, check if the bot has been invited to the channel. Go to the channel, click "Add members or roles" and add your bot account as a member.
Alternatively, you can run it using docker-compose:
Update `.env` with your secret and run
```
docker-compose up -d bot
```See [here](#configurable-environments) for more details on environment variables
View logs
```
docker-compose logs bot
```## Running in development
### Requirement
* Node >= 16.6
* Yarn### Instructions
#### 1. Install dependencies
```
yarn install
```#### 2. Update .env with your secrets
Follow the instructions [here](#configurable-environments)
#### 3. Run the server
```
yarn dev
```## Configurable environments
Here are a list of environments you need to configure before running the NFT bot.
```sh
# RPC node url
SOLANA_RPC=
# Discord bot secret
DISCORD_BOT_TOKEN=
# The discord channel to notify
SUBSCRIPTION_DISCORD_CHANNEL_ID=
# Mint address to watch for sales
SUBSCRIPTION_MINT_ADDRESS=
```
https://github.com/milktoastlab/SolanaNFTBot/blob/main/.env### Variable breakdowns
#### DISCORD_BOT_TOKEN
This is your discord bot secret.
If you don't have a discord bot yet, you can create one following the instructions here:
https://discordpy.readthedocs.io/en/stable/discord.htmlMake sure your bot has the required permissions:
* View channels
* Read/Send messages
* Send messages
* Embed links
#### SUBSCRIPTION_DISCORD_CHANNEL_ID
This is the ID of the discord channel you want to send notifications to.
You will need to enable developer mode have access the channel IDs.
Here are the instructions:
https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-#### SUBSCRIPTION_MINT_ADDRESS
This is the address that you want the Solana NFT bot to watch for notifications.
It needs to be one of the creator addresses:_Note: Avoid personal addresses because it could detect unwanted sales._
## Marketplace support
- [x] [Magic Eden](https://magiceden.io/)
- [x] [Solanart](http://solanart.io/)
- [x] [Digital Eyes](https://digitaleyes.market/)
- [x] [Alpha Art](https://alpha.art/)
- [x] [Exchange Art](https://exchange.art/)
- [x] [Solsea](https://solsea.io/)### Adding new marketplace
SolanaNFTBot aim to support as many marketplaces are possible.
Here is the instruction on how you can add support to other marketplaces.#### 1. Add a new marketplace config
Use `src/lib/marketplaces/solsea.ts` as example#### 2. Write a test for the marketplace
Use `src/lib/marketplaces/solsea.test.ts` as example#### 3. Add the new marketplace to the existing list
`src/lib/marketplaces/marketplaces.ts`