-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathindex.ts
More file actions
24 lines (20 loc) · 864 Bytes
/
index.ts
File metadata and controls
24 lines (20 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { BitcoinMempoolMonitorBuilder, ConsoleExporter, MonitorConfig, PrometheusExporter } from '@rsksmart/rsk-monitor'
import { MONITORED_ADDRESSES, MONITOR_CONFIG } from './config'
async function main (): Promise<void> {
await BitcoinMempoolMonitorBuilder.create({
pollingIntervalSeconds: MONITOR_CONFIG.pollingIntervalSeconds,
monitorName: MONITOR_CONFIG.monitorName,
network: MONITOR_CONFIG.network
} as MonitorConfig, MONITORED_ADDRESSES)
.withBalanceMetric()
.withExporters(new ConsoleExporter(), new PrometheusExporter(MONITOR_CONFIG.port, 'bitcoinbalancemonitor'))
.build()
.run()
console.log('Starting Bitcoin balance monitor...')
console.log('Monitoring addresses:', MONITORED_ADDRESSES)
process.on('SIGINT', () => {
console.log('Stopping monitor...')
process.exit(0)
})
}
main().catch(console.error)