etkframework
Version:
First test release of Etk over colored coins SDK
50 lines (42 loc) • 1.65 kB
JavaScript
// #!/usr/local/bin/node --harmony
/**
* Etk Operations library.
* A wrapper using Colored Coins SDK to create standard token functions that can
* be used to build EarthShares.
* Core Developer(s): @codecakes Akul Mathur akul at earthbenign dot com
* Maintainer(s):
* @codecakes Akul Mathur akul at earthbenign dot com
*/
;
const
path = require("path"),
settingsCreate = require('./opHelper/settingsHelper').settingsCreate,
//minified client side version of the the main colu library
Colu = require("colu"),
getAssetHolder = function getAssetHolder (network, apiKey, privateSeed, assetId, num_confirmation, cb) {
/**
* @params:
* privateSeed: The Pvt key of the user
* cb: CallBack function to process the queried asset Holders' reponse
* assetId: ID of the issued Asset
* num_confirmation: filtering the results by the number of block confirmations.
* Or null
*/
const
//initialize colu object with settings
colu = new Colu(settingsCreate(network, apiKey, privateSeed));
colu.on('connect', function () {
colu.coloredCoins.getStakeHolders(assetId,num_confirmation,function (err, body) {
let res = {};
if (err) {
res.err = err;
res.type = "error";
} else {
res.body = body;
res.type = "message";
}
cb(res);
});
});
};
exports.getAssetHolder = getAssetHolder;