Official BlockCluster Node.js SDK for Dynamo, Paymeter, Hyperion and Platform APIs
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
docs
lib
test
tmp
.editorconfig
.eslintrc.js
.gitattributes
.gitignore
.jsdoc.conf.js
.prettierignore
.prettierrc.js
.remarkignore
.travis.yml
LICENSE
README.md
index.js
package-lock.json
package.json

README.md

blockcluster

build status code coverage code style styled with prettier made with lass license

Official BlockCluster Node.js SDK for Dynamo and Platform APIs

Table of Contents

Install

npm:

npm install blockcluster

yarn:

yarn add blockcluster

Usage

Here is an example script showing how to create an asset type, issue assets and fetch assets:

const Blockcluster = require('blockcluster');

const node = new Blockcluster.Dynamo({
    locationDomain: 'app-ap-south-1b.blockcluster.io', //enter your node's location domain
    instanceId: 'noeurgyb' //enter your instanceId
});

//create license solo asset type
await node.callAPI('assets/createAssetType', {
    assetType: 'solo',
    assetName: 'license',
    fromAccount: node.getWeb3().eth.accounts[0]
});

//issue a license
await node.callAPI('assets/issueSoloAsset', {
    assetName: 'license',
    fromAccount: node.getWeb3().eth.accounts[0],
    toAccount: node.getWeb3().eth.accounts[0],
    identifier: '1234'
});

//get asset info
const assetInfo = await node.callAPI('assets/getSoloAssetInfo', {
    assetName: 'license',
    identifier: '1234'
});

Here is an another example script showing how to create stream using an offline account:

const Wallet = require('ethereumjs-wallet');

const wallet = Wallet.generate();
const privateKey = wallet.getPrivateKey().toString('hex');
const address = '0x' + wallet.getAddress().toString('hex');

await node.callAPI(
    'streams/create',
    {
        streamName: 'renew',
        fromAccount: address
    },
    {
        privateKey
    }
);

Docs

Documentation of Dynamo's REST APIs and their usage is available at https://node.api.blockcluster.io

Contributors

Name Website
BlockCluster https://www.blockcluster.io
Jibin Mathews https://www.jibinmathews.in
Narayan Prusty https://www.github.com/narayanprusty

License

MIT © BlockCluster