icjs-accounts
Version:
A simple module for creating and managing irchain accounts in browser.
1 lines • 123 kB
JavaScript
require=function i(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(p)return p(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var o=s[e]={exports:{}};a[e][0].call(o.exports,function(t){return u(a[e][1][t]||t)},o,o.exports,i,a,s,c)}return s[e].exports}for(var p="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"),o=t("./type"),i=function(){this._inputFormatter=n.formatInputInt,this._outputFormatter=n.formatOutputAddress};((i.prototype=new o({})).constructor=i).prototype.isType=function(t){return!!t.match(/address(\[([0-9]*)\])?/)},e.exports=i},{"./formatters":9,"./type":14}],5:[function(t,e,r){var n=t("./formatters"),o=t("./type"),i=function(){this._inputFormatter=n.formatInputBool,this._outputFormatter=n.formatOutputBool};((i.prototype=new o({})).constructor=i).prototype.isType=function(t){return!!t.match(/^bool(\[([0-9]*)\])*$/)},e.exports=i},{"./formatters":9,"./type":14}],6:[function(t,e,r){var n=t("./formatters"),o=t("./type"),i=function(){this._inputFormatter=n.formatInputBytes,this._outputFormatter=n.formatOutputBytes};((i.prototype=new o({})).constructor=i).prototype.isType=function(t){return!!t.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/)},e.exports=i},{"./formatters":9,"./type":14}],7:[function(t,e,r){var y=t("./formatters"),n=t("./address"),o=t("./bool"),i=t("./int"),a=t("./uint"),s=t("./dynamicbytes"),c=t("./string"),u=t("./real"),p=t("./ureal"),f=t("./bytes"),l=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(i,r){var a=this.getSolidityTypes(i),t=a.map(function(t,e){return t.encode(r[e],i[e])}),e=a.reduce(function(t,e,r){var n=e.staticPartLength(i[r]),o=32*Math.floor((n+31)/32);return t+(l(a[r],i[r])?32:o)},0);return this.encodeMultiWithOffset(i,a,t,e)},h.prototype.encodeMultiWithOffset=function(n,o,i,a){var s="",c=this;return n.forEach(function(t,e){if(l(o[e],n[e])){s+=y.formatInputInt(a).encode();var r=c.encodeWithOffset(n[e],o[e],i[e],a);a+=r.length/2}else s+=c.encodeWithOffset(n[e],o[e],i[e],a)}),n.forEach(function(t,e){if(l(o[e],n[e])){var r=c.encodeWithOffset(n[e],o[e],i[e],a);a+=r.length/2,s+=r}}),s},h.prototype.encodeWithOffset=function(t,e,r,n){var o=1,i=2,a=3,s=e.isDynamicArray(t)?o:e.isStaticArray(t)?i:a;if(s!==a){var c=e.nestedName(t),u=e.staticPartLength(c),p=s===o?r[0]:"";if(e.isDynamicArray(c))for(var f=s===o?2:0,l=0;l<r.length;l++)s===o?f+=+r[l-1][0]||0:s===i&&(f+=+(r[l-1]||[])[0]||0),p+=y.formatInputInt(n+l*u+32*f).encode();for(var h=s===o?r.length-1:r.length,d=0;d<h;d++){var m=p/2;s===o?p+=this.encodeWithOffset(c,e,r[d+1],n+m):s===i&&(p+=this.encodeWithOffset(c,e,r[d],n+m))}return p}return r},h.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},h.prototype.decodeParams=function(r,n){var t=this.getSolidityTypes(r),o=this.getOffsets(r,t);return t.map(function(t,e){return t.decode(n,o[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 o,new i,new a,new s,new f,new c,new u,new p]);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"),o=t("./type"),i=function(){this._inputFormatter=n.formatInputDynamicBytes,this._outputFormatter=n.formatOutputDynamicBytes};((i.prototype=new o({})).constructor=i).prototype.isType=function(t){return!!t.match(/^bytes(\[([0-9]*)\])*$/)},i.prototype.isDynamicType=function(){return!0},e.exports=i},{"./formatters":9,"./type":14}],9:[function(t,e,r){var n=t("bignumber.js"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./param"),s=function(t){n.config(i.IRC_BIGNUMBER_ROUNDING_MODE);var e=o.padLeft(o.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=o.toHex(t).substr(2),r=Math.floor((e.length+63)/64);return e=o.padRight(e,64*r),new a(e)},formatInputDynamicBytes:function(t){var e=o.toHex(t).substr(2),r=e.length/2,n=Math.floor((e.length+63)/64);return e=o.padRight(e,64*n),new a(s(r).value+e)},formatInputString:function(t){var e=o.fromUtf8(t).substr(2),r=e.length/2,n=Math.floor((e.length+63)/64);return e=o.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 o.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"),o=t("./type"),i=function(){this._inputFormatter=n.formatInputInt,this._outputFormatter=n.formatOutputInt};((i.prototype=new o({})).constructor=i).prototype.isType=function(t){return!!t.match(/^int([0-9]*)?(\[([0-9]*)\])*$/)},e.exports=i},{"./formatters":9,"./type":14}],11:[function(t,e,r){var n=t("../utils/utils"),o=function(t,e){this.value=t||"",this.offset=e};o.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},o.prototype.withOffset=function(t){return new o(this.value,t)},o.prototype.combine=function(t){return new o(this.value+t.value)},o.prototype.isDynamic=function(){return void 0!==this.offset},o.prototype.offsetAsBytes=function(){return this.isDynamic()?n.padLeft(n.toTwosComplement(this.offset).toString(16),64):""},o.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},o.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},o.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},o.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=o},{"../utils/utils":20}],12:[function(t,e,r){var n=t("./formatters"),o=t("./type"),i=function(){this._inputFormatter=n.formatInputReal,this._outputFormatter=n.formatOutputReal};((i.prototype=new o({})).constructor=i).prototype.isType=function(t){return!!t.match(/real([0-9]*)?(\[([0-9]*)\])?/)},e.exports=i},{"./formatters":9,"./type":14}],13:[function(t,e,r){var n=t("./formatters"),o=t("./type"),i=function(){this._inputFormatter=n.formatInputString,this._outputFormatter=n.formatOutputString};((i.prototype=new o({})).constructor=i).prototype.isType=function(t){return!!t.match(/^string(\[([0-9]*)\])*$/)},i.prototype.isDynamicType=function(){return!0},e.exports=i},{"./formatters":9,"./type":14}],14:[function(t,e,r){var n=t("./formatters"),a=t("./param"),o=function(t){this._inputFormatter=t.inputFormatter,this._outputFormatter=t.outputFormatter};o.prototype.isType=function(t){throw"this method should be overrwritten for type "+t},o.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)},o.prototype.isDynamicArray=function(t){var e=this.nestedTypes(t);return!!e&&!e[e.length-1].match(/[0-9]{1,}/g)},o.prototype.isStaticArray=function(t){var e=this.nestedTypes(t);return!!e&&!!e[e.length-1].match(/[0-9]{1,}/g)},o.prototype.staticArrayLength=function(t){var e=this.nestedTypes(t);return e?parseInt(e[e.length-1].match(/[0-9]{1,}/g)||1):1},o.prototype.nestedName=function(t){var e=this.nestedTypes(t);return e?t.substr(0,t.length-e[e.length-1].length):t},o.prototype.isDynamicType=function(){return!1},o.prototype.nestedTypes=function(t){return t.match(/(\[[0-9]*\])/g)},o.prototype.encode=function(o,i){var t,e,r,a=this;return this.isDynamicArray(i)?(t=o.length,e=a.nestedName(i),(r=[]).push(n.formatInputInt(t).encode()),o.forEach(function(t){r.push(a.encode(t,e))}),r):this.isStaticArray(i)?function(){for(var t=a.staticArrayLength(i),e=a.nestedName(i),r=[],n=0;n<t;n++)r.push(a.encode(o[n],e));return r}():this._inputFormatter(o,i).encode()},o.prototype.decode=function(c,u,p){var t,e,r,n,f=this;if(this.isDynamicArray(p))return function(){for(var t=parseInt("0x"+c.substr(2*u,64)),e=parseInt("0x"+c.substr(2*t,64)),r=t+32,n=f.nestedName(p),o=f.staticPartLength(n),i=32*Math.floor((o+31)/32),a=[],s=0;s<e*i;s+=i)a.push(f.decode(c,r+s,n));return a}();if(this.isStaticArray(p))return function(){for(var t=f.staticArrayLength(p),e=u,r=f.nestedName(p),n=f.staticPartLength(r),o=32*Math.floor((n+31)/32),i=[],a=0;a<t*o;a+=o)i.push(f.decode(c,e+a,r));return i}();if(this.isDynamicType(p))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),f._outputFormatter(n,p);var o=this.staticPartLength(p),i=new a(c.substr(2*u,2*o));return this._outputFormatter(i,p)},e.exports=o},{"./formatters":9,"./param":11}],15:[function(t,e,r){var n=t("./formatters"),o=t("./type"),i=function(){this._inputFormatter=n.formatInputInt,this._outputFormatter=n.formatOutputUInt};((i.prototype=new o({})).constructor=i).prototype.isType=function(t){return!!t.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/)},e.exports=i},{"./formatters":9,"./type":14}],16:[function(t,e,r){var n=t("./formatters"),o=t("./type"),i=function(){this._inputFormatter=n.formatInputReal,this._outputFormatter=n.formatOutputUReal};((i.prototype=new o({})).constructor=i).prototype.isType=function(t){return!!t.match(/^ureal([0-9]*)?(\[([0-9]*)\])*$/)},e.exports=i},{"./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","eirc","zirc","yirc","nirc","dirc","virc","uirc"],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"),o=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)),o(t,{outputLength:256}).toString()}},{"crypto-js":59,"crypto-js/sha3":80}],20:[function(t,e,r){var n=t("bignumber.js"),o=t("./sha3.js"),a=t("utf8"),i={wei:"1",kwei:"1000",mwei:"1000000",gwei:"1000000000",twei:"1000000000000",pwei:"1000000000000000",irc:"1000000000000000000",kirc:"1000000000000000000000",girc:"1000000000000000000000000",tirc:"1000000000000000000000000000",pirc:"1000000000000000000000000000000",eirc:"1000000000000000000000000000000000",zirc:"1000000000000000000000000000000000000",yirc:"1000000000000000000000000000000000000000",nirc:"1000000000000000000000000000000000000000000",dirc:"1000000000000000000000000000000000000000000000",virc:"1000000000000000000000000000000000000000000000000",uirc:"1000000000000000000000000000000000000000000000000000"},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 o=t.charCodeAt(n);if(0===o){if(!e)break;r+="00"}else{var i=o.toString(16);r+=i.length<2?"0"+i:i}}return"0x"+r},u=function(t){var e=l(t),r=e.toString(16);return e.lessThan(0)?"-0x"+r.substr(1):"0x"+r},p=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)},f=function(t){t=t?t.toLowerCase():"irc";var e=i[t];if(void 0===e)throw new Error("This unit doesn't exists, please use the one of the following units"+JSON.stringify(i,null,2));return new n(e,10)},l=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=o(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:p,toDecimal:function(t){return l(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 o=parseInt(t.substr(r,2),16);if(0===o)break;e+=String.fromCharCode(o)}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 o=parseInt(t.substr(r,2),16);e+=String.fromCharCode(o)}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=l(t).times(f(e));return m(t)?r:r.toString(10)},fromWei:function(t,e){var r=l(t).dividedBy(f(e));return m(t)?r:r.toString(10)},toBigNumber:l,toTwosComplement:function(t){var e=l(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(p(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=o(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.1"}},{}],22:[function(t,e,r){var n=t("./webu/requestmanager"),o=t("./webu/iban"),i=t("./webu/methods/irc"),a=t("./webu/methods/db"),s=t("./webu/methods/shh"),c=t("./webu/methods/net"),u=t("./webu/methods/personal"),p=t("./webu/methods/swarm"),f=t("./webu/settings"),l=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 i(this),this.db=new a(this),this.shh=new s(this),this.net=new c(this),this.personal=new u(this),this.bzz=new p(this),this.settings=new f,this.version={api:l.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 f},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 o(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"),o=t("./event"),i=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]=i.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 o(this._requestManager,r,this._address).decode(t):i.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 o=t("./jsonrpc"),i=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(!o.isValidResponse(t))return n[e].callback(i.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"),o=t("./event"),i=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 i(e._irc,t,e.address)}).forEach(function(t){t.attachToContract(e)})},p=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 o(e._irc._requestManager,t,e.address)}).forEach(function(t){t.attachToContract(e)})},f=function(n,o){var e=0,i=!1,a=n._irc.filter("latest",function(t){if(!t&&!i)if(50<++e){if(a.stopWatching(function(){}),i=!0,!o)throw new Error("Contract transaction couldn't be found after 50 blocks");o(new Error("Contract transaction couldn't be found after 50 blocks"))}else n._irc.getTransactionReceipt(n.transactionHash,function(t,r){r&&r.blockHash&&!i&&n._irc.getCode(r.contractAddress,function(t,e){if(!i&&e)if(a.stopWatching(function(){}),i=!0,1<e.length)n.address=r.contractAddress,u(n),p(n),o&&o(null,n);else{if(!o)throw new Error("The contract code couldn't be stored, please check your gas amount.");o(new Error("The contract code couldn't be stored, please check your gas amount."))}})})})},l=function(t,i){this.irc=t,this.abi=i,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 o=e[e.length-1];if((a.isObject(o)&&!a.isArray(o)&&(t=e.pop()),0<t.value)&&!(i.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),f(n,r))}):(n.transactionHash=this.irc.sendTransaction(t),f(n,null)),n},this.new.getData=this.getData.bind(this)};l.prototype.at=function(t,e){var r=new h(this.irc,this.abi,t);return u(r),p(r),e&&e(null,r),r},l.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=l},{"../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 i=t("../utils/utils"),a=t("../solidity/coder"),s=t("./formatters"),n=t("../utils/sha3"),c=t("./filter"),u=t("./methods/watches"),o=function(t,e,r){this._requestManager=t,this._params=e.inputs,this._name=i.transformToFullName(e),this._address=r,this._anonymous=e.anonymous};o.prototype.types=function(e){return this._params.filter(function(t){return t.indexed===e}).map(function(t){return t.type})},o.prototype.displayName=function(){return i.extractDisplayName(this._name)},o.prototype.typeName=function(){return i.extractTypeName(this._name)},o.prototype.signature=function(){return n(this._name)},o.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:i.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},o.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),o=a.decodeParams(this.types(!1),n),i=s.outputLogFormatter(t);return i.event=this.displayName(),i.address=t.address,i.args=this._params.reduce(function(t,e){return t[e.name]=e.indexed?r.shift():o.shift(),t},{}),delete i.data,delete i.topics,i},o.prototype.execute=function(t,e,r){i.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),o=this.decode.bind(this);return new c(n,"irc",this._requestManager,u.irc(),o,r)},o.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=o},{"../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"),o=t("./../utils/utils"),i=t("./method"),a=t("./property");e.exports=function(r){var t=function(t){var e;t.property?(r[t.property]||(r[t.property]={}),e=r[t.property]):e=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=o,t.Method=i,t.Property=a,t}},{"./../utils/utils":20,"./formatters":30,"./method":36,"./property":45}],29:[function(t,e,r){var u=t("./formatters"),p=t("../utils/utils"),f=function(t){return null==t?null:0===(t=String(t)).indexOf("0x")?t:p.fromUtf8(t)},l=function(t,r){p.isString(t.options)||t.get(function(t,e){t&&r(t),p.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)});p.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,o,i,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(p.isString(t))return t;switch(t=t||{},e){case"irc":return t.topics=t.topics||[],t.topics=t.topics.map(function(t){return p.isArray(t)?t.map(f):f(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=o,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){l(s,t)}),0<s.callbacks.length&&h(s),"function"==typeof i)return s.watch(i)}),this};n.prototype.watch=function(t){return this.callbacks.push(t),this.filterId&&(l(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(!p.isFunction(r)){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})}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},e.exports=n},{"../utils/utils":20,"./formatters":30}],30:[function(t,e,r){"use strict";var n=t("../utils/utils"),o=t("../utils/config"),i=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 i(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?o.defaultBlock:a(t)},inputBlockNumberFormatter:a,inputCallFormatter:function(e){return e.from=e.from||o.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||o.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"),o=t("../utils/utils"),i=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=o.transformToFullName(e),this._address=r};s.prototype.extractCallback=function(t){if(o.isFunction(t[t.length-1]))return t.pop()},s.prototype.extractDefaultBlock=function(t){if(t.length>this._inputTypes.length&&!o.isObject(t[t.length-1]))return formatters.inputDefaultBlockNumberFormatter(t.pop())},s.prototype.validateArgs=function(t){if(t.filter(function(t){return!(!0===o.isObject(t)&&!1===o.isArray(t)&&!1===o.isBigNumber(t))}).length!==this._inputTypes.length)throw i.InvalidNumberOfSolidityArgs()},s.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&o.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 o=this._irc.call(r,e);return this.unpackOutput(o)}var i=this;this._irc.call(r,e,function(e,t){if(e)return n(e,null);var r=null;try{r=i.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 o.extractDisplayName(this._name)},s.prototype.typeName=function(){return o.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 o=t("./errors");"undefined"!=typeof window&&window.XMLHttpRequest?XMLHttpRequest=window.XMLHttpRequest:XMLHttpRequest=t("xmlhttprequest").XMLHttpRequest;var n=t("xhr2"),i=function(t,e,r,n,o){this.host=t||"http://localhost:8545",this.timeout=e||0,this.user=r,this.password=n,this.headers=o};i.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},i.prototype.send=function(t){var e=this.prepareRequest(!1);try{e.send(JSON.stringify(t))}catch(t){throw o.InvalidConnection(this.host)}var r=e.responseText;try{r=JSON.parse(r)}catch(t){throw o.InvalidResponse(e.responseText)}return r},i.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=o.InvalidResponse(n.responseText)}r(e,t)}},n.ontimeout=function(){r(o.ConnectionTimeout(this.timeout))};try{n.send(JSON.stringify(t))}catch(t){r(o.InvalidConnection(this.host))}},i.prototype.isConnected=function(){try{return this.send({id:9999999999,jsonrpc:"2.0",method:"net_listening",params:[]}),!0}catch(t){return!1}},e.exports=i},{"./errors":26,xhr2:86,xmlhttprequest:17}],33:[function(t,e,r){var n=t("bignumber.js"),o=function(t,e){for(var r=t;r.length<2*e;)r="0"+r;return r},i=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=o(e,15);return s.fromBban(r.toUpperCase())},s.fromBban=function(t){var e=("0"+(98-a(i("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(i(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 o(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"),o=t("./errors"),i=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])})})};i.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(),o.InvalidResponse(e)},15e3))}clearTimeout(r.lastChunkTimeout),r.lastChunk=null,t&&n.push(t)}),n},i.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},i.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](o.InvalidConnection("on IPC")),delete this.responseCallbacks[t])},i.prototype.isConnected=function(){return this.connection.writable||this.connection.connect({path:this.path}),!!this.connection.writable},i.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 o.InvalidResponse(r)}return e}throw new Error('You tried to send "'+t.method+'" synchronously. Synchronous requests are not supported by the IPC provider.')},i.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=i},{"../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"),o=t("./errors"),i=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};i.prototype.setRequestManager=function(t){this.requestManager=t},i.prototype.getCall=function(t){return n.isFunction(this.call)?this.call(t):this.call},i.prototype.extractCallback=function(t){if(n.isFunction(t[t.length-1]))return t.pop()},i.prototype.validateArgs=function(t){if(t.length!==this.params)throw o.InvalidNumberOfRPCParams()},i.prototype.formatInput=function(r){return this.inputFormatter?this.inputFormatter.map(function(t,e){return t?t(r[e]):r[e]}):r},i.prototype.formatOutput=function(t){return this.outputFormatter&&t?this.outputFormatter(t):t},i.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}},i.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},i.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},i.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},e.exports=i},{"../utils/utils":20,"./errors":26}],37:[function(t,e,r){var n=t("../method"),o=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;o().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"),o=t("../../utils/config"),i=t("../contract"),a=t("./watches"),s=t("../filter"),c=t("../syncing"),u=t("../namereg"),p=t("../iban"),f=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 l(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=p,this.sendIBANTransaction=f.bind(null,this)}Object.defineProperty(l.prototype,"defaultBlock",{get:function(){return o.defaultBlock},set:function(t){return o.defaultBlock=t}}),Object.defineProperty(l.prototype,"defaultAccount",{get:function(){return o.defaultAccount},set:function(t){return o.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}),o=new v({name:"getUncle",call:w,params:2,inputFormatter:[y.inputBlockNumberFormatter,g.toHex],outputFormatter:y.outputBlockFormatter}),i=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:"