Documentation
¶
Index ¶
Constants ¶
View Source
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 {
ConfigPath string
ForceConfigUpdate bool
Config *TelegramConfig
UserEOAAddress string
PeerIDs []string
PreviousData *PreviousData
StopChan chan bool
}
TelegramService represents the telegram monitoring service
func NewTelegramService ¶
func NewTelegramService(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) GetBlockchainDataForPeerID ¶ added in v1.0.9
func (t *TelegramService) GetBlockchainDataForPeerID(peerID string) (*BlockchainData, error)
GetBlockchainDataForPeerID gets blockchain data for a specific peer ID
func (*TelegramService) Run ¶
func (t *TelegramService) Run() error
Run starts the telegram monitoring service
Click to show internal directories.
Click to hide internal directories.