1+ # Wallet Alert Service
12
2-
3- # Custom Alerts for Wallet Activities
4-
5-
6-
7- This project allows users to set up personalized alerts for wallet activities like large token transfers, NFT mints, or specific on-chain events.
8-
9-
3+ A Go-based microservice that monitors Ethereum wallet activities and sends customized alerts based on user preferences.
104
115## Features
126
13-
14-
15- - Personalized alerts for various wallet activities
7+ - ** Real-time Transaction Monitoring**
8+ - Listens to Ethereum mainnet transactions
9+ - Detects large token transfers (> 1 ETH)
10+ - Identifies NFT transfers for popular collections (BAYC, Moonbirds)
1611
17- - Notifications via email
12+ - ** Customizable User Alerts**
13+ - Email notifications via SendGrid
14+ - Configurable alert thresholds
15+ - Per-wallet notification preferences
1816
19- - Efficient filtering and indexing of on-chain events
17+ - ** Event Types**
18+ - Large transfers (> 1 ETH)
19+ - NFT transfers
20+ - Custom threshold alerts
2021
21- - NFT transfer detection
22+ ## Architecture
2223
23-
24+ ### Core Components
2425
25- ## Technical Overview
26+ - ** Event Detection** : [ ` nfts.NFTDetector ` ] ( nft/nftdetector.go ) for NFT transfers
27+ - ** Notification Service** : [ ` services.EmailNotification ` ] ( services/email_notifier.go ) for sending alerts
28+ - ** Data Storage** : GORM-based PostgreSQL integration
29+ - ** Repository Layer** :
30+ - [ ` EventRepository ` ] ( repository/event_repository.go ) for event storage
31+ - [ ` UserPreferenceRepository ` ] ( repository/user_preference.go ) for user preferences
2632
27-
33+ ### Models
2834
29- Built with Go, this microservice connects to the Ethereum network, listens to events, indexes them based on user preferences, and triggers alerts accordingly.
30-
31-
35+ - [ ` Event ` ] ( models/event.go ) : Stores transaction details and event types
36+ - [ ` UserPreference ` ] ( models/models.go ) : Manages user notification preferences
3237
3338## Installation
3439
35-
40+ 1 . ** Clone the repository ** :
3641
37- 1 . ** Clone the repository ** :
42+ git clone https://github.com/Jetlum/WalletAlertService.git
3843
39- ``` sh
40- git clone https://github.com/Jetlum/WalletAlertServicee.git
41442 . ** Navigate to the project directory** :
42- ` ` ` sh
45+
4346 cd WalletAlertService
47+
44483 . ** Install dependencies** :
45- ` ` ` sh
49+
4650 go mod download
51+
4752## Configuration
4853
4954Create a ` config.yaml ` file in the root directory with the following content:
@@ -57,46 +62,41 @@ Create a `config.yaml` file in the root directory with the following content:
5762
5863## Usage
5964
60-
61-
62651 . ** Configure the Ethereum client** :
6366
64- ` ` ` sh
65- client, err := ethclient.Dial( " wss://mainnet.infura.io/ws/v3/YOUR_INFURA_PROJECT_ID " )
67+ go run main.go
68+
66692. ** Configure user preferences**
6770
68- userPreference := & models.UserPreference{
69- UserID: " user@example.com" ,
70- WalletAddress: " 0x..." ,
71- MinEtherValue: " 1000000000000000000" , // 1 ETH
72- TrackNFTs: true,
73- EmailNotification: true
74- })
71+ userPreference := &models.UserPreference{
72+ UserID: "user@example.com",
73+ WalletAddress: "0x...",
74+ MinEtherValue: "1000000000000000000", // 1 ETH
75+ TrackNFTs: true,
76+ EmailNotification: true
77+ }
7578
76- 3. ** Run the application** :
77- ` ` ` sh
78- go run main.go
7979## Testing
8080
81811 . ** Run all tests** :
8282
83- ` ` ` sh
8483 go test ./... -v
84+
85852 . ** Run specific tests** :
8686
87- ` ` ` sh
8887 go test -v ./services/... // Test notification services
8988 go test -v ./repository/... // Test repositories
89+
9090## Key Components
9191
9292** NFT Detection** :
9393
9494 Pre-configured list of popular NFT contract addresses
9595 Extensible for adding new collections
96- Transaction Processing:
9796
98- ** Real-time block monitoring ** :
97+ ** Transaction Processing ** :
9998
99+ Real-time block monitoring
100100 Transaction filtering and categorization
101101 Event creation and storage
102102
@@ -115,4 +115,22 @@ Project Structure
115115 ├── nft/ # NFT detection logic
116116 ├── repository/ # Data access layer
117117 ├── services/ # Business logic and notifications
118- └── mock/ # Test mocks
118+ └── mock/ # Test mocks
119+
120+ ## Testing Environment
121+ The project includes a robust testing setup:
122+
123+ Unit Tests: Testing individual components
124+ Mock Implementations: For external services and database
125+ Integration Tests: Testing component interactions
126+
127+ Set test environment:
128+
129+ export GO_ENV=test
130+
131+ ## Dependencies
132+
133+ go-ethereum: Ethereum client
134+ sendgrid-go: Email notifications
135+ gorm: Database ORM
136+ viper: Configuration management
0 commit comments