Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@digicat/ethereum-transaction-watcher

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@digicat/ethereum-transaction-watcher

Watch transactions on a web3.js-compatible Ethereum network, providing callbacks for when receipts are received

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

@digicat/ethereum-transaction-watcher

This package can watch transactions on a web3.js-compatible Ethereum network, providing callbacks for when receipts are received. Requires Node.js 8.6 or newer.

Usage

const TransactionWatcher = require('@digicat/ethereum-transaction-watcher')

const watcher = new TransactionWatcher({
  ethereumNode: 'http://localhost:8545',
  interval: 60000, // Interval on which we check for receipts. Default is 60s.

  onError (err, token) {
    // Called when an error occurred when getting a transaction receipt.
    //
    // Expected to be synchronous.
  },

  onReceipt (receipt, token) {
    // Called when a transaction receipt is received for a transaction hash
    // that's being watched.
    //
    // Can be asynchronous (if you return a promise). Won't interleave with
    // other events.
  },

  wrapWeb3Error (err) {
    // Allows for underlying Web3 errors to be wrapped in another Error class.
    // By default returns the error as-is.
    return err
  }
})

// Start watching a new transaction hash. The `token` is provided in callbacks
// as-is.
watcher.add({
  hash: '0xe9d7d2bc7b98b1e5090b9363453836ab89b290415e997acb8d773e4f46440c09',
  token: {
    an: {
      arbitrary: 'object'
    }
  }
})

// Stop watching all transactions.
watcher.stop()

Keywords

FAQs

Package last updated on 17 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc