Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
stakecube-node-sdk
Advanced tools
The official StakeCube API SDK for Node.js - Available on NPM!
NPM: npm i stakecube-node-sdk
...or clone via git and import the module yourself!
To start using the StakeCube SDK, import the module in the format you prefer below:
let SC = require('stakecube-node-sdk');
or...
import { login, getAccount, ... } from 'stakecube-node-sdk';
After installing the module, grab your API Key and Secret from your StakeCube API interface, to use private APIs with this package, you'll have to call the below method:
// Example code
let SC = require('stakecube-node-sdk');
SC.login("your_api_key", "your_secret");
Then you're ready to roll!
Authenticates with your StakeCube account via API Key + Secret, this will allow you to use Private APIs.
login(key, secret);
Parameter | Description | Example |
---|---|---|
(required) key | the SC account's API key | N/A |
(required) secret | the SC account's Secret | N/A |
Example:
SC.login("api_key", "secret"); // result: 'true'
Gets arbitrage information for a chosen coin ticker.
getArbitrageInfo(ticker);
Parameter | Description | Example |
---|---|---|
(required) ticker | the ticker of a coin | SCC |
Example:
SC.getArbitrageInfo("SCC").then(res => { console.log(res) }); // result: { 'coingecko-provided market info object' }
Gets a list of all StakeCube markets under the chosen base market, optionally sorted by
volume
orchange
, but by default sorted alphabetically.
getMarkets(base, orderBy);
Parameter | Description | Example |
---|---|---|
(required) base | the chosen base coin | BTC |
(optional) orderBy | the ordering of the list | volume or change |
Example:
SC.getMarkets("SCC", "volume").then(res => { console.log(res) }); // result: { SCC_BTC: {}, DASH_BTC: {} ... }
Gets an array of the last 500 candles for the chosen market pair and interval.
getOhlcData(market, interval);
Parameter | Description | Example |
---|---|---|
(required) market | the chosen market pair | SCC_BTC |
(required) interval | the per-candle timeframe / period | 1m , 5m , 15m , 30m , 1h , 4h , 1d , 1w , 1mo |
Example:
SC.getOhlcData("SCC_BTC", "1d").then(res => { console.log(res) }); // result: { depth: { asks: [], bids: []}, lines: [], trades: [] }
Gets the current real-time info for MineCube, such as total and available workers, the price of workers, and the payouts-in-progress status.
getMineCubeInfo();
Example:
SC.getMineCubeInfo().then(res => { console.log(res) }); // result: { totalWorker: 123, workerAvailable: 100, ... }
Gets a list of all Miners belonging to MineCube, you may optionally specify a coin to see miners for only that coin, such as 'ETH' which uses AMD GPUs, or 'DASH' which uses StrongU ASICs.
getMineCubeMiners(coin);
Example:
SC.getMineCubeMiners().then(res => { console.log(res) }); // result: { BTC: { minerCount: 200, miner: [ ... ], ... }, DASH: ... }
Gets the current global StakeCube rate-limits for APIs.
getRatelimits();
Example:
SC.getRatelimits().then(res => { console.log(res) }); // result: [ { rate_limit_type: "REQUEST_WEIGHT", interval: "DAY" ... } ... ]
Returns the last trades of a specified market pair, optionally with a custom results limit.
getTrades(market);
Parameter | Description | Example |
---|---|---|
(required) market | the chosen market pair | SCC_BTC |
(optional) limit | the maximum returned trades | 100 |
Example:
SC.getTrades("SCC_BTC").then(res => { console.log(res) }); // result: [ { direction: "BUY", amount: "1.23", price: ... } ... ]
Gets the orderbook of a chosen market, optionally a specified side, but by default will load both orderbook sides.
getOrderbook(market);
Parameter | Description | Example |
---|---|---|
(required) market | the chosen market pair | SCC_BTC |
(optional) side | the orderbook side | buy or sell |
Example:
SC.getOrderbook("SCC_BTC").then(res => { console.log(res) }); // result: { asks: [], bids: [] }
These APIs require you to be logged-in with an API key of sufficient permissions to perform the private action, for example, withdrawals will work on any key with the Withdrawals Permission enabled, order placing/cancelling will work on a key with "Full Permissions", but will not work on a "Read only" key, be aware of this and customize your keys accordingly for security!
To login, please use the login(key, secret);
method provided by the SDK, and key/secret provided by the StakeCube v3 API Dashboard.
Returns general information about your StakeCube account, including wallets, balances, fee-rate in percentage and your account username.
getAccount();
Example:
SC.login("your_key", "your_secret"); // result: true
SC.getAccount().then(res => { console.log(res) }); // result: { user: "JSKitty", exchangeFee: 0.05, wallets: [ ... ], ... }
Creates a withdrawal request with a specified coin, address and amount.
withdraw(ticker, address, amount);
Parameter | Description | Example |
---|---|---|
(required) ticker | the withdrawal coin | SCC |
(required) address | the withdrawal address | sWdSgX... |
(required) amount | the withdrawal amount | 1.23 |
Example:
SC.login("your_key", "your_secret"); // result: true
SC.withdraw("SCC", "sWdSgX...", 1.23).then(res => { console.log(res) }); // result: { success: true }
Returns a list of all open orders for all StakeCube Exchange markets.
getOpenOrders();
Example:
SC.login("your_key", "your_secret"); // result: true
SC.getOpenOrders().then(res => { console.log(res) }); // result: [ { market: "SCC_BTC", id: 123, side: "BUY", ... }, ... ]
Returns a list of all trades, you can leave the market empty ("") to return all trades, or specify a market such as "SCC_BTC" to return those market orders, you may also specify a limit of the amount of returned trades, of which the default is 100 trades.
getMyTrades(market, limit);
Parameter | Description | Example |
---|---|---|
(optional) market | the market pair | SCC_BTC |
(optional) limit | the maximum returned trades | 100 |
Example:
SC.login("your_key", "your_secret"); // result: true
SC.getMyTrades().then(res => { console.log(res) }); // result: [ { market: "SCC_BTC", id: 123, direction: "BUY", ... }, ... ]
Returns a list of all orders from a specified market such as "SCC_BTC", you may also specify a limit of the amount of returned orders, of which the default is 100 orders.
getOrderHistory(market, limit);
Parameter | Description | Example |
---|---|---|
(required) market | the market pair | SCC_BTC |
(optional) limit | the maximum returned trades | 100 |
Example:
SC.login("your_key", "your_secret"); // result: true
SC.getOrderHistory("SCC_BTC").then(res => { console.log(res) }); // result: [ { market: "SCC_BTC", type: "MARKET", side: "BUY", ... }, ... ]
Creates an exchange order for the specified market pair, orderbook side, price and amount.
postOrder(market, side, price, amount);
Parameter | Description | Example |
---|---|---|
(required) market | the market pair | SCC_BTC |
(required) side | the trade side | BUY |
(required) price | the price in the base coin | 0.00002000 (BTC) |
(required) amount | the amount of the trade coin | 1000 (SCC) |
Example:
SC.login("your_key", "your_secret"); // result: true
SC.postOrder("SCC_BTC", "BUY", 0.00002000, 1000).then(res => { console.log(res) }); // result: { orderId: 123, executedAmount: 0, fills: [], ... }
Cancels an open order by it's orderId
cancel(orderId);
Parameter | Description | Example |
---|---|---|
(required) orderId | the ID of your order | 123 |
Example:
SC.login("your_key", "your_secret"); // result: true
SC.cancel(123).then(res => { console.log(res) }); // result: { originalAmount: 1000, executedAmount: 0, canceledAmount: 0.02, ... }
Cancels all orders in a specified market pair.
cancelAll(market);
Parameter | Description | Example |
---|---|---|
(required) market | the market pair | SCC_BTC |
Example:
SC.login("your_key", "your_secret"); // result: true
SC.cancelAll("SCC_BTC").then(res => { console.log(res) }); // result: [ { originalAmount: 1000, executedAmount: 0, canceledAmount: 0.02, ... }, ... ]
Sets a coin as the preferred payout coin to receive upon future MineCube payouts.
setMineCubePayoutCoin(coin);
Parameter | Description | Example |
---|---|---|
(required) coin | the MineCube payout coin | SCC |
Example:
SC.login("your_key", "your_secret"); // result: true
SC.setMineCubePayoutCoin("SCC").then(res => { console.log(res) }); // result: { success: true, ... }
Buys a specified amount of MineCube workers using the chosen payment method.
buyMineCubeWorkers(method, workers);
Parameter | Description | Example |
---|---|---|
(required) method | the payment method | SCC or CREDITS |
(required) workers | the worker quantity | 10 |
Example:
SC.login("your_key", "your_secret"); // result: true
SC.buyMineCubeWorkers("SCC", 10).then(res => { console.log(res) }); // result: { success: true, ... }
FAQs
The official StakeCube.net API SDK for Node.js
We found that stakecube-node-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.