Kleros API
This repository contains a Javascript library that makes it easy to build Relayers and other DApps that use the Kleros protocol.
We assume that you have node and yarn installed.
yarn install
yarn run ganache-cli
yarn test
yarn start
yarn run build
For notifications and event based updates, the api uses event listeners. In order to register and start listening to events, use these methods:
To register all events and start the listener, call:
KlerosInstance.watchForEvents(arbitratorAddress, account, callback)
params:
- arbitratorAddress: Address of arbitrator contract. Needed to update the store for disputes.
- account: Address used for notification callbacks. If an address is provided, push notifications will only be sent for notifications that involve the address. If it is omitted and a callback is included, all notifications will be pushed.
- callback: Function to be called for push notifications.
KlerosInstance.eventListener.stopWatchingArbitratorEvents(arbitratorAddress)