-
Notifications
You must be signed in to change notification settings - Fork 1
/
4.22fe37b584d54e9a8489.js
1 lines (1 loc) · 14.2 KB
/
4.22fe37b584d54e9a8489.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{"+yoj":function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r("9lTW"),f=r("mhLr"),i=r("IzB8"),o=r("OZ/i"),s=r("OLPe"),a=r("dI7W");t.zeroAddress=function(){var e=s.zeros(20);return s.bufferToHex(e)},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===s.addHexPrefix(e)},t.toChecksumAddress=function(e,t){e=f.stripHexPrefix(e).toLowerCase();for(var r=void 0!==t?t.toString()+"0x":"",n=a.keccak(r+e).toString("hex"),i="0x",o=0;o<e.length;o++)parseInt(n[o],16)>=8?i+=e[o].toUpperCase():i+=e[o];return i},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(t,r){t=s.toBuffer(t);var n=new o(r);return n.isZero()?a.rlphash([t,null]).slice(-20):a.rlphash([t,e.from(n.toArray())]).slice(-20)},t.generateAddress2=function(t,r,f){var i=s.toBuffer(t),o=s.toBuffer(r),u=s.toBuffer(f);return n(20===i.length),n(32===o.length),a.keccak256(e.concat([e.from("ff","hex"),i,o,a.keccak256(u)])).slice(-20)},t.isPrecompiled=function(e){var t=s.unpad(e);return 1===t.length&&t[0]>=1&&t[0]<=8},t.isValidPrivate=function(e){return i.privateKeyVerify(e)},t.isValidPublic=function(t,r){return void 0===r&&(r=!1),64===t.length?i.publicKeyVerify(e.concat([e.from([4]),t])):!!r&&i.publicKeyVerify(t)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),e=s.toBuffer(e),t&&64!==e.length&&(e=i.publicKeyConvert(e,!1).slice(1)),n(64===e.length),a.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.privateToPublic=function(e){return e=s.toBuffer(e),i.publicKeyCreate(e,!1).slice(1)},t.importPublic=function(e){return 64!==(e=s.toBuffer(e)).length&&(e=i.publicKeyConvert(e,!1).slice(1)),e}}).call(this,r("HDXh").Buffer)},"1oSv":function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r("f4g2"),f=r.n(n),i=r("WPTD"),o=r.n(i),s=r("Rlsf"),a=r.n(s),u=r("EqmL"),c=r.n(u),d=r("cC/c"),h=r.n(d);function l(e){var t=e.rpcUrl,r=new a.a({getAccounts:e.getAccounts,signTransaction:e.signTransaction}),n=new o.a({rpcUrl:t.includes("http")?t:"https://".concat(t)}),i=new f.a;return i.addProvider(new c.a),i.addProvider(new h.a),i.addProvider(r),i.addProvider(n),i.start(),i}},"3GA+":function(e,t,r){"use strict";var n,f=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r("kX2E"),o=r("HDXh"),s=function(e){function t(t,r){void 0===t&&(t={}),void 0===r&&(r={});var n=e.call(this,t,r)||this;return Object.defineProperty(n,"from",{enumerable:!0,configurable:!0,get:function(){return n.getSenderAddress()},set:function(e){e&&(n._from=i.toBuffer(e))}}),t.from&&(n.from=i.toBuffer(t.from)),n}return f(t,e),t.prototype.hash=function(t){if(void 0===t&&(t=!0),t&&this._from&&""!==this._from.toString("hex")){var r=o.Buffer.concat([this._from,this._from.slice(0,12)]);this.sign(r)}return e.prototype.hash.call(this,t)},t}(r("Zh/5").default);t.default=s},OLPe:function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r("mhLr"),f=r("OZ/i");t.zeros=function(t){return e.allocUnsafe(t).fill(0)},t.setLengthLeft=function(e,r,n){void 0===n&&(n=!1);var f=t.zeros(r);return e=t.toBuffer(e),n?e.length<r?(e.copy(f),f):e.slice(0,r):e.length<r?(e.copy(f,r-e.length),f):e.slice(-r)},t.setLength=t.setLengthLeft,t.setLengthRight=function(e,r){return t.setLength(e,r,!0)},t.unpad=function(e){for(var t=(e=n.stripHexPrefix(e))[0];e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e},t.stripZeros=t.unpad,t.toBuffer=function(t){if(!e.isBuffer(t))if(Array.isArray(t))t=e.from(t);else if("string"==typeof t){if(!n.isHexString(t))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+t);t=e.from(n.padToEven(n.stripHexPrefix(t)),"hex")}else if("number"==typeof t)t=n.intToBuffer(t);else if(null==t)t=e.allocUnsafe(0);else if(f.isBN(t))t=t.toArrayLike(e);else{if(!t.toArray)throw new Error("invalid type");t=e.from(t.toArray())}return t},t.bufferToInt=function(e){return new f(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new f(e).fromTwos(256)},t.toUnsigned=function(t){return e.from(t.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e?e:n.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(r){if(e.isBuffer(r))return"0x"+r.toString("hex");if(r instanceof Array){for(var n=[],f=0;f<r.length;f++)n.push(t.baToJSON(r[f]));return n}}}).call(this,r("HDXh").Buffer)},PdBc:function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r("9lTW"),f=r("mhLr"),i=r("o8pB"),o=r("OLPe");t.defineProperties=function(t,r,s){if(t.raw=[],t._fields=[],t.toJSON=function(e){if(void 0===e&&(e=!1),e){var r={};return t._fields.forEach((function(e){r[e]="0x"+t[e].toString("hex")})),r}return o.baToJSON(t.raw)},t.serialize=function(){return i.encode(t.raw)},r.forEach((function(r,f){function i(){return t.raw[f]}function s(i){"00"!==(i=o.toBuffer(i)).toString("hex")||r.allowZero||(i=e.allocUnsafe(0)),r.allowLess&&r.length?(i=o.stripZeros(i),n(r.length>=i.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===i.length||!r.length||n(r.length===i.length,"The field "+r.name+" must have byte length of "+r.length),t.raw[f]=i}t._fields.push(r.name),Object.defineProperty(t,r.name,{enumerable:!0,configurable:!0,get:i,set:s}),r.default&&(t[r.name]=r.default),r.alias&&Object.defineProperty(t,r.alias,{enumerable:!1,configurable:!0,set:s,get:i})})),s)if("string"==typeof s&&(s=e.from(f.stripHexPrefix(s),"hex")),e.isBuffer(s)&&(s=i.decode(s)),Array.isArray(s)){if(s.length>t._fields.length)throw new Error("wrong number of fields in data");s.forEach((function(e,r){t[t._fields[r]]=o.toBuffer(e)}))}else{if("object"!=typeof s)throw new Error("invalid data");var a=Object.keys(s);r.forEach((function(e){-1!==a.indexOf(e.name)&&(t[e.name]=s[e.name]),-1!==a.indexOf(e.alias)&&(t[e.alias]=s[e.alias])}))}}}).call(this,r("HDXh").Buffer)},"W4v+":function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r("IzB8"),f=r("OZ/i"),i=r("OLPe"),o=r("dI7W");function s(e,t){return t?e-(2*t+35):e-27}function a(e){return 0===e||1===e}t.ecsign=function(e,t,r){var f=n.sign(e,t),i=f.recovery;return{r:f.signature.slice(0,32),s:f.signature.slice(32,64),v:r?i+(2*r+35):i+27}},t.ecrecover=function(t,r,f,o,u){var c=e.concat([i.setLength(f,32),i.setLength(o,32)],64),d=s(r,u);if(!a(d))throw new Error("Invalid signature v value");var h=n.recover(t,c,d);return n.publicKeyConvert(h,!1).slice(1)},t.toRpcSig=function(t,r,n,f){if(!a(s(t,f)))throw new Error("Invalid signature v value");return i.bufferToHex(e.concat([i.setLengthLeft(r,32),i.setLengthLeft(n,32),i.toBuffer(t)]))},t.fromRpcSig=function(e){var t=i.toBuffer(e);if(65!==t.length)throw new Error("Invalid signature length");var r=t[64];return r<27&&(r+=27),{v:r,r:t.slice(0,32),s:t.slice(32,64)}},t.isValidSignature=function(e,t,r,n,i){void 0===n&&(n=!0);var o=new f("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),u=new f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!a(s(e,i)))return!1;var c=new f(t),d=new f(r);return!(c.isZero()||c.gt(u)||d.isZero()||d.gt(u)||n&&1===d.cmp(o))},t.hashPersonalMessage=function(t){var r=e.from("Ethereum Signed Message:\n"+t.length.toString(),"utf-8");return o.keccak(e.concat([r,t]))}}).call(this,r("HDXh").Buffer)},"Zh/5":function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var f in t=arguments[r])Object.prototype.hasOwnProperty.call(t,f)&&(e[f]=t[f]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var f=r("kX2E"),i=r("pi6U"),o=r("HDXh"),s=new f.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),a=function(){function e(e,t){if(void 0===e&&(e={}),void 0===t&&(t={}),t.common){if(t.chain||t.hardfork)throw new Error("Instantiation with both opts.common, and opts.chain and opts.hardfork parameter not allowed!");this._common=t.common}else this._common=new i.default(t.chain?t.chain:"mainnet",t.hardfork?t.hardfork:"petersburg");var r=[{name:"nonce",length:32,allowLess:!0,default:new o.Buffer([])},{name:"gasPrice",length:32,allowLess:!0,default:new o.Buffer([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new o.Buffer([])},{name:"to",allowZero:!0,length:20,default:new o.Buffer([])},{name:"value",length:32,allowLess:!0,default:new o.Buffer([])},{name:"data",alias:"input",allowZero:!0,default:new o.Buffer([])},{name:"v",allowZero:!0,default:new o.Buffer([])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new o.Buffer([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new o.Buffer([])}];f.defineProperties(this,r,e),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)}),this._validateV(this.v),this._overrideVSetterWithValidation()}return e.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},e.prototype.hash=function(e){var t;return void 0===e&&(e=!0),t=e?this.raw:this._implementsEIP155()?this.raw.slice(0,6).concat([f.toBuffer(this.getChainId()),f.stripZeros(f.toBuffer(0)),f.stripZeros(f.toBuffer(0))]):this.raw.slice(0,6),f.rlphash(t)},e.prototype.getChainId=function(){return this._common.chainId()},e.prototype.getSenderAddress=function(){if(this._from)return this._from;var e=this.getSenderPublicKey();return this._from=f.publicToAddress(e),this._from},e.prototype.getSenderPublicKey=function(){if(!this.verifySignature())throw new Error("Invalid Signature");return this._senderPubKey},e.prototype.verifySignature=function(){var e=this.hash(!1);if(this._common.gteHardfork("homestead")&&1===new f.BN(this.s).cmp(s))return!1;try{var t=f.bufferToInt(this.v),r=t>=2*this.getChainId()+35&&this._common.gteHardfork("spuriousDragon");this._senderPubKey=f.ecrecover(e,t,this.r,this.s,r?this.getChainId():void 0)}catch(n){return!1}return!!this._senderPubKey},e.prototype.sign=function(e){this.v=new o.Buffer([]),this.s=new o.Buffer([]),this.r=new o.Buffer([]);var t=this.hash(!1),r=f.ecsign(t,e);this._implementsEIP155()&&(r.v+=2*this.getChainId()+8),Object.assign(this,r)},e.prototype.getDataFee=function(){for(var e=this.raw[5],t=new f.BN(0),r=0;r<e.length;r++)t.iaddn(this._common.param("gasPrices",0===e[r]?"txDataZero":"txDataNonZero"));return t},e.prototype.getBaseFee=function(){var e=this.getDataFee().iaddn(this._common.param("gasPrices","tx"));return this._common.gteHardfork("homestead")&&this.toCreationAddress()&&e.iaddn(this._common.param("gasPrices","txCreation")),e},e.prototype.getUpfrontCost=function(){return new f.BN(this.gasLimit).imul(new f.BN(this.gasPrice)).iadd(new f.BN(this.value))},e.prototype.validate=function(e){void 0===e&&(e=!1);var t=[];return this.verifySignature()||t.push("Invalid Signature"),this.getBaseFee().cmp(new f.BN(this.gasLimit))>0&&t.push(["gas limit is too low. Need at least "+this.getBaseFee()]),!1===e?0===t.length:t.join(" ")},e.prototype.serialize=function(){return f.rlp.encode(this.raw)},e.prototype.toJSON=function(e){return void 0===e&&(e=!1),{}},e.prototype._validateV=function(e){if(void 0!==e&&0!==e.length&&this._common.gteHardfork("spuriousDragon")){var t=f.bufferToInt(e);if(27!==t&&28!==t&&t!==2*this.getChainId()+35&&t!==2*this.getChainId()+36)throw new Error("Incompatible EIP155-based V "+t+" and chain id "+this.getChainId()+". See the second parameter of the Transaction constructor to set the chain id.")}},e.prototype._isSigned=function(){return this.v.length>0&&this.r.length>0&&this.s.length>0},e.prototype._overrideVSetterWithValidation=function(){var e=this,t=Object.getOwnPropertyDescriptor(this,"v");Object.defineProperty(this,"v",n({},t,{set:function(r){void 0!==r&&e._validateV(f.toBuffer(r)),t.set(r)}}))},e.prototype._implementsEIP155=function(){var e=this._common.gteHardfork("spuriousDragon");if(!this._isSigned())return e;var t=f.bufferToInt(this.v);return(t===2*this.getChainId()+35||t===2*this.getChainId()+36)&&e},e}();t.default=a},Zmks:function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r("OZ/i");t.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=e.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=e.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=e.from(t.KECCAK256_RLP_S,"hex")}).call(this,r("HDXh").Buffer)},dI7W:function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r("aYMp"),f=r("mObS"),i=r("mhLr"),o=r("o8pB"),s=r("OLPe");t.keccak=function(t,r){return void 0===r&&(r=256),t="string"!=typeof t||i.isHexString(t)?s.toBuffer(t):e.from(t,"utf8"),r||(r=256),n("keccak"+r).update(t).digest()},t.keccak256=function(e){return t.keccak(e)},t.sha256=function(e){return e=s.toBuffer(e),f("sha256").update(e).digest()},t.ripemd160=function(e,t){e=s.toBuffer(e);var r=f("rmd160").update(e).digest();return!0===t?s.setLength(r,32):r},t.rlphash=function(e){return t.keccak(o.encode(e))}}).call(this,r("HDXh").Buffer)},jSND:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r("Zh/5");t.Transaction=n.default;var f=r("3GA+");t.FakeTransaction=f.default},kX2E:function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0});var f=r("IzB8");t.secp256k1=f;var i=r("mhLr"),o=r("OZ/i");t.BN=o;var s=r("o8pB");t.rlp=s,Object.assign(t,i),n(r("Zmks")),n(r("+yoj")),n(r("dI7W")),n(r("W4v+")),n(r("OLPe")),n(r("PdBc"))}}]);