UNPKG

etkframework

Version:

First test release of Etk over colored coins SDK

63 lines (54 loc) 2.13 kB
// #!/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 */ "use strict"; const path = require("path"), settingsCreate = require('./opHelper/settingsHelper').settingsCreate, //minified client side version of the the main colu library Colu = require("colu"), getAssetData = function getAssetData (network, apiKey, privateSeed, asset, cb) { /** * @params: * privateSeed: The Pvt key of the user * cb: CallBack function to process the queried asset reponse * asset: The asset JSON attributes: * assetId: ID of the issued Asset * addresses: A list of addresses to filter down to/track * confirmations: Number of Block confirmations in the blockchain to filter the * valid TXNs. High confirmations are more regarded. * * var assetId = 'U831iMR6M2aXdDSSmY3tyY7ZqpaCqLXQZKWJt' var addresses = ['mw7hLtuo9vnBNCs9PL7i2h7oqDfs4j8NJG'] var confirmations = 6 var asset = { assetId: assetId, addresses: addresses, numConfirmations:confirmations } */ const //initialize colu object with settings colu = new Colu(settingsCreate(network, apiKey, privateSeed)); colu.on('connect', function () { colu.coloredCoins.getAssetData(asset,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.getAssetData = getAssetData;