sniper-js
v0.2.0
Published
Core JS Module for Sniper.io Platform
Downloads
88
Maintainers
Readme
SniperJS
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