bsc/dist/ethereum.min.js

1 line
15 KiB
JavaScript
Raw Normal View History

2015-01-31 16:22:05 +02:00
require=function t(e,n,r){function i(a,u){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e){var n=t("./web3"),r=t("./utils"),i=t("./types"),o=t("./const"),a=t("./formatters"),u=function(t){return"[]"===t.slice(-2)},s=function(t,e){return u(t)||"string"===t?a.formatInputInt(e.length):""},f=i.inputTypes(),c=function(t,e){{var n="";2*o.ETH_PADDING}return t.inputs.forEach(function(t,r){n+=s(t.type,e[r])}),t.inputs.forEach(function(r,i){for(var o=!1,a=0;a<f.length&&!o;a++)o=f[a].type(t.inputs[i].type,e[i]);o||console.error("input parser does not support type: "+t.inputs[i].type);var s=f[a-1].format,c="";c=u(t.inputs[i].type)?e[i].reduce(function(t,e){return t+s(e)},""):s(e[i]),n+=c}),n},l=function(t){return u(t)||"string"===t?2*o.ETH_PADDING:0},p=i.outputTypes(),h=function(t,e){e=e.slice(2);var n=[],r=2*o.ETH_PADDING,s=t.outputs.reduce(function(t,e){return t+l(e.type)},0),f=e.slice(0,s);return e=e.slice(s),t.outputs.forEach(function(o,s){for(var c=!1,l=0;l<p.length&&!c;l++)c=p[l].type(t.outputs[s].type);c||console.error("output parser does not support type: "+t.outputs[s].type);var h=p[l-1].format;if(u(t.outputs[s].type)){var m=a.formatOutputUInt(f.slice(0,r));f=f.slice(r);for(var d=[],g=0;m>g;g++)d.push(h(e.slice(0,r))),e=e.slice(r);n.push(d)}else i.prefixedType("string")(t.outputs[s].type)?(f=f.slice(r),n.push(h(e.slice(0,r))),e=e.slice(r)):(n.push(h(e.slice(0,r))),e=e.slice(r))}),n},m=function(t){var e={};return t.forEach(function(t){var n=r.extractDisplayName(t.name),i=r.extractTypeName(t.name),o=function(){var e=Array.prototype.slice.call(arguments);return c(t,e)};void 0===e[n]&&(e[n]=o),e[n][i]=o}),e},d=function(t){var e={};return t.forEach(function(t){var n=r.extractDisplayName(t.name),i=r.extractTypeName(t.name),o=function(e){return h(t,e)};void 0===e[n]&&(e[n]=o),e[n][i]=o}),e},g=function(t){return n.sha3(n.fromAscii(t)).slice(0,2+2*o.ETH_SIGNATURE_LENGTH)};e.exports={inputParser:m,outputParser:d,signatureFromAscii:g}},{"./const":2,"./formatters":6,"./types":10,"./utils":11,"./web3":12}],2:[function(t,e){e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:BigNumber.ROUND_DOWN}}},{}],3:[function(t,e){var n=t("./web3"),r=t("./abi"),i=t("./utils"),o=t("./event"),a=function(t){n._currentContractAbi=t.abi,n._currentContractAddress=t.address,n._currentContractMethodName=t.method,n._currentContractMethodParams=t.params},u=function(t){t.call=function(e){return t._isTransact=!1,t._options=e,t},t.transact=function(e){return t._isTransact=!0,t._options=e,t},t._options={},["gas","gasPrice","value","from"].forEach(function(e){t[e]=function(n){return t._options[e]=n,t}})},s=function(t,e,o){var u=r.inputParser(e),s=r.outputParser(e);i.filterFunctions(e).forEach(function(f){var c=i.extractDisplayName(f.name),l=i.extractTypeName(f.name),p=function(){var i=Array.prototype.slice.call(arguments),p=r.signatureFromAscii(f.name),h=u[c][l].apply(null,i),m=t._options||{};m.to=o,m.data=p+h;var d=t._isTransact===!0||t._isTransact!==!1&&!f.constant,g=m.collapse!==!1;if(t._options={},t._isTransact=null,d)return a({abi:e,address:o,method:f.name,params:i}),void n.eth.transact(m);var v=n.eth.call(m),y=s[c][l](v);return g&&(1===y.length?y=y[0]:0===y.length&&(y=null)),y};void 0===t[c]&&(t[c]=p),t[c][l]=p})},f=function(t,e,n){t.address=n,Object.defineProperty(t,"topic",{get:function(){return i.filterEvents(e).map(function(t){return r.signatureFromAscii(t.name)})}})},c=function(t,e,a){i.filterEvents(e).forEach(function(e){var u=function(){var t=Array.prototype.slice.call(arguments),i=r.signatureFromAscii(e.name),u=o(a,i,e),s=u.apply(null,t);return n.eth.watch(s)};u._isEvent=!0;var s=i.extractDisplayName(e.name),f=i.extractTypeName(e.name);void 0===