bsc/dist/ethereum.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

2015-01-31 02:54:46 +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("./formatters");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var o=32,i=4,a=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},u=function(t,e){return a(t,function(t){return t.name===e})},f=function(t,e){var n=u(t,e);return-1===n?void console.error("method "+e+" not found in the abi"):t[n]},s=function(t){return t.filter(function(t){return"function"===t.type})},c=function(t){return t.filter(function(t){return"event"===t.type})},l=function(t){return function(e){return 0===e.indexOf(t)}},p=function(t){return function(e){return t===e}},h=function(t){return"[]"===t.slice(-2)},m=function(t,e){return h(t)||"string"===t?r.formatInputInt(e.length):""},d=function(){return[{type:l("uint"),format:r.formatInputInt},{type:l("int"),format:r.formatInputInt},{type:l("hash"),format:r.formatInputInt},{type:l("string"),format:r.formatInputString},{type:l("real"),format:r.formatInputReal},{type:l("ureal"),format:r.formatInputReal},{type:p("address"),format:r.formatInputInt},{type:p("bool"),format:r.formatInputBool}]},g=d(),v=function(t,e,n){var r="",o=f(t,e);return o.inputs.forEach(function(t,e){r+=m(t.type,n[e])}),o.inputs.forEach(function(t,e){for(var i=!1,a=0;a<g.length&&!i;a++)i=g[a].type(o.inputs[e].type,n[e]);i||console.error("input parser does not support type: "+o.inputs[e].type);var u=g[a-1].format,f="";f=h(o.inputs[e].type)?n[e].reduce(function(t,e){return t+u(e)},""):u(n[e]),r+=f}),r},b=function(t){return h(t)||"string"===t?2*o:0},y=function(){return[{type:l("uint"),format:r.formatOutputUInt},{type:l("int"),format:r.formatOutputInt},{type:l("hash"),format:r.formatOutputHash},{type:l("string"),format:r.formatOutputString},{type:l("real"),format:r.formatOutputReal},{type:l("ureal"),format:r.formatOutputUReal},{type:p("address"),format:r.formatOutputAddress},{type:p("bool"),format:r.formatOutputBool}]},_=y(),w=function(t,e,n){n=n.slice(2);var i=[],a=f(t,e),u=2*o,s=a.outputs.reduce(function(t,e){return t+b(e.type)},0),c=n.slice(0,s);return n=n.slice(s),a.outputs.forEach(function(t,e){for(var o=!1,f=0;f<_.length&&!o;f++)o=_[f].type(a.outputs[e].type);o||console.error("output parser does not support type: "+a.outputs[e].type);var s=_[f-1].format;if(h(a.outputs[e].type)){var p=r.formatOutputUInt(c.slice(0,u));c=c.slice(u);for(var m=[],d=0;p>d;d++)m.push(s(n.slice(0,u))),n=n.slice(u);i.push(m)}else l("string")(a.outputs[e].type)?(c=c.slice(u),i.push(s(n.slice(0,u))),n=n.slice(u)):(i.push(s(n.slice(0,u))),n=n.slice(u))}),i},N=function(t){var e=t.indexOf("(");return-1!==e?t.substr(0,e):t},O=function(t){var e=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)):""},x=function(t){var e={};return s(t).forEach(function(n){var r=N(n.name),o=O(n.name),i=function(){var e=Array.prototype.slice.call(arguments);return v(t,n.name,e)};void 0===e[r]&&(e[r]=i),e[r][o]=i}),e},B=function(t){var e={};return s(t).forEach(function(n){var r=N(n.name),o=O(n.name),i=function(e){return w(t,n.name,e)};void 0===e[r]&&(e[r]=i),e[r][o]=i}),e},I=function(t){return n.sha3(n.fromAscii(t)).slice(0,2+2*i)};e.exports={inputParser:x,outputParser:B,methodSignature:I,methodDisplayName:N,methodTypeName:O,getMethodWithName:f,filterFunctions:s,filterEvents:c}},{"./formatters":5,"./web3":9}],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.fi