go-ethereum/dist/ethereum.min.js

1 line
13 KiB
JavaScript
Raw Normal View History

2015-01-06 19:29:38 +02:00
require=function t(e,n,r){function o(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};e[s][0].call(l.exports,function(t){var n=e[s][1][t];return o(n?n:t)},l,l.exports,t,e,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(t,e){var n,r,o,i,s,a,u,c,l,h,p,f,d;n=function(t){return parseInt(t,16).toString()},r=function(t){return parseInt(t).toString(16)},o=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},i=function(t,e){return o(t,function(t){return t.name===e})},s=function(t,e){return new Array(e-t.length+1).join("0")+t},a=function(){var t=function(t,e){return function(n,r){var o,i=t;return 0!==n.indexOf(i)?!1:(o=parseInt(n.slice(i.length))/8*e,r="number"==typeof r?r.toString(16):"string"==typeof r?web3.toHex(r):0===r.indexOf("0x")?r.substr(2):(+r).toString(16),s(r,2*o))}},e=function(t,e,n){return function(r,o){return r!==t?!1:s(n?n(o):o,2*e)}},n=function(t){return t?"0x1":"0x0"};return[t("uint",1),t("int",1),t("hash",1),t("string",8),e("address",20),e("bool",1,n)]},u=a(),c=function(t,e,n){var r,o,a,c,l="",h=i(t,e);if(-1!==h){for(l="0x"+s(h.toString(16),2),r=t[h],o=0;o<r.inputs.length;o++){for(a=!1,c=0;c<u.length&&!a;c++)a=u[c](r.inputs[o].type,n[o]);a||console.error("unsupported json type: "+r.inputs[o].type),l+=a}return l}},l=function(){var t=function(t,e){return function(n){var r,o=t;return 0!==n.indexOf(o)?-1:(r=parseInt(n.slice(o.length))/8*e,2*r)}},e=function(t,e){return function(n){return t===n?2*e:-1}},r=function(t){return t.length<=8?+parseInt(t,16):n(t)},o=function(t){return"0x"+t},i=function(t){return"1"===t?!0:!1},s=function(t){return web3.toAscii(t)};return[{padding:t("uint",1),format:r},{padding:t("int",1),format:r},{padding:t("hash",1),format:o},{padding:t("string",8),format:s},{padding:e("address",20)},{padding:e("bool",1),format:i}]},h=l(),p=function(t,e,n){var r,o,s,a,u,c,l,p=i(t,e);if(-1!==p){for(n=n.slice(2),r=[],o=t[p],s=0;s<o.outputs.length;s++){for(a=-1,u=0;u<h.length&&-1===a;u++)a=h[u].padding(o.outputs[s].type);-1!==a&&(c=n.slice(0,a),l=h[u-1].format,r.push(l?l(c):"0x"+c),n=n.slice(a))}return r}},f=function(t){var e={};return t.forEach(function(n){e[n.name]=function(){var e=Array.prototype.slice.call(arguments);return c(t,n.name,e)}}),e},d=function(t){var e={};return t.forEach(function(n){e[n.name]=function(e){return p(t,n.name,e)}}),e},e.exports={inputParser:f,outputParser:d}},{}],2:[function(t,e){var n=function(t){var e,n,r,o;if(!web3.haveProvider()){if(this.sendQueue=[],this.onmessageQueue=[],navigator.qt)return void(this.provider=new web3.providers.QtProvider);t=t||{},e={httprpc:t.httprpc||"http://localhost:8080",websockets:t.websockets||"ws://localhost:40404/eth"},n=this,r=function(t){o.close(),t?n.provider=new web3.providers.WebSocketProvider(e.websockets):(n.provider=new web3.providers.HttpRpcProvider(e.httprpc),n.poll=n.provider.poll.bind(n.provider)),n.sendQueue.forEach(function(t){n.provider(t)}),n.onmessageQueue.forEach(function(t){n.provider.onmessage=t})},o=new WebSocket(e.websockets),o.onopen=function(){r(!0)},o.onerror=function(){r(!1)}}};n.prototype.send=function(t){return this.provider?void this.provider.send(t):void this.sendQueue.push(t)},Object.defineProperty(n.prototype,"onmessage",{set:function(t){return this.provider?void(this.provider.onmessage=t):void this.onmessageQueue.push(t)}}),e.exports=n},{}],3:[function(t,e){var n,r;n=t("./abi"),r=function(t,e){var r=n.inputParser(e),o=n.outputParser(e),i={};return e.forEach(function(e){i[e.name]=function(){var n=Array.prototype.slice.call(arguments),i=r[e.name].apply(null,n),s=function(t){return o[e.name](t)};return{call:function(e){return e=e||{},e.to=t,e.data=i,web3.eth.call(e).then(s)},transact:function(e){return e=e||{},e.to=t,e.data=i,web3.eth.transact(e).then(s)}}}}),i},e.exports=r},{"./abi":1}],4:[function(t,e){function n(t){return{jsonrpc:"2.0",method:t.call,params:t