bsc/dist/ethereum.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

2015-01-16 11:47:43 +02:00
require=function t(e,n,r){function o(s,a){if(!n[s]){if(!e[s]){var f="function"==typeof require&&require;if(!a&&f)return f(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return o(n?n:t)},c,c.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=t("bignumber.js"),r=function(t){return parseInt(t,16).toString()},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,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){return function(e){return 0===e.indexOf(t)}},f=function(t){return function(e){return t===e}},u=function(){var t=function(t){var e=64;return t=t instanceof n?t.lessThan(0)?new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1).toString(16):t.toString(16):"number"==typeof t?0>t?new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1).toString(16):new n(t).toString(16):0===t.indexOf("0x")?t.substr(2):"string"==typeof t?new n(t).toString(16):(+t).toString(16),s(t,e)},e=function(t){return web3.fromAscii(t,32).substr(2)},r=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")};return[{type:a("uint"),format:t},{type:a("int"),format:t},{type:a("hash"),format:t},{type:a("string"),format:e},{type:a("real"),format:t},{type:a("ureal"),format:t},{type:f("address"),format:t},{type:f("bool"),format:r}]},c=u(),l=function(t,e,n){var r="",o=i(t,e);if(-1!==o){for(var s=t[o],a=0;a<s.inputs.length;a++){for(var f=!1,u=0;u<c.length&&!f;u++)f=c[u].type(s.inputs[a].type,n[a]);f||console.error("input parser does not support type: "+s.inputs[a].type);var l=c[u-1].format;r+=l?l(n[a]):n[a]}return r}},h=function(){var t=function(t){return t.length<=8?+parseInt(t,16):r(t)},e=function(t){return"0x"+t},n=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},o=function(t){return web3.toAscii(t)},i=function(t){return"0x"+t.slice(t.length-40,t.length)};return[{type:a("uint"),format:t},{type:a("int"),format:t},{type:a("hash"),format:e},{type:a("string"),format:o},{type:a("real"),format:t},{type:a("ureal"),format:t},{type:f("address"),format:i},{type:f("bool"),format:n}]},p=h(),d=function(t,e,n){var r=i(t,e);if(-1!==r){n=n.slice(2);for(var o=[],s=t[r],a=64,f=0;f<s.outputs.length;f++){for(var u=!1,c=0;c<p.length&&!u;c++)u=p[c].type(s.outputs[f].type);if(u){var l=n.slice(0,a),h=p[c-1].format;o.push(h?h(l):"0x"+l),n=n.slice(a)}else console.error("output parser does not support type: "+s.outputs[f].type)}return o}},v=function(t){var e={};return t.forEach(function(n){e[n.name]=function(){var e=Array.prototype.slice.call(arguments);return l(t,n.name,e)}}),e},g=function(t){var e={};return t.forEach(function(n){e[n.name]=function(e){return d(t,n.name,e)}}),e},m=function(t,e){var n=t[i(t,e)],r=e+"(",o=n.inputs.map(function(t){return t.type});return r+=o.join(","),r+=")",web3.sha3(web3.fromAscii(r))};e.exports={inputParser:v,outputParser:g,methodSignature:m}},{"bignumber.js":void 0}],2:[function(t,e){var n=function(t){if(!web3.haveProvider()){if(this.sendQueue=[],this.onmessageQueue=[],navigator.qt)return void(this.provider=new web3.providers.QtProvider);t=t||{};var 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