bsc/dist/ethereum.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

2015-01-31 04:42:13 +02:00
require=function t(e,n,r){function o(a,u){if(!n[a]){if(!e[a]){var f="function"==typeof require&&require;if(!u&&f)return f(a,!0);if(i)return i(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return o(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e){var n=t("./web3"),r=t("./utils"),o=t("./types"),i=t("./formatters");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var a=32,u=4,f=function(t,e){return r.findIndex(t,function(t){return t.name===e})},s=function(t,e){var n=f(t,e);return-1===n?void console.error("method "+e+" not found in the abi"):t[n]},c=function(t){return t.filter(function(t){return"function"===t.type})},l=function(t){return t.filter(function(t){return"event"===t.type})},p=function(t){return"[]"===t.slice(-2)},h=function(t,e){return p(t)||"string"===t?i.formatInputInt(e.length):""},m=o.inputTypes(),d=function(t,e,n){var r="",o=s(t,e);return o.inputs.forEach(function(t,e){r+=h(t.type,n[e])}),o.inputs.forEach(function(t,e){for(var i=!1,a=0;a<m.length&&!i;a++)i=m[a].type(o.inputs[e].type,n[e]);i||console.error("input parser does not support type: "+o.inputs[e].type);var u=m[a-1].format,f="";f=p(o.inputs[e].type)?n[e].reduce(function(t,e){return t+u(e)},""):u(n[e]),r+=f}),r},g=function(t){return p(t)||"string"===t?2*a:0},v=o.outputTypes(),y=function(t,e,n){n=n.slice(2);var r=[],u=s(t,e),f=2*a,c=u.outputs.reduce(function(t,e){return t+g(e.type)},0),l=n.slice(0,c);return n=n.slice(c),u.outputs.forEach(function(t,e){for(var a=!1,s=0;s<v.length&&!a;s++)a=v[s].type(u.outputs[e].type);a||console.error("output parser does not support type: "+u.outputs[e].type);var c=v[s-1].format;if(p(u.outputs[e].type)){var h=i.formatOutputUInt(l.slice(0,f));l=l.slice(f);for(var m=[],d=0;h>d;d++)m.push(c(n.slice(0,f))),n=n.slice(f);r.push(m)}else o.prefixedType("string")(u.outputs[e].type)?(l=l.slice(f),r.push(c(n.slice(0,f))),n=n.slice(f)):(r.push(c(n.slice(0,f))),n=n.slice(f))}),r},b=function(t){var e=t.indexOf("(");return-1!==e?t.substr(0,e):t},_=function(t){var e=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)):""},w=function(t){var e={};return t.forEach(function(n){var r=b(n.name),o=_(n.name),i=function(){var e=Array.prototype.slice.call(arguments);return d(t,n.name,e)};void 0===e[r]&&(e[r]=i),e[r][o]=i}),e},N=function(t){var e={};return t.forEach(function(n){var r=b(n.name),o=_(n.name),i=function(e){return y(t,n.name,e)};void 0===e[r]&&(e[r]=i),e[r][o]=i}),e},x=function(t){return n.sha3(n.fromAscii(t)).slice(0,2+2*u)};e.exports={inputParser:w,outputParser:N,methodSignature:x,methodDisplayName:b,methodTypeName:_,getMethodWithName:s,filterFunctions:c,filterEvents:l}},{"./formatters":5,"./types":9,"./utils":10,"./web3":11}],2:[function(t,e){var n=t("./web3"),r=t("./abi"),o=t("./event"),i=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}})},a=function(t,e,o){var i=r.inputParser(e),a=r.outputParser(e);r.filterFunctions(e).forEach(function(u){var f=r.methodDisplayName(u.name),s=r.methodTypeName(u.name),c=function(){var c=Array.prototype.slice.call(arguments),l=r.methodSignature(u.name),p=i[f][s].apply(null,c),h=t._options||{};h.to=o,h.data=l+p;var m=t._isTransact===!0||t._isTransact!==!1&&!u.constant,d=h.collapse!==!1;if(t._options={},t._isTransact=null,m)return n._currentContractAbi=e,n._currentContractAddress=o,n._currentContractMethodName=u.name,n._currentContractMethodParams=c,void n.eth.transact(h);var g=n.eth.call(h),v=a[f][s](g);return d&&(1===v.length?v=v[0]:0===v.length&&(v=null)),v};void 0===t[f]&&(t[f]=c),t[f][s]=c})},u=function(t,e,n){t.address=n,Object.defineProperty(t,"topic",{get:function(){return r.filterEvents(e).map(function(t){return r.methodSignature(t.name)})}})},f=function(t,e,i){r.filterEvents(e