ethers.js/dist/ethers-v4-beta.min.js

3 lines
280 KiB
JavaScript
Raw Normal View History

2018-09-06 23:41:02 +03:00
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).ethers=e()}}(function(){return function o(s,a,u){function l(t,e){if(!a[t]){if(!s[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(f)return f(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[t]={exports:{}};s[t][0].call(i.exports,function(e){return l(s[t][1][e]||e)},i,i.exports,o,s,a,u)}return a[t].exports}for(var f="function"==typeof require&&require,e=0;e<u.length;e++)l(u[e]);return l}({1:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="4.0.0-beta.13"},{}],2:[function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("./interface"),u=e("../utils/abi-coder"),a=e("../utils/address"),l=e("../utils/bignumber"),f=e("../utils/bytes"),h=e("../utils/constants"),c=e("../utils/properties"),d=n(e("../utils/errors")),o=e("../providers/abstract-provider"),p=e("../wallet/abstract-signer"),v={data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};function y(o,e,s){var a=o.interface.functions[e];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i={};if(e.length===a.inputs.length+1&&"object"==typeof e[e.length-1])for(var r in i=c.shallowCopy(e.pop()))if(!v[r])throw new Error("unknown transaction override "+r);if(e.length!=a.inputs.length)throw new Error("incorrect number of arguments");return["data","to"].forEach(function(e){null!=i[e]&&d.throwError("cannot override "+e,d.UNSUPPORTED_OPERATION,{operation:e})}),i.to=o.deployed().then(function(){return o.addressPromise}),function n(i,o,e){if(Array.isArray(e)){var s=[];return e.forEach(function(e,t){var r=null;r=Array.isArray(o)?o[t]:o[e.name],s.push(n(i,r,e))}),Promise.all(s)}if("address"===e.type)return i.resolveName(o);if("tuple"===e.type)return n(i,o,e.components);var t=e.type.match(/(.*)(\[[0-9]*\]$)/);if(t){if(!Array.isArray(o))throw new Error("invalid value for array");s=[];var r={components:e.components,type:t[1]};return o.forEach(function(e){s.push(n(i,e,r))}),Promise.all(s)}return Promise.resolve(o)}(o.provider,e,a.inputs).then(function(n){if(i.data=a.encode(n),"call"===a.type)return s?Promise.resolve(h.Zero):(o.provider||d.throwError("call (constant functions) require a provider or a signer with a provider",d.UNSUPPORTED_OPERATION,{operation:"call"}),["gasLimit","gasPrice","value"].forEach(function(e){if(null!=i[e])throw new Error("call cannot override "+e)}),null==i.from&&o.signer&&(i.from=o.signer.getAddress()),o.provider.call(i).then(function(t){if(f.hexDataLength(t)%32==4&&"0x08c379a0"===f.hexDataSlice(t,0,4)){var e=u.defaultAbiCoder.decode(["string"],f.hexDataSlice(t,4));d.throwError("call revert exception",d.CALL_EXCEPTION,{address:o.address,args:n,method:a.signature,errorSignature:"Error(string)",errorArgs:[e],reason:e,transaction:i})}try{var r=a.decode(t);return 1===a.outputs.length&&(r=r[0]),r}catch(e){throw"0x"===t&&0<a.outputs.length&&d.throwError("call exception",d.CALL_EXCEPTION,{address:o.address,method:a.signature,args:n}),e}}));if("transaction"===a.type)return s?(o.provider||d.throwError("estimate gas require a provider or a signer with a provider",d.UNSUPPORTED_OPERATION,{operation:"estimateGas"}),null==i.from&&o.signer&&(i.from=o.signer.getAddress()),o.provider.estimateGas(i)):(null==i.gasLimit&&null!=a.gas&&(i.gasLimit=l.bigNumberify(a.gas).add(21e3)),o.signer||d.throwError("sending a transaction require a signer",d.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=i.from&&d.throwError("cannot override from in a transaction",d.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),o.signer.sendTransaction(i));throw new Error("invalid type - "+a.type)})}}fun
//# sourceMappingURL=ethers.min.js.map