nicehash-api for use in an application, install the latest version
from NPM and save it to your
package.json. For this example
$ npm install nicehash-api
To get started using the library, first import the
import NiceHash from 'nicehash-api'
After you have imported the api, you can go ahead and spawn a new
NiceHash Object. You must pass it your NiceHash api key and id or else
the class will not be able to make the API calls.
let NiceHash = new NiceHash(api_key, api_id)
Using your first method
To make sure the class was initiliazed correctly, we can test authorization by calling:
This library wraps every function in a es7 async/await wrapper. If instead you wish to deal with promises in a different way, feel free to do:
NiceHash.testAuthorization().then(success => success).catch(err => err)
We recommend using
async/await as it makes the code more terse.
resolve the promise in a synchronous manner that allows one to expect deterministic
NiceHash.testAuthorization() returns true then you are good to go!
Check out the rest of the documentation to see what else you can do!