etkframework
Version:
First test release of Etk over colored coins SDK
49 lines (41 loc) • 1.5 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"),
getAssetMeta = function getAssetMeta (network, apiKey, privateSeed, assetId, utxo, cb) {
/**
* @params:
* cb: CallBack function to process the queried asset meta reponse
* assetId: ID of the issued Asset
* utxo: The UTXO for that Issued asset
*/
const
//initialize colu object with settings
colu = new Colu(settingsCreate(network, apiKey, privateSeed));
colu.on('connect', function () {
colu.coloredCoins.getAssetMetadata(assetId,utxo,function (err, body) {
let res = {};
if (err) {
res.err = err;
res.type = "error";
} else {
res.body = body;
res.type = "message";
}
cb(res);
});
});
colu.init();
};
exports.getAssetMeta = getAssetMeta;