plugeth/dist/ethereum.min.js

1 line
13 KiB
JavaScript
Raw Normal View History

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,v,g,m;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(t,e){var n=t.slice(e.length);return""===n?32:parseInt(n)/8},u=function(t,e){var n=t.slice(e.length);return""===n?32:parseInt(n)},c=function(t,e){var n,r,o,i=t.slice(e.length);if(""===i)return 32;for(n=i.split("x"),r=0,o=0;n>o;o++)r+=n[o]/8;return r},l=function(){var t=function(t,e){return function(n,r){var o,i=t;return 0!==n.indexOf(i)?!1:(o=e(n,i),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",a),t("int",a),t("hash",a),t("string",u),t("real",c),t("ureal",c),e("address",20),e("bool",1,n)]},h=l(),p=function(t,e,n){var r,o,a,u,c="",l=i(t,e);if(-1!==l){for(c="0x"+s(l.toString(16),2),r=t[l],o=0;o<r.inputs.length;o++){for(a=!1,u=0;u<h.length&&!a;u++)a=h[u](r.inputs[o].type,n[o]);a||console.error("unsupported json type: "+r.inputs[o].type),c+=a}return c}},f=function(){var t=function(t,e){return function(n){var r,o=t;return 0!==n.indexOf(o)?-1:(r=e(n,o),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",a),format:r},{padding:t("int",a),format:r},{padding:t("hash",a),format:o},{padding:t("string",u),format:s},{padding:t("real",c),format:r},{padding:t("ureal",c),format:r},{padding:e("address",20)},{padding:e("bool",1),format:i}]},d=f(),v=function(t,e,n){var r,o,s,a,u,c,l,h=i(t,e);if(-1!==h){for(n=n.slice(2),r=[],o=t[h],s=0;s<o.outputs.length;s++){for(a=-1,u=0;u<d.length&&-1===a;u++)a=d[u].padding(o.outputs[s].type);-1!==a&&(c=n.slice(0,a),l=d[u-1].format,r.push(l?l(c):"0x"+c),n=n.slice(a))}return r}},g=function(t){var e={};return t.forEach(function(n){e[n.name]=function(){var e=Array.prototype.slice.call(arguments);return p(t,n.name,e)}}),e},m=function(t){var e={};return t.forEach(function(n){e[n.name]=function(e){return v(t,n.name,e)}}),e},e.exports={inputParser:g,outputParser:m}},{}],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),