New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nicehash-api-wrapper-v2

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nicehash-api-wrapper-v2

simple api wrapper for nicehash api v2

latest
Source
npmnpm
Version
0.4.1
Version published
Maintainers
1
Created
Source

nicehash-api-wrapper-v2

With this api wrapper you can use the nicehash api v2 in node js. You can read the api documentation here: https://www.nicehash.com/docs/rest/.

Node.js CI

Getting started

Run the following code in your npm environment.

npm i --save nicehash-api-wrapper-v2

Now you have to create an api key.

  • Go to your API Keys settings in NH.
  • Click on "Create new API Key".
  • You can now give your key a name and you can select what permissions the key should have.
  • Click "Generate API key" and verify it with your OTP.
  • Now you have to save your API key and the secret. We will need it later.
  • Activate your key with the email code.

first code

This is an example code which will show you your mining address.

const NHApi = require('nicehash-api-wrapper-v2');
const api = new NHApi({apiKey: "your api key", apiSecret: "your api secret", orgId: "your organization Id"});

api.MinerPrivate.getMiningAddress().then((res) => {
    console.log(res);
});

All implemented Endpoints

Miner Private (Api.MinerPrivate)

getMiningAddress()

Returns the NH-MiningAddress.

Parameterrequiredtypedefaultremark
none

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-miningAddress

getRigs()

List rigs and their statuses.

Parameterrequiredtypedefaultremark
sizeint25
pageint0
pathstringfilter by group name
sortenumNAMENAME,PROFITABILITY,ACTIVE,INACTIVE
systemenumNHM,NHOS,NHQM
statusenumMining,Offline

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs2

getRigStatsAlgo(?rigid)

List mining algos with basic statistics for organization (and for rig id if specified).

Parameterrequiredtypedefaultremark
rigidstring

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-algo-stats

getGroupsList(?extendedResponse)

List of groups with list of rigs in the groups.

Parameterrequiredtypedefaultremark
extendedResponseboolfalseshows more informations

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-groups-list

getRigStatsAlgoStream(rigid, ?algorithm, ?afterTimestamp, ?beforeTimestamp)

Get statistical streams for selected rigs and selected algorithm.

Parameterrequiredtypedefaultremark
rigid*string
algorithmint20id from algorith (20=daggerhashimoto)
afterTimestampint
beforeTimestampint

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rig-stats-algo

getRigStatsUnpaidStream(rigid, ?afterTimestamp, ?beforeTimestamp)

Get statistical streams for selected rig.

Parameterrequiredtypedefaultremark
rigid*string
afterTimestampint
beforeTimestampint

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rig-stats-unpaid

getRigInformation(rigid)

Get mining rig detailed information for selected rig.

Parameterrequiredtypedefaultremark
rigid*string

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rig2-rigId

getActiveWorkers(?size, ?page, ?sortParameter, ?sortDirection)

Get a list of active worker.

Parameterrequiredtypedefaultremark
sizeint100
pageint0
sortParameterenumRIG_NAME
sortDirectionenumASC

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs-activeWorkers

getPayouts(?size, ?page, ?beforeTimestamp)

Get list of payouts.

Parameterrequiredtypedefaultremark
sizeint10
pageint0
beforeTimestampint

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs-payouts

getStatsAlgoStream(?algorithm, ?afterTimestamp, ?beforeTimestamp)

Get statistical streams for all mining rigs for selected algorithm.

Parameterrequiredtypedefaultremark
algorithmint20id of algorithm (20 = daggerhashimoto)
afterTimestampint
beforeTimestampint

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs-stats-algo

getStatsUnpaidStream(?afterTimestamp, ?beforeTimestamp)

Get statistical streams for all mining rigs.

Parameterrequiredtypedefaultremark
afterTimestampint
beforeTimestampint

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs-stats-unpaid

setRigs({group: "", rigId: "", deviceId: "", action: "", options: ""})

Update status for one or more rigs.

https://www.nicehash.com/docs/rest/post-main-api-v2-mining-rigs-status2

Accounting (Api.Accounting)

getBalance(currency, ?extendedResponse)

Get balance for selected currency.

Parameterrequiredtypedefaultremark
currency*enum
extendedResponseboolfalse

https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-account2-currency

getBalances(?extendedResponse, ?fiat)

Get total balance and for each currency separated.

Parameterrequiredtypedefaultremark
extendedResponseboolfalse
fiatstring

https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-accounts2

getActivities(currency, ?type, ?timestamp, ?stage, ?limit)

Get activities for specified currency matching the filtering criteria as specified by request parameters.

Parameterrequiredtypedefaultremark
currency*enum
typeenum
timestamptimestamp
stageenum
limitint10

https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-activity-currency

getDepositAddresses(currency, ?walletType)

Get deposit address for selected currency for all wallet types.

Parameterrequiredtypedefaultremark
currency*enum
walletTypeenum

https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-depositAddresses

getDeposits(currency, ?statuses, ?op, ?timestamp, ?page, ?limit)

List of deposit transactions details matching the filtering criteria as specified by request parameters.

Parameterrequiredtypedefaultremark
currency*enum
statusesarray
openumLT
timestamptimestamp
pageint0
sizeint100

https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-deposits-currency

External Miner (Api.ExternalMiner)

getRigs(btcAddress, ?size, ?page, ?sort)
Parameterrequiredtypedefaultremark
btcAddress*string
sizeint25
pageint0
sortenumNAME[ "NAME", "PROFITABILITY", "ACTIVE", "INACTIVE" ]

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs2

getActiveWorkers(btcAddress, ?size, ?page, ?sortParameter, ?sortDirection)

Getting active workers and information about active workers on external miner, such as current mining algorithm, speed, profitability, etc.

Parameterrequiredtypedefaultremark
btcAddress*string
sizeint25
pageint0
sortParameterenumRIG_NAME[ "RIG_NAME", "TIME", "MARKET", "ALGORITHM", "UNPAID_AMOUNT", "DIFFICULTY", "SPEED_ACCEPTED", "SPEED_REJECTED", "PROFITABILITY" ]
sortDirectionenumASC[ "ASC", "DESC" ]

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs-activeWorkers

getStatsAlgoStream(btcAddress, ?algorithm, ?afterTimestamp, ?beforeTimestamp)

Get statistical streams for all mining rigs with external BTC address for selected algorithm.

Parameterrequiredtypedefaultremark
btcAddress*string
algorithmint20id of algorithm (20 = daggerhashimoto)
afterTimestampint
beforeTimestampint

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs-stats-algo

getStatsUnpaidStream(btcAddress, ?afterTimestamp, ?beforeTimestamp)

Get statistical streams for all mining rigs with external BTC address.

Parameterrequiredtypedefaultremark
btcAddress*string
afterTimestampint
beforeTimestampint

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs-stats-unpaid

getWithdrawals(btcAddress, ?afterTimestamp, ?size, ?page)
Parameterrequiredtypedefaultremark
btcAddress*string
afterTimestampint
sizeint100
pageint0

https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs-withdrawals

HashPower (Api.HashPower)

getMyOrders(?op, ?limit, ?ts, ?algorithm, ?status, ?active, ?market)
Parameterrequiredtypedefaultremark
openumGT
limitint100
tstimestampcurrent timestamp
algorithmenum
statusenum
activebool
marketenum

https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-myOrders

createOrder({parameters})

Create hashpower order. Use parameters from API-doc as JSON.

https://www.nicehash.com/docs/rest/post-main-api-v2-hashpower-order

getOrder(id)

Get hashpower order detailed information using order id.

Parameterrequiredtypedefaultremark
id*order id

https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-order-id

deleteOrder(id)

Cancel hashpower order using order id.

Parameterrequiredtypedefaultremark
id*order id

https://www.nicehash.com/docs/rest/delete-main-api-v2-hashpower-order-id

refillOrder(id, amount)

When order is active, amount on the order can be increased and prolong duration of active order in marketplace. The limitation for minimal and maximal amount are defined for each algorithm and can be fetched using /main/api/v2/public/buy/info endpoint.

Parameterrequiredtypedefaultremark
id*order id
amount*int

https://www.nicehash.com/docs/rest/post-main-api-v2-hashpower-order-id-refill

getOrderStats(id, ?afterTimestamp)

Get statistical streams for selected order using order id.

Parameterrequiredtypedefaultremark
id*order id
afterTimestamptimestamp

https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-order-id-stats

updatePriceAndLimit(id, {parameters})

At any time order speed limit and price can be altered when hashpower order is active. Use parameters from API-doc as JSON.

Parameterrequiredtypedefaultremark
id*order id

https://www.nicehash.com/docs/rest/post-main-api-v2-hashpower-order-id-updatePriceAndLimit

calculateEstimateDuration({parameters})

Estimated duration of a hashpower order from the order type, amount, price and limit. The maximal value for STANDARD order is 10 days. Use parameters from API-doc as JSON.

https://www.nicehash.com/docs/rest/post-main-api-v2-hashpower-orders-calculateEstimateDuration

getOrderBook(algorithm, ?size, ?page)

Hashpower order book for specified algorithm. Response contains orders for all markest and their stats. When there a lot of orders, response will be paged.

Parameterrequiredtypedefaultremark
algorithm*enum
sizeint100
pageint0

https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-orderBook

getOrderSummaries(?market, ?algorithm)

Get accepted and rejected speeds for rigs and pools, rig count and paying price for selected market and/or algorithm. When no market or algorithm is specified all markets and algorithms are returned.

Parameterrequiredtypedefaultremark
marketenum
algorithmenum

https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-orders-summaries

getOrderSummary(market, algorithm)

Get accepted and rejected speed from pools and rigs, rig count and paying price for selected market and algorithm.

Parameterrequiredtypedefaultremark
market*enum
algorithm*enum

https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-orders-summary

getAlgoHistory(algorithm)

Whole history for the selected algorithm.

Parameterrequiredtypedefaultremark
algorithm*enum

https://www.nicehash.com/docs/rest/get-main-api-v2-public-algo-history

getBuyInfo()

Information for each enabled algorithm needed for buying hashpower.

Parameterrequiredtypedefaultremark
none

https://www.nicehash.com/docs/rest/get-main-api-v2-public-buy-info

getOrders(?algorithm, ?market, ?op, ?timestamp, ?page, ?size)

Get all hashpower orders. Request parameter work as filter to fine tune the result. The result is paged, when needed.

Parameterrequiredtypedefaultremark
algorithmenum
marketenum
openum
timestamptimestamp
pageint0
sizeint100

https://www.nicehash.com/docs/rest/get-main-api-v2-public-orders

getSimpleStatus()

Get information about speed and price for each enabled algorithm.

Parameterrequiredtypedefaultremark
none

https://www.nicehash.com/docs/rest/get-main-api-v2-public-simplemultialgo-info

getStats24h()

Get average price and hashpower speed for all enabled algorithms in average for past 24 hours.

Parameterrequiredtypedefaultremark
none

https://www.nicehash.com/docs/rest/get-main-api-v2-public-stats-global-24h

getStatsCurrent()

Get current price and hashpower speed for all enabled algorithms in average for last 5 minutes.

Parameterrequiredtypedefaultremark
none

https://www.nicehash.com/docs/rest/get-main-api-v2-public-stats-global-current

Exchange Public (Api.ExchangePublic)

getCandlesticks(market, ?to, ?from, ?countBack, ?resolution)

Get candlesticks for specified resolution.

Parameterrequiredtypedefaultremark
market*enum
totimestampcurrent timestamp
fromtimestamp
countBackint
resolutionint1

https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-candlesticks

getMarketStats()

Get statistics for all markets.

Parameterrequiredtypedefaultremark
none

https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-marketStats

getPrices()

Get list of last prices for all markets.

Parameterrequiredtypedefaultremark
none

https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-prices

getExchangeStatus()

Get detailed exchange status information for each market.

Parameterrequiredtypedefaultremark
none

https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-status

getTrades(market, ?sortDirection, ?limit, timestamp)

Get trades for specific market. Limit, sort direction and timestamp can be optionally selected.

Parameterrequiredtypedefaultremark
market*enum
sortDirectionenumDESC
limitint25
timestamptimestamp

https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-trades

getOrderbook(market, ?limit)

Get a list of asks and bids. Limit determines the size of asks and bids lists.

Parameterrequiredtypedefaultremark
market*enum
limitint25

https://www.nicehash.com/docs/rest/get-exchange-api-v2-orderbook

Todo

  • implement more endpoints

Feel free to report bugs.

Keywords

nicehash

FAQs

Package last updated on 29 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts