plugeth/dist/ethereum.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

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