sniper-js
Version:
Core JS Module for Sniper.io Platform
62 lines (43 loc) • 1.71 kB
Markdown
//travis-ci.org/sniper-exchange/sniper-js.svg?branch=master)](https://travis-ci.org/sniper-exchange/sniper-js)
[](https://badge.fury.io/js/sniper-js)
[](https://codecov.io/gh/sniper-exchange/sniper-js)
[](https://nodesecurity.io/orgs/sniper-exchange/projects/34350ea9-5bcc-455c-9d28-2f807e738fba)
SniperJS is a javascript library that assists in the of development third-party applications for [sniper.io](https://www.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.
- `npm i --save sniper-js`
```
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)
})
})
```
- Requires NodeJS & NPM
- `npm i`
- `npm test`
- `npm start`
- `npm run build`
[![Build Status](https: