zetsin / kleros-api

A Javascript library that makes it easy to build relayers and other DApps that use the Kleros protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kleros API

NPM Version Build Status Coverage Status Dependencies Dev Dependencies Tested with Jest JavaScript Style Guide Styled with Prettier Conventional Commits Commitizen Friendly

This repository contains a Javascript library that makes it easy to build Relayers and other DApps that use the Kleros protocol.

Installation

We assume that you have node and yarn installed.

yarn install

Test

yarn run ganache-cli
yarn test

Develop

yarn start

Build

yarn run build

Event Listeners

For notifications and event based updates, the api uses event listeners. In order to register and start listening to events, use these methods:

Quick Start

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.
Stop Listener
KlerosInstance.eventListener.stopWatchingArbitratorEvents(arbitratorAddress)

About

A Javascript library that makes it easy to build relayers and other DApps that use the Kleros protocol.

License:MIT License


Languages

Language:JavaScript 100.0%