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

@bosonprotocol/eventcapture

Package Overview
Dependencies
Maintainers
10
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bosonprotocol/eventcapture

Wrap event capture to fix missed events after a chain reorganization

  • 0.0.1-alpha.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
10
Weekly downloads
 
Created
Source

EventCapture library

This library wraps the blockchain event capture on-flight, so that it's possible:

  • to listen to events, calling a specific handler for each of them when they occur (as ethers.js provides it)
  • to look back to events a few blocks later (20 blocks by default) in order to detect some events that could have been missed by the on-flight (usually as a consequence of a chain reorganization)
  • to look back to events again a few blocks later in order to detect some events that have been captured and then, been cancelled (usually as a consequence of a chain reorganization)

Use it

Instead of subscribing directly to the events of a contracts using the on method, create a new EventWrapper instance.

Installation

npm install @bosonprotocol/eventcapture

YOUR CODE BEFORE

contract.on(eventName, listener)

YOUR CODE AFTER

  new EventWrapper(
    contract,
    eventName,
    listener,
    onCancelledTransactionHandler,
    new EventStore())

Test it

Unit tests

npm run test

Integration tests

Be sure the .env file is defining the JSON_RPC_URL

JSON_RPC_PROVIDER=xxxxxxx

Then run the example

npm run example

Build the library

npm run build

Publish the library

npm publish

FAQs

Package last updated on 27 Apr 2022

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