Official BlockCluster Node.js SDK for Dynamo and Platform APIs
npm:
npm install blockcluster
yarn:
yarn add blockcluster
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
}
);
Documentation of Dynamo's REST APIs and their usage is available at https://node.api.blockcluster.io
Name | Website |
---|---|
BlockCluster | https://www.blockcluster.io |
Jibin Mathews | https://www.jibinmathews.in |
Narayan Prusty | https://www.github.com/narayanprusty |
Saikat Chakrabortty | https://www.github.com/saikatharryc |