UNPKG

@web3auth/web3auth

Version:

[![npm version](https://img.shields.io/npm/v/@web3auth/web3auth?label=%22%22)](https://www.npmjs.com/package/@web3auth/web3auth/v/latest) [![minzip](https://img.shields.io/bundlephobia/minzip/@web3auth/web3auth?label=%22%22)](https://bundlephobia.com/resu

2 lines 2.23 MB
/*! For license information please see web3auth.umd.min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Web3auth=t():e.Web3auth=t()}(self,(()=>(()=>{var e,t,a={9895:function(e,t,a){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,a=t&&e[t],r=0;if(a)return a.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.chains=t._getInitializedChains=void 0;var n=c(a(3890)),d=c(a(1443)),f=c(a(8216)),i=c(a(1095)),o=c(a(2487)),s=c(a(6412));function b(e){var t,a,c={1:"mainnet",3:"ropsten",4:"rinkeby",42:"kovan",5:"goerli",11155111:"sepolia"},b={mainnet:n.default,ropsten:d.default,rinkeby:f.default,kovan:i.default,goerli:o.default,sepolia:s.default};if(e)try{for(var u=r(e),l=u.next();!l.done;l=u.next()){var h=l.value,x=h.name;c[h.chainId.toString()]=x,b[x]=h}}catch(e){t={error:e}}finally{try{l&&!l.done&&(a=u.return)&&a.call(u)}finally{if(t)throw t.error}}return b.names=c,b}t._getInitializedChains=b,t.chains=b()},5745:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EIPs=void 0,t.EIPs={1153:a(9486),1559:a(805),2315:a(6568),2537:a(8175),2565:a(2946),2718:a(6426),2929:a(588),2930:a(600),3198:a(3729),3529:a(1121),3540:a(8704),3541:a(6198),3554:a(6702),3607:a(2017),3651:a(5982),3670:a(8474),3675:a(4272),3855:a(4114),3860:a(5220),4345:a(7764),4399:a(3505),5133:a(9813)}},5576:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hardforks=void 0,t.hardforks=[["chainstart",a(5049)],["homestead",a(9850)],["dao",a(4976)],["tangerineWhistle",a(6908)],["spuriousDragon",a(3340)],["byzantium",a(5727)],["constantinople",a(2938)],["petersburg",a(6989)],["istanbul",a(279)],["muirGlacier",a(5512)],["berlin",a(3156)],["london",a(9570)],["shanghai",a(3172)],["arrowGlacier",a(2124)],["grayGlacier",a(130)],["mergeForkIdTransition",a(2912)],["merge",a(3374)]]},6446:function(e,t,a){"use strict";var r,c=a(8834).Buffer,n=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function a(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(a.prototype=t.prototype,new a)}),d=this&&this.__assign||function(){return d=Object.assign||function(e){for(var t,a=1,r=arguments.length;a<r;a++)for(var c in t=arguments[a])Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c]);return e},d.apply(this,arguments)},f=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,a=t&&e[t],r=0;if(a)return a.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.ConsensusAlgorithm=t.ConsensusType=t.Hardfork=t.Chain=t.CustomChain=void 0;var i,o,s,b,u,l=a(2699),h=a(7108),x=a(7144),p=a(9895),g=a(5576),m=a(5745);!function(e){e.PolygonMainnet="polygon-mainnet",e.PolygonMumbai="polygon-mumbai",e.ArbitrumRinkebyTestnet="arbitrum-rinkeby-testnet",e.xDaiChain="x-dai-chain",e.OptimisticKovan="optimistic-kovan",e.OptimisticEthereum="optimistic-ethereum"}(i=t.CustomChain||(t.CustomChain={})),(u=t.Chain||(t.Chain={}))[u.Mainnet=1]="Mainnet",u[u.Ropsten=3]="Ropsten",u[u.Rinkeby=4]="Rinkeby",u[u.Kovan=42]="Kovan",u[u.Goerli=5]="Goerli",u[u.Sepolia=11155111]="Sepolia",function(e){e.Chainstart="chainstart",e.Homestead="homestead",e.Dao="dao",e.TangerineWhistle="tangerineWhistle",e.SpuriousDragon="spuriousDragon",e.Byzantium="byzantium",e.Constantinople="constantinople",e.Petersburg="petersburg",e.Istanbul="istanbul",e.MuirGlacier="muirGlacier",e.Berlin="berlin",e.London="london",e.ArrowGlacier="arrowGlacier",e.GrayGlacier="grayGlacier",e.MergeForkIdTransition="mergeForkIdTransition",e.Merge="merge",e.Shanghai="shanghai"}(o=t.Hardfork||(t.Hardfork={})),(b=t.ConsensusType||(t.ConsensusType={})).ProofOfStake="pos",b.ProofOfWork="pow",b.ProofOfAuthority="poa",(s=t.ConsensusAlgorithm||(t.ConsensusAlgorithm={})).Ethash="ethash",s.Clique="clique",s.Casper="casper";var y=function(e){function t(t){var a,r,c,n,d=this;(d=e.call(this)||this)._supportedHardforks=[],d._eips=[],d._customChains=null!==(c=t.customChains)&&void 0!==c?c:[],d._chainParams=d.setChain(t.chain),d.DEFAULT_HARDFORK=null!==(n=d._chainParams.defaultHardfork)&&void 0!==n?n:o.Istanbul;try{for(var i=f(d._chainParams.hardforks),s=i.next();!s.done;s=i.next()){var b=s.value;b.forkHash||(b.forkHash=d._calcForkHash(b.name))}}catch(e){a={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return d._hardfork=d.DEFAULT_HARDFORK,t.supportedHardforks&&(d._supportedHardforks=t.supportedHardforks),t.hardfork&&d.setHardfork(t.hardfork),t.eips&&d.setEIPs(t.eips),d}return n(t,e),t.custom=function(e,a){var r;void 0===a&&(a={});var c=null!==(r=a.baseChain)&&void 0!==r?r:"mainnet",n=d({},t._getChainParams(c));if(n.name="custom-chain","string"!=typeof e)return new t(d({chain:d(d({},n),e)},a));if(e===i.PolygonMainnet)return t.custom({name:i.PolygonMainnet,chainId:137,networkId:137},a);if(e===i.PolygonMumbai)return t.custom({name:i.PolygonMumbai,chainId:80001,networkId:80001},a);if(e===i.ArbitrumRinkebyTestnet)return t.custom({name:i.ArbitrumRinkebyTestnet,chainId:421611,networkId:421611},a);if(e===i.xDaiChain)return t.custom({name:i.xDaiChain,chainId:100,networkId:100},a);if(e===i.OptimisticKovan)return t.custom({name:i.OptimisticKovan,chainId:69,networkId:69},d({hardfork:o.Berlin},a));if(e===i.OptimisticEthereum)return t.custom({name:i.OptimisticEthereum,chainId:10,networkId:10},d({hardfork:o.Berlin},a));throw new Error("Custom chain ".concat(e," not supported"))},t.forCustomChain=function(e,a,r,c){var n=t._getChainParams(e);return new t({chain:d(d({},n),a),hardfork:r,supportedHardforks:c})},t.isSupportedChainId=function(e){var t=(0,p._getInitializedChains)();return Boolean(t.names[e.toString()])},t._getChainParams=function(e,t){var a=(0,p._getInitializedChains)(t);if("number"==typeof e||x.BN.isBN(e)){if(e=e.toString(),a.names[e])return a[a.names[e]];throw new Error("Chain with ID ".concat(e," not supported"))}if(a[e])return a[e];throw new Error("Chain with name ".concat(e," not supported"))},t.prototype.setChain=function(e){var a,r;if("number"==typeof e||"string"==typeof e||x.BN.isBN(e)){var c;c=this._customChains&&this._customChains.length>0&&Array.isArray(this._customChains[0])?this._customChains.map((function(e){return e[0]})):this._customChains,this._chainParams=t._getChainParams(e,c)}else{if("object"!=typeof e)throw new Error("Wrong input format");if(this._customChains.length>0)throw new Error("Chain must be a string, number, or BN when initialized with customChains passed in");try{for(var n=f(["networkId","genesis","hardforks","bootstrapNodes"]),d=n.next();!d.done;d=n.next()){var i=d.value;if(void 0===e[i])throw new Error("Missing required chain parameter: ".concat(i))}}catch(e){a={error:e}}finally{try{d&&!d.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}this._chainParams=e}return this._chainParams},t.prototype.setHardfork=function(e){var t,a;if(!this._isSupportedHardfork(e))throw new Error("Hardfork ".concat(e," not set as supported in supportedHardforks"));var r=!1;try{for(var c=f(g.hardforks),n=c.next();!n.done;n=c.next())n.value[0]===e&&(this._hardfork!==e&&(this._hardfork=e,this.emit("hardforkChanged",e)),r=!0)}catch(e){t={error:e}}finally{try{n&&!n.done&&(a=c.return)&&a.call(c)}finally{if(t)throw t.error}}if(!r)throw new Error("Hardfork with name ".concat(e," not supported"))},t.prototype.getHardforkByBlockNumber=function(e,t){var a,r;e=(0,x.toType)(e,x.TypeOutput.BN),t=(0,x.toType)(t,x.TypeOutput.BN);var c,n,d,i=o.Chainstart;try{for(var s=f(this.hardforks()),b=s.next();!b.done;b=s.next()){var u=b.value;if(null!==u.block)e.gte(new x.BN(u.block))&&(i=u.name),t&&u.td&&(t.gte(new x.BN(u.td))?c=u.name:n=d),d=u.name;else if(null!=t&&void 0!==u.td&&null!==u.td&&t.gte(new x.BN(u.td)))return u.name}}catch(e){a={error:e}}finally{try{b&&!b.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}if(t){var l="block number: ".concat(e," (-> ").concat(i,"), ");if(c&&!this.hardforkGteHardfork(i,c)){var h="HF determined by block number is lower than the minimum total difficulty HF";throw l+="total difficulty: ".concat(t," (-> ").concat(c,")"),new Error("".concat(h,": ").concat(l))}if(n&&!this.hardforkGteHardfork(n,i))throw h="Maximum HF determined by total difficulty is lower than the block number HF",l+="total difficulty: ".concat(t," (-> ").concat(n,")"),new Error("".concat(h,": ").concat(l))}return i},t.prototype.setHardforkByBlockNumber=function(e,t){var a=this.getHardforkByBlockNumber(e,t);return this.setHardfork(a),a},t.prototype._chooseHardfork=function(e,t){if(void 0===t&&(t=!0),e){if(t&&!this._isSupportedHardfork(e))throw new Error("Hardfork ".concat(e," not set as supported in supportedHardforks"))}else e=this._hardfork;return e},t.prototype._getHardfork=function(e){var t,a,r=this.hardforks();try{for(var c=f(r),n=c.next();!n.done;n=c.next()){var d=n.value;if(d.name===e)return d}}catch(e){t={error:e}}finally{try{n&&!n.done&&(a=c.return)&&a.call(c)}finally{if(t)throw t.error}}throw new Error("Hardfork ".concat(e," not defined for chain ").concat(this.chainName()))},t.prototype._isSupportedHardfork=function(e){var t,a;if(!(this._supportedHardforks.length>0))return!0;try{for(var r=f(this._supportedHardforks),c=r.next();!c.done;c=r.next())if(e===c.value)return!0}catch(e){t={error:e}}finally{try{c&&!c.done&&(a=r.return)&&a.call(r)}finally{if(t)throw t.error}}return!1},t.prototype.setEIPs=function(e){var t,a,r=this;void 0===e&&(e=[]);var c=function(t){if(!(t in m.EIPs))throw new Error("".concat(t," not supported"));var a=n.gteHardfork(m.EIPs[t].minimumHardfork);if(!a)throw new Error("".concat(t," cannot be activated on hardfork ").concat(n.hardfork(),", minimumHardfork: ").concat(a));m.EIPs[t].requiredEIPs&&m.EIPs[t].requiredEIPs.forEach((function(a){if(!e.includes(a)&&!r.isActivatedEIP(a))throw new Error("".concat(t," requires EIP ").concat(a,", but is not included in the EIP list"))}))},n=this;try{for(var d=f(e),i=d.next();!i.done;i=d.next())c(i.value)}catch(e){t={error:e}}finally{try{i&&!i.done&&(a=d.return)&&a.call(d)}finally{if(t)throw t.error}}this._eips=e},t.prototype.param=function(e,t){var a,r,c=null;try{for(var n=f(this._eips),d=n.next();!d.done;d=n.next()){var i=d.value;if(null!==(c=this.paramByEIP(e,t,i)))return c}}catch(e){a={error:e}}finally{try{d&&!d.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return this.paramByHardfork(e,t,this._hardfork)},t.prototype.paramByHardfork=function(e,t,a){var r,c,n,d;a=this._chooseHardfork(a);var i=null;try{for(var o=f(g.hardforks),s=o.next();!s.done;s=o.next()){var b=s.value;if("eips"in b[1]){var u=b[1].eips;try{for(var l=(n=void 0,f(u)),h=l.next();!h.done;h=l.next()){var x=h.value,p=this.paramByEIP(e,t,x);i=null!==p?p:i}}catch(e){n={error:e}}finally{try{h&&!h.done&&(d=l.return)&&d.call(l)}finally{if(n)throw n.error}}}else{if(!b[1][e])throw new Error("Topic ".concat(e," not defined"));void 0!==b[1][e][t]&&(i=b[1][e][t].v)}if(b[0]===a)break}}catch(e){r={error:e}}finally{try{s&&!s.done&&(c=o.return)&&c.call(o)}finally{if(r)throw r.error}}return i},t.prototype.paramByEIP=function(e,t,a){if(!(a in m.EIPs))throw new Error("".concat(a," not supported"));var r=m.EIPs[a];if(!(e in r))throw new Error("Topic ".concat(e," not defined"));return void 0===r[e][t]?null:r[e][t].v},t.prototype.paramByBlock=function(e,t,a){var r=this.activeHardforks(a),c=r[r.length-1].name;return this.paramByHardfork(e,t,c)},t.prototype.isActivatedEIP=function(e){var t,a;if(this.eips().includes(e))return!0;try{for(var r=f(g.hardforks),c=r.next();!c.done;c=r.next()){var n=c.value[1];if(this.gteHardfork(n.name)&&"eips"in n&&n.eips.includes(e))return!0}}catch(e){t={error:e}}finally{try{c&&!c.done&&(a=r.return)&&a.call(r)}finally{if(t)throw t.error}}return!1},t.prototype.hardforkIsActiveOnBlock=function(e,t,a){var r;void 0===a&&(a={}),t=(0,x.toType)(t,x.TypeOutput.BN);var c=null!==(r=a.onlySupported)&&void 0!==r&&r;e=this._chooseHardfork(e,c);var n=this.hardforkBlockBN(e);return!(!n||!t.gte(n))},t.prototype.activeOnBlock=function(e,t){return this.hardforkIsActiveOnBlock(null,e,t)},t.prototype.hardforkGteHardfork=function(e,t,a){var r,c;void 0===a&&(a={});var n,d=void 0!==a.onlyActive&&a.onlyActive;e=this._chooseHardfork(e,a.onlySupported),n=d?this.activeHardforks(null,a):this.hardforks();var i=-1,o=-1,s=0;try{for(var b=f(n),u=b.next();!u.done;u=b.next()){var l=u.value;l.name===e&&(i=s),l.name===t&&(o=s),s+=1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(c=b.return)&&c.call(b)}finally{if(r)throw r.error}}return i>=o&&-1!==o},t.prototype.gteHardfork=function(e,t){return this.hardforkGteHardfork(null,e,t)},t.prototype.hardforkIsActiveOnChain=function(e,t){var a,r,c;void 0===t&&(t={});var n=null!==(c=t.onlySupported)&&void 0!==c&&c;e=this._chooseHardfork(e,n);try{for(var d=f(this.hardforks()),i=d.next();!i.done;i=d.next()){var o=i.value;if(o.name===e&&null!==o.block)return!0}}catch(e){a={error:e}}finally{try{i&&!i.done&&(r=d.return)&&r.call(d)}finally{if(a)throw a.error}}return!1},t.prototype.activeHardforks=function(e,t){var a,r;void 0===t&&(t={});var c=[],n=this.hardforks();try{for(var d=f(n),i=d.next();!i.done;i=d.next()){var o=i.value;if(null!==o.block){if(null!=e&&e<o.block)break;t.onlySupported&&!this._isSupportedHardfork(o.name)||c.push(o)}}}catch(e){a={error:e}}finally{try{i&&!i.done&&(r=d.return)&&r.call(d)}finally{if(a)throw a.error}}return c},t.prototype.activeHardfork=function(e,t){void 0===t&&(t={});var a=this.activeHardforks(e,t);if(a.length>0)return a[a.length-1].name;throw new Error("No (supported) active hardfork found")},t.prototype.hardforkBlock=function(e){var t=this.hardforkBlockBN(e);return(0,x.toType)(t,x.TypeOutput.Number)},t.prototype.hardforkBlockBN=function(e){e=this._chooseHardfork(e,!1);var t=this._getHardfork(e).block;return null==t?null:new x.BN(t)},t.prototype.hardforkTD=function(e){e=this._chooseHardfork(e,!1);var t=this._getHardfork(e).td;return null==t?null:new x.BN(t)},t.prototype.isHardforkBlock=function(e,t){e=(0,x.toType)(e,x.TypeOutput.BN),t=this._chooseHardfork(t,!1);var a=this.hardforkBlockBN(t);return!!a&&a.eq(e)},t.prototype.nextHardforkBlock=function(e){var t=this.nextHardforkBlockBN(e);return(0,x.toType)(t,x.TypeOutput.Number)},t.prototype.nextHardforkBlockBN=function(e){e=this._chooseHardfork(e,!1);var t=this.hardforkBlockBN(e);return null===t?null:this.hardforks().reduce((function(e,a){var r=new x.BN(a.block);return r.gt(t)&&null===e?r:e}),null)},t.prototype.isNextHardforkBlock=function(e,t){e=(0,x.toType)(e,x.TypeOutput.BN),t=this._chooseHardfork(t,!1);var a=this.nextHardforkBlockBN(t);return null!==a&&a.eq(e)},t.prototype._calcForkHash=function(e){var t,a,r=c.from(this.genesis().hash.substr(2),"hex"),n=c.alloc(0),d=0;try{for(var i=f(this.hardforks()),o=i.next();!o.done;o=i.next()){var s=o.value,b=s.block;if(0!==b&&null!==b&&b!==d){var u=c.from(b.toString(16).padStart(16,"0"),"hex");n=c.concat([n,u])}if(s.name===e)break;null!==b&&(d=b)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}var l=c.concat([r,n]),p=(0,x.intToBuffer)((0,h.buf)(l)>>>0).toString("hex");return"0x".concat(p)},t.prototype.forkHash=function(e){e=this._chooseHardfork(e,!1);var t=this._getHardfork(e);if(null===t.block&&void 0===t.td)throw new Error("No fork hash calculation possible for future hardfork");return void 0!==t.forkHash?t.forkHash:this._calcForkHash(e)},t.prototype.hardforkForForkHash=function(e){var t=this.hardforks().filter((function(t){return t.forkHash===e}));return t.length>=1?t[t.length-1]:null},t.prototype.genesis=function(){return this._chainParams.genesis},t.prototype.genesisState=function(){var e,t;switch(this.chainName()){case"mainnet":return a(2816);case"ropsten":return a(8332);case"rinkeby":return a(6270);case"kovan":return a(5943);case"goerli":return a(2734);case"sepolia":return a(9411)}if(this._customChains&&this._customChains.length>0&&Array.isArray(this._customChains[0]))try{for(var r=f(this._customChains),c=r.next();!c.done;c=r.next()){var n=c.value;if(n[0].name===this.chainName())return n[1]}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return{}},t.prototype.hardforks=function(){return this._chainParams.hardforks},t.prototype.bootstrapNodes=function(){return this._chainParams.bootstrapNodes},t.prototype.dnsNetworks=function(){return this._chainParams.dnsNetworks},t.prototype.hardfork=function(){return this._hardfork},t.prototype.chainId=function(){return(0,x.toType)(this.chainIdBN(),x.TypeOutput.Number)},t.prototype.chainIdBN=function(){return new x.BN(this._chainParams.chainId)},t.prototype.chainName=function(){return this._chainParams.name},t.prototype.networkId=function(){return(0,x.toType)(this.networkIdBN(),x.TypeOutput.Number)},t.prototype.networkIdBN=function(){return new x.BN(this._chainParams.networkId)},t.prototype.eips=function(){return this._eips},t.prototype.consensusType=function(){var e,t,a,r=this.hardfork();try{for(var c=f(g.hardforks),n=c.next();!n.done;n=c.next()){var d=n.value;if("consensus"in d[1]&&(a=d[1].consensus.type),d[0]===r)break}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}return a||this._chainParams.consensus.type},t.prototype.consensusAlgorithm=function(){var e,t,a,r=this.hardfork();try{for(var c=f(g.hardforks),n=c.next();!n.done;n=c.next()){var d=n.value;if("consensus"in d[1]&&(a=d[1].consensus.algorithm),d[0]===r)break}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}return a||this._chainParams.consensus.algorithm},t.prototype.consensusConfig=function(){var e,t,a,r=this.hardfork();try{for(var c=f(g.hardforks),n=c.next();!n.done;n=c.next()){var d=n.value;if("consensus"in d[1]&&(a=d[1].consensus[d[1].consensus.algorithm]),d[0]===r)break}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}if(a)return a;var i=this.consensusAlgorithm();return this._chainParams.consensus[i]},t.prototype.copy=function(){var e=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return e.removeAllListeners(),e},t}(l.EventEmitter);t.default=y},5204:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var c=Object.getOwnPropertyDescriptor(t,a);c&&!("get"in c?!t.__esModule:c.writable||c.configurable)||(c={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,c)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),c=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return c(t,e),t},d=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,a=t&&e[t],r=0;if(a)return a.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},f=this&&this.__read||function(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var r,c,n=a.call(e),d=[];try{for(;(void 0===t||t-- >0)&&!(r=n.next()).done;)d.push(r.value)}catch(e){c={error:e}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(c)throw c.error}}return d};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTransaction=void 0;var i=n(a(6446)),o=a(7144),s=a(8871),b=function(){function e(e,t){this.cache={hash:void 0,dataFee:void 0},this.activeCapabilities=[],this.DEFAULT_CHAIN=i.Chain.Mainnet,this.DEFAULT_HARDFORK=i.Hardfork.Istanbul;var a=e.nonce,r=e.gasLimit,c=e.to,n=e.value,d=e.data,f=e.v,s=e.r,b=e.s,u=e.type;this._type=new o.BN((0,o.toBuffer)(u)).toNumber(),this.txOptions=t;var l=(0,o.toBuffer)(""===c?"0x":c),h=(0,o.toBuffer)(""===f?"0x":f),x=(0,o.toBuffer)(""===s?"0x":s),p=(0,o.toBuffer)(""===b?"0x":b);this.nonce=new o.BN((0,o.toBuffer)(""===a?"0x":a)),this.gasLimit=new o.BN((0,o.toBuffer)(""===r?"0x":r)),this.to=l.length>0?new o.Address(l):void 0,this.value=new o.BN((0,o.toBuffer)(""===n?"0x":n)),this.data=(0,o.toBuffer)(""===d?"0x":d),this.v=h.length>0?new o.BN(h):void 0,this.r=x.length>0?new o.BN(x):void 0,this.s=p.length>0?new o.BN(p):void 0,this._validateCannotExceedMaxInteger({value:this.value,r:this.r,s:this.s}),this._validateCannotExceedMaxInteger({gasLimit:this.gasLimit},64),this._validateCannotExceedMaxInteger({nonce:this.nonce},64,!0)}return Object.defineProperty(e.prototype,"transactionType",{get:function(){return this.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),e.prototype.supports=function(e){return this.activeCapabilities.includes(e)},e.prototype.validate=function(e){void 0===e&&(e=!1);var t=[];return this.getBaseFee().gt(this.gasLimit)&&t.push("gasLimit is too low. given ".concat(this.gasLimit,", need at least ").concat(this.getBaseFee())),this.isSigned()&&!this.verifySignature()&&t.push("Invalid Signature"),e?t:0===t.length},e.prototype.getBaseFee=function(){var e=this.getDataFee().addn(this.common.param("gasPrices","tx"));return this.common.gteHardfork("homestead")&&this.toCreationAddress()&&e.iaddn(this.common.param("gasPrices","txCreation")),e},e.prototype.getDataFee=function(){for(var e=this.common.param("gasPrices","txDataZero"),t=this.common.param("gasPrices","txDataNonZero"),a=0,r=0;r<this.data.length;r++)0===this.data[r]?a+=e:a+=t;if(a=new o.BN(a),(void 0===this.to||null===this.to)&&this.common.isActivatedEIP(3860)){var c=Math.ceil(this.data.length/32),n=new o.BN(this.common.param("gasPrices","initCodeWordCost")).imuln(c);a.iadd(n)}return a},e.prototype.toCreationAddress=function(){return void 0===this.to||0===this.to.buf.length},e.prototype.isSigned=function(){var e=this,t=e.v,a=e.r,r=e.s;return 0===this.type?!!(t&&a&&r):!(void 0===t||!a||!r)},e.prototype.verifySignature=function(){try{var e=this.getSenderPublicKey();return 0!==(0,o.unpadBuffer)(e).length}catch(e){return!1}},e.prototype.getSenderAddress=function(){return new o.Address((0,o.publicToAddress)(this.getSenderPublicKey()))},e.prototype.sign=function(e){if(32!==e.length){var t=this._errorMsg("Private key must be 32 bytes in length.");throw new Error(t)}var a=!1;0===this.type&&this.common.gteHardfork("spuriousDragon")&&!this.supports(s.Capability.EIP155ReplayProtection)&&(this.activeCapabilities.push(s.Capability.EIP155ReplayProtection),a=!0);var r=this.getMessageToSign(!0),c=(0,o.ecsign)(r,e),n=c.v,d=c.r,f=c.s,i=this._processSignature(n,d,f);if(a){var b=this.activeCapabilities.indexOf(s.Capability.EIP155ReplayProtection);b>-1&&this.activeCapabilities.splice(b,1)}return i},e.prototype._getCommon=function(e,t){var a;if(t){var r=new o.BN((0,o.toBuffer)(t));if(e){if(!e.chainIdBN().eq(r)){var c=this._errorMsg("The chain ID does not match the chain ID of Common");throw new Error(c)}return e.copy()}return i.default.isSupportedChainId(r)?new i.default({chain:r,hardfork:this.DEFAULT_HARDFORK}):i.default.forCustomChain(this.DEFAULT_CHAIN,{name:"custom-chain",networkId:r,chainId:r},this.DEFAULT_HARDFORK)}return null!==(a=null==e?void 0:e.copy())&&void 0!==a?a:new i.default({chain:this.DEFAULT_CHAIN,hardfork:this.DEFAULT_HARDFORK})},e.prototype._validateCannotExceedMaxInteger=function(e,t,a){var r,c;void 0===t&&(t=256),void 0===a&&(a=!1);try{for(var n=d(Object.entries(e)),i=n.next();!i.done;i=n.next()){var s=f(i.value,2),b=s[0],u=s[1];switch(t){case 64:if(a){if(null==u?void 0:u.gte(o.MAX_UINT64)){var l=this._errorMsg("".concat(b," cannot equal or exceed MAX_UINT64 (2^64-1), given ").concat(u));throw new Error(l)}}else if(null==u?void 0:u.gt(o.MAX_UINT64))throw l=this._errorMsg("".concat(b," cannot exceed MAX_UINT64 (2^64-1), given ").concat(u)),new Error(l);break;case 256:if(a){if(null==u?void 0:u.gte(o.MAX_INTEGER))throw l=this._errorMsg("".concat(b," cannot equal or exceed MAX_INTEGER (2^256-1), given ").concat(u)),new Error(l)}else if(null==u?void 0:u.gt(o.MAX_INTEGER))throw l=this._errorMsg("".concat(b," cannot exceed MAX_INTEGER (2^256-1), given ").concat(u)),new Error(l);break;default:throw l=this._errorMsg("unimplemented bits value"),new Error(l)}}}catch(e){r={error:e}}finally{try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(r)throw r.error}}},e.prototype._getSharedErrorPostfix=function(){var e="";try{e=this.isSigned()?(0,o.bufferToHex)(this.hash()):"not available (unsigned)"}catch(t){e="error"}var t="";try{t=this.isSigned().toString()}catch(t){e="error"}var a="";try{a=this.common.hardfork()}catch(e){a="error"}return"tx type=".concat(this.type," hash=").concat(e," nonce=").concat(this.nonce," value=").concat(this.value," ")+"signed=".concat(t," hf=").concat(a)},e}();t.BaseTransaction=b},3160:function(e,t,a){"use strict";var r,c=a(8834).Buffer,n=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function a(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(a.prototype=t.prototype,new a)}),d=this&&this.__assign||function(){return d=Object.assign||function(e){for(var t,a=1,r=arguments.length;a<r;a++)for(var c in t=arguments[a])Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c]);return e},d.apply(this,arguments)},f=this&&this.__read||function(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var r,c,n=a.call(e),d=[];try{for(;(void 0===t||t-- >0)&&!(r=n.next()).done;)d.push(r.value)}catch(e){c={error:e}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(c)throw c.error}}return d};Object.defineProperty(t,"__esModule",{value:!0});var i=a(7144),o=a(5204),s=a(8871),b=a(3165),u=c.from(2..toString(16).padStart(2,"0"),"hex"),l=function(e){function t(t,a){void 0===a&&(a={});var r,c,n=this;(n=e.call(this,d(d({},t),{type:2}),a)||this).DEFAULT_HARDFORK="london";var f=t.chainId,o=t.accessList,u=t.maxFeePerGas,l=t.maxPriorityFeePerGas;if(n.common=n._getCommon(a.common,f),n.chainId=n.common.chainIdBN(),!n.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");n.activeCapabilities=n.activeCapabilities.concat([1559,2718,2930]);var h=b.AccessLists.getAccessListData(null!=o?o:[]);if(n.accessList=h.accessList,n.AccessListJSON=h.AccessListJSON,b.AccessLists.verifyAccessList(n.accessList),n.maxFeePerGas=new i.BN((0,i.toBuffer)(""===u?"0x":u)),n.maxPriorityFeePerGas=new i.BN((0,i.toBuffer)(""===l?"0x":l)),n._validateCannotExceedMaxInteger({maxFeePerGas:n.maxFeePerGas,maxPriorityFeePerGas:n.maxPriorityFeePerGas}),n.gasLimit.mul(n.maxFeePerGas).gt(i.MAX_INTEGER)){var x=n._errorMsg("gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)");throw new Error(x)}if(n.maxFeePerGas.lt(n.maxPriorityFeePerGas))throw x=n._errorMsg("maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)"),new Error(x);if(n.v&&!n.v.eqn(0)&&!n.v.eqn(1))throw x=n._errorMsg("The y-parity of the transaction should either be 0 or 1"),new Error(x);if(n.common.gteHardfork("homestead")&&(null===(r=n.s)||void 0===r?void 0:r.gt(s.N_DIV_2)))throw x=n._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid"),new Error(x);return n.common.isActivatedEIP(3860)&&(0,b.checkMaxInitCodeSize)(n.common,n.data.length),(null===(c=null==a?void 0:a.freeze)||void 0===c||c)&&Object.freeze(n),n}return n(t,e),Object.defineProperty(t.prototype,"senderR",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"senderS",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"yParity",{get:function(){return this.v},enumerable:!1,configurable:!0}),t.fromTxData=function(e,a){return void 0===a&&(a={}),new t(e,a)},t.fromSerializedTx=function(e,a){if(void 0===a&&(a={}),!e.slice(0,1).equals(u))throw new Error("Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: ".concat(2,", received: ").concat(e.slice(0,1).toString("hex")));var r=i.rlp.decode(e.slice(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return t.fromValuesArray(r,a)},t.fromRlpSerializedTx=function(e,a){return void 0===a&&(a={}),t.fromSerializedTx(e,a)},t.fromValuesArray=function(e,a){if(void 0===a&&(a={}),9!==e.length&&12!==e.length)throw new Error("Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx).");var r=f(e,12),c=r[0],n=r[1],d=r[2],o=r[3],s=r[4],b=r[5],u=r[6],l=r[7],h=r[8],x=r[9],p=r[10],g=r[11];return(0,i.validateNoLeadingZeroes)({nonce:n,maxPriorityFeePerGas:d,maxFeePerGas:o,gasLimit:s,value:u,v:x,r:p,s:g}),new t({chainId:new i.BN(c),nonce:n,maxPriorityFeePerGas:d,maxFeePerGas:o,gasLimit:s,to:b,value:u,data:l,accessList:null!=h?h:[],v:void 0!==x?new i.BN(x):void 0,r:p,s:g},a)},t.prototype.getDataFee=function(){if(this.cache.dataFee&&this.cache.dataFee.hardfork===this.common.hardfork())return this.cache.dataFee.value;var t=e.prototype.getDataFee.call(this);return t.iaddn(b.AccessLists.getDataFeeEIP2930(this.accessList,this.common)),Object.isFrozen(this)&&(this.cache.dataFee={value:t,hardfork:this.common.hardfork()}),t},t.prototype.getUpfrontCost=function(e){void 0===e&&(e=new i.BN(0));var t=i.BN.min(this.maxPriorityFeePerGas,this.maxFeePerGas.sub(e)).add(e);return this.gasLimit.mul(t).add(this.value)},t.prototype.raw=function(){return[(0,i.bnToUnpaddedBuffer)(this.chainId),(0,i.bnToUnpaddedBuffer)(this.nonce),(0,i.bnToUnpaddedBuffer)(this.maxPriorityFeePerGas),(0,i.bnToUnpaddedBuffer)(this.maxFeePerGas),(0,i.bnToUnpaddedBuffer)(this.gasLimit),void 0!==this.to?this.to.buf:c.from([]),(0,i.bnToUnpaddedBuffer)(this.value),this.data,this.accessList,void 0!==this.v?(0,i.bnToUnpaddedBuffer)(this.v):c.from([]),void 0!==this.r?(0,i.bnToUnpaddedBuffer)(this.r):c.from([]),void 0!==this.s?(0,i.bnToUnpaddedBuffer)(this.s):c.from([])]},t.prototype.serialize=function(){var e=this.raw();return c.concat([u,i.rlp.encode(e)])},t.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,9),a=c.concat([u,i.rlp.encode(t)]);return e?(0,i.keccak256)(a):a},t.prototype.hash=function(){if(!this.isSigned()){var e=this._errorMsg("Cannot call hash method if transaction is not signed");throw new Error(e)}return Object.isFrozen(this)?(this.cache.hash||(this.cache.hash=(0,i.keccak256)(this.serialize())),this.cache.hash):(0,i.keccak256)(this.serialize())},t.prototype.getMessageToVerifySignature=function(){return this.getMessageToSign()},t.prototype.getSenderPublicKey=function(){var e;if(!this.isSigned()){var t=this._errorMsg("Cannot call this method if transaction is not signed");throw new Error(t)}var a=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(s.N_DIV_2)))throw t=this._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid"),new Error(t);var r=this,c=r.v,n=r.r,d=r.s;try{return(0,i.ecrecover)(a,c.addn(27),(0,i.bnToUnpaddedBuffer)(n),(0,i.bnToUnpaddedBuffer)(d))}catch(e){throw t=this._errorMsg("Invalid Signature"),new Error(t)}},t.prototype._processSignature=function(e,a,r){var c=d(d({},this.txOptions),{common:this.common});return t.fromTxData({chainId:this.chainId,nonce:this.nonce,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:new i.BN(e-27),r:new i.BN(a),s:new i.BN(r)},c)},t.prototype.toJSON=function(){var e=b.AccessLists.getAccessListJSON(this.accessList);return{chainId:(0,i.bnToHex)(this.chainId),nonce:(0,i.bnToHex)(this.nonce),maxPriorityFeePerGas:(0,i.bnToHex)(this.maxPriorityFeePerGas),maxFeePerGas:(0,i.bnToHex)(this.maxFeePerGas),gasLimit:(0,i.bnToHex)(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:(0,i.bnToHex)(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?(0,i.bnToHex)(this.v):void 0,r:void 0!==this.r?(0,i.bnToHex)(this.r):void 0,s:void 0!==this.s?(0,i.bnToHex)(this.s):void 0}},t.prototype.errorStr=function(){return this._getSharedErrorPostfix()+" maxFeePerGas=".concat(this.maxFeePerGas," maxPriorityFeePerGas=").concat(this.maxPriorityFeePerGas)},t.prototype._errorMsg=function(e){return"".concat(e," (").concat(this.errorStr(),")")},t}(o.BaseTransaction);t.default=l},2385:function(e,t,a){"use strict";var r,c=a(8834).Buffer,n=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function a(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(a.prototype=t.prototype,new a)}),d=this&&this.__assign||function(){return d=Object.assign||function(e){for(var t,a=1,r=arguments.length;a<r;a++)for(var c in t=arguments[a])Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c]);return e},d.apply(this,arguments)},f=this&&this.__read||function(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var r,c,n=a.call(e),d=[];try{for(;(void 0===t||t-- >0)&&!(r=n.next()).done;)d.push(r.value)}catch(e){c={error:e}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(c)throw c.error}}return d};Object.defineProperty(t,"__esModule",{value:!0});var i=a(7144),o=a(5204),s=a(8871),b=a(3165),u=c.from(1..toString(16).padStart(2,"0"),"hex"),l=function(e){function t(t,a){void 0===a&&(a={});var r,c,n=this;(n=e.call(this,d(d({},t),{type:1}),a)||this).DEFAULT_HARDFORK="berlin";var f=t.chainId,o=t.accessList,u=t.gasPrice;if(n.common=n._getCommon(a.common,f),n.chainId=n.common.chainIdBN(),!n.common.isActivatedEIP(2930))throw new Error("EIP-2930 not enabled on Common");n.activeCapabilities=n.activeCapabilities.concat([2718,2930]);var l=b.AccessLists.getAccessListData(null!=o?o:[]);if(n.accessList=l.accessList,n.AccessListJSON=l.AccessListJSON,b.AccessLists.verifyAccessList(n.accessList),n.gasPrice=new i.BN((0,i.toBuffer)(""===u?"0x":u)),n._validateCannotExceedMaxInteger({gasPrice:n.gasPrice}),n.gasPrice.mul(n.gasLimit).gt(i.MAX_INTEGER)){var h=n._errorMsg("gasLimit * gasPrice cannot exceed MAX_INTEGER");throw new Error(h)}if(n.v&&!n.v.eqn(0)&&!n.v.eqn(1))throw h=n._errorMsg("The y-parity of the transaction should either be 0 or 1"),new Error(h);if(n.common.gteHardfork("homestead")&&(null===(r=n.s)||void 0===r?void 0:r.gt(s.N_DIV_2)))throw h=n._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid"),new Error(h);return n.common.isActivatedEIP(3860)&&(0,b.checkMaxInitCodeSize)(n.common,n.data.length),(null===(c=null==a?void 0:a.freeze)||void 0===c||c)&&Object.freeze(n),n}return n(t,e),Object.defineProperty(t.prototype,"senderR",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"senderS",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"yParity",{get:function(){return this.v},enumerable:!1,configurable:!0}),t.fromTxData=function(e,a){return void 0===a&&(a={}),new t(e,a)},t.fromSerializedTx=function(e,a){if(void 0===a&&(a={}),!e.slice(0,1).equals(u))throw new Error("Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: ".concat(1,", received: ").concat(e.slice(0,1).toString("hex")));var r=i.rlp.decode(e.slice(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return t.fromValuesArray(r,a)},t.fromRlpSerializedTx=function(e,a){return void 0===a&&(a={}),t.fromSerializedTx(e,a)},t.fromValuesArray=function(e,a){if(void 0===a&&(a={}),8!==e.length&&11!==e.length)throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).");var r=f(e,11),c=r[0],n=r[1],d=r[2],o=r[3],s=r[4],b=r[5],u=r[6],l=r[7],h=r[8],x=r[9],p=r[10];return(0,i.validateNoLeadingZeroes)({nonce:n,gasPrice:d,gasLimit:o,value:b,v:h,r:x,s:p}),new t({chainId:new i.BN(c),nonce:n,gasPrice:d,gasLimit:o,to:s,value:b,data:u,accessList:null!=l?l:[],v:void 0!==h?new i.BN(h):void 0,r:x,s:p},a)},t.prototype.getDataFee=function(){if(this.cache.dataFee&&this.cache.dataFee.hardfork===this.common.hardfork())return this.cache.dataFee.value;var t=e.prototype.getDataFee.call(this);return t.iaddn(b.AccessLists.getDataFeeEIP2930(this.accessList,this.common)),Object.isFrozen(this)&&(this.cache.dataFee={value:t,hardfork:this.common.hardfork()}),t},t.prototype.getUpfrontCost=function(){return this.gasLimit.mul(this.gasPrice).add(this.value)},t.prototype.raw=function(){return[(0,i.bnToUnpaddedBuffer)(this.chainId),(0,i.bnToUnpaddedBuffer)(this.nonce),(0,i.bnToUnpaddedBuffer)(this.gasPrice),(0,i.bnToUnpaddedBuffer)(this.gasLimit),void 0!==this.to?this.to.buf:c.from([]),(0,i.bnToUnpaddedBuffer)(this.value),this.data,this.accessList,void 0!==this.v?(0,i.bnToUnpaddedBuffer)(this.v):c.from([]),void 0!==this.r?(0,i.bnToUnpaddedBuffer)(this.r):c.from([]),void 0!==this.s?(0,i.bnToUnpaddedBuffer)(this.s):c.from([])]},t.prototype.serialize=function(){var e=this.raw();return c.concat([u,i.rlp.encode(e)])},t.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,8),a=c.concat([u,i.rlp.encode(t)]);return e?(0,i.keccak256)(a):a},t.prototype.hash=function(){if(!this.isSigned()){var e=this._errorMsg("Cannot call hash method if transaction is not signed");throw new Error(e)}return Object.isFrozen(this)?(this.cache.hash||(this.cache.hash=(0,i.keccak256)(this.serialize())),this.cache.hash):(0,i.keccak256)(this.serialize())},t.prototype.getMessageToVerifySignature=function(){return this.getMessageToSign()},t.prototype.getSenderPublicKey=function(){var e;if(!this.isSigned()){var t=this._errorMsg("Cannot call this method if transaction is not signed");throw new Error(t)}var a=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(s.N_DIV_2)))throw t=this._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid"),new Error(t);var r=this,c=r.yParity,n=r.r,d=r.s;try{return(0,i.ecrecover)(a,c.addn(27),(0,i.bnToUnpaddedBuffer)(n),(0,i.bnToUnpaddedBuffer)(d))}catch(e){throw t=this._errorMsg("Invalid Signature"),new Error(t)}},t.prototype._processSignature=function(e,a,r){var c=d(d({},this.txOptions),{common:this.common});return t.fromTxData({chainId:this.chainId,nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:new i.BN(e-27),r:new i.BN(a),s:new i.BN(r)},c)},t.prototype.toJSON=function(){var e=b.AccessLists.getAccessListJSON(this.accessList);return{chainId:(0,i.bnToHex)(this.chainId),nonce:(0,i.bnToHex)(this.nonce),gasPrice:(0,i.bnToHex)(this.gasPrice),gasLimit:(0,i.bnToHex)(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:(0,i.bnToHex)(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?(0,i.bnToHex)(this.v):void 0,r:void 0!==this.r?(0,i.bnToHex)(this.r):void 0,s:void 0!==this.s?(0,i.bnToHex)(this.s):void 0}},t.prototype.errorStr=function(){var e,t;return this._getSharedErrorPostfix()+" gasPrice=".concat(this.gasPrice," accessListCount=").concat(null!==(t=null===(e=this.accessList)||void 0===e?void 0:e.length)&&void 0!==t?t:0)},t.prototype._errorMsg=function(e){return"".concat(e," (").concat(this.errorStr(),")")},t}(o.BaseTransaction);t.default=l},3498:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var c=Object.getOwnPropertyDescriptor(t,a);c&&!("get"in c?!t.__esModule:c.writable||c.configurable)||(c={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,c)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),c=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||r(t,e,a)},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeeMarketEIP1559Transaction=t.TransactionFactory=t.AccessListEIP2930Transaction=t.Transaction=void 0;var d=a(1719);Object.defineProperty(t,"Transaction",{enumerable:!0,get:function(){return n(d).default}});var f=a(2385);Object.defineProperty(t,"AccessListEIP2930Transaction",{enumerable:!0,get:function(){return n(f).default}});var i=a(9175);Object.defineProperty(t,"TransactionFactory",{enumerable:!0,get:function(){return n(i).default}});var o=a(3160);Object.defineProperty(t,"FeeMarketEIP1559Transaction",{enumerable:!0,get:function(){return n(o).default}}),c(a(8871),t)},1719:function(e,t,a){"use strict";var r,c=a(8834).Buffer,n=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function a(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(a.prototype=t.prototype,new a)}),d=this&&this.__assign||function(){return d=Object.assign||function(e){for(var t,a=1,r=arguments.length;a<r;a++)for(var c in t=arguments[a])Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c]);return e},d.apply(this,arguments)},f=this&&this.__read||function(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var r,c,n=a.call(e),d=[];try{for(;(void 0===t||t-- >0)&&!(r=n.next()).done;)d.push(r.value)}catch(e){c={error:e}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(c)throw c.error}}return d};Object.defineProperty(t,"__esModule",{value:!0});var i=a(7144),o=a(8871),s=a(5204),b=a(3165),u=function(e){function t(t,a){void 0===a&&(a={});var r,c=this;if((c=e.call(this,d(d({},t),{type:0}),a)||this).common=c._validateTxV(c.v,a.common),c.gasPrice=new i.BN((0,i.toBuffer)(""===t.gasPrice?"0x":t.gasPrice)),c.gasPrice.mul(c.gasLimit).gt(i.MAX_INTEGER)){var n=c._errorMsg("gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)");throw new Error(n)}if(c._validateCannotExceedMaxInteger({gasPrice:c.gasPrice}),c.common.gteHardfork("spuriousDragon"))if(c.isSigned()){var f=c.v,s=c.common.chainIdBN().muln(2);(f.eq(s.addn(35))||f.eq(s.addn(36)))&&c.activeCapabilities.push(o.Capability.EIP155ReplayProtection)}else c.activeCapabilities.push(o.Capability.EIP155ReplayProtection);return c.common.isActivatedEIP(3860)&&(0,b.checkMaxInitCodeSize)(c.common,c.data.length),(null===(r=null==a?void 0:a.freeze)||void 0===r||r)&&Object.freeze(c),c}return n(t,e),t.fromTxData=function(e,a){return void 0===a&&(a={}),new t(e,a)},t.fromSerializedTx=function(e,t){void 0===t&&(t={});var a=i.rlp.decode(e);if(!Array.isArray(a))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(a,t)},t.fromRlpSerializedTx=function(e,a){return void 0===a&&(a={}),t.fromSerializedTx(e,a)},t.fromValuesArray=function(e,a){if(void 0===a&&(a={}),6!==e.length&&9!==e.length)throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx).");var r=f(e,9),c=r[0],n=r[1],d=r[2],o=r[3],s=r[4],b=r[5],u=r[6],l=r[7],h=r[8];return(0,i.validateNoLeadingZeroes)({nonce:c,gasPrice:n,gasLimit:d,value:s,v:u,r:l,s:h}),new t({nonce:c,gasPrice:n,gasLimit:d,to:o,value:s,data:b,v:u,r:l,s:h},a)},t.prototype.raw=function(){return[(0,i.bnToUnpaddedBuffer)(this.nonce),(0,i.bnToUnpaddedBuffer)(this.gasPrice),(0,i.bnToUnpaddedBuffer)(this.gasLimit),void 0!==this.to?this.to.buf:c.from([]),(0,i.bnToUnpaddedBuffer)(this.value),this.data,void 0!==this.v?(0,i.bnToUnpaddedBuffer)(this.v):c.from([]),void 0!==this.r?(0,i.bnToUnpaddedBuffer)(this.r):c.from([]),void 0!==this.s?(0,i.bnToUnpaddedBuffer)(this.s):c.from([])]},t.prototype.serialize=function(){return i.rlp.encode(this.raw())},t.prototype._getMessageToSign=function(){var e=[(0,i.bnToUnpaddedBuffer)(this.nonce),(0,i.bnToUnpaddedBuffer)(this.gasPrice),(0,i.bnToUnpaddedBuffer)(this.gasLimit),void 0!==this.to?this.to.buf:c.from([]),(0,i.bnToUnpaddedBuffer)(this.value),this.data];return this.supports(o.Capability.EIP155ReplayProtection)&&(e.push((0,i.toBuffer)(this.common.chainIdBN())),e.push((0,i.unpadBuffer)((0,i.toBuffer)(0))),e.push((0,i.unpadBuffer)((0,i.toBuffer)(0)))),e},t.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this._getMessageToSign();return e?(0,i.rlphash)(t):t},t.prototype.getDataFee=function(){return this.cache.dataFee&&this.cache.dataFee.hardfork===this.common.hardfork()?this.cache.dataFee.value:(Object.isFrozen(this)&&(this.cache.dataFee={value:e.prototype.getDataFee.call(this),hardfork:this.common.hardfork()}),e.prototype.getDataFee.call(this))},t.prototype.getUpfrontCost=function(){return this.gasLimit.mul(this.gasPrice).add(this.value)},t.prototype.hash=function(){return Object.isFrozen(this)?(this.cache.hash||(this.cache.hash=(0,i.rlphash)(this.raw())),this.cache.hash):(0,i.rlphash)(this.raw())},t.prototype.getMessageToVerifySignature=function(){if(!this.isSigned()){var e=this._errorMsg("This transaction is not signed");throw new Error(e)}var t=this._getMessageToSign();return(0,i.rlphash)(t)},t.prototype.getSenderPublicKey=function(){var e,t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(o.N_DIV_2))){var a=this._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");throw new Error(a)}var r=this,c=r.v,n=r.r,d=r.s;try{return(0,i.ecrecover)(t,c,(0,i.bnToUnpaddedBuffer)(n),(0,i.bnToUnpaddedBuffer)(d),this.supports(o.Capability.EIP155ReplayProtection)?this.common.chainIdBN():void 0)}catch(e){throw a=this._errorMsg("Invalid Signature"),new Error(a)}},t.prototype._processSignature=function(e,a,r){var c=new i.BN(e);this.supports(o.Capability.EIP155ReplayProtection)&&c.iadd(this.common.chainIdBN().muln(2).addn(8));var n=d(d({},this.txOptions),{common:this.common});return t.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:c,r:new i.BN(a),s:new i.BN(r)},n)},t.prototype.toJSON=function(){return{nonce:(0,i.bnToHex)(this.nonce),gasPrice:(0,i.bnToHex)(this.gasPrice),gasLimit:(0,i.bnToHex)(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:(0,i.bnToHex)(this.value),data:"0x"+this.data.toString("hex"),v:void 0!==this.v?(0,i.bnToHex)(this.v):void 0,r:void 0!==this.r?(0,i.bnToHex)(this.r):void 0,s:void 0!==this.s?(0,i.bnToHex)(this.s):void 0}},t.prototype._validateTxV=function(e,t){if(void 0!==e&&e.ltn(37)&&!e.eqn(27)&&!e.eqn(28))throw new Error("Legacy txs need either v = 27/28 or v >= 37 (EIP-155 replay protection), got v = ".concat(e));var a;if(void 0!==e&&(!t||t.gteHardfork("spuriousDragon"))&&!e.eqn(27)&&!e.eqn(28))if(t){var r=t.chainIdBN().muln(2);if(!e.eq(r.addn(35))&&!e.eq(r.addn(36)))throw new Error("Incompatible EIP155-based V ".concat(e," and chain id ").concat(t.chainIdBN(),". See the Common parameter of the Transaction constructor to set the chain id."))}else{var c;c=e.subn(35).isEven()?35:36,a=e.subn(c).divn(2)}return this._getCommon(t,a)},t.prototype._unsignedTxImplementsEIP155=function(){return this.common.gteHardfork("spuriousDragon")},t.prototype._signedTxImplementsEIP155=function(){if(!this.isSigned()){var e=this._errorMsg("This transaction is not signed");throw new Error(e)}var t=this.common.gteHardfork("spuriousDragon"),a=this.v,r=this.common.chainIdBN().muln(2);return(a.eq(r.addn(35))||a.eq(r.addn(36)))&&t},t.prototype.errorStr=function(){return this._getSharedErrorPostfix()+" gasPrice=".concat(this.gasPrice)},t.prototype._errorMsg=function(e){return"".concat(e," (").concat(this.errorStr(),")")},t}(s.BaseTransaction);t.default=u},9175:(e,t,a)=>{"use strict";var r=a(8834).Buffer;Object.defineProperty(t,"__esModule",{value:!0});var c=a(7144),n=a(3498),d=function(){function e(){}return e.fromTxData=function(e,t){if(void 0===t&&(t={}),"type"in e&&void 0!==e.type){var a=new c.BN((0,c.toBuffer)(e.type)).toNumber();if(0===a)return n.Transaction.fromTxData(e,t);if(1===a)return n.AccessListEIP2930Transaction.fromTxData(e,t);if(2===a)return n.FeeMarketEIP1559Transaction.fromTxData(e,t);throw new Error("Tx instantiation with type ".concat(a," not supported"))}return n.Transaction.fromTxData(e,t)},e.fromSerializedData=function(e,t){if(void 0===t&&(t={}),e[0]<=127){var a=void 0;switch(e[0]){case 1:a=2930;break;case 2:a=1559;break;default:throw new Error("TypedTransaction with ID ".concat(e[0]," unknown"))}return 1559===a?n.FeeMarketEIP1559Transaction.fromSerializedTx(e,t):n.AccessListEIP2930Transaction.fromSerial