go-ethereum/dist/ethereum.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

require=function e(t,n,r){function o(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t){var n=e("./web3");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var r=function(e,t){for(var n=!1,r=0;r<e.length&&!n;r++)n=t(e[r]);return n?r-1:-1},o=function(e,t){return r(e,function(e){return e.name===t})},i=function(e,t,n){return new Array(t-e.length+1).join(n?n:"0")+e},s=function(e){return function(t){return 0===t.indexOf(e)}},a=function(e){return function(t){return e===t}},u=function(){var e=function(t){var n=64;return t instanceof BigNumber||"number"==typeof t?("number"==typeof t&&(t=new BigNumber(t)),t=t.round(),t.lessThan(0)&&(t=new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?e(new BigNumber(t)):(+t).toString(16),i(t,n)},t=function(e){return n.fromAscii(e,32).substr(2)},r=function(e){return"000000000000000000000000000000000000000000000000000000000000000"+(e?"1":"0")};return[{type:s("uint"),format:e},{type:s("int"),format:e},{type:s("hash"),format:e},{type:s("string"),format:t},{type:s("real"),format:e},{type:s("ureal"),format:e},{type:a("address"),format:e},{type:a("bool"),format:r}]},f=u(),c=function(e,t,n){var r="",i=o(e,t);if(-1!==i){for(var s=e[i],a=0;a<s.inputs.length;a++){for(var u=!1,c=0;c<f.length&&!u;c++)u=f[c].type(s.inputs[a].type,n[a]);u||console.error("input parser does not support type: "+s.inputs[a].type);var l=f[c-1].format;r+=l?l(n[a]):n[a]}return r}},l=function(){var e=function(e){return"f"===e.substr(0,1).toLowerCase()?new BigNumber(e,16).minus(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new BigNumber(e,16)},t=function(e){return new BigNumber(e,16)},r=function(e){return"0x"+e},o=function(e){return"0000000000000000000000000000000000000000000000000000000000000001"===e?!0:!1},i=function(e){return n.toAscii(e)},u=function(e){return"0x"+e.slice(e.length-40,e.length)};return[{type:s("uint"),format:t},{type:s("int"),format:e},{type:s("hash"),format:r},{type:s("string"),format:i},{type:s("real"),format:e},{type:s("ureal"),format:e},{type:a("address"),format:u},{type:a("bool"),format:o}]},h=l(),p=function(e,t,n){var r=o(e,t);if(-1!==r){n=n.slice(2);for(var i=[],s=e[r],a=64,u=0;u<s.outputs.length;u++){for(var f=!1,c=0;c<h.length&&!f;c++)f=h[c].type(s.outputs[u].type);if(f){var l=n.slice(0,a),p=h[c-1].format;i.push(p?p(l):"0x"+l),n=n.slice(a)}else console.error("output parser does not support type: "+s.outputs[u].type)}return i}},d=function(e){var t={};return e.forEach(function(n){t[n.name]=function(){var t=Array.prototype.slice.call(arguments);return c(e,n.name,t)}}),t},v=function(e){var t={};return e.forEach(function(n){t[n.name]=function(t){return p(e,n.name,t)}}),t},g=function(e,t){var r=e[o(e,t)],i=t+"(",s=r.inputs.map(function(e){return e.type});return i+=s.join(","),i+=")",n.sha3(n.fromAscii(i))};t.exports={inputParser:d,outputParser:v,methodSignature:g}},{"./web3":8}],2:[function(e,t){var n=function(e){if(!web3.haveProvider()){if(this.sendQueue=[],this.onmessageQueue=[],navigator.qt)return void(this.provider=new web3.providers.QtProvider);e=e||{};var t={httprpc:e.httprpc||"http://localhost:8080",websockets:e.websockets||"ws://localhost:40404/eth"},n=this,r=function(e){o.close(),e?n.provider=new web3.providers.WebSocketProvider(t.websockets):(n.provider=new web3.providers.HttpRpcProvider(t.httprpc),n.poll=n.provider.poll.bind(n.provider)),n.sendQueue.forEach(function(e){n.provider(e)}),n.onmessageQueue.forEach(function(e){n.provider.onmessage=e})},o=new WebSocket(t.websockets);o.onopen=function(){r(!0)},o.onerror=function(){r(!1)}}};n.prototype.send=function(e){r