UNPKG

susyweb

Version:

Sophon JavaScript API, middleware to talk to a sophon node over RPC

1 lines 229 kB
require=function o(s,a,u){function c(e,t){if(!a[e]){if(!s[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(h)return h(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[e]={exports:{}};s[e][0].call(i.exports,function(t){return c(s[e][1][t]||t)},i,i.exports,o,s,a,u)}return a[e].exports}for(var h="function"==typeof require&&require,t=0;t<u.length;t++)c(u[t]);return c}({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"),s=t("./uint"),a=t("./dynamicbytes"),u=t("./string"),c=t("./real"),h=t("./ureal"),f=t("./bytes"),l=function(t,e){return t.isDynamicType(e)||t.isDynamicArray(e)},p=function(t){this._types=t};p.prototype._requireType=function(e){var t=this._types.filter(function(t){return t.isType(e)})[0];if(!t)throw Error("invalid polynomial type!: "+e);return t},p.prototype.encodeParam=function(t,e){return this.encodeParams([t],[e])},p.prototype.encodeParams=function(o,r){var s=this.getPolynomialTypes(o),t=s.map(function(t,e){return t.encode(r[e],o[e])}),e=s.reduce(function(t,e,r){var n=e.staticPartLength(o[r]),i=32*Math.floor((n+31)/32);return t+(l(s[r],o[r])?32:i)},0);return this.encodeMultiWithOffset(o,s,t,e)},p.prototype.encodeMultiWithOffset=function(n,i,o,s){var a="",u=this;return n.forEach(function(t,e){if(l(i[e],n[e])){a+=y.formatInputInt(s).encode();var r=u.encodeWithOffset(n[e],i[e],o[e],s);s+=r.length/2}else a+=u.encodeWithOffset(n[e],i[e],o[e],s)}),n.forEach(function(t,e){if(l(i[e],n[e])){var r=u.encodeWithOffset(n[e],i[e],o[e],s);s+=r.length/2,a+=r}}),a},p.prototype.encodeWithOffset=function(t,e,r,n){var i=1,o=2,s=3,a=e.isDynamicArray(t)?i:e.isStaticArray(t)?o:s;if(a!==s){var u=e.nestedName(t),c=e.staticPartLength(u),h=a===i?r[0]:"";if(e.isDynamicArray(u))for(var f=a===i?2:0,l=0;l<r.length;l++)a===i?f+=+r[l-1][0]||0:a===o&&(f+=+(r[l-1]||[])[0]||0),h+=y.formatInputInt(n+l*c+32*f).encode();for(var p=a===i?r.length-1:r.length,d=0;d<p;d++){var m=h/2;a===i?h+=this.encodeWithOffset(u,e,r[d+1],n+m):a===o&&(h+=this.encodeWithOffset(u,e,r[d],n+m))}return h}return r},p.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},p.prototype.decodeParams=function(r,n){var t=this.getPolynomialTypes(r),i=this.getOffsets(r,t);return t.map(function(t,e){return t.decode(n,i[e],r[e],e)})},p.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])})},p.prototype.getPolynomialTypes=function(t){var e=this;return t.map(function(t){return e._requireType(t)})};var d=new p([new n,new i,new o,new s,new a,new f,new u,new c,new h]);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"),s=t("./param"),a=function(t){n.config(o.SOF_BIGNUMBER_ROUNDING_MODE);var e=i.padLeft(i.toTwosComplement(t).toString(16),64);return new s(e)},u=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)},c=function(t){var e=t.staticPart()||"0";return new n(e,16)};e.exports={formatInputInt:a,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 s(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 s(a(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 s(a(r).value+e)},formatInputBool:function(t){return new s("000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0"))},formatInputReal:function(t){return a(new n(t).times(new n(2).pow(128)))},formatOutputInt:u,formatOutputUInt:c,formatOutputReal:function(t){return u(t).dividedBy(new n(2).pow(128))},formatOutputUReal:function(t){return c(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"),s=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,s=this;return this.isDynamicArray(o)?(t=i.length,e=s.nestedName(o),(r=[]).push(n.formatInputInt(t).encode()),i.forEach(function(t){r.push(s.encode(t,e))}),r):this.isStaticArray(o)?function(){for(var t=s.staticArrayLength(o),e=s.nestedName(o),r=[],n=0;n<t;n++)r.push(s.encode(i[n],e));return r}():this._inputFormatter(i,o).encode()},i.prototype.decode=function(u,c,h){var t,e,r,n,f=this;if(this.isDynamicArray(h))return function(){for(var t=parseInt("0x"+u.substr(2*c,64)),e=parseInt("0x"+u.substr(2*t,64)),r=t+32,n=f.nestedName(h),i=f.staticPartLength(n),o=32*Math.floor((i+31)/32),s=[],a=0;a<e*o;a+=o)s.push(f.decode(u,r+a,n));return s}();if(this.isStaticArray(h))return function(){for(var t=f.staticArrayLength(h),e=c,r=f.nestedName(h),n=f.staticPartLength(r),i=32*Math.floor((n+31)/32),o=[],s=0;s<t*i;s+=i)o.push(f.decode(u,e+s,r));return o}();if(this.isDynamicType(h))return t=parseInt("0x"+u.substr(2*c,64)),e=parseInt("0x"+u.substr(2*t,64)),r=Math.floor((e+31)/32),n=new s(u.substr(2*t,64*(1+r)),0),f._outputFormatter(n,h);var i=this.staticPartLength(h),o=new s(u.substr(2*c,2*i));return this._outputFormatter(o,h)},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={SOF_PADDING:32,SOF_SIGNATURE_LENGTH:4,SOF_UNITS:["wei","kwei","Mwei","Gwei","szabo","finney","femtosophy","picosophy","nanosophy","microsophy","millisophy","nano","micro","milli","sophy","grand","Msophy","Gsophy","Tsofer","Psophy","Esophy","Zsophy","Ysophy","Nsophy","Dsophy","Vsophy","Usophy"],SOF_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:n.ROUND_DOWN},SOF_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":65,"crypto-js/sha3":86}],20:[function(t,e,r){var n=t("bignumber.js"),i=t("./sha3.js"),s=t("utf8"),o={nosophy:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtosophy:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picosophy:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanosophy:"1000000000",nano:"1000000000",szabo:"1000000000000",microsophy:"1000000000000",micro:"1000000000000",finney:"1000000000000000",millisophy:"1000000000000000",milli:"1000000000000000",sophy:"1000000000000000000",ksophy:"1000000000000000000000",grand:"1000000000000000000000",msophy:"1000000000000000000000000",gsophy:"1000000000000000000000000000",tsophy:"1000000000000000000000000000000"},a=function(t,e,r){return new Array(e-t.length+1).join(r||"0")+t},u=function(t,e){t=s.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},c=function(t){var e=l(t),r=e.toString(16);return e.lessThan(0)?"-0x"+r.substr(1):"0x"+r},h=function(t){if(g(t))return c(+t);if(m(t))return c(t);if("object"==typeof t)return u(JSON.stringify(t));if(y(t)){if(0===t.indexOf("-0x"))return c(t);if(0===t.indexOf("0x"))return t;if(!isFinite(t))return u(t,1)}return c(t)},f=function(t){t=t?t.toLowerCase():"sophy";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)},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)},p=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:a,padRight:function(t,e,r){return t+new Array(e-t.length+1).join(r||"0")},toHex:h,toDecimal:function(t){return l(t).toNumber()},fromDecimal:c,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 s.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:u,fromAscii:function(t,e){for(var r="",n=0;n<t.length;n++){var i=t.charCodeAt(n).toString(16);r+=i.length<2?"0"+i:i}return"0x"+r.padEnd(e,"0")},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 p(t)?t:/^[0-9a-f]{40}$/.test(t)?"0x"+t:"0x"+a(h(t).substr(2),40)},isBigNumber:m,isStrictAddress:p,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:123}],21:[function(t,e,r){e.exports={version:"0.20.7"}},{}],22:[function(t,e,r){var n=t("./susyweb/requestmanager"),i=t("./susyweb/iban"),o=t("./susyweb/methods/sof"),s=t("./susyweb/methods/db"),a=t("./susyweb/methods/shh"),u=t("./susyweb/methods/net"),c=t("./susyweb/methods/personal"),h=t("./susyweb/methods/swarm"),f=t("./susyweb/settings"),l=t("./version.json"),p=t("./utils/utils"),d=t("./utils/sha3"),m=t("./susyweb/extend"),y=t("./susyweb/batch"),g=t("./susyweb/property"),v=t("./susyweb/httpprovider"),b=t("./susyweb/ipcprovider"),_=t("bignumber.js");function w(t){this._requestManager=new n(t),this.currentProvider=t,this.sof=new o(this),this.db=new s(this),this.shh=new a(this),this.net=new u(this),this.personal=new c(this),this.bzz=new h(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.toHex=p.toHex,w.prototype.toAscii=p.toAscii,w.prototype.toUtf8=p.toUtf8,w.prototype.fromAscii=p.fromAscii,w.prototype.fromUtf8=p.fromUtf8,w.prototype.toDecimal=p.toDecimal,w.prototype.fromDecimal=p.fromDecimal,w.prototype.toBigNumber=p.toBigNumber,w.prototype.toWei=p.toWei,w.prototype.fromWei=p.fromWei,w.prototype.isAddress=p.isAddress,w.prototype.isChecksumAddress=p.isChecksumAddress,w.prototype.toChecksumAddress=p.toChecksumAddress,w.prototype.isIBAN=p.isIBAN,w.prototype.padLeft=p.padLeft,w.prototype.padRight=p.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:"susyweb_clientVersion"}),new g({name:"version.network",getter:"net_version",inputFormatter:p.toDecimal}),new g({name:"version.sophon",getter:"sof_protocolVersion",inputFormatter:p.toDecimal}),new g({name:"version.whisper",getter:"shh_version",inputFormatter:p.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,"./susyweb/batch":24,"./susyweb/extend":28,"./susyweb/httpprovider":32,"./susyweb/iban":33,"./susyweb/ipcprovider":34,"./susyweb/methods/db":37,"./susyweb/methods/sof":38,"./susyweb/methods/net":39,"./susyweb/methods/personal":40,"./susyweb/methods/shh":41,"./susyweb/methods/swarm":42,"./susyweb/property":45,"./susyweb/requestmanager":46,"./susyweb/settings":47,"bignumber.js":"bignumber.js"}],23:[function(t,e,r){var n=t("../utils/sha3"),i=t("./event"),o=t("./formatters"),s=t("../utils/utils"),a=t("./filter"),u=t("./methods/watches"),c=function(t,e,r){this._requestManager=t,this._json=e,this._address=r};c.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},c.prototype.decode=function(t){t.data=t.data||"";var e=s.isArray(t.topics)&&s.isString(t.topics[0])?t.topics[0].slice(2):"",r=this._json.filter(function(t){return e===n(s.transformToFullName(t))})[0];return r?new i(this._requestManager,r,this._address).decode(t):o.outputLogFormatter(t)},c.prototype.execute=function(t,e){s.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 a(r,"sof",this._requestManager,u.sof(),n,e)},c.prototype.attachToContract=function(t){var e=this.execute.bind(this);t.allEvents=e},e.exports=c},{"../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 u=t("../utils/utils"),n=t("../polynomial/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]||""},a=function(e){e.abi.filter(function(t){return"function"===t.type}).map(function(t){return new o(e._sof,t,e.address)}).forEach(function(t){t.attachToContract(e)})},h=function(e){var t=e.abi.filter(function(t){return"event"===t.type});new s(e._sof._requestManager,t,e.address).attachToContract(e),t.map(function(t){return new i(e._sof._requestManager,t,e.address)}).forEach(function(t){t.attachToContract(e)})},f=function(n,i){var e=0,o=!1,s=n._sof.filter("latest",function(t){if(!t&&!o)if(50<++e){if(s.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._sof.getTransactionReceipt(n.transactionHash,function(t,r){r&&r.blockHash&&!o&&n._sof.getCode(r.contractAddress,function(t,e){if(!o&&e)if(s.stopWatching(function(){}),o=!0,3<e.length)n.address=r.contractAddress,a(n),h(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."))}})})})},l=function(t,a){this.sof=t,this.abi=a,this.new=function(){var r,n=new p(this.sof,this.abi),t={},e=Array.prototype.slice.call(arguments);u.isFunction(e[e.length-1])&&(r=e.pop());var i=e[e.length-1];if((u.isObject(i)&&!u.isArray(i)&&(t=e.pop()),0<t.value)&&!(a.filter(function(t){return"constructor"===t.type&&t.inputs.length===e.length})[0]||{}).payable)throw new Error("Cannot send value to non-payable constructor");var o=c(this.abi,e);if(t.data+=o,r)this.sof.sendTransaction(t,function(t,e){t?r(t):(n.transactionHash=e,r(null,n),f(n,r))});else{var s=this.sof.sendTransaction(t);n.transactionHash=s,f(n)}return n},this.new.getData=this.getData.bind(this)};l.prototype.at=function(t,e){var r=new p(this.sof,this.abi,t);return a(r),h(r),e&&e(null,r),r},l.prototype.getData=function(){var t={},e=Array.prototype.slice.call(arguments),r=e[e.length-1];u.isObject(r)&&!u.isArray(r)&&(t=e.pop());var n=c(this.abi,e);return t.data+=n,t.data};var p=function(t,e,r){this._sof=t,this.transactionHash=null,this.address=r,this.abi=e};e.exports=l},{"../polynomial/coder":7,"../utils/utils":20,"./allevents":23,"./event":27,"./function":31}],26:[function(t,e,r){e.exports={InvalidNumberOfPolynomialArgs:function(){return new Error("Invalid number of arguments to Polynomial 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"),s=t("../polynomial/coder"),a=t("./formatters"),n=t("../utils/sha3"),u=t("./filter"),c=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]=a.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"+s.encodeParam(e.type,t)}):"0x"+s.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=s.decodeParams(this.types(!0),e),n=t.data.slice(2),i=s.decodeParams(this.types(!1),n),o=a.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 u(n,"sof",this._requestManager,c.sof(),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},{"../polynomial/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"),s=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=i,t.Method=o,t.Property=s,t}},{"./../utils/utils":20,"./formatters":30,"./method":36,"./property":45}],29:[function(t,e,r){var c=t("./formatters"),h=t("../utils/utils"),f=function(t){return null==t?null:0===(t=String(t)).indexOf("0x")?t:h.fromUtf8(t)},l=function(t,r){h.isString(t.options)||t.get(function(t,e){t&&r(t),h.isArray(e)&&e.forEach(function(t){r(null,t)})})},p=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)});h.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,s){var a=this,u={};return n.forEach(function(t){t.setRequestManager(r),t.attachToObject(u)}),this.requestManager=r,this.options=function(t,e){if(h.isString(t))return t;switch(t=t||{},e){case"sof":return t.topics=t.topics||[],t.topics=t.topics.map(function(t){return h.isArray(t)?t.map(f):f(t)}),{topics:t.topics,from:t.from,to:t.to,address:t.address,fromBlock:c.inputBlockNumberFormatter(t.fromBlock),toBlock:c.inputBlockNumberFormatter(t.toBlock)};case"shh":return t}}(t,e),this.implementation=u,this.filterId=null,this.callbacks=[],this.getLogsCallbacks=[],this.pollFilters=[],this.formatter=i,this.implementation.newFilter(this.options,function(e,t){if(e)a.callbacks.forEach(function(t){t(e)}),"function"==typeof s&&s(e);else if(a.filterId=t,a.getLogsCallbacks.forEach(function(t){a.get(t)}),a.getLogsCallbacks=[],a.callbacks.forEach(function(t){l(a,t)}),0<a.callbacks.length&&p(a),"function"==typeof o)return a.watch(o)}),this};n.prototype.watch=function(t){return this.callbacks.push(t),this.filterId&&(l(this,t),p(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(!h.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"),i=t("../utils/config"),o=t("./iban"),s=function(t){var e;if(void 0!==t)return"latest"===(e=t)||"pending"===e||"earliest"===e?t:n.toHex(t)},a=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},u=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},c=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:s(t)},inputBlockNumberFormatter:s,inputCallFormatter:function(e){return e.from=e.from||i.defaultAccount,e.from&&(e.from=c(e.from)),e.to&&(e.to=c(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=c(e.from),e.to&&(e.to=c(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:c,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:a,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 u(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 a(t)}),t},outputLogFormatter:u,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("../polynomial/coder"),i=t("../utils/utils"),o=t("./errors"),s=t("./formatters"),a=t("../utils/sha3"),u=function(t,e,r){this._sof=t,this._inputTypes=e.inputs.map(function(t){return t.type}),this._outputTypes=e.outputs.map(function(t){return t.type}),this._constant="view"===e.stateMutability||"pure"===e.stateMutability||e.constant,this._payable="payable"===e.stateMutability||e.payable,this._name=i.transformToFullName(e),this._address=r};u.prototype.extractCallback=function(t){if(i.isFunction(t[t.length-1]))return t.pop()},u.prototype.extractDefaultBlock=function(t){if(t.length>this._inputTypes.length&&!i.isObject(t[t.length-1]))return s.inputDefaultBlockNumberFormatter(t.pop())},u.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.InvalidNumberOfPolynomialArgs()},u.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},u.prototype.signature=function(){return a(this._name).slice(0,8)},u.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}},u.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._sof.call(r,e);return this.unpackOutput(i)}var o=this;this._sof.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)})},u.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._sof.sendTransaction(r);this._sof.sendTransaction(r,e)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),r=this.toPayload(t);if(!e)return this._sof.estimateGas(r);this._sof.estimateGas(r,e)},u.prototype.getData=function(){var t=Array.prototype.slice.call(arguments);return this.toPayload(t).data},u.prototype.displayName=function(){return i.extractDisplayName(this._name)},u.prototype.typeName=function(){return i.extractTypeName(this._name)},u.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?"sof_call":"sof_sendTransaction",callback:e,params:[r],format:n}},u.prototype.execute=function(){return!this._constant?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.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=u},{"../polynomial/coder":7,"../utils/sha3":19,"../utils/utils":20,"./errors":26,"./formatters":30}],32:[function(e,r,t){(function(n){var i=e("./errors");"undefined"!=typeof window&&window.XMLHttpRequest?XMLHttpRequest=window.XMLHttpRequest:XMLHttpRequest=e("xmlhttprequest").XMLHttpRequest;var o=e("xhr2-cookies").XMLHttpRequest,t=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};t.prototype.prepareRequest=function(t){var e;if(t?(e=new o).timeout=this.timeout:e=new XMLHttpRequest,e.withCredentials=!0,e.open("POST",this.host,t),this.user&&this.password){var r="Basic "+new n(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},t.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},t.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))}},t.prototype.isConnected=function(){try{return this.send({id:9999999999,jsonrpc:"2.0",method:"net_listening",params:[]}),!0}catch(t){return!1}},r.exports=t}).call(this,e("buffer").Buffer)},{"./errors":26,buffer:53,"xhr2-cookies":126,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("")},s=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},a=function(t){this._iban=t};a.fromAddress=function(t){var e=new n(t,16).toString(36),r=i(e,15);return a.fromBban(r.toUpperCase())},a.fromBban=function(t){var e=("0"+(98-s(o("XE00"+t)))).slice(-2);return new a("XE"+e+t)},a.createIndirect=function(t){return a.fromBban("SOF"+t.institution+t.identifier)},a.isValid=function(t){return new a(t).isValid()},a.prototype.isValid=function(){return/^XE[0-9]{2}(SOF[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban)&&1===s(o(this._iban))},a.prototype.isDirect=function(){return 34===this._iban.length||35===this._iban.length},a.prototype.isIndirect=function(){return 20===this._iban.length},a.prototype.checksum=function(){return this._iban.substr(2,2)},a.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},a.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},a.prototype.address=function(){if(this.isDirect()){var t=this._iban.substr(4),e=new n(t,36);return i(e.toString(16),20)}return""},a.prototype.toString=function(){return this._iban},e.exports=a},{"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"),s=t("./watches"),a=t("../filter"),u=t("../syncing"),c=t("../namereg"),h=t("../iban"),f=t("../transfer"),b=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"sof_getBlockByHash":"sof_getBlockByNumber"},_=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"sof_getTransactionByBlockHashAndIndex":"sof_getTransactionByBlockNumberAndIndex"},w=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"sof_getUncleByBlockHashAndIndex":"sof_getUncleByBlockNumberAndIndex"},x=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"sof_getBlockTransactionCountByHash":"sof_getBlockTransactionCountByNumber"},k=function(t){return g.isString(t[0])&&0===t[0].indexOf("0x")?"sof_getUncleCountByBlockHash":"sof_getUncleCountByBlockNumber"};function l(t){this._requestManager=t._requestManager;var e=this;p().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)}),d().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)}),this.iban=h,this.sendIBANTransaction=f.bind(null,this)}Object.defineProperty(l.prototype,"defaultBlock",{get:function(){return i.defaultBlock},set:function(t){return i.defaultBlock=t}}),Object.defineProperty(l.prototype,"defaultAccount",{get:function(){return i.defaultAccount},set:function(t){return i.defaultAccount=t}});var p=function(){var t=new v({name:"getBalance",call:"sof_getBalance",params:2,inputFormatter:[y.inputAddressFormatter,y.inputDefaultBlockNumberFormatter],outputFormatter:y.outputBigNumberFormatter}),e=new v({name:"getStorageAt",call:"sof_getStorageAt",params:3,inputFormatter:[null,g.toHex,y.inputDefaultBlockNumberFormatter]}),r=new v({name:"getCode",call:"sof_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.input