Documentation
¶
Index ¶
Constants ¶
const DefaultConfigPath = "telegram-config.json"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlchemyRequest ¶
type AlchemyRequest struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params []interface{} `json:"params"`
ID int `json:"id"`
}
AlchemyRequest represents a JSON-RPC request to Alchemy
type AlchemyResponse ¶
type AlchemyResponse struct {
JSONRPC string `json:"jsonrpc"`
ID int `json:"id"`
Result interface{} `json:"result,omitempty"`
Error *struct {
Code int `json:"code"`
Message string `json:"message"`
} `json:"error,omitempty"`
}
AlchemyResponse represents a JSON-RPC response from Alchemy
type BlockchainData ¶
BlockchainData represents the blockchain data for a user
type PreviousData ¶
type PreviousData struct {
Votes *big.Int `json:"votes"`
Rewards *big.Int `json:"rewards"`
LastCheck time.Time `json:"last_check"`
}
PreviousData stores the previous blockchain data for comparison
type TelegramConfig ¶
type TelegramConfig struct {
BotToken string `json:"bot_token"`
ChatID string `json:"chat_id"`
WelcomeSent bool `json:"welcome_sent"`
}
TelegramConfig stores the info needed to send messages to Telegram
type TelegramService ¶
type TelegramService struct {
UserDataPath string
ConfigPath string
ForceConfigUpdate bool
Config *TelegramConfig
PreviousData *PreviousData
StopChan chan bool
}
TelegramService represents the telegram monitoring service
func NewTelegramService ¶
func NewTelegramService(userDataPath string, configPath string, forceUpdate bool) *TelegramService
NewTelegramService creates a new telegram service instance
func (*TelegramService) GetBlockchainData ¶
func (t *TelegramService) GetBlockchainData(userAddress string) (*BlockchainData, error)
GetBlockchainData queries all blockchain data for a user using Alchemy API
func (*TelegramService) Run ¶
func (t *TelegramService) Run() error
Run starts the telegram monitoring service
type UserData ¶
type UserData struct {
OrgID string `json:"orgId"`
Address string `json:"address"`
UserID string `json:"userId"`
Email string `json:"email"`
}
UserData represents the user data structure from Gensyn
type UserDataFile ¶
type UserDataFile struct {
// The key is dynamic (like "org_12345"), so we'll use a map
Data map[string]UserData `json:"-"`
}
UserDataFile represents the complete structure of userData.json