etkframework
Version:
First test release of Etk over colored coins SDK
54 lines (44 loc) • 1.51 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): @akurnya Akul Mathur
* Maintainer(s):
* @akurnya Akul Mathur
*/
;
const
path = require("path"),
settingsCreate = require('./opHelper/settingsHelper').settingsCreate,
//minified client side version of the the main colu library
Colu = require("colu"),
getAddr = function getAddr (privateSeed, network, apiKey, cb) {
const
colu = new Colu(settingsCreate(network, apiKey, privateSeed));
colu.on('connect', function () {
cb( colu.hdwallet.getAddress() );
});
colu.init();
},
getAddrInfo = function getAddrInfo (privateSeed, network, apiKey, address, cb) {
/**
* get all the assets for the address,
* this information is per utxo owned by the address,
* also retrives uncolored utxos.
*/
const
colu = new Colu(settingsCreate(network, apiKey, privateSeed));
colu.on('connect', function () {
colu.coloredCoins.getAddressInfo(address, function (err, body) {
if (err) throw("Address Query Error: " + err);
cb(body);
});
});
colu.init();
};
module.exports = {
getAddr:getAddr,
getAddrInfo: getAddrInfo,
};
// debugging and testing purpose only