For the complete documentation index, see llms.txt. This page is also available as Markdown.

Monitor Module

The Monitor Module is useful to poll for changes, e.g. on the blockchain, especially for confirmations of transactions.

Installation

npm i @signumjs/monitor
yarn add @signumjs/monitor
<script src='https://cdn.jsdelivr.net/npm/@signumjs/monitor/dist/signumjs.monitor.min.js'></script>

The namespace is sig$monitor

// Create an account monitor
const monitor = new sig$monitor.Monitor({
   asyncFetcherFn: tryFetchAccount,
   compareFn: checkIfAccountExists,
   intervalSecs: 10, // polling interval in seconds
   key: 'monitor-account',
   timeoutSecs: 2 * 240 // when reached timeout the monitor stops
})
.onFulfilled(() => {
   // called when `checkIfAccountExists` returns true
   console.log('Yay, account active');
})
.onTimeout(() => {
   // called when `timeoutSecs` is reached
   console.log('Hmm, something went wrong');
}).start();

API Reference

Last updated