GoingOn is a Go application that leverages the power of NATS messaging system and Telegram bot API to process and send real-time notifications for Aptos transactions. The application listens for messages on a specific NATS topic, extracts relevant transaction data, and sends notifications via Telegram bot to specified chat ID.
To follow along with the workshop and see the code changes made in each step, you can refer to the following subrepositories:
- Step 0: Empty Boilerplate from Go SDK
- Step 1: Basic NATS Connecrtion Established
- Step 2: Added Stream
- Step 3: Added Filtering
- Step 4: Added Telegram Bot
- Listens for Aptos transaction messages on a NATS topic.
- Extracts sender address, receiver address, withdrawal amount, and deposit amount from the transaction data.
- Sends real-time notifications with transaction details to a specified Telegram chat ID.
- Handles different types of events within the transaction, including deposit and withdrawal events.
- Provides error handling and logging for improved reliability and troubleshooting.
To install and run the GoingOn application, follow these steps:
-
Clone the repository:
git clone [email protected]:SyntropyNet/aptos-hackathon-2023.git
-
Navigate to the project directory if you want to start from a scratch:
cd aptos-hackathon-2023/0-GoingOn-empty-repo
OR test working demo:
cd aptos-hackathon-2023/GoingOn
-
Install the required dependencies:
go mod download go get github.com/SyntropyNet/pubsub-go/pubsub
-
Update the configuration:
- Update the
natsUrl
constant in themain.go
file with the appropriate NATS server URL. - Update the
accessToken
and in the next steps:botToken
, andchatID
constants with the corresponding values for your Telegram bot and chat ID.
- Update the
-
Build the application:
make build
-
Run the application:
make serve
- Ensure that the NATS server is running and accessible (yep - it should be running because we have the best DevOps team in the world).
- Start the GoingOn application by running the executable generated in the
dist
directory. - The application will connect to the NATS server and start listening for Aptos transaction messages.
- Whenever a relevant transaction message is received, the application will extract the required details and send a notification to the specified Telegram chat ID.
The provided Makefile is used for building, testing, and Dockerizing a Go application. It defines various targets that can be invoked using the make
command followed by the target name.
Here is a short description of the available targets:
gen
: Generate necessary files usinggo generate
.build
: Build the production binary of the application using CGO disabled.build-debug
: Build the debug binary of the application.test
: Run all tests in the application.serve
: Run the development version of the program using the specified command ($(DEV_CMD)
).docker-build
: Build the production Docker image using the specified Dockerfile ($(DOCKERFILE_PROD)
).docker-build-dev
: Build the development Docker image using the specified Dockerfile ($(DOCKERFILE_DEV)
).clean
: Remove the build artifacts (delete the$(DIST_PATH)
directory).all-tests
: Run all tests and build the production Docker image.help
: Display a help message with a summary of the available targets.
To use the Makefile, open a terminal in the project directory and run make
followed by the target name. For example, to build the production binary, you can run make build
. Similarly, you can run other targets as needed for building, testing, running, or Dockerizing the application.
Contact anyone from Syntropy.
Beata Lipska, Andrius Mikonis, Povilas Žvaliauskas
Contributions to the GoingOn project are welcome and encouraged. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request. Make sure to follow the repository's code style and guidelines.
This project is licensed under the MIT License. Feel free to use, modify, and distribute the code for both commercial and non-commercial purposes.