aboutsummaryrefslogtreecommitdiffstats
path: root/dist/ethereum.js.map
blob: 9886b70ce0297eb6514a3ca53ff7186bb34138e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "version": 3,
  "sources": [
    "node_modules/browserify/node_modules/browser-pack/_prelude.js",
    "lib/abi.js",
    "lib/autoprovider.js",
    "lib/contract.js",
    "lib/httprpc.js",
    "lib/qt.js",
    "lib/web3.js",
    "lib/websocket.js",
    "index.js"
  ],
  "names": [],
  "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5fA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA",
  "file": "generated.js",
  "sourceRoot": "",
  "sourcesContent": [
    "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})",
    "/*\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 abi.js\n * @authors:\n *   Marek Kotewicz <marek@ethdev.com>\n *   Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\n// TODO: is these line is supposed to be here? \nif (\"build\" !== 'build') {/*\n    var web3 = require('./web3'); // jshint ignore:line\n*/}\n\n// TODO: make these be actually accurate instead of falling back onto JS's doubles.\nvar hexToDec = function (hex) {\n    return parseInt(hex, 16).toString();\n};\n\nvar decToHex = function (dec) {\n    return parseInt(dec).toString(16);\n};\n\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\nvar findMethodIndex = function (json, methodName) {\n    return findIndex(json, function (method) {\n        return method.name === methodName;\n    });\n};\n\nvar padLeft = function (string, chars) {\n    return new Array(chars - string.length + 1).join(\"0\") + string;\n};\n\nvar calcBitPadding = function (type, expected) {\n    var value = type.slice(expected.length);\n    if (value === \"\") {\n        return 32;\n    }\n    return parseInt(value) / 8;\n};\n\nvar calcBytePadding = function (type, expected) {\n    var value = type.slice(expected.length);\n    if (value === \"\") {\n        return 32;\n    }\n    return parseInt(value);\n};\n\nvar calcRealPadding = function (type, expected) {\n    var value = type.slice(expected.length);\n    if (value === \"\") {\n        return 32;\n    }\n    var sizes = value.split('x');\n    for (var padding = 0, i = 0; i < sizes; i++) {\n        padding += (sizes[i] / 8);\n    }\n    return padding;\n};\n\nvar setupInputTypes = function () {\n    \n    var prefixedType = function (prefix, calcPadding) {\n        return function (type, value) {\n            var expected = prefix;\n            if (type.indexOf(expected) !== 0) {\n                return false;\n            }\n\n            var padding = calcPadding(type, expected);\n            if (typeof value === \"number\")\n                value = value.toString(16);\n            else if (typeof value === \"string\")\n                value = web3.toHex(value); \n            else if (value.indexOf('0x') === 0)\n                value = value.substr(2);\n            else\n                value = (+value).toString(16);\n            return padLeft(value, padding * 2);\n        };\n    };\n\n    var namedType = function (name, padding, formatter) {\n        return function (type, value) {\n            if (type !== name) {\n                return false;\n            }\n\n            return padLeft(formatter ? formatter(value) : value, padding * 2);\n        };\n    };\n\n    var formatBool = function (value) {\n        return value ? '0x1' : '0x0';\n    };\n\n    return [\n        prefixedType('uint', calcBitPadding),\n        prefixedType('int', calcBitPadding),\n        prefixedType('hash', calcBitPadding),\n        prefixedType('string', calcBytePadding),\n        prefixedType('real', calcRealPadding),\n        prefixedType('ureal', calcRealPadding),\n        namedType('address', 20),\n        namedType('bool', 1, formatBool),\n    ];\n};\n\nvar inputTypes = setupInputTypes();\n\nvar toAbiInput = function (json, methodName, params) {\n    var bytes = \"\";\n    var index = findMethodIndex(json, methodName);\n\n    if (index === -1) {\n        return;\n    }\n\n    bytes = \"0x\" + padLeft(index.toString(16), 2);\n    var method = json[index];\n\n    for (var i = 0; i < method.inputs.length; i++) {\n        var found = false;\n        for (var j = 0; j < inputTypes.length && !found; j++) {\n            found = inputTypes[j](method.inputs[i].type, params[i]);\n        }\n        if (!found) {\n            console.error('unsupported json type: ' + method.inputs[i].type);\n        }\n        bytes += found;\n    }\n    return bytes;\n};\n\nvar setupOutputTypes = function () {\n\n    var prefixedType = function (prefix, calcPadding) {\n        return function (type) {\n            var expected = prefix;\n            if (type.indexOf(expected) !== 0) {\n                return -1;\n            }\n\n            var padding = calcPadding(type, expected);\n            return padding * 2;\n        };\n    };\n\n    var namedType = function (name, padding) {\n        return function (type) {\n            return name === type ? padding * 2 : -1;\n        };\n    };\n\n    var formatInt = function (value) {\n        return value.length <= 8 ? +parseInt(value, 16) : hexToDec(value);\n    };\n\n    var formatHash = function (value) {\n        return \"0x\" + value;\n    };\n\n    var formatBool = function (value) {\n        return value === '1' ? true : false;\n    };\n\n    var formatString = function (value) {\n        return web3.toAscii(value);\n    };\n\n    return [\n    { padding: prefixedType('uint', calcBitPadding), format: formatInt },\n    { padding: prefixedType('int', calcBitPadding), format: formatInt },\n    { padding: prefixedType('hash', calcBitPadding), format: formatHash },\n    { padding: prefixedType('string', calcBytePadding), format: formatString },\n    { padding: prefixedType('real', calcRealPadding), format: formatInt },\n    { padding: prefixedType('ureal', calcRealPadding), format: formatInt },\n    { padding: namedType('address', 20) },\n    { padding: namedType('bool', 1), format: formatBool }\n    ];\n};\n\nvar outputTypes = setupOutputTypes();\n\nvar fromAbiOutput = function (json, methodName, output) {\n    var index = findMethodIndex(json, methodName);\n\n    if (index === -1) {\n        return;\n    }\n\n    output = output.slice(2);\n\n    var result = [];\n    var method = json[index];\n    for (var i = 0; i < method.outputs.length; i++) {\n        var padding = -1;\n        for (var j = 0; j < outputTypes.length && padding === -1; j++) {\n            padding = outputTypes[j].padding(method.outputs[i].type);\n        }\n\n        if (padding === -1) {\n            // not found output parsing\n            continue;\n        }\n        var res = output.slice(0, padding);\n        var formatter = outputTypes[j - 1].format;\n        result.push(formatter ? formatter(res) : (\"0x\" + res));\n        output = output.slice(padding);\n    }\n\n    return result;\n};\n\nvar inputParser = function (json) {\n    var parser = {};\n    json.forEach(function (method) {\n        parser[method.name] = function () {\n            var params = Array.prototype.slice.call(arguments);\n            return toAbiInput(json, method.name, params);\n        };\n    });\n\n    return parser;\n};\n\nvar outputParser = function (json) {\n    var parser = {};\n    json.forEach(function (method) {\n        parser[method.name] = function (output) {\n            return fromAbiOutput(json, method.name, output);\n        };\n    });\n\n    return parser;\n};\n\nmodule.exports = {\n    inputParser: inputParser,\n    outputParser: outputParser\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 autoprovider.js\n * @authors:\n *   Marek Kotewicz <marek@ethdev.com>\n *   Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\n/*\n * @brief if qt object is available, uses QtProvider,\n * if not tries to connect over websockets\n * if it fails, it uses HttpRpcProvider\n */\n\n// TODO: is these line is supposed to be here? \nif (\"build\" !== 'build') {/*\n    var WebSocket = require('ws'); // jshint ignore:line\n    var web3 = require('./web3'); // jshint ignore:line\n*/}\n\nvar AutoProvider = function (userOptions) {\n    if (web3.haveProvider()) {\n        return;\n    }\n\n    // before we determine what provider we are, we have to cache request\n    this.sendQueue = [];\n    this.onmessageQueue = [];\n\n    if (navigator.qt) {\n        this.provider = new web3.providers.QtProvider();\n        return;\n    }\n\n    userOptions = userOptions || {};\n    var options = {\n        httprpc: userOptions.httprpc || 'http://localhost:8080',\n        websockets: userOptions.websockets || 'ws://localhost:40404/eth'\n    };\n\n    var self = this;\n    var closeWithSuccess = function (success) {\n        ws.close();\n        if (success) {\n            self.provider = new web3.providers.WebSocketProvider(options.websockets);\n        } else {\n            self.provider = new web3.providers.HttpRpcProvider(options.httprpc);\n            self.poll = self.provider.poll.bind(self.provider);\n        }\n        self.sendQueue.forEach(function (payload) {\n            self.provider(payload);\n        });\n        self.onmessageQueue.forEach(function (handler) {\n            self.provider.onmessage = handler;\n        });\n    };\n\n    var ws = new WebSocket(options.websockets);\n\n    ws.onopen = function() {\n        closeWithSuccess(true);\n    };\n\n    ws.onerror = function() {\n        closeWithSuccess(false);\n    };\n};\n\nAutoProvider.prototype.send = function (payload) {\n    if (this.provider) {\n        this.provider.send(payload);\n        return;\n    }\n    this.sendQueue.push(payload);\n};\n\nObject.defineProperty(AutoProvider.prototype, 'onmessage', {\n    set: function (handler) {\n        if (this.provider) {\n            this.provider.onmessage = handler;\n            return;\n        }\n        this.onmessageQueue.push(handler);\n    }\n});\n\nmodule.exports = AutoProvider;\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 contract.js\n * @authors:\n *   Marek Kotewicz <marek@ethdev.com>\n * @date 2014\n */\n\n// TODO: is these line is supposed to be here? \nif (\"build\" !== 'build') {/*\n    var web3 = require('./web3'); // jshint ignore:line\n*/}\n\nvar abi = require('./abi');\n\nvar contract = function (address, desc) {\n    var inputParser = abi.inputParser(desc);\n    var outputParser = abi.outputParser(desc);\n\n    var contract = {};\n\n    desc.forEach(function (method) {\n        contract[method.name] = function () {\n            var params = Array.prototype.slice.call(arguments);\n            var parsed = inputParser[method.name].apply(null, params);\n\n            var onSuccess = function (result) {\n                return outputParser[method.name](result);\n            };\n\n            return {\n                call: function (extra) {\n                    extra = extra || {};\n                    extra.to = address;\n                    extra.data = parsed;\n                    return web3.eth.call(extra).then(onSuccess);\n                },\n                transact: function (extra) {\n                    extra = extra || {};\n                    extra.to = address;\n                    extra.data = parsed;\n                    return web3.eth.transact(extra).then(onSuccess);\n                }\n            };\n        };\n    });\n\n    return contract;\n};\n\nmodule.exports = contract;\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 httprpc.js\n * @authors:\n *   Marek Kotewicz <marek@ethdev.com>\n *   Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\n// TODO: is these line is supposed to be here? \nif (\"build\" !== 'build') {/*\n    var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line\n*/}\n\nvar HttpRpcProvider = function (host) {\n    this.handlers = [];\n    this.host = host;\n};\n\nfunction formatJsonRpcObject(object) {\n    return {\n        jsonrpc: '2.0',\n        method: object.call,\n        params: object.args,\n        id: object._id\n    };\n}\n\nfunction formatJsonRpcMessage(message) {\n    var object = JSON.parse(message);\n\n    return {\n        _id: object.id,\n        data: object.result,\n        error: object.error\n    };\n}\n\nHttpRpcProvider.prototype.sendRequest = function (payload, cb) {\n    var data = formatJsonRpcObject(payload);\n\n    var request = new XMLHttpRequest();\n    request.open(\"POST\", this.host, true);\n    request.send(JSON.stringify(data));\n    request.onreadystatechange = function () {\n        if (request.readyState === 4 && cb) {\n            cb(request);\n        }\n    };\n};\n\nHttpRpcProvider.prototype.send = function (payload) {\n    var self = this;\n    this.sendRequest(payload, function (request) {\n        self.handlers.forEach(function (handler) {\n            handler.call(self, formatJsonRpcMessage(request.responseText));\n        });\n    });\n};\n\nHttpRpcProvider.prototype.poll = function (payload, id) {\n    var self = this;\n    this.sendRequest(payload, function (request) {\n        var parsed = JSON.parse(request.responseText);\n        if (parsed.error || (parsed.result instanceof Array ? parsed.result.length === 0 : !parsed.result)) {\n            return;\n        }\n        self.handlers.forEach(function (handler) {\n            handler.call(self, {_event: payload.call, _id: id, data: parsed.result});\n        });\n    });\n};\n\nObject.defineProperty(HttpRpcProvider.prototype, \"onmessage\", {\n    set: function (handler) {\n        this.handlers.push(handler);\n    }\n});\n\nmodule.exports = HttpRpcProvider;\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 qt.js\n * @authors:\n *   Jeffrey Wilcke <jeff@ethdev.com>\n *   Marek Kotewicz <marek@ethdev.com>\n * @date 2014\n */\n\nvar QtProvider = function() {\n    this.handlers = [];\n\n    var self = this;\n    navigator.qt.onmessage = function (message) {\n        self.handlers.forEach(function (handler) {\n            handler.call(self, JSON.parse(message.data));\n        });\n    };\n};\n\nQtProvider.prototype.send = function(payload) {\n    navigator.qt.postMessage(JSON.stringify(payload));\n};\n\nObject.defineProperty(QtProvider.prototype, \"onmessage\", {\n    set: function(handler) {\n        this.handlers.push(handler);\n    }\n});\n\nmodule.exports = QtProvider;\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 main.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\nfunction flattenPromise (obj) {\n    if (obj instanceof Promise) {\n        return Promise.resolve(obj);\n    }\n\n    if (obj instanceof Array) {\n        return new Promise(function (resolve) {\n            var promises = obj.map(function (o) {\n                return flattenPromise(o);\n            });\n\n            return Promise.all(promises).then(function (res) {\n                for (var i = 0; i < obj.length; i++) {\n                    obj[i] = res[i];\n                }\n                resolve(obj);\n            });\n        });\n    }\n\n    if (obj instanceof Object) {\n        return new Promise(function (resolve) {\n            var keys = Object.keys(obj);\n            var promises = keys.map(function (key) {\n                return flattenPromise(obj[key]);\n            });\n\n            return Promise.all(promises).then(function (res) {\n                for (var i = 0; i < keys.length; i++) {\n                    obj[keys[i]] = res[i];\n                }\n                resolve(obj);\n            });\n        });\n    }\n\n    return Promise.resolve(obj);\n}\n\nvar web3Methods = function () {\n    return [\n    { name: 'sha3', call: 'web3_sha3' }\n    ];\n};\n\nvar ethMethods = function () {\n    var blockCall = function (args) {\n        return typeof args[0] === \"string\" ? \"eth_blockByHash\" : \"eth_blockByNumber\";\n    };\n\n    var transactionCall = function (args) {\n        return typeof args[0] === \"string\" ? 'eth_transactionByHash' : 'eth_transactionByNumber';\n    };\n\n    var uncleCall = function (args) {\n        return typeof args[0] === \"string\" ? 'eth_uncleByHash' : 'eth_uncleByNumber';\n    };\n\n    var methods = [\n    { name: 'balanceAt', call: 'eth_balanceAt' },\n    { name: 'stateAt', call: 'eth_stateAt' },\n    { name: 'storageAt', call: 'eth_storageAt' },\n    { name: 'countAt', call: 'eth_countAt'},\n    { name: 'codeAt', call: 'eth_codeAt' },\n    { name: 'transact', call: 'eth_transact' },\n    { name: 'call', call: 'eth_call' },\n    { name: 'block', call: blockCall },\n    { name: 'transaction', call: transactionCall },\n    { name: 'uncle', call: uncleCall },\n    { name: 'compilers', call: 'eth_compilers' },\n    { name: 'lll', call: 'eth_lll' },\n    { name: 'solidity', call: 'eth_solidity' },\n    { name: 'serpent', call: 'eth_serpent' },\n    { name: 'logs', call: 'eth_logs' }\n    ];\n    return methods;\n};\n\nvar ethProperties = function () {\n    return [\n    { name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' },\n    { name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' },\n    { name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' },\n    { name: 'gasPrice', getter: 'eth_gasPrice' },\n    { name: 'account', getter: 'eth_account' },\n    { name: 'accounts', getter: 'eth_accounts' },\n    { name: 'peerCount', getter: 'eth_peerCount' },\n    { name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' },\n    { name: 'number', getter: 'eth_number'}\n    ];\n};\n\nvar dbMethods = function () {\n    return [\n    { name: 'put', call: 'db_put' },\n    { name: 'get', call: 'db_get' },\n    { name: 'putString', call: 'db_putString' },\n    { name: 'getString', call: 'db_getString' }\n    ];\n};\n\nvar shhMethods = function () {\n    return [\n    { name: 'post', call: 'shh_post' },\n    { name: 'newIdentity', call: 'shh_newIdentity' },\n    { name: 'haveIdentity', call: 'shh_haveIdentity' },\n    { name: 'newGroup', call: 'shh_newGroup' },\n    { name: 'addToGroup', call: 'shh_addToGroup' }\n    ];\n};\n\nvar ethWatchMethods = function () {\n    var newFilter = function (args) {\n        return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';\n    };\n\n    return [\n    { name: 'newFilter', call: newFilter },\n    { name: 'uninstallFilter', call: 'eth_uninstallFilter' },\n    { name: 'getMessages', call: 'eth_filterLogs' }\n    ];\n};\n\nvar shhWatchMethods = function () {\n    return [\n    { name: 'newFilter', call: 'shh_newFilter' },\n    { name: 'uninstallFilter', call: 'shh_uninstallFilter' },\n    { name: 'getMessage', call: 'shh_getMessages' }\n    ];\n};\n\nvar setupMethods = function (obj, methods) {\n    methods.forEach(function (method) {\n        obj[method.name] = function () {\n            return flattenPromise(Array.prototype.slice.call(arguments)).then(function (args) {\n                var call = typeof method.call === \"function\" ? method.call(args) : method.call;\n                return {call: call, args: args};\n            }).then(function (request) {\n                return new Promise(function (resolve, reject) {\n                    web3.provider.send(request, function (err, result) {\n                        if (!err) {\n                            resolve(result);\n                            return;\n                        }\n                        reject(err);\n                    });\n                });\n            }).catch(function(err) {\n                console.error(err);\n            });\n        };\n    });\n};\n\nvar setupProperties = function (obj, properties) {\n    properties.forEach(function (property) {\n        var proto = {};\n        proto.get = function () {\n            return new Promise(function(resolve, reject) {\n                web3.provider.send({call: property.getter}, function(err, result) {\n                    if (!err) {\n                        resolve(result);\n                        return;\n                    }\n                    reject(err);\n                });\n            });\n        };\n        if (property.setter) {\n            proto.set = function (val) {\n                return flattenPromise([val]).then(function (args) {\n                    return new Promise(function (resolve) {\n                        web3.provider.send({call: property.setter, args: args}, function (err, result) {\n                            if (!err) {\n                                resolve(result);\n                                return;\n                            }\n                            reject(err);\n                        });\n                    });\n                }).catch(function (err) {\n                    console.error(err);\n                });\n            };\n        }\n        Object.defineProperty(obj, property.name, proto);\n    });\n};\n\n// TODO: import from a dependency, don't duplicate.\nvar hexToDec = function (hex) {\n    return parseInt(hex, 16).toString();\n};\n\nvar decToHex = function (dec) {\n    return parseInt(dec).toString(16);\n};\n\n\nvar web3 = {\n    _callbacks: {},\n    _events: {},\n    providers: {},\n\n    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    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        for(; i < l; i+=2) {\n            var code = hex.charCodeAt(i);\n            if(code === 0) {\n                break;\n            }\n\n            str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));\n        }\n\n        return str;\n    },\n\n    fromAscii: function(str, pad) {\n        pad = pad === undefined ? 32 : pad;\n        var hex = this.toHex(str);\n        while(hex.length < pad*2)\n            hex += \"00\";\n        return \"0x\" + hex;\n    },\n\n    toDecimal: function (val) {\n        return hexToDec(val.substring(2));\n    },\n\n    fromDecimal: function (val) {\n        return \"0x\" + decToHex(val);\n    },\n\n    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 = [ 'wei', 'Kwei', 'Mwei', 'Gwei', 'szabo', 'finney', 'ether', 'grand', 'Mether', 'Gether', 'Tether', 'Pether', 'Eether', 'Zether', 'Yether', 'Nether', 'Dether', 'Vether', 'Uether' ];\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\n    eth: {\n        prototype: Object(), // jshint ignore:line\n        watch: function (params) {\n            return new Filter(params, ethWatch);\n        }\n    },\n\n    db: {\n        prototype: Object() // jshint ignore:line\n    },\n\n    shh: {\n        prototype: Object(), // jshint ignore:line\n        watch: function (params) {\n            return new Filter(params, shhWatch);\n        }\n    },\n\n    on: function(event, id, cb) {\n        if(web3._events[event] === undefined) {\n            web3._events[event] = {};\n        }\n\n        web3._events[event][id] = cb;\n        return this;\n    },\n\n    off: function(event, id) {\n        if(web3._events[event] !== undefined) {\n            delete web3._events[event][id];\n        }\n\n        return this;\n    },\n\n    trigger: function(event, id, data) {\n        var callbacks = web3._events[event];\n        if (!callbacks || !callbacks[id]) {\n            return;\n        }\n        var cb = callbacks[id];\n        cb(data);\n    }\n};\n\nsetupMethods(web3, web3Methods());\nsetupMethods(web3.eth, ethMethods());\nsetupProperties(web3.eth, ethProperties());\nsetupMethods(web3.db, dbMethods());\nsetupMethods(web3.shh, shhMethods());\n\nvar ethWatch = {\n    changed: 'eth_changed'\n};\nsetupMethods(ethWatch, ethWatchMethods());\nvar shhWatch = {\n    changed: 'shh_changed'\n};\nsetupMethods(shhWatch, shhWatchMethods());\n\nvar ProviderManager = function() {\n    this.queued = [];\n    this.polls = [];\n    this.ready = false;\n    this.provider = undefined;\n    this.id = 1;\n\n    var self = this;\n    var poll = function () {\n        if (self.provider && self.provider.poll) {\n            self.polls.forEach(function (data) {\n                data.data._id = self.id;\n                self.id++;\n                self.provider.poll(data.data, data.id);\n            });\n        }\n        setTimeout(poll, 12000);\n    };\n    poll();\n};\n\nProviderManager.prototype.send = function(data, cb) {\n    data._id = this.id;\n    if (cb) {\n        web3._callbacks[data._id] = cb;\n    }\n\n    data.args = data.args || [];\n    this.id++;\n\n    if(this.provider !== undefined) {\n        this.provider.send(data);\n    } else {\n        console.warn(\"provider is not set\");\n        this.queued.push(data);\n    }\n};\n\nProviderManager.prototype.set = function(provider) {\n    if(this.provider !== undefined && this.provider.unload !== undefined) {\n        this.provider.unload();\n    }\n\n    this.provider = provider;\n    this.ready = true;\n};\n\nProviderManager.prototype.sendQueued = function() {\n    for(var i = 0; this.queued.length; i++) {\n        // Resend\n        this.send(this.queued[i]);\n    }\n};\n\nProviderManager.prototype.installed = function() {\n    return this.provider !== undefined;\n};\n\nProviderManager.prototype.startPolling = function (data, pollId) {\n    if (!this.provider || !this.provider.poll) {\n        return;\n    }\n    this.polls.push({data: data, id: pollId});\n};\n\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\nweb3.provider = new ProviderManager();\n\nweb3.setProvider = function(provider) {\n    provider.onmessage = messageHandler;\n    web3.provider.set(provider);\n    web3.provider.sendQueued();\n};\n\nweb3.haveProvider = function() {\n    return !!web3.provider.provider;\n};\n\nvar Filter = function(options, impl) {\n    this.impl = impl;\n    this.callbacks = [];\n\n    var self = this;\n    this.promise = impl.newFilter(options);\n    this.promise.then(function (id) {\n        self.id = id;\n        web3.on(impl.changed, id, self.trigger.bind(self));\n        web3.provider.startPolling({call: impl.changed, args: [id]}, id);\n    });\n};\n\nFilter.prototype.arrived = function(callback) {\n    this.changed(callback);\n};\n\nFilter.prototype.changed = function(callback) {\n    var self = this;\n    this.promise.then(function(id) {\n        self.callbacks.push(callback);\n    });\n};\n\nFilter.prototype.trigger = function(messages) {\n    for(var i = 0; i < this.callbacks.length; i++) {\n        this.callbacks[i].call(this, messages);\n    }\n};\n\nFilter.prototype.uninstall = function() {\n    var self = this;\n    this.promise.then(function (id) {\n        self.impl.uninstallFilter(id);\n        web3.provider.stopPolling(id);\n        web3.off(impl.changed, id);\n    });\n};\n\nFilter.prototype.messages = function() {\n    var self = this;\n    return this.promise.then(function (id) {\n        return self.impl.getMessages(id);\n    });\n};\n\nFilter.prototype.logs = function () {\n    return this.messages();\n};\n\nfunction messageHandler(data) {\n    if(data._event !== undefined) {\n        web3.trigger(data._event, data._id, data.data);\n        return;\n    }\n\n    if(data._id) {\n        var cb = web3._callbacks[data._id];\n        if (cb) {\n            cb.call(this, data.error, data.data);\n            delete web3._callbacks[data._id];\n        }\n    }\n}\n\nmodule.exports = web3;\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 websocket.js\n * @authors:\n *   Jeffrey Wilcke <jeff@ethdev.com>\n *   Marek Kotewicz <marek@ethdev.com>\n *   Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\n// TODO: is these line is supposed to be here? \nif (\"build\" !== 'build') {/*\n    var WebSocket = require('ws'); // jshint ignore:line\n*/}\n\nvar WebSocketProvider = function(host) {\n    // onmessage handlers\n    this.handlers = [];\n    // queue will be filled with messages if send is invoked before the ws is ready\n    this.queued = [];\n    this.ready = false;\n\n    this.ws = new WebSocket(host);\n\n    var self = this;\n    this.ws.onmessage = function(event) {\n        for(var i = 0; i < self.handlers.length; i++) {\n            self.handlers[i].call(self, JSON.parse(event.data), event);\n        }\n    };\n\n    this.ws.onopen = function() {\n        self.ready = true;\n\n        for(var i = 0; i < self.queued.length; i++) {\n            // Resend\n            self.send(self.queued[i]);\n        }\n    };\n};\n\nWebSocketProvider.prototype.send = function(payload) {\n    if(this.ready) {\n        var data = JSON.stringify(payload);\n\n        this.ws.send(data);\n    } else {\n        this.queued.push(payload);\n    }\n};\n\nWebSocketProvider.prototype.onMessage = function(handler) {\n    this.handlers.push(handler);\n};\n\nWebSocketProvider.prototype.unload = function() {\n    this.ws.close();\n};\nObject.defineProperty(WebSocketProvider.prototype, \"onmessage\", {\n    set: function(provider) { this.onMessage(provider); }\n});\n\nmodule.exports = WebSocketProvider;\n",
    "var web3 = require('./lib/web3');\nweb3.providers.WebSocketProvider = require('./lib/websocket');\nweb3.providers.HttpRpcProvider = require('./lib/httprpc');\nweb3.providers.QtProvider = require('./lib/qt');\nweb3.providers.AutoProvider = require('./lib/autoprovider');\nweb3.contract = require('./lib/contract');\n\nmodule.exports = web3;\n"
  ]
}