Skip to content

Commit

Permalink
RC 1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
zoernert committed Oct 15, 2018
1 parent f4aedc1 commit 50670f5
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 54 deletions.
96 changes: 74 additions & 22 deletions dist/correntlywallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", {
/**
* Ethereum Blockchain Wallet implementing Green Energy semantics for Corrently based decentralized capacity market.
*
* @link https://corrently.com/
* @module CorrentlyWallet
*/

Expand Down Expand Up @@ -202,10 +203,13 @@ ethers.Wallet.prototype.newDemand = function (data) {


ethers.Wallet.prototype.transferCapacity = function (ethereumAddress, kilowatthours) {
var parent = this;
return new Promise(function (resolve, reject) {
var cori_contract = new ethers.Contract(ethers.CORRENTLY.CORI_ADDRESS, ethers.CORRENTLY.ERC20ABI, ethers.providers.getDefaultProvider('homestead'));
var cori_contract = new ethers.Contract(ethers.CORRENTLY.CORI_ADDRESS, ethers.CORRENTLY.ERC20ABI, parent);
cori_contract.transfer(ethereumAddress, Math.round(kilowatthours * 100)).then(function (tx) {
resolve(tx);
}).catch(function (e) {
reject(e);
});
});
};
Expand Down Expand Up @@ -256,7 +260,7 @@ ethers.Wallet.prototype._retrieveCoriAccount = function () {

ethers.utils._retrieveCoriAccount = function (address) {
return new Promise(function (resolve, reject) {
request(ethers.CORRENTLY.API + 'totalSupply?account=' + address, function (e, r, b) {
request(ethers.CORRENTLY.API + 'accountInfo?account=' + address, function (e, r, b) {
resolve(JSON.parse(b).result);
});
});
Expand All @@ -275,6 +279,41 @@ ethers.Market = function () {
});
});
};
/**
* Retrieve Performance profile of given asset.
* Corrently has a day based performance monitoring for assets on the market.
* This is subject to be changed in later releases to merge with Performance package
*
* @function performance
* @param {string} asset transaction hash of asset contract setup
* @return {Object} Performance data as returned by asset schema
*/


ethers.Market.performance = function (asset) {
return new Promise(function (resolve, reject) {
request(ethers.CORRENTLY.API + 'assetPerformance?asset=' + asset, function (e, r, b) {
resolve(JSON.parse(b).results);
});
});
};
/**
* Retrieve Performance profile of given asset Metering ID.
* Note: This is not standarized at the moment and schema is subject to be changed.
*
* @function Performance
* @param {string} meterid unique id to dispatch
* @return {Object} Performance data as given by meter schema
*/


ethers.Performance = function (meterid) {
return new Promise(function (resolve, reject) {
request(ethers.CORRENTLY.API + 'performance?meterid=' + meterid, function (e, r, b) {
resolve(JSON.parse(b));
});
});
};

exports.default = ethers;

Expand Down Expand Up @@ -12252,6 +12291,12 @@ utils.intFromLE = intFromLE;

},{"bn.js":15}],42:[function(require,module,exports){
module.exports={
"_args": [
[
"elliptic@6.3.3",
"/home/zoernert/Development/stromdao/CorrentlyWallet"
]
],
"_from": "elliptic@6.3.3",
"_id": "elliptic@6.3.3",
"_inBundle": false,
Expand All @@ -12269,27 +12314,26 @@ module.exports={
"fetchSpec": "6.3.3"
},
"_requiredBy": [
"/browserify-sign",
"/create-ecdh",
"/ethers"
],
"_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz",
"_shasum": "5482d9646d54bcb89fd7d994fc9e2e9568876e3f",
"_spec": "elliptic@6.3.3",
"_where": "/home/zoernert/Development/stromdao/CorrentlyWallet/node_modules/ethers",
"_spec": "6.3.3",
"_where": "/home/zoernert/Development/stromdao/CorrentlyWallet",
"author": {
"name": "Fedor Indutny",
"email": "fedor@indutny.com"
},
"bugs": {
"url": "https://github.com/indutny/elliptic/issues"
},
"bundleDependencies": false,
"dependencies": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"hash.js": "^1.0.0",
"inherits": "^2.0.1"
},
"deprecated": false,
"description": "EC cryptography",
"devDependencies": {
"brfs": "^1.4.3",
Expand Down Expand Up @@ -13055,6 +13099,12 @@ if (typeof Object.create === 'function') {

},{}],48:[function(require,module,exports){
module.exports={
"_args": [
[
"ethers@3.0.6",
"/home/zoernert/Development/stromdao/CorrentlyWallet"
]
],
"_from": "ethers@3.0.6",
"_id": "ethers@3.0.6",
"_inBundle": false,
Expand All @@ -13075,8 +13125,7 @@ module.exports={
"/"
],
"_resolved": "http://registry.npmjs.org/ethers/-/ethers-3.0.6.tgz",
"_shasum": "54e6bb4468b9baa0ed494bd5e4626018b4d7c00b",
"_spec": "ethers@3.0.6",
"_spec": "3.0.6",
"_where": "/home/zoernert/Development/stromdao/CorrentlyWallet",
"author": {
"name": "Richard Moore",
Expand All @@ -13091,7 +13140,6 @@ module.exports={
"bugs": {
"url": "https://github.com/ethers-io/ethers-wallet/issues"
},
"bundleDependencies": false,
"dependencies": {
"aes-js": "3.0.0",
"bn.js": "^4.4.0",
Expand All @@ -13104,7 +13152,6 @@ module.exports={
"uuid": "2.0.1",
"xmlhttprequest": "1.8.0"
},
"deprecated": false,
"description": "Ethereum wallet library.",
"devDependencies": {
"browserify-zlib": "^0.2.0",
Expand Down Expand Up @@ -51253,37 +51300,43 @@ Store.prototype.getAllCookies = function(cb) {

},{}],239:[function(require,module,exports){
module.exports={
"_from": "tough-cookie@~2.4.3",
"_args": [
[
"tough-cookie@2.4.3",
"/home/zoernert/Development/stromdao/CorrentlyWallet"
]
],
"_from": "tough-cookie@2.4.3",
"_id": "tough-cookie@2.4.3",
"_inBundle": false,
"_integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
"_location": "/tough-cookie",
"_phantomChildren": {},
"_requested": {
"type": "range",
"type": "version",
"registry": true,
"raw": "tough-cookie@~2.4.3",
"raw": "tough-cookie@2.4.3",
"name": "tough-cookie",
"escapedName": "tough-cookie",
"rawSpec": "~2.4.3",
"rawSpec": "2.4.3",
"saveSpec": null,
"fetchSpec": "~2.4.3"
"fetchSpec": "2.4.3"
},
"_requiredBy": [
"/request"
"/jsdom",
"/request",
"/request-promise-native"
],
"_resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
"_shasum": "53f36da3f47783b0925afa06ff9f3b165280f781",
"_spec": "tough-cookie@~2.4.3",
"_where": "/home/zoernert/Development/stromdao/CorrentlyWallet/node_modules/request",
"_spec": "2.4.3",
"_where": "/home/zoernert/Development/stromdao/CorrentlyWallet",
"author": {
"name": "Jeremy Stashewsky",
"email": "jstash@gmail.com"
},
"bugs": {
"url": "https://github.com/salesforce/tough-cookie/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Alexander Savin"
Expand All @@ -51308,7 +51361,6 @@ module.exports={
"psl": "^1.1.24",
"punycode": "^1.4.1"
},
"deprecated": false,
"description": "RFC6265 Cookies and Cookie Jar for node.js",
"devDependencies": {
"async": "^1.4.2",
Expand Down
41 changes: 39 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
/**
* Ethereum Blockchain Wallet implementing Green Energy semantics for Corrently based decentralized capacity market.
*
* @link https://corrently.com/
* @module CorrentlyWallet
*/

Expand Down Expand Up @@ -186,10 +187,13 @@ ethers.Wallet.prototype.newDemand = function (data) {
* @param {number} kilowatthours Kilo-Watt-Hours per year to transfer
*/
ethers.Wallet.prototype.transferCapacity = function (ethereumAddress, kilowatthours) {
var parent = this;
return new Promise(function (resolve, reject) {
var cori_contract = new ethers.Contract(ethers.CORRENTLY.CORI_ADDRESS, ethers.CORRENTLY.ERC20ABI, ethers.providers.getDefaultProvider('homestead'));
var cori_contract = new ethers.Contract(ethers.CORRENTLY.CORI_ADDRESS, ethers.CORRENTLY.ERC20ABI, parent);
cori_contract.transfer(ethereumAddress, Math.round(kilowatthours * 100)).then(function (tx) {
resolve(tx);
}).catch(function (e) {
reject(e);
});
});
};
Expand Down Expand Up @@ -240,7 +244,7 @@ ethers.Wallet.prototype._retrieveCoriAccount = function () {

ethers.utils._retrieveCoriAccount = function (address) {
return new Promise(function (resolve, reject) {
request(ethers.CORRENTLY.API + 'totalSupply?account=' + address, function (e, r, b) {
request(ethers.CORRENTLY.API + 'accountInfo?account=' + address, function (e, r, b) {
resolve(JSON.parse(b).result);
});
});
Expand All @@ -259,4 +263,37 @@ ethers.Market = function () {
});
};

/**
* Retrieve Performance profile of given asset.
* Corrently has a day based performance monitoring for assets on the market.
* This is subject to be changed in later releases to merge with Performance package
*
* @function performance
* @param {string} asset transaction hash of asset contract setup
* @return {Object} Performance data as returned by asset schema
*/
ethers.Market.performance = function (asset) {
return new Promise(function (resolve, reject) {
request(ethers.CORRENTLY.API + 'assetPerformance?asset=' + asset, function (e, r, b) {
resolve(JSON.parse(b).results);
});
});
};

/**
* Retrieve Performance profile of given asset Metering ID.
* Note: This is not standarized at the moment and schema is subject to be changed.
*
* @function Performance
* @param {string} meterid unique id to dispatch
* @return {Object} Performance data as given by meter schema
*/
ethers.Performance = function (meterid) {
return new Promise(function (resolve, reject) {
request(ethers.CORRENTLY.API + 'performance?meterid=' + meterid, function (e, r, b) {
resolve(JSON.parse(b));
});
});
};

exports.default = ethers;
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Co
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 13:16:27 GMT+0200 (CEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 14:24:31 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ <h1 class="page-title">Source: index.js</h1>

ethers.utils._retrieveCoriAccount = function(address) {
return new Promise(function(resolve, reject) {
request(ethers.CORRENTLY.API + 'totalSupply?account=' + address, function(e, r, b) {
request(ethers.CORRENTLY.API + 'accountInfo?account=' + address, function(e, r, b) {
resolve(JSON.parse(b).result);
});
});
Expand Down Expand Up @@ -337,7 +337,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Co
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 13:16:27 GMT+0200 (CEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 14:24:31 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/module-CorrentlyWallet.html
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Co
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 13:16:27 GMT+0200 (CEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 14:24:31 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial-cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Co
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 13:16:27 GMT+0200 (CEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 14:24:31 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial-getting_started.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Co
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 13:16:27 GMT+0200 (CEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 14:24:31 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial-roadmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Co
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 13:16:27 GMT+0200 (CEST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 15 2018 14:24:31 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "correntlywallet",
"version": "1.0.5",
"version": "1.0.6",
"description": "Ethereum Blockchain Wallet implementing Green Energy semantics for Corrently based decentralized capacity market",
"keywords": [
"ethereum",
Expand Down
Loading

0 comments on commit 50670f5

Please sign in to comment.