ether-pudding
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -460,3 +460,3 @@ | ||
Pudding.class_defaults = {}; | ||
Pudding.version = "1.0.1"; | ||
Pudding.version = "1.0.2"; | ||
@@ -463,0 +463,0 @@ return Pudding; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _toConsumableArray(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(t,r):t.__proto__=r)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}var _get=function(t,r,e){for(var n=!0;n;){var a=t,o=r,i=e;s=c=l=void 0,n=!1,null===a&&(a=Function.prototype);var s=Object.getOwnPropertyDescriptor(a,o);if(void 0!==s){if("value"in s)return s.value;var l=s.get;return void 0===l?void 0:l.call(i)}var c=Object.getPrototypeOf(a);if(null===c)return void 0;t=c,r=o,e=i,n=!0}},_createClass=function(){function t(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(r,e,n){return e&&t(r.prototype,e),n&&t(r,n),r}}(),factory=function(t,r){var e=function(){function r(t){if(_classCallCheck(this,r),!this.constructor.abi)throw new Error("Contract ABI not set. Please inherit Pudding and set static .abi variable with contract abi.");this.contract=t,this.address=t.address,this.web3||(this.web3=r.web3);var e=!0,n=!1,a=void 0;try{for(var o,i=this.constructor.abi[Symbol.iterator]();!(e=(o=i.next()).done);e=!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{!e&&i["return"]&&i["return"]()}finally{if(n)throw a}}this.allEvents=this.contract.allEvents}return _createClass(r,null,[{key:"new",value:function(){var e=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=e.web3.eth.contract(e.abi),s={};e.is_object(n[n.length-1])&&(s=n.pop()),s=e.merge(r.class_defaults,e.class_defaults,s),null==s.data&&(s.data=e.binary);var l=function(r,e){return null!=r?void o(r):void(null==r&&null!=e&&null!=e.address&&t(new a(e)))};n.push(s,l),i["new"].apply(i,n)})}},{key:"at",value:function(t){var r=this.web3.eth.contract(this.abi),e=r.at(t);return new this(e)}},{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),r=!1,e=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 c,u=Object.keys(o)[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var f=c.value,y=o[f];this.prototype[f]=y}}catch(h){s=!0,l=h}finally{try{!i&&u["return"]&&u["return"]()}finally{if(s)throw l}}}}catch(h){r=!0,e=h}finally{try{!t&&a["return"]&&a["return"]()}finally{if(r)throw e}}}},{key:"whisk",value:function(t,r){var e=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=function(t){function r(){_classCallCheck(this,r),_get(Object.getPrototypeOf(r.prototype),"constructor",this).apply(this,arguments)}return _inherits(r,t),r}(this);return n.abi=t,n.binary=r,n.class_defaults=e,n}},{key:"defaults",value:function(t){null==this.class_defaults&&(this.class_defaults={});var r=!0,e=!1,n=void 0;try{for(var a,o=Object.keys(t)[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){var i=a.value,s=t[i];this.class_defaults[i]=s}}catch(l){e=!0,n=l}finally{try{!r&&o["return"]&&o["return"]()}finally{if(e)throw n}}return this.class_defaults}},{key:"setWeb3",value:function(t){this.web3=t}},{key:"is_object",value:function(t){return"object"==typeof t&&!(t instanceof Array)}},{key:"merge",value:function(){var t={},r=Array.prototype.slice.call(arguments),e=!0,n=!1,a=void 0;try{for(var o,i=r[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var s=o.value,l=!0,c=!1,u=void 0;try{for(var f,y=Object.keys(s)[Symbol.iterator]();!(l=(f=y.next()).done);l=!0){var h=f.value,v=s[h];t[h]=v}}catch(d){c=!0,u=d}finally{try{!l&&y["return"]&&y["return"]()}finally{if(c)throw u}}}}catch(d){n=!0,a=d}finally{try{!e&&i["return"]&&i["return"]()}finally{if(n)throw a}}return t}},{key:"promisifyFunction",value:function(e){var n=this;return function(){var a=this,o=Array.prototype.slice.call(arguments),i={};return n.is_object(o[o.length-1])&&(i=o.pop()),i=n.merge(r.class_defaults,n.class_defaults,i),new t(function(t,r){var n=function(e,n){null!=e?r(e):t(n)};o.push(i,n),e.apply(a.contract,o)})}}},{key:"synchronizeFunction",value:function(e){var n=this;return function(){var a=Array.prototype.slice.call(arguments),o={};return n.is_object(a[a.length-1])&&(o=a.pop()),o=n.merge(r.class_defaults,n.class_defaults,o),new t(function(t,r){var i=function(e,a){var o=null,i=240,s=0;if(null!=e)return void r(e);var o,l=function(){n.web3.eth.getTransaction(a,function(e,n){null==e&&(null!=n.blockHash&&(clearInterval(o),t(a)),s>=i&&(clearInterval(o),r(new Error("Transaction "+a+" wasn't processed in "+s+" attempts!"))),s+=1)})};o=setInterval(l,1e3),l()};a.push(o,i),e.apply(void 0,_toConsumableArray(a))})}}},{key:"load",value:function(t,r){null==r&&(r="undefined"==typeof module?window:global),t instanceof Array||(t=[t]);var e=[],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,c=l(this);e.push(c.contract_name),r[c.contract_name]=c}}catch(u){a=!0,o=u}finally{try{!n&&s["return"]&&s["return"]()}finally{if(a)throw o}}return e}}]),r}();return e.class_defaults={},e.version="1.0.1",e};"undefined"!=typeof module?module.exports=factory(require("bluebird")):window.Pudding=factory(Promise); | ||
"use strict";function _toConsumableArray(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(t,r):t.__proto__=r)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}var _get=function(t,r,e){for(var n=!0;n;){var a=t,o=r,i=e;s=c=l=void 0,n=!1,null===a&&(a=Function.prototype);var s=Object.getOwnPropertyDescriptor(a,o);if(void 0!==s){if("value"in s)return s.value;var l=s.get;return void 0===l?void 0:l.call(i)}var c=Object.getPrototypeOf(a);if(null===c)return void 0;t=c,r=o,e=i,n=!0}},_createClass=function(){function t(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(r,e,n){return e&&t(r.prototype,e),n&&t(r,n),r}}(),factory=function(t,r){var e=function(){function r(t){if(_classCallCheck(this,r),!this.constructor.abi)throw new Error("Contract ABI not set. Please inherit Pudding and set static .abi variable with contract abi.");this.contract=t,this.address=t.address,this.web3||(this.web3=r.web3);var e=!0,n=!1,a=void 0;try{for(var o,i=this.constructor.abi[Symbol.iterator]();!(e=(o=i.next()).done);e=!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{!e&&i["return"]&&i["return"]()}finally{if(n)throw a}}this.allEvents=this.contract.allEvents}return _createClass(r,null,[{key:"new",value:function(){var e=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=e.web3.eth.contract(e.abi),s={};e.is_object(n[n.length-1])&&(s=n.pop()),s=e.merge(r.class_defaults,e.class_defaults,s),null==s.data&&(s.data=e.binary);var l=function(r,e){return null!=r?void o(r):void(null==r&&null!=e&&null!=e.address&&t(new a(e)))};n.push(s,l),i["new"].apply(i,n)})}},{key:"at",value:function(t){var r=this.web3.eth.contract(this.abi),e=r.at(t);return new this(e)}},{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),r=!1,e=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 c,u=Object.keys(o)[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var f=c.value,y=o[f];this.prototype[f]=y}}catch(h){s=!0,l=h}finally{try{!i&&u["return"]&&u["return"]()}finally{if(s)throw l}}}}catch(h){r=!0,e=h}finally{try{!t&&a["return"]&&a["return"]()}finally{if(r)throw e}}}},{key:"whisk",value:function(t,r){var e=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=function(t){function r(){_classCallCheck(this,r),_get(Object.getPrototypeOf(r.prototype),"constructor",this).apply(this,arguments)}return _inherits(r,t),r}(this);return n.abi=t,n.binary=r,n.class_defaults=e,n}},{key:"defaults",value:function(t){null==this.class_defaults&&(this.class_defaults={});var r=!0,e=!1,n=void 0;try{for(var a,o=Object.keys(t)[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){var i=a.value,s=t[i];this.class_defaults[i]=s}}catch(l){e=!0,n=l}finally{try{!r&&o["return"]&&o["return"]()}finally{if(e)throw n}}return this.class_defaults}},{key:"setWeb3",value:function(t){this.web3=t}},{key:"is_object",value:function(t){return"object"==typeof t&&!(t instanceof Array)}},{key:"merge",value:function(){var t={},r=Array.prototype.slice.call(arguments),e=!0,n=!1,a=void 0;try{for(var o,i=r[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var s=o.value,l=!0,c=!1,u=void 0;try{for(var f,y=Object.keys(s)[Symbol.iterator]();!(l=(f=y.next()).done);l=!0){var h=f.value,v=s[h];t[h]=v}}catch(d){c=!0,u=d}finally{try{!l&&y["return"]&&y["return"]()}finally{if(c)throw u}}}}catch(d){n=!0,a=d}finally{try{!e&&i["return"]&&i["return"]()}finally{if(n)throw a}}return t}},{key:"promisifyFunction",value:function(e){var n=this;return function(){var a=this,o=Array.prototype.slice.call(arguments),i={};return n.is_object(o[o.length-1])&&(i=o.pop()),i=n.merge(r.class_defaults,n.class_defaults,i),new t(function(t,r){var n=function(e,n){null!=e?r(e):t(n)};o.push(i,n),e.apply(a.contract,o)})}}},{key:"synchronizeFunction",value:function(e){var n=this;return function(){var a=Array.prototype.slice.call(arguments),o={};return n.is_object(a[a.length-1])&&(o=a.pop()),o=n.merge(r.class_defaults,n.class_defaults,o),new t(function(t,r){var i=function(e,a){var o=null,i=240,s=0;if(null!=e)return void r(e);var o,l=function(){n.web3.eth.getTransaction(a,function(e,n){null==e&&(null!=n.blockHash&&(clearInterval(o),t(a)),s>=i&&(clearInterval(o),r(new Error("Transaction "+a+" wasn't processed in "+s+" attempts!"))),s+=1)})};o=setInterval(l,1e3),l()};a.push(o,i),e.apply(void 0,_toConsumableArray(a))})}}},{key:"load",value:function(t,r){null==r&&(r="undefined"==typeof module?window:global),t instanceof Array||(t=[t]);var e=[],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,c=l(this);e.push(c.contract_name),r[c.contract_name]=c}}catch(u){a=!0,o=u}finally{try{!n&&s["return"]&&s["return"]()}finally{if(a)throw o}}return e}}]),r}();return e.class_defaults={},e.version="1.0.2",e};"undefined"!=typeof module?module.exports=factory(require("bluebird")):window.Pudding=factory(Promise); |
{ | ||
"name": "ether-pudding", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Pudding - a (more) delightful Ethereum contract abstraction", | ||
@@ -5,0 +5,0 @@ "author": "Tim Coulter", |
@@ -51,3 +51,3 @@ # The Proof is in the Pudding | ||
See [Interacting With Your Contracts](#asdfasd) below for details on how to use the newly created `MyContract` object. | ||
See [Interacting With Your Contracts](https://github.com/ConsenSys/ether-pudding#interacting-with-your-contracts) below for details on how to use the newly created `MyContract` object. | ||
@@ -54,0 +54,0 @@ ### Using Pudding: Advanced |
49929