sniper-js

0.2.0 • Public • Published

SniperJS

Build Status npm version codecov NSP Status

Overview

SniperJS is a javascript library that assists in the of development third-party applications for sniper.io. SniperJS ships as an ECMAScript 6 module, and can run in-browser or in NodeJS. This module aims to provide reusable code in support of a range of applications, from frontends to bots.

Module Installation

  • npm i --save sniper-js

Quickstart

import Sniper from 'sniper-js'

// requires web3 Provider
let snpr = new Sniper({
  provider: web3 // can be injected web3 object, or rpc URL string
})

// create an order
snpr.init().then(() => {
  // orderObj contains order data
  snpr.createOrderAsync(orderObj)
  .then((order) => {
    let hash = snpr.getOrderHash(order)

    // verify order signature
    console.log(
      'verification test:',
      snpr.verifySignature(hash, order.maker, order.sig)
    )

    return order
  }).then((order) => {
    // submit order
    snpr.submitOrder(order)
  })
})

Local Installation

  • Requires NodeJS & NPM
  • npm i

Test

  • npm test

Develop

  • npm start

Standalone Build

  • npm run build

Package Sidebar

Install

npm i sniper-js

Weekly Downloads

5

Version

0.2.0

License

none

Unpacked Size

129 kB

Total Files

45

Last publish

Collaborators

  • sniper-exchange