blockchain-event-monitor
v0.1.2
Published
A simple npm package that allows any user to monitor the events emitted from a smart contract and use those information to build products.Internally it uses web3.js to monitor contracts.
Downloads
13
Maintainers
Readme
blockchain-event-monitor
A simple npm package that allows any user to monitor the events emitted from a smart contract and use those information to build products.Internally it uses web3.js to monitor contracts.
How to install the package
npm i blockchain-event-monitor
- How to use it in node.js project, Example :-
import SmartContractEventMonitor from 'blockchain-event-monitor';
const monitor = new SmartContractEventMonitor();
const rpcUrl = 'wss://eth-sepolia.g.alchemy.com/v2/<alchemy-key>';
const contractAddress = <Your-contract-address>;
const abi = <Your-ABI>
const eventName = 'Transfer';
const filterOptions = { };
monitor.configureEventMetaData(rpcUrl, contractAddress, abi, eventName, filterOptions);
monitor.trackEvents((error, event) => {
if (error) {
console.error('Error tracking event:', error);
} else {
console.log('Event data in use :', event);
}
});