2015-01-06 12:26:51 +00: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=function(t){return parseInt(t,16).toString()},r=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},o=function(t,e){return r(t,function(t){return t.name===e})},i=function(t,e){return new Array(e-t.length+1).join("0")+t},s=function(){var t=function(t){return function(e,n){var r,o=t;return 0!==e.indexOf(o)?!1:(r=parseInt(e.slice(o.length))/8,n="number"==typeof n?n.toString(16):0===n.indexOf("0x")?n.substr(2):(+n).toString(16),i(n,2*r))}},e=function(t,e,n){return function(r,o){return r!==t?!1:i(n?n(o):o,2*e)}},n=function(t){return t?"0x1":"0x0"};return[t("uint"),t("int"),t("hash"),e("address",20),e("bool",1,n)]},a=s(),u=function(t,e,n){var r,s,u,c,l="",h=o(t,e);if(-1!==h){for(l="0x"+i(h.toString(16),2),r=t[h],s=0;s<r.inputs.length;s++){for(u=!1,c=0;c<a.length&&!u;c++)u=a[c](r.inputs[s].type,n[s]);u||console.error("unsupported json type: "+r.inputs[s].type),l+=u}return l}},c=function(){var t=function(t){return function(e){var n,r=t;return 0!==e.indexOf(r)?-1:(n=parseInt(e.slice(r.length))/8,2*n)}},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};return[{padding:t("uint"),format:r},{padding:t("int"),format:r},{padding:t("hash"),format:o},{padding:e("address",20)},{padding:e("bool",1),format:i}]},l=c(),h=function(t,e,n){var r,i,s,a,u,c,h,p=o(t,e);if(-1!==p){for(n=n.slice(2),r=[],i=t[p],s=0;s<i.outputs.length;s++){for(a=-1,u=0;u<l.length&&-1===a;u++)a=l[u].padding(i.outputs[s].type);-1!==a&&(c=n.slice(0,a),h=l[u-1].format,r.push(h?h(c):"0x"+c),n=n.slice(a))}return r}},p=function(t){var e={};return t.forEach(function(n){e[n.name]=function(){var e=Array.prototype.slice.call(arguments);return u(t,n.name,e)}}),e},d=function(t){var e={};return t.forEach(function(n){e[n.name]=function(e){return h(t,n.name,e)}}),e};e.exports={inputParser:p,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.args,id:t._id}}function r(t){var e=JSON.parse(t);return{_id:e.id,data:e.result,error:e.error}}var o=function(t){this.handlers=[],this.host=t};o.prototype.sendRequest=function(t,e){var r=n(t),o=new XMLHttpReques
|