UNPKG

webu

Version:

IrChain JavaScript API, middleware to talk to a irchain node over RPC

1 lines 139 kB
require=function o(a,s,c){function u(e,t){if(!s[e]){if(!a[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(f)return f(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[e]={exports:{}};a[e][0].call(i.exports,function(t){return u(a[e][1][t]||t)},i,i.exports,o,a,s,c)}return s[e].exports}for(var f="function"==typeof require&&require,t=0;t<c.length;t++)u(c[t]);return u}({1:[function(t,e,r){e.exports=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"_name",type:"bytes32"},{indexed:!1,name:"_winner",type:"address"}],name:"AuctionEnded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"_name",type:"bytes32"},{indexed:!1,name:"_bidder",type:"address"},{indexed:!1,name:"_value",type:"uint256"}],name:"NewBid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}]},{}],2:[function(t,e,r){e.exports=[{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_refund",type:"address"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"}],name:"setAddr",outputs:[],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"}]},{}],3:[function(t,e,r){e.exports=[{constant:!1,inputs:[{name:"from",type:"bytes32"},{name:"to",type:"address"},{name:"value",type:"uint256"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"from",type:"bytes32"},{name:"to",type:"address"},{name:"indirectId",type:"bytes32"},{name:"value",type:"uint256"}],name:"icapTransfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"to",type:"bytes32"}],name:"deposit",outputs:[],payable:!0,type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"AnonymousDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"bytes32"},{indexed:!1,name:"value",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"bytes32"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"bytes32"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"indirectId",type:"bytes32"},{indexed:!1,name:"value",type:"uint256"}],name:"IcapTransfer",type:"event"}]},{}],4:[function(t,e,r){var n=t("./formatters"),i=t("./type"),o=function(){this._inputFormatter=n.formatInputInt,this._outputFormatter=n.formatOutputAddress};((o.prototype=new i({})).constructor=o).prototype.isType=function(t){return!!t.match(/address(\[([0-9]*)\])?/)},e.exports=o},{"./formatters":9,"./type":14}],5:[function(t,e,r){var n=t("./formatters"),i=t("./type"),o=function(){this._inputFormatter=n.formatInputBool,this._outputFormatter=n.formatOutputBool};((o.prototype=new i({})).constructor=o).prototype.isType=function(t){return!!t.match(/^bool(\[([0-9]*)\])*$/)},e.exports=o},{"./formatters":9,"./type":14}],6:[function(t,e,r){var n=t("./formatters"),i=t("./type"),o=function(){this._inputFormatter=n.formatInputBytes,this._outputFormatter=n.formatOutputBytes};((o.prototype=new i({})).constructor=o).prototype.isType=function(t){return!!t.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/)},e.exports=o},{"./formatters":9,"./type":14}],7:[function(t,e,r){var y=t("./formatters"),n=t("./address"),i=t("./bool"),o=t("./int"),a=t("./uint"),s=t("./dynamicbytes"),c=t("./string"),u=t("./real"),f=t("./ureal"),l=t("./bytes"),p=function(t,e){return t.isDynamicType(e)||t.isDynamicArray(e)},h=function(t){this._types=t};h.prototype._requireType=function(e){var t=this._types.filter(function(t){return t.isType(e)})[0];if(!t)throw Error("invalid solidity type!: "+e);return t},h.prototype.encodeParam=function(t,e){return this.encodeParams([t],[e])},h.prototype.encodeParams=function(o,r){var a=this.getSolidityTypes(o),t=a.map(function(t,e){return t.encode(r[e],o[e])}),e=a.reduce(function(t,e,r){var n=e.staticPartLength(o[r]),i=32*Math.floor((n+31)/32);return t+(p(a[r],o[r])?32:i)},0);return this.encodeMultiWithOffset(o,a,t,e)},h.prototype.encodeMultiWithOffset=function(n,i,o,a){var s="",c=this;return n.forEach(function(t,e){if(p(i[e],n[e])){s+=y.formatInputInt(a).encode();var r=c.encodeWithOffset(n[e],i[e],o[e],a);a+=r.length/2}else s+=c.encodeWithOffset(n[e],i[e],o[e],a)}),n.forEach(function(t,e){if(p(i[e],n[e])){var r=c.encodeWithOffset(n[e],i[e],o[e],a);a+=r.length/2,s+=r}}),s},h.prototype.encodeWithOffset=function(t,e,r,n){var i=1,o=2,a=3,s=e.isDynamicArray(t)?i:e.isStaticArray(t)?o:a;if(s===a)return r;var c=e.nestedName(t),u=e.staticPartLength(c),f=s===i?r[0]:"";if(e.isDynamicArray(c))for(var l=s===i?2:0,p=0;p<r.length;p++)s===i?l+=+r[p-1][0]||0:s===o&&(l+=+(r[p-1]||[])[0]||0),f+=y.formatInputInt(n+p*u+32*l).encode();for(var h=s===i?r.length-1:r.length,d=0;d<h;d++){var m=f/2;s===i?f+=this.encodeWithOffset(c,e,r[d+1],n+m):s===o&&(f+=this.encodeWithOffset(c,e,r[d],n+m))}return f},h.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},h.prototype.decodeParams=function(r,n){var t=this.getSolidityTypes(r),i=this.getOffsets(r,t);return t.map(function(t,e){return t.decode(n,i[e],r[e],e)})},h.prototype.getOffsets=function(r,n){for(var t=n.map(function(t,e){return t.staticPartLength(r[e])}),e=1;e<t.length;e++)t[e]+=t[e-1];return t.map(function(t,e){return t-n[e].staticPartLength(r[e])})},h.prototype.getSolidityTypes=function(t){var e=this;return t.map(function(t){return e._requireType(t)})};var d=new h([new n,new i,new o,new a,new s,new l,new c,new u,new f]);e.exports=d},{"./address":4,"./bool":5,"./bytes":6,"./dynamicbytes":8,"./formatters":9,"./int":10,"./real":12,"./string":13,"./uint":15,"./ureal":16}],8:[function(t,e,r){var n=t("./formatters"),i=t("./type"),o=function(){this._inputFormatter=n.formatInputDynamicBytes,this._outputFormatter=n.formatOutputDynamicBytes};((o.prototype=new i({})).constructor=o).prototype.isType=function(t){return!!t.match(/^bytes(\[([0-9]*)\])*$/)},o.prototype.isDynamicType=function(){return!0},e.exports=o},{"./formatters":9,"./type":14}],9:[function(t,e,r){var n=t("bignumber.js"),i=t("../utils/utils"),o=t("../utils/config"),a=t("./param"),s=function(t){n.config(o.IRC_BIGNUMBER_ROUNDING_MODE);var e=i.padLeft(i.toTwosComplement(t).toString(16),64);return new a(e)},c=function(t){var e=t.staticPart()||"0";return"1"===new n(e.substr(0,1),16).toString(2).substr(0,1)?new n(e,16).minus(new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new n(e,16)},u=function(t){var e=t.staticPart()||"0";return new n(e,16)};e.exports={formatInputInt:s,formatInputBytes:function(t){var e=i.toHex(t).substr(2),r=Math.floor((e.length+63)/64);return e=i.padRight(e,64*r),new a(e)},formatInputDynamicBytes:function(t){var e=i.toHex(t).substr(2),r=e.length/2,n=Math.floor((e.length+63)/64);return e=i.padRight(e,64*n),new a(s(r).value+e)},formatInputString:function(t){var e=i.fromUtf8(t).substr(2),r=e.length/2,n=Math.floor((e.length+63)/64);return e=i.padRight(e,64*n),new a(s(r).value+e)},formatInputBool:function(t){return new a("000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0"))},formatInputReal:function(t){return s(new n(t).times(new n(2).pow(128)))},formatOutputInt:c,formatOutputUInt:u,formatOutputReal:function(t){return c(t).dividedBy(new n(2).pow(128))},formatOutputUReal:function(t){return u(t).dividedBy(new n(2).pow(128))},formatOutputBool:function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()},formatOutputBytes:function(t,e){var r=e.match(/^bytes([0-9]*)/),n=parseInt(r[1]);return"0x"+t.staticPart().slice(0,2*n)},formatOutputDynamicBytes:function(t){var e=2*new n(t.dynamicPart().slice(0,64),16).toNumber();return"0x"+t.dynamicPart().substr(64,e)},formatOutputString:function(t){var e=2*new n(t.dynamicPart().slice(0,64),16).toNumber();return i.toUtf8(t.dynamicPart().substr(64,e))},formatOutputAddress:function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)}}},{"../utils/config":18,"../utils/utils":20,"./param":11,"bignumber.js":"bignumber.js"}],10:[function(t,e,r){var n=t("./formatters"),i=t("./type"),o=function(){this._inputFormatter=n.formatInputInt,this._outputFormatter=n.formatOutputInt};((o.prototype=new i({})).constructor=o).prototype.isType=function(t){return!!t.match(/^int([0-9]*)?(\[([0-9]*)\])*$/)},e.exports=o},{"./formatters":9,"./type":14}],11:[function(t,e,r){var n=t("../utils/utils"),i=function(t,e){this.value=t||"",this.offset=e};i.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},i.prototype.withOffset=function(t){return new i(this.value,t)},i.prototype.combine=function(t){return new i(this.value+t.value)},i.prototype.isDynamic=function(){return void 0!==this.offset},i.prototype.offsetAsBytes=function(){return this.isDynamic()?n.padLeft(n.toTwosComplement(this.offset).toString(16),64):""},i.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},i.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},i.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},i.encodeList=function(t){var r=32*t.length,e=t.map(function(t){if(!t.isDynamic())return t;var e=r;return r+=t.dynamicPartLength(),t.withOffset(e)});return e.reduce(function(t,e){return t+e.dynamicPart()},e.reduce(function(t,e){return t+e.staticPart()},""))},e.exports=i},{"../utils/utils":20}],12:[function(t,e,r){var n=t("./formatters"),i=t("./type"),o=function(){this._inputFormatter=n.formatInputReal,this._outputFormatter=n.formatOutputReal};((o.prototype=new i({})).constructor=o).prototype.isType=function(t){return!!t.match(/real([0-9]*)?(\[([0-9]*)\])?/)},e.exports=o},{"./formatters":9,"./type":14}],13:[function(t,e,r){var n=t("./formatters"),i=t("./type"),o=function(){this._inputFormatter=n.formatInputString,this._outputFormatter=n.formatOutputString};((o.prototype=new i({})).constructor=o).prototype.isType=function(t){return!!t.match(/^string(\[([0-9]*)\])*$/)},o.prototype.isDynamicType=function(){return!0},e.exports=o},{"./formatters":9,"./type":14}],14:[function(t,e,r){var n=t("./formatters"),a=t("./param"),i=function(t){this._inputFormatter=t.inputFormatter,this._outputFormatter=t.outputFormatter};i.prototype.isType=function(t){throw"this method should be overrwritten for type "+t},i.prototype.staticPartLength=function(t){return(this.nestedTypes(t)||["[1]"]).map(function(t){return parseInt(t.slice(1,-1),10)||1}).reduce(function(t,e){return t*e},32)},i.prototype.isDynamicArray=function(t){var e=this.nestedTypes(t);return!!e&&!e[e.length-1].match(/[0-9]{1,}/g)},i.prototype.isStaticArray=function(t){var e=this.nestedTypes(t);return!!e&&!!e[e.length-1].match(/[0-9]{1,}/g)},i.prototype.staticArrayLength=function(t){var e=this.nestedTypes(t);return e?parseInt(e[e.length-1].match(/[0-9]{1,}/g)||1):1},i.prototype.nestedName=function(t){var e=this.nestedTypes(t);return e?t.substr(0,t.length-e[e.length-1].length):t},i.prototype.isDynamicType=function(){return!1},i.prototype.nestedTypes=function(t){return t.match(/(\[[0-9]*\])/g)},i.prototype.encode=function(i,o){var t,e,r,a=this;return this.isDynamicArray(o)?(t=i.length,e=a.nestedName(o),(r=[]).push(n.formatInputInt(t).encode()),i.forEach(function(t){r.push(a.encode(t,e))}),r):this.isStaticArray(o)?function(){for(var t=a.staticArrayLength(o),e=a.nestedName(o),r=[],n=0;n<t;n++)r.push(a.encode(i[n],e));return r}():this._inputFormatter(i,o).encode()},i.prototype.decode=function(c,u,f){var t,e,r,n,l=this;if(this.isDynamicArray(f))return function(){for(var t=parseInt("0x"+c.substr(2*u,64)),e=parseInt("0x"+c.substr(2*t,64)),r=t+32,n=l.nestedName(f),i=l.staticPartLength(n),o=32*Math.floor((i+31)/32),a=[],s=0;s<e*o;s+=o)a.push(l.decode(c,r+s,n));return a}();if(this.isStaticArray(f))return function(){for(var t=l.staticArrayLength(f),e=u,r=l.nestedName(f),n=l.staticPartLength(r),i=32*Math.floor((n+31)/32),o=[],a=0;a<t*i;a+=i)o.push(l.decode(c,e+a,r));return o}();if(this.isDynamicType(f))return t=parseInt("0x"+c.substr(2*u,64)),e=parseInt("0x"+c.substr(2*t,64)),r=Math.floor((e+31)/32),n=new a(c.substr(2*t,64*(1+r)),0),l._outputFormatter(n,f);var i=this.staticPartLength(f),o=new a(c.substr(2*u,2*i));return this._outputFormatter(o,f)},e.exports=i},{"./formatters":9,"./param":11}],15:[function(t,e,r){var n=t("./formatters"),i=t("./type"),o=function(){this._inputFormatter=n.formatInputInt,this._outputFormatter=n.formatOutputUInt};((o.prototype=new i({})).constructor=o).prototype.isType=function(t){return!!t.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/)},e.exports=o},{"./formatters":9,"./type":14}],16:[function(t,e,r){var n=t("./formatters"),i=t("./type"),o=function(){this._inputFormatter=n.formatInputReal,this._outputFormatter=n.formatOutputUReal};((o.prototype=new i({})).constructor=o).prototype.isType=function(t){return!!t.match(/^ureal([0-9]*)?(\[([0-9]*)\])*$/)},e.exports=o},{"./formatters":9,"./type":14}],17:[function(t,e,r){"use strict";"undefined"==typeof XMLHttpRequest?r.XMLHttpRequest={}:r.XMLHttpRequest=XMLHttpRequest},{}],18:[function(t,e,r){var n=t("bignumber.js");e.exports={IRC_PADDING:32,IRC_SIGNATURE_LENGTH:4,IRC_UNITS:["wei","kwei","mwei","gwei","twei","pwei","irc","kirc","mirc","girc","tirc","pirc"],IRC_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:n.ROUND_DOWN},IRC_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],19:[function(t,e,r){var n=t("crypto-js"),i=t("crypto-js/sha3");e.exports=function(t,e){return e&&"hex"===e.encoding&&(2<t.length&&"0x"===t.substr(0,2)&&(t=t.substr(2)),t=n.enc.Hex.parse(t)),i(t,{outputLength:256}).toString()}},{"crypto-js":59,"crypto-js/sha3":80}],20:[function(t,e,r){var n=t("bignumber.js"),i=t("./sha3.js"),a=t("utf8"),o={wei:"1",kwei:"1000",mwei:"1000000",gwei:"1000000000",twei:"1000000000000",pwei:"1000000000000000",irc:"1000000000000000000",kirc:"1000000000000000000000",mirc:"1000000000000000000000000",girc:"1000000000000000000000000000",tirc:"1000000000000000000000000000000",pirc:"1000000000000000000000000000000000"},s=function(t,e,r){return new Array(e-t.length+1).join(r||"0")+t},c=function(t,e){t=a.encode(t);for(var r="",n=0;n<t.length;n++){var i=t.charCodeAt(n);if(0===i){if(!e)break;r+="00"}else{var o=i.toString(16);r+=o.length<2?"0"+o:o}}return"0x"+r},u=function(t){var e=p(t),r=e.toString(16);return e.lessThan(0)?"-0x"+r.substr(1):"0x"+r},f=function(t){if(g(t))return u(+t);if(m(t))return u(t);if("object"==typeof t)return c(JSON.stringify(t));if(y(t)){if(0===t.indexOf("-0x"))return u(t);if(0===t.indexOf("0x"))return t;if(!isFinite(t))return c(t,1)}return u(t)},l=function(t){t=t?t.toLowerCase():"irc";var e=o[t];if(void 0===e)throw new Error("This unit doesn't exists, please use the one of the following units"+JSON.stringify(o,null,2));return new n(e,10)},p=function(t){return m(t=t||0)?t:!y(t)||0!==t.indexOf("0x")&&0!==t.indexOf("-0x")?new n(t.toString(10),10):new n(t.replace("0x",""),16)},h=function(t){return/^0x[0-9a-f]{40}$/i.test(t)},d=function(t){t=t.replace("0x","");for(var e=i(t.toLowerCase()),r=0;r<40;r++)if(7<parseInt(e[r],16)&&t[r].toUpperCase()!==t[r]||parseInt(e[r],16)<=7&&t[r].toLowerCase()!==t[r])return!1;return!0},m=function(t){return t instanceof n||t&&t.constructor&&"BigNumber"===t.constructor.name},y=function(t){return"string"==typeof t||t&&t.constructor&&"String"===t.constructor.name},g=function(t){return"boolean"==typeof t};e.exports={padLeft:s,padRight:function(t,e,r){return t+new Array(e-t.length+1).join(r||"0")},toHex:f,toDecimal:function(t){return p(t).toNumber()},fromDecimal:u,toUtf8:function(t){var e="",r=0,n=t.length;for("0x"===t.substring(0,2)&&(r=2);r<n;r+=2){var i=parseInt(t.substr(r,2),16);if(0===i)break;e+=String.fromCharCode(i)}return a.decode(e)},toAscii:function(t){var e="",r=0,n=t.length;for("0x"===t.substring(0,2)&&(r=2);r<n;r+=2){var i=parseInt(t.substr(r,2),16);e+=String.fromCharCode(i)}return e},fromUtf8:c,fromAscii:function(t){for(var e="",r=0;r<t.length;r++){var n=t.charCodeAt(r).toString(16);e+=n.length<2?"0"+n:n}return"0x"+e},transformToFullName:function(t){if(-1!==t.name.indexOf("("))return t.name;var e=t.inputs.map(function(t){return t.type}).join();return t.name+"("+e+")"},extractDisplayName:function(t){var e=t.indexOf("("),r=t.indexOf(")");return-1!==e&&-1!==r?t.substr(0,e):t},extractTypeName:function(t){var e=t.indexOf("("),r=t.indexOf(")");return-1!==e&&-1!==r?t.substr(e+1,r-e-1).replace(" ",""):""},toWei:function(t,e){var r=p(t).times(l(e));return m(t)?r:r.toString(10)},fromWei:function(t,e){var r=p(t).dividedBy(l(e));return m(t)?r:r.toString(10)},toBigNumber:p,toTwosComplement:function(t){var e=p(t).round();return e.lessThan(0)?new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(e).plus(1):e},toAddress:function(t){return h(t)?t:/^[0-9a-f]{40}$/.test(t)?"0x"+t:"0x"+s(f(t).substr(2),40)},isBigNumber:m,isStrictAddress:h,isAddress:function(t){return!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t))||d(t))},isChecksumAddress:d,toChecksumAddress:function(t){if(void 0===t)return"";t=t.toLowerCase().replace("0x","");for(var e=i(t),r="0x",n=0;n<t.length;n++)7<parseInt(e[n],16)?r+=t[n].toUpperCase():r+=t[n];return r},isFunction:function(t){return"function"==typeof t},isString:y,isObject:function(t){return null!==t&&!Array.isArray(t)&&"object"==typeof t},isBoolean:g,isArray:function(t){return Array.isArray(t)},isJson:function(t){try{return!!JSON.parse(t)}catch(t){return!1}},isBloom:function(t){return!(!/^(0x)?[0-9a-f]{512}$/i.test(t)||!/^(0x)?[0-9a-f]{512}$/.test(t)&&!/^(0x)?[0-9A-F]{512}$/.test(t))},isTopic:function(t){return!(!/^(0x)?[0-9a-f]{64}$/i.test(t)||!/^(0x)?[0-9a-f]{64}$/.test(t)&&!/^(0x)?[0-9A-F]{64}$/.test(t))}}},{"./sha3.js":19,"bignumber.js":"bignumber.js",utf8:85}],21:[function(t,e,r){e.exports={version:"2.0.3"}},{}],22:[function(t,e,r){var n=t("./webu/requestmanager"),i=t("./webu/iban"),o=t("./webu/methods/irc"),a=t("./webu/methods/db"),s=t("./webu/methods/shh"),c=t("./webu/methods/net"),u=t("./webu/methods/personal"),f=t("./webu/methods/swarm"),l=t("./webu/settings"),p=t("./version.json"),h=t("./utils/utils"),d=t("./utils/sha3"),m=t("./webu/extend"),y=t("./webu/batch"),g=t("./webu/property"),v=t("./webu/httpprovider"),b=t("./webu/ipcprovider"),_=t("bignumber.js");function w(t){this._requestManager=new n(t),this.currentProvider=t,this.irc=new o(this),this.db=new a(this),this.shh=new s(this),this.net=new c(this),this.personal=new u(this),this.bzz=new f(this),this.settings=new l,this.version={api:p.version},this.providers={HttpProvider:v,IpcProvider:b},this._extend=m(this),this._extend({properties:x()})}w.providers={HttpProvider:v,IpcProvider:b},w.prototype.setProvider=function(t){this._requestManager.setProvider(t),this.currentProvider=t},w.prototype.reset=function(t){this._requestManager.reset(t),this.settings=new l},w.prototype.BigNumber=_,w.prototype.utils=h,w.prototype.toHex=h.toHex,w.prototype.toAscii=h.toAscii,w.prototype.toUtf8=h.toUtf8,w.prototype.fromAscii=h.fromAscii,w.prototype.fromUtf8=h.fromUtf8,w.prototype.toDecimal=h.toDecimal,w.prototype.fromDecimal=h.fromDecimal,w.prototype.toBigNumber=h.toBigNumber,w.prototype.toWei=h.toWei,w.prototype.fromWei=h.fromWei,w.prototype.isAddress=h.isAddress,w.prototype.isChecksumAddress=h.isChecksumAddress,w.prototype.toChecksumAddress=h.toChecksumAddress,w.prototype.isIBAN=h.isIBAN,w.prototype.padLeft=h.padLeft,w.prototype.padRight=h.padRight,w.prototype.sha3=function(t,e){return"0x"+d(t,e)},w.prototype.fromICAP=function(t){return new i(t).address()};var x=function(){return[new g({name:"version.node",getter:"webu_clientVersion"}),new g({name:"version.network",getter:"net_version",inputFormatter:h.toDecimal}),new g({name:"version.irchain",getter:"irc_protocolVersion",inputFormatter:h.toDecimal}),new g({name:"version.whisper",getter:"shh_version",inputFormatter:h.toDecimal})]};w.prototype.isConnected=function(){return this.currentProvider&&this.currentProvider.isConnected()},w.prototype.createBatch=function(){return new y(this)},e.exports=w},{"./utils/sha3":19,"./utils/utils":20,"./version.json":21,"./webu/batch":24,"./webu/extend":28,"./webu/httpprovider":32,"./webu/iban":33,"./webu/ipcprovider":34,"./webu/methods/db":37,"./webu/methods/irc":38,"./webu/methods/net":39,"./webu/methods/personal":40,"./webu/methods/shh":41,"./webu/methods/swarm":42,"./webu/property":45,"./webu/requestmanager":46,"./webu/settings":47,"bignumber.js":"bignumber.js"}],23:[function(t,e,r){var n=t("../utils/sha3"),i=t("./event"),o=t("./formatters"),a=t("../utils/utils"),s=t("./filter"),c=t("./methods/watches"),u=function(t,e,r){this._requestManager=t,this._json=e,this._address=r};u.prototype.encode=function(e){e=e||{};var r={};return["fromBlock","toBlock"].filter(function(t){return void 0!==e[t]}).forEach(function(t){r[t]=o.inputBlockNumberFormatter(e[t])}),r.address=this._address,r},u.prototype.decode=function(t){t.data=t.data||"";var e=a.isArray(t.topics)&&a.isString(t.topics[0])?t.topics[0].slice(2):"",r=this._json.filter(function(t){return e===n(a.transformToFullName(t))})[0];return r?new i(this._requestManager,r,this._address).decode(t):o.outputLogFormatter(t)},u.prototype.execute=function(t,e){a.isFunction(arguments[arguments.length-1])&&(e=arguments[arguments.length-1],1===arguments.length&&(t=null));var r=this.encode(t),n=this.decode.bind(this);return new s(r,"irc",this._requestManager,c.irc(),n,e)},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);t.allEvents=e},e.exports=u},{"../utils/sha3":19,"../utils/utils":20,"./event":27,"./filter":29,"./formatters":30,"./methods/watches":43}],24:[function(t,e,r){var i=t("./jsonrpc"),o=t("./errors"),n=function(t){this.requestManager=t._requestManager,this.requests=[]};n.prototype.add=function(t){this.requests.push(t)},n.prototype.execute=function(){var n=this.requests;this.requestManager.sendBatch(n,function(t,r){r=r||[],n.map(function(t,e){return r[e]||{}}).forEach(function(t,e){if(n[e].callback){if(!i.isValidResponse(t))return n[e].callback(o.InvalidResponse(t));n[e].callback(null,n[e].format?n[e].format(t.result):t.result)}})})},e.exports=n},{"./errors":26,"./jsonrpc":35}],25:[function(t,e,r){var a=t("../utils/utils"),n=t("../solidity/coder"),i=t("./event"),o=t("./function"),s=t("./allevents"),c=function(t,e){return t.filter(function(t){return"constructor"===t.type&&t.inputs.length===e.length}).map(function(t){return t.inputs.map(function(t){return t.type})}).map(function(t){return n.encodeParams(t,e)})[0]||""},u=function(e){e.abi.filter(function(t){return"function"===t.type}).map(function(t){return new o(e._irc,t,e.address)}).forEach(function(t){t.attachToContract(e)})},f=function(e){var t=e.abi.filter(function(t){return"event"===t.type});new s(e._irc._requestManager,t,e.address).attachToContract(e),t.map(function(t){return new i(e._irc._requestManager,t,e.address)}).forEach(function(t){t.attachToContract(e)})},l=function(n,i){var e=0,o=!1,a=n._irc.filter("latest",function(t){if(!t&&!o)if(50<++e){if(a.stopWatching(function(){}),o=!0,!i)throw new Error("Contract transaction couldn't be found after 50 blocks");i(new Error("Contract transaction couldn't be found after 50 blocks"))}else n._irc.getTransactionReceipt(n.transactionHash,function(t,r){r&&r.blockHash&&!o&&n._irc.getCode(r.contractAddress,function(t,e){if(!o&&e)if(a.stopWatching(function(){}),o=!0,1<e.length)n.address=r.contractAddress,u(n),f(n),i&&i(null,n);else{if(!i)throw new Error("The contract code couldn't be stored, please check your gas amount.");i(new Error("The contract code couldn't be stored, please check your gas amount."))}})})})},p=function(t,o){this.irc=t,this.abi=o,this.new=function(){var r,n=new h(this.irc,this.abi,null),t={},e=Array.prototype.slice.call(arguments);a.isFunction(e[e.length-1])&&(r=e.pop());var i=e[e.length-1];if((a.isObject(i)&&!a.isArray(i)&&(t=e.pop()),0<t.value)&&!(o.filter(function(t){return"constructor"===t.type&&t.inputs.length===e.length})[0]||{}).payable)throw new Error("Cannot send value to non-payable constructor");return t.data+=c(this.abi,e),r?this.irc.sendTransaction(t,function(t,e){t?r(t):(n.transactionHash=e,r(null,n),l(n,r))}):(n.transactionHash=this.irc.sendTransaction(t),l(n,null)),n},this.new.getData=this.getData.bind(this)};p.prototype.at=function(t,e){var r=new h(this.irc,this.abi,t);return u(r),f(r),e&&e(null,r),r},p.prototype.getData=function(){var t={},e=Array.prototype.slice.call(arguments),r=e[e.length-1];return a.isObject(r)&&!a.isArray(r)&&(t=e.pop()),t.data+=c(this.abi,e),t.data};var h=function(t,e,r){this._irc=t,this.transactionHash=null,this.address=r,this.abi=e};e.exports=p},{"../solidity/coder":7,"../utils/utils":20,"./allevents":23,"./event":27,"./function":31}],26:[function(t,e,r){e.exports={InvalidNumberOfSolidityArgs:function(){return new Error("Invalid number of arguments to Solidity function")},InvalidNumberOfRPCParams:function(){return new Error("Invalid number of input parameters to RPC method")},InvalidConnection:function(t){return new Error("CONNECTION ERROR: Couldn't connect to node "+t+".")},InvalidProvider:function(){return new Error("Provider not set or invalid")},InvalidResponse:function(t){var e=t&&t.error&&t.error.message?t.error.message:"Invalid JSON RPC response: "+JSON.stringify(t);return new Error(e)},ConnectionTimeout:function(t){return new Error("CONNECTION TIMEOUT: timeout of "+t+" ms achived")}}},{}],27:[function(t,e,r){var o=t("../utils/utils"),a=t("../solidity/coder"),s=t("./formatters"),n=t("../utils/sha3"),c=t("./filter"),u=t("./methods/watches"),i=function(t,e,r){this._requestManager=t,this._params=e.inputs,this._name=o.transformToFullName(e),this._address=r,this._anonymous=e.anonymous};i.prototype.types=function(e){return this._params.filter(function(t){return t.indexed===e}).map(function(t){return t.type})},i.prototype.displayName=function(){return o.extractDisplayName(this._name)},i.prototype.typeName=function(){return o.extractTypeName(this._name)},i.prototype.signature=function(){return n(this._name)},i.prototype.encode=function(r,e){r=r||{},e=e||{};var n={};["fromBlock","toBlock"].filter(function(t){return void 0!==e[t]}).forEach(function(t){n[t]=s.inputBlockNumberFormatter(e[t])}),n.topics=[],n.address=this._address,this._anonymous||n.topics.push("0x"+this.signature());var t=this._params.filter(function(t){return!0===t.indexed}).map(function(e){var t=r[e.name];return null==t?null:o.isArray(t)?t.map(function(t){return"0x"+a.encodeParam(e.type,t)}):"0x"+a.encodeParam(e.type,t)});return n.topics=n.topics.concat(t),n},i.prototype.decode=function(t){t.data=t.data||"",t.topics=t.topics||[];var e=(this._anonymous?t.topics:t.topics.slice(1)).map(function(t){return t.slice(2)}).join(""),r=a.decodeParams(this.types(!0),e),n=t.data.slice(2),i=a.decodeParams(this.types(!1),n),o=s.outputLogFormatter(t);return o.event=this.displayName(),o.address=t.address,o.args=this._params.reduce(function(t,e){return t[e.name]=e.indexed?r.shift():i.shift(),t},{}),delete o.data,delete o.topics,o},i.prototype.execute=function(t,e,r){o.isFunction(arguments[arguments.length-1])&&(r=arguments[arguments.length-1],2===arguments.length&&(e=null),1===arguments.length&&(e=null,t={}));var n=this.encode(t,e),i=this.decode.bind(this);return new c(n,"irc",this._requestManager,u.irc(),i,r)},i.prototype.attachToContract=function(t){var e=this.execute.bind(this),r=this.displayName();t[r]||(t[r]=e),t[r][this.typeName()]=this.execute.bind(this,t)},e.exports=i},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./filter":29,"./formatters":30,"./methods/watches":43}],28:[function(t,e,r){var n=t("./formatters"),i=t("./../utils/utils"),o=t("./method"),a=t("./property");e.exports=function(r){var t=function(t){var e;e=t.property?(r[t.property]||(r[t.property]={}),r[t.property]):r,t.methods&&t.methods.forEach(function(t){t.attachToObject(e),t.setRequestManager(r._requestManager)}),t.properties&&t.properties.forEach(function(t){t.attachToObject(e),t.setRequestManager(r._requestManager)})};return t.formatters=n,t.utils=i,t.Method=o,t.Property=a,t}},{"./../utils/utils":20,"./formatters":30,"./method":36,"./property":45}],29:[function(t,e,r){var u=t("./formatters"),f=t("../utils/utils"),l=function(t){return null==t?null:0===(t=String(t)).indexOf("0x")?t:f.fromUtf8(t)},p=function(t,r){f.isString(t.options)||t.get(function(t,e){t&&r(t),f.isArray(e)&&e.forEach(function(t){r(null,t)})})},h=function(r){r.requestManager.startPolling({method:r.implementation.poll.call,params:[r.filterId]},r.filterId,function(e,t){if(e)return r.callbacks.forEach(function(t){t(e)});f.isArray(t)&&t.forEach(function(e){e=r.formatter?r.formatter(e):e,r.callbacks.forEach(function(t){t(null,e)})})},r.stopWatching.bind(r))},n=function(t,e,r,n,i,o,a){var s=this,c={};return n.forEach(function(t){t.setRequestManager(r),t.attachToObject(c)}),this.requestManager=r,this.options=function(t,e){if(f.isString(t))return t;switch(t=t||{},e){case"irc":return t.topics=t.topics||[],t.topics=t.topics.map(function(t){return f.isArray(t)?t.map(l):l(t)}),{topics:t.topics,from:t.from,to:t.to,address:t.address,fromBlock:u.inputBlockNumberFormatter(t.fromBlock),toBlock:u.inputBlockNumberFormatter(t.toBlock)};case"shh":return t}}(t,e),this.implementation=c,this.filterId=null,this.callbacks=[],this.getLogsCallbacks=[],this.pollFilters=[],this.formatter=i,this.implementation.newFilter(this.options,function(e,t){if(e)s.callbacks.forEach(function(t){t(e)}),"function"==typeof a&&a(e);else if(s.filterId=t,s.getLogsCallbacks.forEach(function(t){s.get(t)}),s.getLogsCallbacks=[],s.callbacks.forEach(function(t){p(s,t)}),0<s.callbacks.length&&h(s),"function"==typeof o)return s.watch(o)}),this};n.prototype.watch=function(t){return this.callbacks.push(t),this.filterId&&(p(this,t),h(this)),this},n.prototype.stopWatching=function(t){if(this.requestManager.stopPolling(this.filterId),this.callbacks=[],!t)return this.implementation.uninstallFilter(this.filterId);this.implementation.uninstallFilter(this.filterId,t)},n.prototype.get=function(r){var n=this;if(f.isFunction(r))return null===this.filterId?this.getLogsCallbacks.push(r):this.implementation.getLogs(this.filterId,function(t,e){t?r(t):r(null,e.map(function(t){return n.formatter?n.formatter(t):t}))}),this;if(null===this.filterId)throw new Error("Filter ID Error: filter().get() can't be chained synchronous, please provide a callback for the get() method.");return this.implementation.getLogs(this.filterId).map(function(t){return n.formatter?n.formatter(t):t})},e.exports=n},{"../utils/utils":20,"./formatters":30}],30:[function(t,e,r){"use strict";var n=t("../utils/utils"),i=t("../utils/config"),o=t("./iban"),a=function(t){var e;if(void 0!==t)return"latest"===(e=t)||"pending"===e||"earliest"===e?t:n.toHex(t)},s=function(t){return null!==t.blockNumber&&(t.blockNumber=n.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=n.toDecimal(t.transactionIndex)),t.nonce=n.toDecimal(t.nonce),t.gas=n.toDecimal(t.gas),t.gasPrice=n.toBigNumber(t.gasPrice),t.value=n.toBigNumber(t.value),t},c=function(t){return t.blockNumber&&(t.blockNumber=n.toDecimal(t.blockNumber)),t.transactionIndex&&(t.transactionIndex=n.toDecimal(t.transactionIndex)),t.logIndex&&(t.logIndex=n.toDecimal(t.logIndex)),t},u=function(t){var e=new o(t);if(e.isValid()&&e.isDirect())return"0x"+e.address();if(n.isStrictAddress(t))return t;if(n.isAddress(t))return"0x"+t;throw new Error("invalid address")};e.exports={inputDefaultBlockNumberFormatter:function(t){return void 0===t?i.defaultBlock:a(t)},inputBlockNumberFormatter:a,inputCallFormatter:function(e){return e.from=e.from||i.defaultAccount,e.from&&(e.from=u(e.from)),e.to&&(e.to=u(e.to)),["gasPrice","gas","value","nonce"].filter(function(t){return void 0!==e[t]}).forEach(function(t){e[t]=n.fromDecimal(e[t])}),e},inputTransactionFormatter:function(e){return e.from=e.from||i.defaultAccount,e.from=u(e.from),e.to&&(e.to=u(e.to)),["gasPrice","gas","value","nonce"].filter(function(t){return void 0!==e[t]}).forEach(function(t){e[t]=n.fromDecimal(e[t])}),e},inputAddressFormatter:u,inputPostFormatter:function(t){return t.ttl=n.fromDecimal(t.ttl),t.workToProve=n.fromDecimal(t.workToProve),t.priority=n.fromDecimal(t.priority),n.isArray(t.topics)||(t.topics=t.topics?[t.topics]:[]),t.topics=t.topics.map(function(t){return 0===t.indexOf("0x")?t:n.fromUtf8(t)}),t},outputBigNumberFormatter:function(t){return n.toBigNumber(t)},outputTransactionFormatter:s,outputTransactionReceiptFormatter:function(t){return null!==t.blockNumber&&(t.blockNumber=n.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=n.toDecimal(t.transactionIndex)),t.cumulativeGasUsed=n.toDecimal(t.cumulativeGasUsed),t.gasUsed=n.toDecimal(t.gasUsed),n.isArray(t.logs)&&(t.logs=t.logs.map(function(t){return c(t)})),t},outputBlockFormatter:function(t){return t.gasLimit=n.toDecimal(t.gasLimit),t.gasUsed=n.toDecimal(t.gasUsed),t.size=n.toDecimal(t.size),t.timestamp=n.toDecimal(t.timestamp),null!==t.number&&(t.number=n.toDecimal(t.number)),t.difficulty=n.toBigNumber(t.difficulty),t.totalDifficulty=n.toBigNumber(t.totalDifficulty),n.isArray(t.transactions)&&t.transactions.forEach(function(t){if(!n.isString(t))return s(t)}),t},outputLogFormatter:c,outputPostFormatter:function(t){return t.expiry=n.toDecimal(t.expiry),t.sent=n.toDecimal(t.sent),t.ttl=n.toDecimal(t.ttl),t.workProved=n.toDecimal(t.workProved),t.topics||(t.topics=[]),t.topics=t.topics.map(function(t){return n.toAscii(t)}),t},outputSyncingFormatter:function(t){return t&&(t.startingBlock=n.toDecimal(t.startingBlock),t.currentBlock=n.toDecimal(t.currentBlock),t.highestBlock=n.toDecimal(t.highestBlock),t.knownStates&&(t.knownStates=n.toDecimal(t.knownStates),t.pulledStates=n.toDecimal(t.pulledStates))),t}}},{"../utils/config":18,"../utils/utils":20,"./iban":33}],31:[function(t,e,r){var n=t("../solidity/coder"),i=t("../utils/utils"),o=t("./errors"),a=(t("./formatters"),t("../utils/sha3")),s=function(t,e,r){this._irc=t,this._inputTypes=e.inputs.map(function(t){return t.type}),this._outputTypes=e.outputs.map(function(t){return t.type}),this._constant=e.constant,this._payable=e.payable,this._name=i.transformToFullName(e),this._address=r};s.prototype.extractCallback=function(t){if(i.isFunction(t[t.length-1]))return t.pop()},s.prototype.extractDefaultBlock=function(t){if(t.length>this._inputTypes.length&&!i.isObject(t[t.length-1]))return formatters.inputDefaultBlockNumberFormatter(t.pop())},s.prototype.validateArgs=function(t){if(t.filter(function(t){return!(!0===i.isObject(t)&&!1===i.isArray(t)&&!1===i.isBigNumber(t))}).length!==this._inputTypes.length)throw o.InvalidNumberOfSolidityArgs()},s.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&i.isObject(t[t.length-1])&&(e=t[t.length-1]),this.validateArgs(t),e.to=this._address,e.data="0x"+this.signature()+n.encodeParams(this._inputTypes,t),e},s.prototype.signature=function(){return a(this._name).slice(0,8)},s.prototype.unpackOutput=function(t){if(t){t=2<=t.length?t.slice(2):t;var e=n.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},s.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),n=this.extractCallback(t),e=this.extractDefaultBlock(t),r=this.toPayload(t);if(!n){var i=this._irc.call(r,e);return this.unpackOutput(i)}var o=this;this._irc.call(r,e,function(e,t){if(e)return n(e,null);var r=null;try{r=o.unpackOutput(t)}catch(t){e=t}n(e,r)})},s.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),r=this.toPayload(t);if(0<r.value&&!this._payable)throw new Error("Cannot send value to non-payable function");if(!e)return this._irc.sendTransaction(r);this._irc.sendTransaction(r,e)},s.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),r=this.toPayload(t);if(!e)return this._irc.estimateGas(r);this._irc.estimateGas(r,e)},s.prototype.getData=function(){var t=Array.prototype.slice.call(arguments);return this.toPayload(t).data},s.prototype.displayName=function(){return i.extractDisplayName(this._name)},s.prototype.typeName=function(){return i.extractTypeName(this._name)},s.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),r=this.toPayload(t),n=this.unpackOutput.bind(this);return{method:this._constant?"irc_call":"irc_sendTransaction",callback:e,params:[r],format:n}},s.prototype.execute=function(){return!this._constant?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},s.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this),e.getData=this.getData.bind(this);var r=this.displayName();t[r]||(t[r]=e),t[r][this.typeName()]=e},e.exports=s},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./errors":26,"./formatters":30}],32:[function(t,e,r){var i=t("./errors");"undefined"!=typeof window&&window.XMLHttpRequest?XMLHttpRequest=window.XMLHttpRequest:XMLHttpRequest=t("xmlhttprequest").XMLHttpRequest;var n=t("xhr2"),o=function(t,e,r,n,i){this.host=t||"http://localhost:8545",this.timeout=e||0,this.user=r,this.password=n,this.headers=i};o.prototype.prepareRequest=function(t){var e;if(t?(e=new n).timeout=this.timeout:e=new XMLHttpRequest,e.open("POST",this.host,t),this.user&&this.password){var r="Basic "+new Buffer(this.user+":"+this.password).toString("base64");e.setRequestHeader("Authorization",r)}return e.setRequestHeader("Content-Type","application/json"),this.headers&&this.headers.forEach(function(t){e.setRequestHeader(t.name,t.value)}),e},o.prototype.send=function(t){var e=this.prepareRequest(!1);try{e.send(JSON.stringify(t))}catch(t){throw i.InvalidConnection(this.host)}var r=e.responseText;try{r=JSON.parse(r)}catch(t){throw i.InvalidResponse(e.responseText)}return r},o.prototype.sendAsync=function(t,r){var n=this.prepareRequest(!0);n.onreadystatechange=function(){if(4===n.readyState&&1!==n.timeout){var t=n.responseText,e=null;try{t=JSON.parse(t)}catch(t){e=i.InvalidResponse(n.responseText)}r(e,t)}},n.ontimeout=function(){r(i.ConnectionTimeout(this.timeout))};try{n.send(JSON.stringify(t))}catch(t){r(i.InvalidConnection(this.host))}},o.prototype.isConnected=function(){try{return this.send({id:9999999999,jsonrpc:"2.0",method:"net_listening",params:[]}),!0}catch(t){return!1}},e.exports=o},{"./errors":26,xhr2:86,xmlhttprequest:17}],33:[function(t,e,r){var n=t("bignumber.js"),i=function(t,e){for(var r=t;r.length<2*e;)r="0"+r;return r},o=function(t){var r="A".charCodeAt(0),n="Z".charCodeAt(0);return(t=(t=t.toUpperCase()).substr(4)+t.substr(0,4)).split("").map(function(t){var e=t.charCodeAt(0);return r<=e&&e<=n?e-r+10:t}).join("")},a=function(t){for(var e,r=t;2<r.length;)e=r.slice(0,9),r=parseInt(e,10)%97+r.slice(e.length);return parseInt(r,10)%97},s=function(t){this._iban=t};s.fromAddress=function(t){var e=new n(t,16).toString(36),r=i(e,15);return s.fromBban(r.toUpperCase())},s.fromBban=function(t){var e=("0"+(98-a(o("XU00"+t)))).slice(-2);return new s("XU"+e+t)},s.createIndirect=function(t){return s.fromBban("IRC"+t.institution+t.identifier)},s.isValid=function(t){return new s(t).isValid()},s.prototype.isValid=function(){return/^XU[0-9]{2}(IRC[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban)&&1===a(o(this._iban))},s.prototype.isDirect=function(){return 34===this._iban.length||35===this._iban.length},s.prototype.isIndirect=function(){return 20===this._iban.length},s.prototype.checksum=function(){return this._iban.substr(2,2)},s.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},s.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},s.prototype.address=function(){if(this.isDirect()){var t=this._iban.substr(4),e=new n(t,36);return i(e.toString(16),20)}return""},s.prototype.toString=function(){return this._iban},e.exports=s},{"bignumber.js":"bignumber.js"}],34:[function(t,e,r){"use strict";var n=t("../utils/utils"),i=t("./errors"),o=function(t,e){var r=this;this.responseCallbacks={},this.path=t,this.connection=e.connect({path:this.path}),this.connection.on("error",function(t){console.error("IPC Connection Error",t),r._timeout()}),this.connection.on("end",function(){r._timeout()}),this.connection.on("data",function(t){r._parseResponse(t.toString()).forEach(function(t){var e=null;n.isArray(t)?t.forEach(function(t){r.responseCallbacks[t.id]&&(e=t.id)}):e=t.id,r.responseCallbacks[e]&&(r.responseCallbacks[e](null,t),delete r.responseCallbacks[e])})})};o.prototype._parseResponse=function(t){var r=this,n=[];return t.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(function(e){r.lastChunk&&(e=r.lastChunk+e);var t=null;try{t=JSON.parse(e)}catch(t){return r.lastChunk=e,clearTimeout(r.lastChunkTimeout),void(r.lastChunkTimeout=setTimeout(function(){throw r._timeout(),i.InvalidResponse(e)},15e3))}clearTimeout(r.lastChunkTimeout),r.lastChunk=null,t&&n.push(t)}),n},o.prototype._addResponseCallback=function(t,e){var r=t.id||t[0].id,n=t.method||t[0].method;this.responseCallbacks[r]=e,this.responseCallbacks[r].method=n},o.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](i.InvalidConnection("on IPC")),delete this.responseCallbacks[t])},o.prototype.isConnected=function(){return this.connection.writable||this.connection.connect({path:this.path}),!!this.connection.writable},o.prototype.send=function(t){if(this.connection.writeSync){var e;this.connection.writable||this.connection.connect({path:this.path});var r=this.connection.writeSync(JSON.stringify(t));try{e=JSON.parse(r)}catch(t){throw i.InvalidResponse(r)}return e}throw new Error('You tried to send "'+t.method+'" synchronously. Synchronous requests are not supported by the IPC provider.')},o.prototype.sendAsync=function(t,e){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(t)),this._addResponseCallback(t,e)},e.exports=o},{"../utils/utils":20,"./errors":26}],35:[function(t,e,r){var n={messageId:0,toPayload:function(t,e){return t||console.error("jsonrpc method should be specified!"),n.messageId++,{jsonrpc:"2.0",id:n.messageId,method:t,params:e||[]}},isValidResponse:function(t){return Array.isArray(t)?t.every(e):e(t);function e(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result}},toBatchPayload:function(t){return t.map(function(t){return n.toPayload(t.method,t.params)})}};e.exports=n},{}],36:[function(t,e,r){var n=t("../utils/utils"),i=t("./errors"),o=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter,this.requestManager=null};o.prototype.setRequestManager=function(t){this.requestManager=t},o.prototype.getCall=function(t){return n.isFunction(this.call)?this.call(t):this.call},o.prototype.extractCallback=function(t){if(n.isFunction(t[t.length-1]))return t.pop()},o.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfRPCParams()},o.prototype.formatInput=function(r){return this.inputFormatter?this.inputFormatter.map(function(t,e){return t?t(r[e]):r[e]}):r},o.prototype.formatOutput=function(t){return this.outputFormatter&&t?this.outputFormatter(t):t},o.prototype.toPayload=function(t){var e=this.getCall(t),r=this.extractCallback(t),n=this.formatInput(t);return this.validateArgs(n),{method:e,params:n,callback:r}},o.prototype.attachToObject=function(t){var e=this.buildCall();e.call=this.call;var r=this.name.split(".");1<r.length?(t[r[0]]=t[r[0]]||{},t[r[0]][r[1]]=e):t[r[0]]=e},o.prototype.buildCall=function(){var n=this,t=function(){var r=n.toPayload(Array.prototype.slice.call(arguments));return r.callback?n.requestManager.sendAsync(r,function(t,e){r.callback(t,n.formatOutput(e))}):n.formatOutput(n.requestManager.send(r))};return t.request=this.request.bind(this),t},o.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},e.exports=o},{"../utils/utils":20,"./errors":26}],37:[function(t,e,r){var n=t("../method"),i=function(){return[new n({name:"putString",call:"db_putString",params:3}),new n({name:"getString",call:"db_getString",params:2}),new n({name:"putHex",call:"db_putHex",params:3}),new n({name:"getHex",call:"db_getHex",params:2})]};e.exports=function(e){this._requestManager=e._requestManager;var r=this;i().forEach(function(t){t.attachToObject(r),t.setRequestManager(e._requestManager)})}},{"../method":36}],38:[function(t,e,r){"use strict";var y=t("../formatters"),g=t("../../utils/utils"),v=t("../method"),n=t("../property"),i=t("../../utils/config"),o=t("../contract"),a=t("./watches"),s=t("../filter"),c=t("../syncing"),u=t("../namereg"),f=t("../iban"),l=t("../transfer"),b=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"irc_getBlockByHash":"irc_getBlockByNumber"},_=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"irc_getTransactionByBlockHashAndIndex":"irc_getTransactionByBlockNumberAndIndex"},w=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"irc_getUncleByBlockHashAndIndex":"irc_getUncleByBlockNumberAndIndex"},x=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"irc_getBlockTransactionCountByHash":"irc_getBlockTransactionCountByNumber"},k=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"irc_getUncleCountByIrcBlockHash":"irc_getUncleCountByBlockNumber"};function p(t){this._requestManager=t._requestManager;var e=this;h().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)}),d().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)}),this.iban=f,this.sendIBANTransaction=l.bind(null,this)}Object.defineProperty(p.prototype,"defaultBlock",{get:function(){return i.defaultBlock},set:function(t){return i.defaultBlock=t}}),Object.defineProperty(p.prototype,"defaultAccount",{get:function(){return i.defaultAccount},set:function(t){return i.defaultAccount=t}});var h=function(){var t=new v({name:"getBalance",call:"irc_getBalance",params:2,inputFormatter:[y.inputAddressFormatter,y.inputDefaultBlockNumberFormatter],outputFormatter:y.outputBigNumberFormatter}),e=new v({name:"getStorageAt",call:"irc_getStorageAt",params:3,inputFormatter:[null,g.toHex,y.inputDefaultBlockNumberFormatter]}),r=new v({name:"getCode",call:"irc_getCode",params:2,inputFormatter:[y.inputAddressFormatter,y.inputDefaultBlockNumberFormatter]}),n=new v({name:"getBlock",call:b,params:2,inputFormatter:[y.inputBlockNumberFormatter,function(t){return!!t}],outputFormatter:y.outputBlockFormatter}),i=new v({name:"getUncle",call:w,params:2,inputFormatter:[y.inputBlockNumberFormatter,g.toHex],outputFormatter:y.outputBlockFormatter}),o=new v({name:"getCompilers",call:"irc_getCompilers",params:0}),a=new v({name:"getBlockTransactionCount",call:x,params:1,inputFormatter:[y.inputBlockNumberFormatter],outputFormatter:g.toDecimal}),s=new v({name:"getBlockUncleCount",call:k,params:1,inputFormatter:[y.inputBlockNumberFormatter],outputFormatter:g.toDecimal}),c=new v({name:"getTransaction",call:"irc_getTransactionByHash",params:1,outputFormatter:y.outputTransactionFormatter}),u=new v({name:"getTransactionFromBlock",call:_,params:2,inputFormatter:[y.inputBlockNumberFormatter,g.toHex],outputFormatter:y.outputTransactionFormatter}),f=new v({name:"getTransactionReceipt",call:"irc_getTransactionReceipt",params:1,outputFormatter:y.outputTrans