bsc/dist/ethereum.min.js

1 line
11 KiB
JavaScript
Raw Normal View History

2014-11-13 19:29:31 +02:00
require=function e(t,n,r){function o(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return o(n?n:e)},l,l.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=function(e,t){for(var n=!1,r=0;r<e.length&&!n;r++)n=t(e[r]);return n?r-1:-1},r=function(e,t){return n(e,function(e){return e.name===t})},o=function(e,t){return new Array(2*t-e.toString().length+1).join("0")+e},i=function(){var e=function(e){return function(t,n){var r,i=e;return 0!==t.indexOf(i)?!1:(r=parseInt(t.slice(i.length))/8,o(n,r))}},t=function(e,t,n){return function(r,i){return r!==e?!1:o(n?i:n(i),t)}},n=function(e){return e?"1":"0"};return[e("uint"),e("int"),t("address",20),t("bool",1,n)]},s=i(),a=function(e,t,n){var o,i,a,c,u="",l=r(e,t);if(-1!==l){for(u=u+l+"x0",o=e[l],i=0;i<o.inputs.length;i++){for(a=!1,c=0;c<s.length&&!a;c++)a=s[c](o.inputs[i].type,n[i]);a||console.error("unsupported json type: "+o.inputs[i].type),u+=a}return u}},c=function(){var e=function(e){return function(t){var n,r=e;return 0!==t.indexOf(r)?-1:(n=parseInt(t.slice(r.length))/8,2*n)}},t=function(e,t){return function(n){return e===n?2*t:-1}},n=function(e){return parseInt(e,16)},r=function(e){return"1"===e?!0:!1};return[{padding:e("uint"),format:n},{padding:e("int"),format:n},{padding:t("address",20)},{padding:t("bool",1),format:r}]},u=(c(),function(e){var t={};return e.forEach(function(n){t[n.name]=function(){var t=Array.prototype.slice.call(arguments);return a(e,n.name,t)}}),t});t.exports=u},{}],2:[function(e,t){var n=function(e){var t,n,r,o;if(!web3.haveProvider()){if(this.sendQueue=[],this.onmessageQueue=[],navigator.qt)return void(this.provider=new web3.providers.QtProvider);e=e||{},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){return this.provider?void this.provider.send(e):void this.sendQueue.push(e)},Object.defineProperty(n.prototype,"onmessage",{set:function(e){return this.provider?void(this.provider.onmessage=e):void this.onmessageQueue.push(e)}}),t.exports=n},{}],3:[function(e,t){function n(e){return{jsonrpc:"2.0",method:e.call,params:e.args,id:e._id}}function r(e){var t=JSON.parse(e);return{_id:t.id,data:t.result,error:t.error}}var o=function(e){this.handlers=[],this.host=e};o.prototype.sendRequest=function(e,t){var r=n(e),o=new XMLHttpRequest;o.open("POST",this.host,!0),o.send(JSON.stringify(r)),o.onreadystatechange=function(){4===o.readyState&&t&&t(o)}},o.prototype.send=function(e){var t=this;this.sendRequest(e,function(e){t.handlers.forEach(function(n){n.call(t,r(e.responseText))})})},o.prototype.poll=function(e,t){var n=this;this.sendRequest(e,function(r){var o=JSON.parse(r.responseText);!o.error&&(o.result instanceof Array?0!==o.result.length:o.result)&&n.handlers.forEach(function(r){r.call(n,{_event:e.call,_id:t,data:o.result})})})},Object.defineProperty(o.prototype,"onmessage",{set:function(e){this.handlers.push(e)}}),t.exports=o},{}],4:[function(e,t){function n(e){return e instanceof Promise?Promise.resolve(e):e instanceof Array?new Promise(function(t){var r=e.map(function(e){return n(e)});return Promise.all(r).then(function(n){for(var r=0;r<e.length;r++)e[r]=n[r];t(e)})}):e instanceof Object?new Promise(function(t){var r=Object.keys(e),o=r.map(function(t){return n(e[t])});return Promise.all(o).then(function(n){for(var o=0;o<r.length;o++)e[r[o]]=n[o];t(e)})}):Promise.resolve(e)}function r(e){if(v