Watch Ethereum contract transactions and events with decoded name and params

Node.js package that allows watching for Ethereum contract transactions and events with minimal overhead and maximum readability.
It listens via WebSockets and decodes function and events with provided contract ABI.
Basically a wrapper on eth.subscribe web3.js function
To install package execute
``npm i -s contract-watcher`
Then import it into your project
`var watcher = require("contract-watcher")`
or
`import {ContractWatcher} from 'contract-watcher'`
You can try the library with your contract, before the installation here
To create a new instance of the watcher
- `new ContractWatcher(nodeIp, abi, contractAddress)`
nodeIp:string - IP of your Ethereum node, with properly configured WebSockets.
For Parity, make sure port 8546 is open and correct config flags are being run (starting with --ws). This package supports Parity versions 1.10 up.
abi:Array -contract to be watched ABI, from the compilation result JSON
contractAddres:string - contract to be watched address
- `subscribeForTransactionsData() : Promise`
Subscribe for new pending transactions events
- `contractWatcher.subscribeForEventsData(): Promise`
Subscribe for new contract events fired
- `onTransaction(): void`
This method wraps web3.js on() method on subscriber api for pending transactions.
On data subscription returned object, additionally from web3.js Transaction properties, contains executed function name, array of key value decoded parameters and receivedAt unix timestamp when it was handled.
Transaction handler
- `onEvent(): void`
This method wraps web3.js on() method on subscriber api for past logs.
On data subscription returned object, additionally from web3.js Log properties, contains fired event name, array of key value decoded parameters and receivedAt unix timestamp when it was handled.
- `unsubscribeAll() : Promise``
Unsubscribe from all subscriptions
Please note that indexed string parameters of Solidity event will be skipped when decoding.