web3.js/dist/ethereum.min.js

1 line
19 KiB
JavaScript
Raw Normal View History

require=function t(e,n,r){function a(i,s){if(!n[i]){if(!e[i]){var u="function"==typeof require&&require;if(!s&&u)return u(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[i]={exports:{}};e[i][0].call(f.exports,function(t){var n=e[i][1][t];return a(n?n:t)},f,f.exports,t,e,n,r)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;i<r.length;i++)a(r[i]);return a}({1:[function(t,e){var n=t("./web3"),r=t("./utils"),a=t("./types"),o=t("./const"),i=t("./formatters"),s=function(t){console.error("parser does not support type: "+t)},u=function(t){return"[]"===t.slice(-2)},c=function(t,e){return u(t)||"string"===t?i.formatInputInt(e.length):""},f=a.inputTypes(),l=function(t,e){{var n="";2*o.ETH_PADDING}return t.forEach(function(t,r){n+=c(t.type,e[r])}),t.forEach(function(r,a){for(var o=!1,i=0;i<f.length&&!o;i++)o=f[i].type(t[a].type,e[a]);o||s(t[a].type);var c=f[i-1].format,l="";l=u(t[a].type)?e[a].reduce(function(t,e){return t+c(e)},""):c(e[a]),n+=l}),n},p=function(t){return u(t)||"string"===t?2*o.ETH_PADDING:0},m=a.outputTypes(),h=function(t,e){e=e.slice(2);var n=[],r=2*o.ETH_PADDING,c=t.reduce(function(t,e){return t+p(e.type)},0),f=e.slice(0,c);return e=e.slice(c),t.forEach(function(o,c){for(var l=!1,p=0;p<m.length&&!l;p++)l=m[p].type(t[c].type);l||s(t[c].type);var h=m[p-1].format;if(u(t[c].type)){var d=i.formatOutputUInt(f.slice(0,r));f=f.slice(r);for(var g=[],v=0;d>v;v++)g.push(h(e.slice(0,r))),e=e.slice(r);n.push(g)}else a.prefixedType("string")(t[c].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},d=function(t){var e={};return t.forEach(function(t){var n=r.extractDisplayName(t.name),a=r.extractTypeName(t.name),o=function(){var e=Array.prototype.slice.call(arguments);return l(t.inputs,e)};void 0===e[n]&&(e[n]=o),e[n][a]=o}),e},g=function(t){var e={};return t.forEach(function(t){var n=r.extractDisplayName(t.name),a=r.extractTypeName(t.name),o=function(e){return h(t.outputs,e)};void 0===e[n]&&(e[n]=o),e[n][a]=o}),e},v=function(t){return n.sha3(n.fromAscii(t)).slice(0,2+2*o.ETH_SIGNATURE_LENGTH)},y=function(t){return n.sha3(n.fromAscii(t))};e.exports={inputParser:d,outputParser:g,formatInput:l,formatOutput:h,signatureFromAscii:v,eventSignatureFromAscii:y}},{"./const":2,"./formatters":8,"./types":14,"./utils":15,"./web3":17}],2:[function(t,e){var n=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:n,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:BigNumber.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3}},{}],3:[function(t,e){var n=t("./web3"),r=t("./abi"),a=t("./utils"),o=t("./event"),i=(t("./filter"),function(t){n._currentContractAbi=t.abi,n._currentContractAddress=t.address,n._currentContractMethodName=t.method,n._currentContractMethodParams=t.params}),s=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}})},u=function(t,e,o){var s=r.inputParser(e),u=r.outputParser(e);a.filterFunctions(e).forEach(function(c){var f=a.extractDisplayName(c.name),l=a.extractTypeName(c.name),p=function(){var a=Array.prototype.slice.call(arguments),p=r.signatureFromAscii(c.name),m=s[f][l].apply(null,a),h=t._options||{};h.to=o,h.data=p+m;var d=t._isTransact===!0||t._isTransact!==!1&&!c.constant,g=h.collapse!==!1;if(t._options={},t._isTransact=null,d)return i({abi:e,address:o,method:c.name,params:a}),void n.eth.sendTransaction(h);var v=n.eth.call(h),y=u[f][l](v);return g&&(1===y.length?y=y[0]:0===y.length&&(y=null)),y};void 0===t[f]&&(t[f]=p),t[f][l]=p})},c=function(t,e,n){t.address=n,t._onWatchEventResult=function(t){var n=event.getMatchingEvent(a.filterEvents(e)),r=o.outputParser(n);return r(t)},Object.defineProperty(t,"topic",{get:function(){return a.filterEvents(e).map(funct