scalechain-nodejs
v1.0.5
Published
The ScaleChain SDK for Node.js
Downloads
20
Readme
The ScaleChain API for Node.js
The official Node.js library for the ScaleChain API.
Installation
npm install scalechain-nodejsQuick Start
Sign Up
The first thing you'll need to do is sign up for ScaleChain Cloud.
Get API Key
Go to Manage API and click 'Add New API Key'.
Get an Access Token
// Import ScaleChain SDK
var ScaleChain = require('scalechain-nodejs');
var apiKey = "API-KEY";
var apiSecret = "API-SECRET";
var config = ScaleChain.configuration;
var auth = ScaleChain.AuthorizationController;
auth.getAccessTokenByClientCredential(apiKey, apiSecret, function(err, res, req) {
config.oAuthAccessToken = res.access_token;
config.oAuthRefreshToken = res.refresh_token;
});Making API Calls
var block = ScaleChain.BlockController;
block.getBlock('latest', 'mainnet', function(err, res, req) {
console.log(res);
});Switching to Testnet Blockchain
var block = ScaleChain.BlockController;
block.getBlock('latest', 'testnet', function(err, res, req) {
console.log(res);
});API Reference
Visit docs.scalechain.io.
