SignumJS
  • ๐Ÿ‘‹Welcome to SignumJS
  • Getting Started
    • Installation
    • Modules
    • Usage
  • ๐Ÿ‘ฉโ€๐Ÿ’ปReference
    • API Reference
      • Core Module
      • Util Module
      • Crypto Module
      • Http Module
      • Contracts Module
      • Monitor Module
  • ๐ŸงพRecipes
    • Basics
      • Getting Accounts Balance
      • List Transactions
      • Show attached messages
      • Send Signa
    • Advanced
Powered by GitBook
On this page
  • Installation
  • API Reference
  1. Reference
  2. API Reference

Monitor Module

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

PreviousContracts ModuleNextBasics

Last updated 3 years ago

This module is still in an experimental stage

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

๐Ÿ‘ฉโ€๐Ÿ’ป
monitor | signumjs - The Javascript SDK for Signum Network