Coder Social home page Coder Social logo

coinhive-http-api's Introduction

Coinhive-HTTP-API

Node.js class for the Coinhive HTTP API

Notes

Tested on Node.js v8.9.4

Usage

const CoinHiveAPI = require('./coinhive-api');

// Instantiate the class with your secret key
var coinhive = new CoinHiveAPI('your-secret-key');

coinhive.verifyToken({
  token:"04imQTobrmbTjEq5th0g9eLRRHf5F9hw",
  hashes:1024,
}).then(token=>{console.log('verifyToken:',token.success);})
.catch(error=>{console.log(error);});

coinhive.getUserBalance({name:'ext'}).then(userBalance=>{console.log('userBalance:',userBalance.success);})
.catch(error=>{console.log(error);});

coinhive.withdrawUser({
  name:'ext',
  amount:10
}).then(withdraw=>{console.log('withdraw:',withdraw.success);})
.catch(error=>{console.log(error);});

coinhive.resetUser({name:'ext'}).then(reset=>{console.log('reset:',reset.success);})
.catch(error=>{console.log(error);});

coinhive.resetAllUser({name:'ext'}).then(reset=>{console.log('reset:',reset.success);})
.catch(error=>{console.log(error);});


coinhive.getTopUser({
  count:1024,
  order:'total'
}).then(userList=>{console.log('TopUser:',userList.success);})
.catch(error=>{console.log(error);});

coinhive.getListUser({
  count:8192,
  page:''
}).then(userList=>{console.log('listUser:',userList.success);})
.catch(error=>{console.log(error);});

coinhive.createLink({
  url:"https://coinhive.com",
  hashes:1024,
}).then(link=>{console.log('createLink:',link.success);})
.catch(error=>{console.log(error);});

coinhive.getPayoutStats().then(payoutStats=>{console.log('getPayoutStats:',payoutStats.success);})
.catch(error=>{console.log(error);});

coinhive.getSiteStats().then(siteStats=>{console.log('getSiteStats:',siteStats.success);})
.catch(error=>{console.log(error);});

coinhive.getHistoryStats({
  begin: (new Date('2018-01-03T10:11:10')).getTime()/1000,
  end: (new Date('2018-01-03T23:11:10')).getTime()/1000,
}).then(historyStats=>{console.log('getHistoryStats:',historyStats.success);})
.catch(error=>{console.log(error);});

coinhive-http-api's People

Contributors

8holon avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.