ether-pudding
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -484,3 +484,3 @@ | ||
Pudding.class_defaults = {}; | ||
Pudding.version = "1.1.2"; | ||
Pudding.version = "1.1.3"; | ||
@@ -487,0 +487,0 @@ return Pudding; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _toConsumableArray(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},_createClass=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),factory=function(t){var e=function(){function e(t){if(_classCallCheck(this,e),!this.constructor.abi)throw new Error("Contract ABI not set. Please inherit Pudding and set static .abi variable with contract abi.");if(this.contract=t,this.address=t.address,this.web3||(this.web3=e.web3),!this.web3)throw new Error("Please call Pudding.setWeb3() before using any Pudding class.");var r=!0,n=!1,a=void 0;try{for(var o,i=this.constructor.abi[Symbol.iterator]();!(r=(o=i.next()).done);r=!0){var s=o.value;"function"==s.type&&(1==s.constant?this[s.name]=this.constructor.promisifyFunction(this.contract[s.name]):this[s.name]=this.constructor.synchronizeFunction(this.contract[s.name]),this[s.name].call=this.constructor.promisifyFunction(this.contract[s.name].call),this[s.name].sendTransaction=this.constructor.promisifyFunction(this.contract[s.name].sendTransaction),this[s.name].request=this.contract[s.name].request),"event"==s.type&&(this[s.name]=this.contract[s.name])}}catch(l){n=!0,a=l}finally{try{!r&&i["return"]&&i["return"]()}finally{if(n)throw a}}this.allEvents=this.contract.allEvents}return _createClass(e,null,[{key:"new",value:function(){var r=this,n=Array.prototype.slice.call(arguments);if(!this.binary)throw new Error("Contract binary not set. Please override Pudding and set .binary before calling new()");var a=this;return new t(function(t,o){var i=r.web3.eth.contract(r.abi),s={},l=n[n.length-1];r.is_object(l)&&l instanceof e.BigNumber==0&&(s=n.pop()),s=r.merge(e.class_defaults,r.class_defaults,s),null==s.data&&(s.data=r.binary);var u=function(e,r){return null!=e?void o(e):void(null==e&&null!=r&&null!=r.address&&t(new a(r)))};n.push(s,u),i["new"].apply(i,n)})}},{key:"at",value:function(t){var e=this.web3.eth.contract(this.abi),r=e.at(t);return new this(r)}},{key:"deployed",value:function(){if(!this.address)throw new Error("Contract address not set - deployed() relies on the contract class having a static 'address' value; please set that before using deployed().");return this.at(this.address)}},{key:"extend",value:function(){var t=(Array.prototype.slice.call(arguments),!0),e=!1,r=void 0;try{for(var n,a=arguments[Symbol.iterator]();!(t=(n=a.next()).done);t=!0){var o=n.value,i=!0,s=!1,l=void 0;try{for(var u,c=Object.keys(o)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var f=u.value,y=o[f];this.prototype[f]=y}}catch(h){s=!0,l=h}finally{try{!i&&c["return"]&&c["return"]()}finally{if(s)throw l}}}}catch(h){e=!0,r=h}finally{try{!t&&a["return"]&&a["return"]()}finally{if(e)throw r}}}},{key:"whisk",value:function(t,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,Object.getPrototypeOf(e).apply(this,arguments))}return _inherits(e,t),e}(this);return n.abi=t,n.binary=e,n.class_defaults=r,n}},{key:"defaults",value:function(t){null==this.class_defaults&&(this.class_defaults={}),null==t&&(t={});var e=!0,r=!1,n=void 0;try{for(var a,o=Object.keys(t)[Symbol.iterator]();!(e=(a=o.next()).done);e=!0){var i=a.value,s=t[i];this.class_defaults[i]=s}}catch(l){r=!0,n=l}finally{try{!e&&o["return"]&&o["return"]()}finally{if(r)throw n}}return this.class_defaults}},{key:"setWeb3",value:function(t){if(this.web3=t,null==this.web3.toBigNumber)throw new Error("Pudding.setWeb3() must be passed an instance of Web3 and not Web3 itself.");this.BigNumber=this.web3.toBigNumber(0).constructor}},{key:"is_object",value:function(t){return"object"==("undefined"==typeof t?"undefined":_typeof(t))&&!(t instanceof Array)}},{key:"merge",value:function(){var t={},e=Array.prototype.slice.call(arguments),r=!0,n=!1,a=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done);r=!0){var s=o.value,l=!0,u=!1,c=void 0;try{for(var f,y=Object.keys(s)[Symbol.iterator]();!(l=(f=y.next()).done);l=!0){var h=f.value,d=s[h];t[h]=d}}catch(b){u=!0,c=b}finally{try{!l&&y["return"]&&y["return"]()}finally{if(u)throw c}}}}catch(b){n=!0,a=b}finally{try{!r&&i["return"]&&i["return"]()}finally{if(n)throw a}}return t}},{key:"promisifyFunction",value:function(r){var n=this;return function(){var a=this,o=Array.prototype.slice.call(arguments),i={},s=o[o.length-1];return n.is_object(s)&&s instanceof e.BigNumber==0&&(i=o.pop()),i=n.merge(e.class_defaults,n.class_defaults,i),new t(function(t,e){var n=function(r,n){null!=r?e(r):t(n)};o.push(i,n),r.apply(a.contract,o)})}}},{key:"synchronizeFunction",value:function(r){var n=this;return function(){var a=Array.prototype.slice.call(arguments),o={},i=a[a.length-1];return n.is_object(i)&&i instanceof e.BigNumber==0&&(o=a.pop()),o=n.merge(e.class_defaults,n.class_defaults,o),new t(function(t,e){var i=function(r,a){var o=null,i=240,s=0;if(null!=r)return void e(r);var o,l=function(){n.web3.eth.getTransaction(a,function(r,n){null==r&&(null!=n.blockHash&&(clearInterval(o),t(a)),s>=i&&(clearInterval(o),e(new Error("Transaction "+a+" wasn't processed in "+s+" attempts!"))),s+=1)})};o=setInterval(l,1e3),l()};a.push(o,i),r.apply(void 0,_toConsumableArray(a))})}}},{key:"load",value:function(t,e){null==e&&(e="undefined"==typeof module?window:global),t instanceof Array||(t=[t]);var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=t[Symbol.iterator]();!(n=(i=s.next()).done);n=!0){var l=i.value,u=l(this);r.push(u.contract_name),e[u.contract_name]=u}}catch(c){a=!0,o=c}finally{try{!n&&s["return"]&&s["return"]()}finally{if(a)throw o}}return r}}]),e}();return e.class_defaults={},e.version="1.1.2",e};"undefined"!=typeof module?module.exports=factory(require("bluebird")):window.Pudding=factory(Promise); | ||
"use strict";function _toConsumableArray(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},_createClass=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),factory=function(t){var e=function(){function e(t){if(_classCallCheck(this,e),!this.constructor.abi)throw new Error("Contract ABI not set. Please inherit Pudding and set static .abi variable with contract abi.");if(this.contract=t,this.address=t.address,this.web3||(this.web3=e.web3),!this.web3)throw new Error("Please call Pudding.setWeb3() before using any Pudding class.");var r=!0,n=!1,a=void 0;try{for(var o,i=this.constructor.abi[Symbol.iterator]();!(r=(o=i.next()).done);r=!0){var s=o.value;"function"==s.type&&(1==s.constant?this[s.name]=this.constructor.promisifyFunction(this.contract[s.name]):this[s.name]=this.constructor.synchronizeFunction(this.contract[s.name]),this[s.name].call=this.constructor.promisifyFunction(this.contract[s.name].call),this[s.name].sendTransaction=this.constructor.promisifyFunction(this.contract[s.name].sendTransaction),this[s.name].request=this.contract[s.name].request),"event"==s.type&&(this[s.name]=this.contract[s.name])}}catch(l){n=!0,a=l}finally{try{!r&&i["return"]&&i["return"]()}finally{if(n)throw a}}this.allEvents=this.contract.allEvents}return _createClass(e,null,[{key:"new",value:function(){var r=this,n=Array.prototype.slice.call(arguments);if(!this.binary)throw new Error("Contract binary not set. Please override Pudding and set .binary before calling new()");var a=this;return new t(function(t,o){var i=r.web3.eth.contract(r.abi),s={},l=n[n.length-1];r.is_object(l)&&l instanceof e.BigNumber==0&&(s=n.pop()),s=r.merge(e.class_defaults,r.class_defaults,s),null==s.data&&(s.data=r.binary);var u=function(e,r){return null!=e?void o(e):void(null==e&&null!=r&&null!=r.address&&t(new a(r)))};n.push(s,u),i["new"].apply(i,n)})}},{key:"at",value:function(t){var e=this.web3.eth.contract(this.abi),r=e.at(t);return new this(r)}},{key:"deployed",value:function(){if(!this.address)throw new Error("Contract address not set - deployed() relies on the contract class having a static 'address' value; please set that before using deployed().");return this.at(this.address)}},{key:"extend",value:function(){var t=(Array.prototype.slice.call(arguments),!0),e=!1,r=void 0;try{for(var n,a=arguments[Symbol.iterator]();!(t=(n=a.next()).done);t=!0){var o=n.value,i=!0,s=!1,l=void 0;try{for(var u,c=Object.keys(o)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var f=u.value,y=o[f];this.prototype[f]=y}}catch(h){s=!0,l=h}finally{try{!i&&c["return"]&&c["return"]()}finally{if(s)throw l}}}}catch(h){e=!0,r=h}finally{try{!t&&a["return"]&&a["return"]()}finally{if(e)throw r}}}},{key:"whisk",value:function(t,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,Object.getPrototypeOf(e).apply(this,arguments))}return _inherits(e,t),e}(this);return n.abi=t,n.binary=e,n.class_defaults=r,n}},{key:"defaults",value:function(t){null==this.class_defaults&&(this.class_defaults={}),null==t&&(t={});var e=!0,r=!1,n=void 0;try{for(var a,o=Object.keys(t)[Symbol.iterator]();!(e=(a=o.next()).done);e=!0){var i=a.value,s=t[i];this.class_defaults[i]=s}}catch(l){r=!0,n=l}finally{try{!e&&o["return"]&&o["return"]()}finally{if(r)throw n}}return this.class_defaults}},{key:"setWeb3",value:function(t){if(this.web3=t,null==this.web3.toBigNumber)throw new Error("Pudding.setWeb3() must be passed an instance of Web3 and not Web3 itself.");this.BigNumber=this.web3.toBigNumber(0).constructor}},{key:"is_object",value:function(t){return"object"==("undefined"==typeof t?"undefined":_typeof(t))&&!(t instanceof Array)}},{key:"merge",value:function(){var t={},e=Array.prototype.slice.call(arguments),r=!0,n=!1,a=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done);r=!0){var s=o.value,l=!0,u=!1,c=void 0;try{for(var f,y=Object.keys(s)[Symbol.iterator]();!(l=(f=y.next()).done);l=!0){var h=f.value,d=s[h];t[h]=d}}catch(b){u=!0,c=b}finally{try{!l&&y["return"]&&y["return"]()}finally{if(u)throw c}}}}catch(b){n=!0,a=b}finally{try{!r&&i["return"]&&i["return"]()}finally{if(n)throw a}}return t}},{key:"promisifyFunction",value:function(r){var n=this;return function(){var a=this,o=Array.prototype.slice.call(arguments),i={},s=o[o.length-1];return n.is_object(s)&&s instanceof e.BigNumber==0&&(i=o.pop()),i=n.merge(e.class_defaults,n.class_defaults,i),new t(function(t,e){var n=function(r,n){null!=r?e(r):t(n)};o.push(i,n),r.apply(a.contract,o)})}}},{key:"synchronizeFunction",value:function(r){var n=this;return function(){var a=Array.prototype.slice.call(arguments),o={},i=a[a.length-1];return n.is_object(i)&&i instanceof e.BigNumber==0&&(o=a.pop()),o=n.merge(e.class_defaults,n.class_defaults,o),new t(function(t,e){var i=function(r,a){var o=null,i=240,s=0;if(null!=r)return void e(r);var o,l=function(){n.web3.eth.getTransaction(a,function(r,n){null==r&&(null!=n.blockHash&&(clearInterval(o),t(a)),s>=i&&(clearInterval(o),e(new Error("Transaction "+a+" wasn't processed in "+s+" attempts!"))),s+=1)})};o=setInterval(l,1e3),l()};a.push(o,i),r.apply(void 0,_toConsumableArray(a))})}}},{key:"load",value:function(t,e){null==e&&(e="undefined"==typeof module?window:global),t instanceof Array||(t=[t]);var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=t[Symbol.iterator]();!(n=(i=s.next()).done);n=!0){var l=i.value,u=l(this);r.push(u.contract_name),e[u.contract_name]=u}}catch(c){a=!0,o=c}finally{try{!n&&s["return"]&&s["return"]()}finally{if(a)throw o}}return r}}]),e}();return e.class_defaults={},e.version="1.1.3",e};"undefined"!=typeof module?module.exports=factory(require("bluebird")):window.Pudding=factory(Promise); |
@@ -32,3 +32,3 @@ var fs = require("fs"); | ||
generate: function(contract_name, contract_data, options, Pudding) { | ||
generate: function(contract_name, contract_data, Pudding) { | ||
var classfile = class_template; | ||
@@ -35,0 +35,0 @@ |
{ | ||
"name": "ether-pudding", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Pudding - a (more) delightful Ethereum contract abstraction", | ||
@@ -5,0 +5,0 @@ "author": "Tim Coulter", |
96734