"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file formatters.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * @date 2015\n */\n\nif (\"build\" !== 'build') {/*\n var BigNumber = require('bignumber.js'); // jshint ignore:line\n*/}\n\nvar utils = require('./utils');\nvar c = require('./const');\n\n/// @param string string to be padded\n/// @param number of characters that result string should have\n/// @param sign, by default 0\n/// @returns right aligned string\nvar padLeft = function (string, chars, sign) {\n return new Array(chars - string.length + 1).join(sign ? sign : \"0\") + string;\n};\n\n/// Formats input value to byte representation of int\n/// If value is negative, return it's two's complement\n/// If the value is floating point, round it down\n/// @returns right-aligned byte representation of int\nvar formatInputInt = function (value) {\n var padding = c.ETH_PADDING * 2;\n if (value instanceof BigNumber || typeof value === 'number') {\n if (typeof value === 'number')\n value = new BigNumber(value);\n BigNumber.config(c.ETH_BIGNUMBER_ROUNDING_MODE);\n value = value.round();\n\n if (value.lessThan(0)) \n value = new BigNumber(\"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\", 16).plus(value).plus(1);\n value = value.toString(16);\n }\n else if (value.indexOf('0x') === 0)\n value = value.substr(2);\n else if (typeof value === 'string')\n value = formatInputInt(new BigNumber(value));\n else\n value = (+value).toString(16);\n return padLeft(value, padding);\n};\n\n/// Formats input value to byte representation of string\n/// @returns left-algined byte representation of string\nvar formatInputString = function (value) {\n return utils.fromAscii(value, c.ETH_PADDING).substr(2);\n};\n\n/// Formats input value to byte representation of bool\n/// @returns right-aligned byte representation bool\nvar formatInputBool = function (value) {\n return '000000000000000000000000000000000000000000000000000000000000000' + (value ? '1' : '0');\n};\n\n/// Formats input value to byte representation of real\n/// Values are multiplied by 2^m and encoded as integers\n/// @returns byte representation of real\nvar formatInputReal = function (value) {\n return formatInputInt(new BigNumber(value).times(new BigNumber(2).pow(128))); \n};\n\n\n/// Check if input value is negative\n/// @param value is hex format\n/// @returns true if it is negative, otherwise false\nvar signedIsNegative = function (value) {\n return (new BigNumber(value.substr(0, 1), 16).toString(2).substr(0, 1)) === '1';\n};\n\n/// Formats input right-aligned input bytes to int\n/// @returns right-aligned input bytes formatted to int\nvar formatOutputInt = function (value) {\n value = value || \"0\";\n // check if it's negative number\n // it it is, return two's complement\n if (signedIsNegative(value)) {\n return new BigNumber(value, 16).minus(new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)).minus(1);\n }\n return new BigNumber(value, 16);\n};\n\n/// Formats big right-aligned input bytes to uint\n/// @returns right-aligned input bytes formatted to uint\nvar formatOutputUInt = function (value) {\n value = value || \"0\";\n return new BigNumber(value, 16);\n};\n\n/// @returns input bytes formatted to real\nvar formatOutputReal = function (value) {\n return formatOutputInt(value).dividedBy(new BigNumber(2).pow(128)); \n};\n\n/// @returns input bytes formatted to ureal\nvar formatOutputUReal = function (value) {\n return formatOutputUInt(value).dividedBy(new BigNumber(2).pow(128)); \n};\n\n/// @returns right-aligned input bytes formatted to hex\nvar formatOutputHash = function (value) {\n return \"0x\" + value;\n};\n\n/// @returns right-aligned input bytes formatted to bool\nvar formatOutputBool = function (value) {\n return value === '0000000000000000000000000000000000000000000000000000000000000001' ? true : false;\n};\n\n/// @returns left-aligned input bytes formatted to ascii string\nvar formatOutputString = function (value) {\n return utils.toAscii(value);\n};\n\n/// @returns right-aligned input bytes formatted to address\nvar formatOutputAddress = function (value) {\n return \"0x\" + value.slice(value.length - 40, value.length);\n};\n\n\nmodule.exports = {\n formatInputInt: formatInputInt,\n formatInputString: formatInputString,\n formatInputBool: formatInputBool,\n formatInputReal: formatInputReal,\n formatOutputInt: formatOutputInt,\n formatOutputUInt: formatOutputUInt,\n formatOutputReal: formatOutputReal,\n formatOutputUReal: formatOutputUReal,\n formatOutputHash: formatOutputHash,\n formatOutputBool: formatOutputBool,\n formatOutputString: formatOutputString,\n formatOutputAddress: formatOutputAddress\n};\n\n",
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file httpsync.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\nif (\"build\" !== 'build') {/*\n var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line\n*/}\n\nvar HttpSyncProvider = function (host) {\n this.handlers = [];\n this.host = host || 'http://localhost:8080';\n};\n\nHttpSyncProvider.prototype.send = function (payload) {\n //var data = formatJsonRpcObject(payload);\n \n var request = new XMLHttpRequest();\n request.open('POST', this.host, false);\n request.send(JSON.stringify(payload));\n \n // check request.status\n var result = request.responseText;\n return JSON.parse(result);\n};\n\nmodule.exports = HttpSyncProvider;\n\n",
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file jsonrpc.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * @date 2015\n */\n\nvar messageId = 1;\n\n/// Should be called to valid json create payload object\n/// @param method of jsonrpc call, required\n/// @param params, an array of method params, optional\n/// @returns valid jsonrpc payload object\nvar toPayload = function (method, params) {\n if (!method)\n console.error('jsonrpc method should be specified!');\n\n return {\n jsonrpc: '2.0',\n method: method,\n params: params || [],\n id: messageId++\n }; \n};\n\n/// Should be called to check if jsonrpc response is valid\n/// @returns true if response is valid, otherwise false \nvar isValidResponse = function (response) {\n return !!response &&\n !response.error &&\n response.jsonrpc === '2.0' &&\n typeof response.id === 'number' &&\n response.result !== undefined; // only undefined is not valid json object\n};\n\n/// Should be called to create batch payload object\n/// @param messages, an array of objects with method (required) and params (optional) fields\nvar toBatchPayload = function (messages) {\n return messages.map(function (message) {\n return toPayload(message.method, message.params);\n }); \n};\n\nmodule.exports = {\n toPayload: toPayload,\n isValidResponse: isValidResponse,\n toBatchPayload: toBatchPayload\n};\n\n\n",
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file providermanager.js\n * @authors:\n * Jeffrey Wilcke <jeff@ethdev.com>\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\nvar web3 = require('./web3'); \nvar jsonrpc = require('./jsonrpc');\n\n\n/**\n * Provider manager object prototype\n * It's responsible for passing messages to providers\n * If no provider is set it's responsible for queuing requests\n * It's also responsible for polling the ethereum node for incoming messages\n * Default poll timeout is 12 seconds\n * If we are running ethereum.js inside ethereum browser, there are backend based tools responsible for polling,\n * and provider manager polling mechanism is not used\n */\nvar ProviderManager = function() {\n this.polls = [];\n this.provider = undefined;\n\n var self = this;\n var poll = function () {\n if (self.provider) {\n var pollsBatch = self.polls.map(function (data) {\n return data.data;\n });\n\n var payload = jsonrpc.toBatchPayload(pollsBatch);\n var results = self.provider.send(payload);\n\n self.polls.forEach(function (data, index) {\n var result = results[index];\n \n if (!jsonrpc.isValidResponse(result)) {\n console.log(result);\n return;\n }\n\n result = result.result;\n // dont call the callback if result is not an array, or empty one\n if (!(result instanceof Array) || result.length === 0) {\n return;\n }\n\n data.callback(result);\n\n });\n\n }\n setTimeout(poll, 1000);\n };\n poll();\n};\n\n/// sends outgoing requests\n/// @params data - an object with at least 'method' property\nProviderManager.prototype.send = function(data) {\n var payload = jsonrpc.toPayload(data.method, data.params);\n\n if (this.provider === undefined) {\n console.error('provider is not set');\n return null; \n }\n\n var result = this.provider.send(payload);\n\n if (!jsonrpc.isValidResponse(result)) {\n console.log(result);\n return null;\n }\n\n return result.result;\n};\n\n/// setups provider, which will be used for sending messages\nProviderManager.prototype.set = function(provider) {\n this.provider = provider;\n};\n\n/// this method is only used, when we do not have native qt bindings and have to do polling on our own\n/// should be callled, on start watching for eth/shh changes\nProviderManager.prototype.startPolling = function (data, pollId, callback) {\n this.polls.push({data: data, id: pollId, callback: callback});\n};\n\n/// should be called to stop polling for certain watch changes\nProviderManager.prototype.stopPolling = function (pollId) {\n for (var i = this.polls.length; i--;) {\n var poll = this.polls[i];\n if (poll.id === pollId) {\n this.polls.splice(i, 1);\n }\n }\n};\n\nmodule.exports = ProviderManager;\n\n",
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file providermanager.js\n * @authors:\n * Jeffrey Wilcke <jeff@ethdev.com>\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\nvar web3 = require('./web3'); \nvar jsonrpc = require('./jsonrpc');\n\n\n/**\n * Provider manager object prototype\n * It's responsible for passing messages to providers\n * If no provider is set it's responsible for queuing requests\n * It's also responsible for polling the ethereum node for incoming messages\n * Default poll timeout is 12 seconds\n * If we are running ethereum.js inside ethereum browser, there are backend based tools responsible for polling,\n * and provider manager polling mechanism is not used\n */\nvar ProviderManager = function() {\n this.polls = [];\n this.provider = undefined;\n\n var self = this;\n var poll = function () {\n self.polls.forEach(function (data) {\n var result = self.send(data.data);\n\n if (!(result instanceof Array) || result.length === 0) {\n return;\n }\n\n data.callback(result);\n });\n\n setTimeout(poll, 1000);\n };\n poll();\n};\n\n/// sends outgoing requests\n/// @params data - an object with at least 'method' property\nProviderManager.prototype.send = function(data) {\n var payload = jsonrpc.toPayload(data.method, data.params);\n\n if (this.provider === undefined) {\n console.error('provider is not set');\n return null; \n }\n\n var result = this.provider.send(payload);\n\n if (!jsonrpc.isValidResponse(result)) {\n console.log(result);\n return null;\n }\n\n return result.result;\n};\n\n/// setups provider, which will be used for sending messages\nProviderManager.prototype.set = function(provider) {\n this.provider = provider;\n};\n\n/// this method is only used, when we do not have native qt bindings and have to do polling on our own\n/// should be callled, on start watching for eth/shh changes\nProviderManager.prototype.startPolling = function (data, pollId, callback) {\n this.polls.push({data: data, id: pollId, callback: callback});\n};\n\n/// should be called to stop polling for certain watch changes\nProviderManager.prototype.stopPolling = function (pollId) {\n for (var i = this.polls.length; i--;) {\n var poll = this.polls[i];\n if (poll.id === pollId) {\n this.polls.splice(i, 1);\n }\n }\n};\n\nmodule.exports = ProviderManager;\n\n",
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file qtsync.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\nvar QtSyncProvider = function () {\n};\n\nQtSyncProvider.prototype.send = function (payload) {\n var result = navigator.qt.callMethod(JSON.stringify(payload));\n return JSON.parse(result);\n};\n\nmodule.exports = QtSyncProvider;\n\n",
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file types.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * @date 2015\n */\n\nvar f = require('./formatters');\n\n/// @param expected type prefix (string)\n/// @returns function which checks if type has matching prefix. if yes, returns true, otherwise false\nvar prefixedType = function (prefix) {\n return function (type) {\n return type.indexOf(prefix) === 0;\n };\n};\n\n/// @param expected type name (string)\n/// @returns function which checks if type is matching expected one. if yes, returns true, otherwise false\nvar namedType = function (name) {\n return function (type) {\n return name === type;\n };\n};\n\n/// Setups input formatters for solidity types\n/// @returns an array of input formatters \nvar inputTypes = function () {\n \n return [\n { type: prefixedType('uint'), format: f.formatInputInt },\n { type: prefixedType('int'), format: f.formatInputInt },\n { type: prefixedType('hash'), format: f.formatInputInt },\n { type: prefixedType('string'), format: f.formatInputString }, \n { type: prefixedType('real'), format: f.formatInputReal },\n { type: prefixedType('ureal'), format: f.formatInputReal },\n { type: namedType('address'), format: f.formatInputInt },\n { type: namedType('bool'), format: f.formatInputBool }\n ];\n};\n\n/// Setups output formaters for solidity types\n/// @returns an array of output formatters\nvar outputTypes = function () {\n\n return [\n { type: prefixedType('uint'), format: f.formatOutputUInt },\n { type: prefixedType('int'), format: f.formatOutputInt },\n { type: prefixedType('hash'), format: f.formatOutputHash },\n { type: prefixedType('string'), format: f.formatOutputString },\n { type: prefixedType('real'), format: f.formatOutputReal },\n { type: prefixedType('ureal'), format: f.formatOutputUReal },\n { type: namedType('address'), format: f.formatOutputAddress },\n { type: namedType('bool'), format: f.formatOutputBool }\n ];\n};\n\nmodule.exports = {\n prefixedType: prefixedType,\n namedType: namedType,\n inputTypes: inputTypes,\n outputTypes: outputTypes\n};\n\n",
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file utils.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * @date 2015\n */\n\nvar c = require('./const');\n\n/// Finds first index of array element matching pattern\n/// @param array\n/// @param callback pattern\n/// @returns index of element\nvar findIndex = function (array, callback) {\n var end = false;\n var i = 0;\n for (; i < array.length && !end; i++) {\n end = callback(array[i]);\n }\n return end ? i - 1 : -1;\n};\n\n/// @returns ascii string representation of hex value prefixed with 0x\nvar toAscii = function(hex) {\n// Find termination\n var str = \"\";\n var i = 0, l = hex.length;\n if (hex.substring(0, 2) === '0x') {\n i = 2;\n }\n for (; i < l; i+=2) {\n var code = parseInt(hex.substr(i, 2), 16);\n if (code === 0) {\n break;\n }\n\n str += String.fromCharCode(code);\n }\n\n return str;\n};\n \nvar toHex = function(str) {\n var hex = \"\";\n for(var i = 0; i < str.length; i++) {\n var n = str.charCodeAt(i).toString(16);\n hex += n.length < 2 ? '0' + n : n;\n }\n\n return hex;\n};\n\n/// @returns hex representation (prefixed by 0x) of ascii string\nvar fromAscii = function(str, pad) {\n pad = pad === undefined ? 0 : pad;\n var hex = toHex(str);\n while (hex.length < pad*2)\n hex += \"00\";\n return \"0x\" + hex;\n};\n\n/// @returns display name for function/event eg. multiply(uint256) -> multiply\nvar extractDisplayName = function (name) {\n var length = name.indexOf('('); \n return length !== -1 ? name.substr(0, length) : name;\n};\n\n/// @returns overloaded part of function/event name\nvar extractTypeName = function (name) {\n /// TODO: make it invulnerable\n var length = name.indexOf('(');\n return length !== -1 ? name.substr(length + 1, name.length - 1 - (length + 1)).replace(' ', '') : \"\";\n};\n\n/// Filters all function from input abi\n/// @returns abi array with filtered objects of type 'function'\nvar filterFunctions = function (json) {\n return json.filter(function (current) {\n return current.type === 'function'; \n }); \n};\n\n/// Filters all events form input abi\n/// @returns abi array with filtered objects of type 'event'\nvar filterEvents = function (json) {\n return json.filter(function (current) {\n return current.type === 'event';\n });\n};\n\n/// used to transform value/string to eth string\n/// TODO: use BigNumber.js to parse int\n/// TODO: add tests for it!\nvar toEth = function (str) {\n var val = typeof str === \"string\" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;\n var unit = 0;\n var units = c.ETH_UNITS;\n while (val > 3000 && unit < units.length - 1)\n {\n val /= 1000;\n unit++;\n }\n var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2);\n var replaceFunction = function($0, $1, $2) {\n return $1 + ',' + $2;\n };\n\n while (true) {\n var o = s;\n s = s.replace(/(\\d)(\\d\\d\\d[\\.\\,])/, replaceFunction);\n if (o === s)\n break;\n }\n return s + ' ' + units[unit];\n};\n\nmodule.exports = {\n findIndex: findIndex,\n toAscii: toAscii,\n fromAscii: fromAscii,\n extractDisplayName: extractDisplayName,\n extractTypeName: extractTypeName,\n filterFunctions: filterFunctions,\n filterEvents: filterEvents,\n toEth: toEth\n};\n\n",
require=functiont(e,n,r){functioni(a,u){if(!n[a]){if(!e[a]){vars="function"==typeofrequire&&require;if(!u&&s)returns(a,!0);if(o)returno(a,!0);varf=newError("Cannot find module '"+a+"'");throwf.code="MODULE_NOT_FOUND",f}varc=n[a]={exports:{}};e[a][0].call(c.exports,function(t){varn=e[a][1][t];returni(n?n:t)},c,c.exports,t,e,n,r)}returnn[a].exports}for(varo="function"==typeofrequire&&require,a=0;a<r.length;a++)i(r[a]);returni}({1:[function(t,e){varn=t("./web3"),r=t("./utils"),i=t("./types"),o=t("./const"),a=t("./formatters"),u=function(t){console.error("parser does not support type: "+t)},s=function(t){return"[]"===t.slice(-2)},f=function(t,e){returns(t)||"string"===t?a.formatInputInt(e.length):""},c=i.inputTypes(),l=function(t,e){{varn="";2*o.ETH_PADDING}returnt.forEach(function(t,r){n+=f(t.type,e[r])}),t.forEach(function(r,i){for(varo=!1,a=0;a<c.length&&!o;a++)o=c[a].type(t[i].type,e[i]);o||u(t[i].type);varf=c[a-1].format,l="";l=s(t[i].type)?e[i].reduce(function(t,e){returnt+f(e)},""):f(e[i]),n+=l}),n},p=function(t){returns(t)||"string"===t?2*o.ETH_PADDING:0},m=i.outputTypes(),h=function(t,e){e=e.slice(2);varn=[],r=2*o.ETH_PADDING,f=t.reduce(function(t,e){returnt+p(e.type)},0),c=e.slice(0,f);returne=e.slice(f),t.forEach(function(o,f){for(varl=!1,p=0;p<m.length&&!l;p++)l=m[p].type(t[f].type);l||u(t[f].type);varh=m[p-1].format;if(s(t[f].type)){vard=a.formatOutputUInt(c.slice(0,r));c=c.slice(r);for(varg=[],v=0;d>v;v++)g.push(h(e.slice(0,r))),e=e.slice(r);n.push(g)}elsei.prefixedType("string")(t[f].type)?(c=c.slice(r),n.push(h(e.slice(0,r))),e=e.slice(r)):(n.push(h(e.slice(0,r))),e=e.slice(r))}),n},d=function(t){vare={};returnt.forEach(function(t){varn=r.extractDisplayName(t.name),i=r.extractTypeName(t.name),o=function(){vare=Array.prototype.slice.call(arguments);returnl(t.inputs,e)};void0===e[n]&&(e[n]=o),e[n][i]=o}),e},g=function(t){vare={};returnt.forEach(function(t){varn=r.extractDisplayName(t.name),i=r.extractTypeName(t.name),o=function(e){returnh(t.outputs,e)};void0===e[n]&&(e[n]=o),e[n][i]=o}),e},v=function(t){returnn.sha3(n.fromAscii(t)).slice(0,2+2*o.ETH_SIGNATURE_LENGTH)},y=function(t){returnn.sha3(n.fromAscii(t))};e.exports={inputParser:d,outputParser:g,formatInput:l,formatOutput:h,signatureFromAscii:v,eventSignatureFromAscii:y}},{"./const":2,"./formatters":6,"./types":11,"./utils":12,"./web3":13}],2:[function(t,e){varn=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:n,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:BigNumber.ROUND_DOWN}}},{}],3:[function(t,e){varn=t("./web3"),r=t("./abi"),i=t("./utils"),o=t("./event"),a=function(t){n._currentContractAbi=t.abi,n._currentContractAddress=t.address,n._currentContractMethodName=t.method,n._currentContractMethodParams=t.params},u=function(t){t.call=function(e){returnt._isTransact=!1,t._options=e,t},t.transact=function(e){returnt._isTransact=!0,t._options=e,t},t._options={},["gas","gasPrice","value","from"].forEach(function(e){t[e]=function(n){returnt._options[e]=n,t}})},s=function(t,e,o){varu=r.inputParser(e),s=r.outputParser(e);i.filterFunctions(e).forEach(function(f){varc=i.extractDisplayName(f.name),l=i.extractTypeName(f.name),p=function(){vari=Array.prototype.slice.call(arguments),p=r.signatureFromAscii(f.name),m=u[c][l].apply(null,i),h=t._options||{};h.to=o,h.data=p+m;vard=t._isTransact===!0||t._isTransact!==!1&&!f.constant,g=h.collapse!==!1;if(t._options={},t._isTransact=null,d)returna({abi:e,address:o,method:f.name,params:i}),voidn.eth.transact(h);varv=n.eth.call(h),y=s[c][l](v);returng&&(1===y.length?y=y[0]:0===y.length&&(y=null)),y};void0===t[c]&&(t[c]=p),t[c][l]=p})},f=function(t,e,n){t.address=n,t._onWatchEventResult=function(t){varn=event.getMatchingEvent(i.filterEvents(e)),r=o.outputParser(n);returnr(t)},Object.defineProperty(t,"topic",{get:function(){returni.filterEvents(e).map(function(t){returnr.eventSignatureFromAscii(t.name)})}})},c=function(t,e,a){i.filterEvents(e).forEach(function(e){varu=function(){vart=Array.prototype.slice.call(arguments),i=r.eventSignatureFromAscii(e.name),u=o.inputParser(a,i,e),s=u.apply(null,t);returns._onWatchEventResult=function(t){varn=o.outputParser(e);returnn(t)},n.eth.watch(s)};u._isEvent=!0;vars=i.extractDisplayName(e.name),f=i.extractTypeName(e.name);void0===t[s]&&(t[s]=u),t[s][f]=u})},l=function(t,e){e.forEach(function(t){if(-1===t.name.indexOf("(")){vare=t.name,n=t.inputs.map(function(t){returnt.type}).join();t.name=e+"("+n+")"}});varn={};returnu(n),s(n,e,t),f(n,e,t),c(n,e,t),n};e.exports=l},{"./abi":1,"./event":4,"./utils":12,"./web3":13}],4:[function(t,e){varn=t("./abi"),r=t("./utils"),i=function(t,e){returnt.filter(function(t){returnt.indexed===e})},o=function(t,e){varn=r.findIndex(t,function(t){returnt.name===e});return-1===n?voidconsole.error("indexed param with name "+e+" not found"):t[n]},a=function(t,e){returnObject.keys(e).map(function(r){vara=[o(i(t.inputs,!0),r)],u=e[r];returnuinstanceofArray?u.map(function(t){returnn.formatInput(a,[t])}):n.formatInput(a,[u])})},u=function(t,e,n){returnfunction(r,i){varo=i||{};returno.address=t,o.topic=[],o.topic.push(e),r&&(o.topic=o.topic.concat(a(n,r))),o}},s=function(t,e,n){e.slice(),n.slice();returnt.reduce(function(t,r){vari;returni=r.indexed?e.splice(0,1)[0]:n.splice(0,1)[0],t[r.name]=i,t},{})},f=function(t){returnfunction(e){varo={event:r.extractDisplayName(t.name),number:e.number,args:{}};if(!e.topic)returno;vara=i(t.inputs,!0),u="0x"+e.topic.slice(1,e.topic.length).map(function(t){returnt.slice(2)}).join(""),f=n.formatOutput(a,u),c=i(t.inputs,!1),l=n.formatOutput(c,e.data);returno.args=s(t.inputs,f,l),o}},c=function(t,e){for(varr=0;r<t.length;r++){vari=n.eventSignatureFromAscii(t[r].name);if(i===e.topic[0])returnt[r]}returnvoid0};e.exports={inputParser:u,outputParser:f,getMatchingEvent:c}},{"./abi":1,"./utils":12}],5:[function(t,e){varn=t("./web3"),r=function(t,e){"string"!=typeoft&&(t.topics&&console.warn('"topics" is deprecated, use "topic" instead'),this._onWatchResult=t._onWatchEventResult,t={to:t.to,topic:t.topic,earliest:t.earliest,latest:t.latest,max:t.max,skip:t.skip,address:t.address}),this.impl=e,this.callbacks=[],this.id=e.newFilter(t),n.provider.startPolling({method:e.changed,params:[this.id]},this.id,this.trigger.bind(this))};r.prototype.arrived=function(t){this.changed(t)},r.prototype.happened=function(t){this.changed(t)},r.prototype.changed=function(t){this.callbacks.push(t)},r.prototype.trigger=function(t){for(vare=0;e<this.callbacks.length;e++)for(varn=0;n<t.length;n++){varr=this._onWatchResult?this._onWatchResult(t[n]):t[n];this.callbacks[e].call(this,r)}},r.prototype.uninstall=function(){this.impl.uninstallFilter(this.id),n.provider.stopPolling(this.id)},r.prototype.messages=function(){returnthis.impl.getMessages(this.id)},r.prototype.logs=function(){returnthis.messages()},e.exports=r},{"./web3":13}],6:[function(t,e){varn=t("./utils"),r=t("./const"),i=function(t,e,n){returnnewArray(e-t.length+1).join(n?n:"0")+t},o=function(t){vare=2*r.ETH_PADDING;returntinstanceofBigNumber||"number"==typeoft?("number"==typeoft&&(t=newBigNumber(t)),BigNumber.config(r.ETH_BIGNUMBER_ROUNDING_MODE),t=t.round(),t.lessThan(0)&&(t=newBigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeoft?o(newBigNumber(t)):(+t).toString(16),i(t,e)},a=function(t){returnn.fromAscii(t,r.ETH_PADDING).substr(2)},u=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},s=function(t){returno(newBigNumber(t).times(newBigNumber(2).pow(128)))},f=function(t){return"1"===newBigNumber(t.substr(0,1),16).toString(2).substr(0,1)},c=function(t){returnt=t||"0",f(t)?newBigNumber(t,16).minus(newBigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):newBigNumber(t,16)},l=function(t){returnt=t||"0",newBigNumber(t,16)},p=function(t){returnc(t).dividedBy(newBigNumber(2).pow(128))},m=function(t){returnl(t).dividedBy(newBigNumber(2).pow(128))},h=function(t){return"0x"+t},d=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},g=function(t){returnn.toAscii(t)},v=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:o,formatInputString:a,formatInputBool:u,formatInputReal:s,formatOutputInt:c,formatOutputUInt:l,formatOutputReal:p,formatOutputUReal:m,formatOutputHash:h,formatOutputBool:d,formatOutputString:g,formatOutputAddress:v}},{"./const":2,"./utils":12}],7:[function(t,e){varn=function(t){this.handlers=[],this.host=t||"http://localhost:8080"};n.prototype.send=function(t){vare=newXMLHttpRequest;e.open("POST",this.host,!1),e.send(JSON.stringify(t));varn=e.responseText;returnJSON.parse(n)},e.exports=n},{}],8:[function(t,e){varn=1,r=function(t,e){returnt||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:n++}},i=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeoft.id&&void0!==t.result},o=function(t){returnt.map(function(t){returnr(t.method,t.params)})};e.exports={toPayload:r,isValidResponse:i,toBatchPayload:o}},{}],9:[function(t,e){varn=(t("./web3"),t("./jsonrpc")),r=function(){this.polls=[],this.provider=void0;vart=this,e=function(){if(t.provider){varr=t.polls.map(function(t){returnt.data}),i=n.toBatchPayload(r),o=t.provider.send(i);t.polls.forEach(function(t,e){varr=o[e];returnn.isValidResponse(r)?(r=r.result,void(rinstanceofArray&&0!==r.length&&t.callback(r))):voidconsole.log(r)})}setTimeout(e,1e3)};e()};r.prototype.send=function(t){vare=n.toPayload(t.method,t.params);if(void0===this.provider)returnconsole.error("provider is not set"),null;varr=this.provider.send(e);returnn.isValidResponse(r)?r.result:(console.log(r),null)},r.prototype.set=function(t){this.provider=t},r.prototype.startPolling=function(t,e,n){this.polls.push({data:t,id:e,callback:n})},r.prototype.stopPolling=function(t){for(vare=this.polls.length;e--;){varn=this.polls[e];n.id===t&&this.polls.splice(e,1)}},e.exports=r},{"./jsonrpc":8,"./web3":13}],10:[function(t,e){varn=function(){};n.prototype.send=function(t){vare=navigator.qt.callMethod(JSON.stringify(t));returnJSON.parse(e)},e.exports=n},{}],11:[function(t,e){varn=t("./formatters"),r=function(t){returnfunction(e){return0===e.indexOf(t)}},i=function(t){returnfunction(e){returnt===e}},o=function(){return[{type:r("uint"),format:n.formatInputInt},{type:r("int"),format:n.formatInputInt},{type:r("hash"),format:n.formatInputInt},{type:r("string"),format:n.formatInputString},{type:r("real"),format:n.formatInputReal},{type:r("ureal"),format:n.formatInputReal},{type:i("address"),format:n.formatInputInt},{type:i("bool"),format:n.formatInputBool}]},a=function(){return[{type:r("uint"),format:n.formatOutputUInt},{type:r("int"),format:n.formatOutputInt},{type:r("hash"),format:n.formatOutputHash},{type:r("string"),format:n.formatOutputString},{type:r("real"),format:n.formatOutputReal},{type:r("ureal"),format:n.formatOutputUReal},{type:i("address"),format:n.formatOutputAddress},{type:i("bool"),format:n.formatOutputBool}]};e.exports={prefixedType:r,namedType:i,inputTypes:o,outputTypes:a}},{"./formatters":6}],12:[function(t,e){varn=t("./const"),r=function(t,e){for(varn=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);returnn?r-1:-1},i=function(t){vare="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){vari=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}returne},o=function(t){for(vare="",n=0;n<t.length;n++){varr=t.charCodeAt(n).toString(16);e+=r.length<2?"0"+r:r}returne},a=function(t,e){e=void0===e?0:e;for(varn=o(t);n.length<2*e;)n+="00";return"0x"+n},u=function(t){vare=t.indexOf("(");return-1!==e?t.substr(0,e):t},s=function(t){vare=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)).replace("",""):""},f=function(t){returnt.filter(function(t){return"function"===t.type})},c=function(t){returnt.filter(function(t){return"event"===t.type})},l=function(t){for(vare="string"==typeoft?0===t.indexOf("0x")?parseInt(t.substr(2),16):parseInt(t):t,r=0,i=n.ETH_UNITS;e>3e3&&r<i.length-1;)e/=1e3,r++;for(varo=e.toString().length<e.toFixed(2).length?e.toString():e.toFixed(2),a=function(t,e,n){returne+","+n};;){varu=o;if(o=o.replace(/(\d)(\d\d\d[\.\,])/,a),u===o)break}returno+""+i[r]};e.exports={findIndex:r,toAscii:i,fromAscii:a,extractDisplayName:u,extractTypeName:s,filterFunctions:f,filterEvents:c,toEth:l}},{"./const":2}],13:[function(t,e){varn=t("./utils"),r=function(){return[{name:"sha3",call:"web3_sha3"}]},i=function(){vart=function(t){return"string"==typeoft[0]?"eth_blockByHash":"eth_blockByNumber"},e=function(t){return"string"==typeoft[0]?"eth_transactionByHash":"eth_transactionByNumber"},n=function(t){return"string"==typeoft[0]?"eth_uncleByHash":"eth_uncleByNumber"},r=[{name:"balanceAt",call:"eth_balanceAt"},{name:"stateAt",call:"eth_stateAt"},{name:"storageAt",call:"eth_storageAt"},{name:"countAt",call:"eth_countAt"},{name:"codeAt",call:"eth_codeAt"},{name:"transact",call:"eth_transact"},{name:"call",call:"eth_call"},{name:"block",call:t},{name:"transaction",call:e},{name:"uncle",call:n},{name:"compilers",call:"eth_compilers"},{name:"flush",call:"eth_flush"},{name:"lll",call:"eth_lll"},{name:"solidity",call:"eth_solidity"},{name:"serpent",call:"eth_serpent"},{name:"logs",call:"eth_logs"}];returnr},o=function(){return[{name:"coinbase",getter:"eth_coinbase",setter:"eth_setCoinbase"},{name:"listening",getter:"eth_listening",setter:"eth_setListening"},{name:"mining",getter:"eth_mining",setter:"eth_setMining"},{name:"gasPrice",getter:"eth_gasPrice"},{name:"accounts",getter:"eth_accounts"},{name:"peerCount",getter:"eth_peerCount"},{name:"defaultBlock",getter:"eth_defaultBlock",setter:"eth_setDefaultBlock"},{name:"number",getter:"eth_number"}]},a=function(){return[{name:"put",call:"db_put"},{name:"get",call:"db_get"},{name:"putString",call:"db_putString"},{name:"getString",call:"db_getString"}]},u=function(){return[{name:"post",call:"shh_post"},{name:"newIdentity",call:"shh_newIdentity"},{name:"haveIdentity",call:"shh_haveIdentity"},{name:"newGroup",call:"shh_newGroup"},{name:"addToGroup",call:"shh_addToGroup"}]},s=function(){vart=function(t){return"string"==typeoft[0]?"eth_newFilterString":"eth_newFilter"};return[{name:"newFilter",call:t},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getMessages",call:"eth_filterLogs"}]},f=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getMessages",call:"shh_getMessages"}]},c=function(t,e){e.forEach(function(e){t[e.name]=function(){vart=Array.prototype.slice.call(arguments),n="function"==typeofe.call?e.call(t):e.call;returnp.provider.send({method:n,params:t})}})},l=function(t,e){e.forEach(function(e){varn={};n.get=function(){returnp.provider.send({method:e.getter})},e.setter&&(n.set=function(t){returnp.provider.send({method:e.setter,params:[t]})}),Object.defineProperty(t,e.name,n)})},p={_callbacks:{},_events:{},providers:{},toAscii:n.toAscii,fromAscii:n.fromAscii,toDecimal:function(t){returnt=t.length>2?t.substring(2):"0",newBigNumber(t,16).toString(10)},fromDecimal:function(t){return"0x"+newBigNumber(t).toString(16)},toEth:n.toEth,eth:{contractFromAbi:function(t){returnfunction(e){e=e||"0xc6d9d2cd449a754c494264e1809c50e34d64562b";varn=p.eth.contract(e,t);returnn.address=e,n}},watch:function(t,e,n){returnt._isEvent?t(e,n):newp.filter(t,m)}},db:{},shh:{watch:function(t){returnnewp.filter(t,h)}}};c(p,r()),c(p.eth,i()),l(p.eth,o()),c(p.db,a()),c(p.shh,u());varm={changed:"eth_changed"};c(m,s());varh={changed:"shh_changed"};c(h,f()),p.setProvider=function(t){p.provider.set(t)},e.exports=p},{"./utils":12}],web3:[function(t,e){varn=t("./lib/web3"),r=t("./lib/providermanager");n.provider=newr,n.filter=t("./lib/filter"),n.providers.HttpSyncProvider=t("./lib/httpsync"),n.providers.QtSyncProvider=t("./lib/qtsync"),n.eth.contract=t("./lib/contract"),n.abi=t("./lib/abi"),e.exports=n},{"./lib/abi":1,"./lib/contract":3,"./lib/filter":5,"./lib/httpsync":7,"./lib/providermanager":9,"./lib/qtsync":10,"./lib/web3":13}]},{},["web3"]);
\ No newline at end of file
require=functiont(e,n,r){functioni(a,u){if(!n[a]){if(!e[a]){vars="function"==typeofrequire&&require;if(!u&&s)returns(a,!0);if(o)returno(a,!0);varf=newError("Cannot find module '"+a+"'");throwf.code="MODULE_NOT_FOUND",f}varc=n[a]={exports:{}};e[a][0].call(c.exports,function(t){varn=e[a][1][t];returni(n?n:t)},c,c.exports,t,e,n,r)}returnn[a].exports}for(varo="function"==typeofrequire&&require,a=0;a<r.length;a++)i(r[a]);returni}({1:[function(t,e){varn=t("./web3"),r=t("./utils"),i=t("./types"),o=t("./const"),a=t("./formatters"),u=function(t){console.error("parser does not support type: "+t)},s=function(t){return"[]"===t.slice(-2)},f=function(t,e){returns(t)||"string"===t?a.formatInputInt(e.length):""},c=i.inputTypes(),l=function(t,e){{varn="";2*o.ETH_PADDING}returnt.forEach(function(t,r){n+=f(t.type,e[r])}),t.forEach(function(r,i){for(varo=!1,a=0;a<c.length&&!o;a++)o=c[a].type(t[i].type,e[i]);o||u(t[i].type);varf=c[a-1].format,l="";l=s(t[i].type)?e[i].reduce(function(t,e){returnt+f(e)},""):f(e[i]),n+=l}),n},p=function(t){returns(t)||"string"===t?2*o.ETH_PADDING:0},m=i.outputTypes(),h=function(t,e){e=e.slice(2);varn=[],r=2*o.ETH_PADDING,f=t.reduce(function(t,e){returnt+p(e.type)},0),c=e.slice(0,f);returne=e.slice(f),t.forEach(function(o,f){for(varl=!1,p=0;p<m.length&&!l;p++)l=m[p].type(t[f].type);l||u(t[f].type);varh=m[p-1].format;if(s(t[f].type)){vard=a.formatOutputUInt(c.slice(0,r));c=c.slice(r);for(varg=[],v=0;d>v;v++)g.push(h(e.slice(0,r))),e=e.slice(r);n.push(g)}elsei.prefixedType("string")(t[f].type)?(c=c.slice(r),n.push(h(e.slice(0,r))),e=e.slice(r)):(n.push(h(e.slice(0,r))),e=e.slice(r))}),n},d=function(t){vare={};returnt.forEach(function(t){varn=r.extractDisplayName(t.name),i=r.extractTypeName(t.name),o=function(){vare=Array.prototype.slice.call(arguments);returnl(t.inputs,e)};void0===e[n]&&(e[n]=o),e[n][i]=o}),e},g=function(t){vare={};returnt.forEach(function(t){varn=r.extractDisplayName(t.name),i=r.extractTypeName(t.name),o=function(e){returnh(t.outputs,e)};void0===e[n]&&(e[n]=o),e[n][i]=o}),e},v=function(t){returnn.sha3(n.fromAscii(t)).slice(0,2+2*o.ETH_SIGNATURE_LENGTH)},y=function(t){returnn.sha3(n.fromAscii(t))};e.exports={inputParser:d,outputParser:g,formatInput:l,formatOutput:h,signatureFromAscii:v,eventSignatureFromAscii:y}},{"./const":2,"./formatters":6,"./types":11,"./utils":12,"./web3":13}],2:[function(t,e){varn=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:n,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:BigNumber.ROUND_DOWN}}},{}],3:[function(t,e){varn=t("./web3"),r=t("./abi"),i=t("./utils"),o=t("./event"),a=function(t){n._currentContractAbi=t.abi,n._currentContractAddress=t.address,n._currentContractMethodName=t.method,n._currentContractMethodParams=t.params},u=function(t){t.call=function(e){returnt._isTransact=!1,t._options=e,t},t.transact=function(e){returnt._isTransact=!0,t._options=e,t},t._options={},["gas","gasPrice","value","from"].forEach(function(e){t[e]=function(n){returnt._options[e]=n,t}})},s=function(t,e,o){varu=r.inputParser(e),s=r.outputParser(e);i.filterFunctions(e).forEach(function(f){varc=i.extractDisplayName(f.name),l=i.extractTypeName(f.name),p=function(){vari=Array.prototype.slice.call(arguments),p=r.signatureFromAscii(f.name),m=u[c][l].apply(null,i),h=t._options||{};h.to=o,h.data=p+m;vard=t._isTransact===!0||t._isTransact!==!1&&!f.constant,g=h.collapse!==!1;if(t._options={},t._isTransact=null,d)returna({abi:e,address:o,method:f.name,params:i}),voidn.eth.transact(h);varv=n.eth.call(h),y=s[c][l](v);returng&&(1===y.length?y=y[0]:0===y.length&&(y=null)),y};void0===t[c]&&(t[c]=p),t[c][l]=p})},f=function(t,e,n){t.address=n,t._onWatchEventResult=function(t){varn=event.getMatchingEvent(i.filterEvents(e)),r=o.outputParser(n);returnr(t)},Object.defineProperty(t,"topic",{get:function(){returni.filterEvents(e).map(function(t){returnr.eventSignatureFromAscii(t.name)})}})},c=function(t,e,a){i.filterEvents(e).forEach(function(e){varu=function(){vart=Array.prototype.slice.call(arguments),i=r.eventSignatureFromAscii(e.name),u=o.inputParser(a,i,e),s=u.apply(null,t);returns._onWatchEventResult=function(t){varn=o.outputParser(e);returnn(t)},n.eth.watch(s)};u._isEvent=!0;vars=i.extractDisplayName(e.name),f=i.extractTypeName(e.name);void0===t[s]&&(t[s]=u),t[s][f]=u})},l=function(t,e){e.forEach(function(t){if(-1===t.name.indexOf("(")){vare=t.name,n=t.inputs.map(function(t){returnt.type}).join();t.name=e+"("+n+")"}});varn={};returnu(n),s(n,e,t),f(n,e,t),c(n,e,t),n};e.exports=l},{"./abi":1,"./event":4,"./utils":12,"./web3":13}],4:[function(t,e){varn=t("./abi"),r=t("./utils"),i=function(t,e){returnt.filter(function(t){returnt.indexed===e})},o=function(t,e){varn=r.findIndex(t,function(t){returnt.name===e});return-1===n?voidconsole.error("indexed param with name "+e+" not found"):t[n]},a=function(t,e){returnObject.keys(e).map(function(r){vara=[o(i(t.inputs,!0),r)],u=e[r];returnuinstanceofArray?u.map(function(t){returnn.formatInput(a,[t])}):n.formatInput(a,[u])})},u=function(t,e,n){returnfunction(r,i){varo=i||{};returno.address=t,o.topic=[],o.topic.push(e),r&&(o.topic=o.topic.concat(a(n,r))),o}},s=function(t,e,n){e.slice(),n.slice();returnt.reduce(function(t,r){vari;returni=r.indexed?e.splice(0,1)[0]:n.splice(0,1)[0],t[r.name]=i,t},{})},f=function(t){returnfunction(e){varo={event:r.extractDisplayName(t.name),number:e.number,args:{}};if(!e.topic)returno;vara=i(t.inputs,!0),u="0x"+e.topic.slice(1,e.topic.length).map(function(t){returnt.slice(2)}).join(""),f=n.formatOutput(a,u),c=i(t.inputs,!1),l=n.formatOutput(c,e.data);returno.args=s(t.inputs,f,l),o}},c=function(t,e){for(varr=0;r<t.length;r++){vari=n.eventSignatureFromAscii(t[r].name);if(i===e.topic[0])returnt[r]}returnvoid0};e.exports={inputParser:u,outputParser:f,getMatchingEvent:c}},{"./abi":1,"./utils":12}],5:[function(t,e){varn=t("./web3"),r=function(t,e){"string"!=typeoft&&(t.topics&&console.warn('"topics" is deprecated, use "topic" instead'),this._onWatchResult=t._onWatchEventResult,t={to:t.to,topic:t.topic,earliest:t.earliest,latest:t.latest,max:t.max,skip:t.skip,address:t.address}),this.impl=e,this.callbacks=[],this.id=e.newFilter(t),n.provider.startPolling({method:e.changed,params:[this.id]},this.id,this.trigger.bind(this))};r.prototype.arrived=function(t){this.changed(t)},r.prototype.happened=function(t){this.changed(t)},r.prototype.changed=function(t){this.callbacks.push(t)},r.prototype.trigger=function(t){for(vare=0;e<this.callbacks.length;e++)for(varn=0;n<t.length;n++){varr=this._onWatchResult?this._onWatchResult(t[n]):t[n];this.callbacks[e].call(this,r)}},r.prototype.uninstall=function(){this.impl.uninstallFilter(this.id),n.provider.stopPolling(this.id)},r.prototype.messages=function(){returnthis.impl.getMessages(this.id)},r.prototype.logs=function(){returnthis.messages()},e.exports=r},{"./web3":13}],6:[function(t,e){varn=t("./utils"),r=t("./const"),i=function(t,e,n){returnnewArray(e-t.length+1).join(n?n:"0")+t},o=function(t){vare=2*r.ETH_PADDING;returntinstanceofBigNumber||"number"==typeoft?("number"==typeoft&&(t=newBigNumber(t)),BigNumber.config(r.ETH_BIGNUMBER_ROUNDING_MODE),t=t.round(),t.lessThan(0)&&(t=newBigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeoft?o(newBigNumber(t)):(+t).toString(16),i(t,e)},a=function(t){returnn.fromAscii(t,r.ETH_PADDING).substr(2)},u=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},s=function(t){returno(newBigNumber(t).times(newBigNumber(2).pow(128)))},f=function(t){return"1"===newBigNumber(t.substr(0,1),16).toString(2).substr(0,1)},c=function(t){returnt=t||"0",f(t)?newBigNumber(t,16).minus(newBigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):newBigNumber(t,16)},l=function(t){returnt=t||"0",newBigNumber(t,16)},p=function(t){returnc(t).dividedBy(newBigNumber(2).pow(128))},m=function(t){returnl(t).dividedBy(newBigNumber(2).pow(128))},h=function(t){return"0x"+t},d=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},g=function(t){returnn.toAscii(t)},v=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:o,formatInputString:a,formatInputBool:u,formatInputReal:s,formatOutputInt:c,formatOutputUInt:l,formatOutputReal:p,formatOutputUReal:m,formatOutputHash:h,formatOutputBool:d,formatOutputString:g,formatOutputAddress:v}},{"./const":2,"./utils":12}],7:[function(t,e){varn=function(t){this.handlers=[],this.host=t||"http://localhost:8080"};n.prototype.send=function(t){vare=newXMLHttpRequest;e.open("POST",this.host,!1),e.send(JSON.stringify(t));varn=e.responseText;returnJSON.parse(n)},e.exports=n},{}],8:[function(t,e){varn=1,r=function(t,e){returnt||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:n++}},i=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeoft.id&&void0!==t.result},o=function(t){returnt.map(function(t){returnr(t.method,t.params)})};e.exports={toPayload:r,isValidResponse:i,toBatchPayload:o}},{}],9:[function(t,e){varn=(t("./web3"),t("./jsonrpc")),r=function(){this.polls=[],this.provider=void0;vart=this,e=function(){t.polls.forEach(function(e){varn=t.send(e.data);ninstanceofArray&&0!==n.length&&e.callback(n)}),setTimeout(e,1e3)};e()};r.prototype.send=function(t){vare=n.toPayload(t.method,t.params);if(void0===this.provider)returnconsole.error("provider is not set"),null;varr=this.provider.send(e);returnn.isValidResponse(r)?r.result:(console.log(r),null)},r.prototype.set=function(t){this.provider=t},r.prototype.startPolling=function(t,e,n){this.polls.push({data:t,id:e,callback:n})},r.prototype.stopPolling=function(t){for(vare=this.polls.length;e--;){varn=this.polls[e];n.id===t&&this.polls.splice(e,1)}},e.exports=r},{"./jsonrpc":8,"./web3":13}],10:[function(t,e){varn=function(){};n.prototype.send=function(t){vare=navigator.qt.callMethod(JSON.stringify(t));returnJSON.parse(e)},e.exports=n},{}],11:[function(t,e){varn=t("./formatters"),r=function(t){returnfunction(e){return0===e.indexOf(t)}},i=function(t){returnfunction(e){returnt===e}},o=function(){return[{type:r("uint"),format:n.formatInputInt},{type:r("int"),format:n.formatInputInt},{type:r("hash"),format:n.formatInputInt},{type:r("string"),format:n.formatInputString},{type:r("real"),format:n.formatInputReal},{type:r("ureal"),format:n.formatInputReal},{type:i("address"),format:n.formatInputInt},{type:i("bool"),format:n.formatInputBool}]},a=function(){return[{type:r("uint"),format:n.formatOutputUInt},{type:r("int"),format:n.formatOutputInt},{type:r("hash"),format:n.formatOutputHash},{type:r("string"),format:n.formatOutputString},{type:r("real"),format:n.formatOutputReal},{type:r("ureal"),format:n.formatOutputUReal},{type:i("address"),format:n.formatOutputAddress},{type:i("bool"),format:n.formatOutputBool}]};e.exports={prefixedType:r,namedType:i,inputTypes:o,outputTypes:a}},{"./formatters":6}],12:[function(t,e){varn=t("./const"),r=function(t,e){for(varn=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);returnn?r-1:-1},i=function(t){vare="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){vari=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}returne},o=function(t){for(vare="",n=0;n<t.length;n++){varr=t.charCodeAt(n).toString(16);e+=r.length<2?"0"+r:r}returne},a=function(t,e){e=void0===e?0:e;for(varn=o(t);n.length<2*e;)n+="00";return"0x"+n},u=function(t){vare=t.indexOf("(");return-1!==e?t.substr(0,e):t},s=function(t){vare=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)).replace("",""):""},f=function(t){returnt.filter(function(t){return"function"===t.type})},c=function(t){returnt.filter(function(t){return"event"===t.type})},l=function(t){for(vare="string"==typeoft?0===t.indexOf("0x")?parseInt(t.substr(2),16):parseInt(t):t,r=0,i=n.ETH_UNITS;e>3e3&&r<i.length-1;)e/=1e3,r++;for(varo=e.toString().length<e.toFixed(2).length?e.toString():e.toFixed(2),a=function(t,e,n){returne+","+n};;){varu=o;if(o=o.replace(/(\d)(\d\d\d[\.\,])/,a),u===o)break}returno+""+i[r]};e.exports={findIndex:r,toAscii:i,fromAscii:a,extractDisplayName:u,extractTypeName:s,filterFunctions:f,filterEvents:c,toEth:l}},{"./const":2}],13:[function(t,e){varn=t("./utils"),r=function(){return[{name:"sha3",call:"web3_sha3"}]},i=function(){vart=function(t){return"string"==typeoft[0]?"eth_blockByHash":"eth_blockByNumber"},e=function(t){return"string"==typeoft[0]?"eth_transactionByHash":"eth_transactionByNumber"},n=function(t){return"string"==typeoft[0]?"eth_uncleByHash":"eth_uncleByNumber"},r=[{name:"balanceAt",call:"eth_balanceAt"},{name:"stateAt",call:"eth_stateAt"},{name:"storageAt",call:"eth_storageAt"},{name:"countAt",call:"eth_countAt"},{name:"codeAt",call:"eth_codeAt"},{name:"transact",call:"eth_transact"},{name:"call",call:"eth_call"},{name:"block",call:t},{name:"transaction",call:e},{name:"uncle",call:n},{name:"compilers",call:"eth_compilers"},{name:"flush",call:"eth_flush"},{name:"lll",call:"eth_lll"},{name:"solidity",call:"eth_solidity"},{name:"serpent",call:"eth_serpent"},{name:"logs",call:"eth_logs"}];returnr},o=function(){return[{name:"coinbase",getter:"eth_coinbase",setter:"eth_setCoinbase"},{name:"listening",getter:"eth_listening",setter:"eth_setListening"},{name:"mining",getter:"eth_mining",setter:"eth_setMining"},{name:"gasPrice",getter:"eth_gasPrice"},{name:"accounts",getter:"eth_accounts"},{name:"peerCount",getter:"eth_peerCount"},{name:"defaultBlock",getter:"eth_defaultBlock",setter:"eth_setDefaultBlock"},{name:"number",getter:"eth_number"}]},a=function(){return[{name:"put",call:"db_put"},{name:"get",call:"db_get"},{name:"putString",call:"db_putString"},{name:"getString",call:"db_getString"}]},u=function(){return[{name:"post",call:"shh_post"},{name:"newIdentity",call:"shh_newIdentity"},{name:"haveIdentity",call:"shh_haveIdentity"},{name:"newGroup",call:"shh_newGroup"},{name:"addToGroup",call:"shh_addToGroup"}]},s=function(){vart=function(t){return"string"==typeoft[0]?"eth_newFilterString":"eth_newFilter"};return[{name:"newFilter",call:t},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getMessages",call:"eth_filterLogs"}]},f=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getMessages",call:"shh_getMessages"}]},c=function(t,e){e.forEach(function(e){t[e.name]=function(){vart=Array.prototype.slice.call(arguments),n="function"==typeofe.call?e.call(t):e.call;returnp.provider.send({method:n,params:t})}})},l=function(t,e){e.forEach(function(e){varn={};n.get=function(){returnp.provider.send({method:e.getter})},e.setter&&(n.set=function(t){returnp.provider.send({method:e.setter,params:[t]})}),Object.defineProperty(t,e.name,n)})},p={_callbacks:{},_events:{},providers:{},toAscii:n.toAscii,fromAscii:n.fromAscii,toDecimal:function(t){returnt=t.length>2?t.substring(2):"0",newBigNumber(t,16).toString(10)},fromDecimal:function(t){return"0x"+newBigNumber(t).toString(16)},toEth:n.toEth,eth:{contractFromAbi:function(t){returnfunction(e){e=e||"0xc6d9d2cd449a754c494264e1809c50e34d64562b";varn=p.eth.contract(e,t);returnn.address=e,n}},watch:function(t,e,n){returnt._isEvent?t(e,n):newp.filter(t,m)}},db:{},shh:{watch:function(t){returnnewp.filter(t,h)}}};c(p,r()),c(p.eth,i()),l(p.eth,o()),c(p.db,a()),c(p.shh,u());varm={changed:"eth_changed"};c(m,s());varh={changed:"shh_changed"};c(h,f()),p.setProvider=function(t){p.provider.set(t)},e.exports=p},{"./utils":12}],web3:[function(t,e){varn=t("./lib/web3"),r=t("./lib/providermanager");n.provider=newr,n.filter=t("./lib/filter"),n.providers.HttpSyncProvider=t("./lib/httpsync"),n.providers.QtSyncProvider=t("./lib/qtsync"),n.eth.contract=t("./lib/contract"),n.abi=t("./lib/abi"),e.exports=n},{"./lib/abi":1,"./lib/contract":3,"./lib/filter":5,"./lib/httpsync":7,"./lib/providermanager":9,"./lib/qtsync":10,"./lib/web3":13}]},{},["web3"]);