@brightunion/sdk
Version:
Brightjs is a set of javascript tools to interact with the Bright Union's risk platform aggregator's protocol on Ethereum, Binance Smart Chain and Polygon blockchains.
2 lines • 5.29 MB
JavaScript
/*! For license information please see index.js.LICENSE.txt */
(()=>{var e={31200:(e,t,n)=>{"use strict";function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){a(e,t,n[t])}))}return e}n.r(t),n.d(t,{default:()=>d});var i,s={debug:!1,containerId:null,dataLayerName:"dataLayer",dataLayer:void 0,preview:void 0,auth:void 0,execution:"async"},o={};function c(e){var t=o[e];t||(t=new RegExp("googletagmanager\\.com\\/gtm\\.js.*[?&]id="+e),o[e]=t);var n=document.querySelectorAll("script[src]");return!!Object.keys(n).filter((function(e){return(n[e].src||"").match(t)})).length}const d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{name:"google-tag-manager",config:r({},s,e),initialize:function(e){var t=e.config,n=t.containerId,a=t.dataLayerName,r=t.customScriptSrc,s=t.preview,o=t.auth,d=t.execution;if(!n)throw new Error("No google tag manager containerId defined");if(s&&!o)throw new Error("When enabling preview mode, both preview and auth parameters must be defined");var u=r||"https://www.googletagmanager.com/gtm.js";c(n)||(function(e,t,n,a,r){e[a]=e[a]||[],e[a].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var i=t.getElementsByTagName(n)[0],c=t.createElement(n),f="dataLayer"!=a?"&l="+a:"",l=s?">m_preview="+s+">m_auth="+o+">m_cookies_win=x":"";d&&(c[d]=!0),c.src="".concat(u,"?id=")+r+f+l,i.parentNode.insertBefore(c,i)}(window,document,"script",a,n),i=a,t.dataLayer=window[a])},page:function(e){var t=e.payload,n=(e.options,e.instance,e.config);void 0!==n.dataLayer&&n.dataLayer.push(t.properties)},track:function(e){var t=e.payload,n=(e.options,e.config);if(void 0!==n.dataLayer){var a=t.anonymousId,i=t.userId,s=t.properties,o=s;i&&(o.userId=i),a&&(o.anonymousId=a),s.category||(o.category="All"),n.debug&&console.log("gtag push",r({event:t.event},o)),n.dataLayer.push(r({event:t.event},o))}},loaded:function(){var t=!!i&&!(!window[i]||Array.prototype.push===window[i].push);return c(e.containerId)&&t}}}},74083:function(e,t,n){"use strict";var a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},r=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 i=r(n(87295)),s=r(n(31227)),o=r(n(40439)),c=r(n(37098)),d=r(n(17687)),u=r(n(49422));function f(e){var t,n,r={1:"mainnet",3:"ropsten",4:"rinkeby",42:"kovan",5:"goerli",11155111:"sepolia"},f={mainnet:i.default,ropsten:s.default,rinkeby:o.default,kovan:c.default,goerli:d.default,sepolia:u.default};if(e)try{for(var l=a(e),p=l.next();!p.done;p=l.next()){var b=p.value,y=b.name;r[b.chainId.toString()]=y,f[y]=b}}catch(e){t={error:e}}finally{try{p&&!p.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return f.names=r,f}t._getInitializedChains=f,t.chains=f()},97616:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EIPs=void 0,t.EIPs={1153:n(96561),1559:n(77523),2315:n(83339),2537:n(26769),2565:n(17897),2718:n(62170),2929:n(88436),2930:n(96213),3198:n(25491),3529:n(20070),3540:n(52256),3541:n(21871),3554:n(47225),3607:n(3968),3651:n(29496),3670:n(74290),3675:n(98571),3855:n(64551),3860:n(94300),4345:n(74818),4399:n(68372)}},37459:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hardforks=void 0,t.hardforks=[["chainstart",n(60114)],["homestead",n(62800)],["dao",n(7197)],["tangerineWhistle",n(22302)],["spuriousDragon",n(90716)],["byzantium",n(26985)],["constantinople",n(35993)],["petersburg",n(4064)],["istanbul",n(83166)],["muirGlacier",n(42946)],["berlin",n(20015)],["london",n(61250)],["shanghai",n(5553)],["arrowGlacier",n(51971)],["mergeForkIdTransition",n(49347)],["merge",n(88648)]]},2832:function(e,t,n){"use strict";var a,r=n(48764).Buffer,i=this&&this.__extends||(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},a(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 n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],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 c,d,u,f,l,p=n(17187),b=n(34606),y=n(22751),m=n(74083),h=n(37459),x=n(97616);!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"}(c=t.CustomChain||(t.CustomChain={})),(l=t.Chain||(t.Chain={}))[l.Mainnet=1]="Mainnet",l[l.Ropsten=3]="Ropsten",l[l.Rinkeby=4]="Rinkeby",l[l.Kovan=42]="Kovan",l[l.Goerli=5]="Goerli",l[l.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.Shanghai="shanghai",e.MergeForkIdTransition="mergeForkIdTransition",e.Merge="merge"}(d=t.Hardfork||(t.Hardfork={})),(f=t.ConsensusType||(t.ConsensusType={})).ProofOfStake="pos",f.ProofOfWork="pow",f.ProofOfAuthority="poa",(u=t.ConsensusAlgorithm||(t.ConsensusAlgorithm={})).Ethash="ethash",u.Clique="clique",u.Casper="casper";var g=function(e){function t(t){var n,a,r,i,s=this;(s=e.call(this)||this)._supportedHardforks=[],s._eips=[],s._customChains=null!==(r=t.customChains)&&void 0!==r?r:[],s._chainParams=s.setChain(t.chain),s.DEFAULT_HARDFORK=null!==(i=s._chainParams.defaultHardfork)&&void 0!==i?i:d.Istanbul;try{for(var c=o(s._chainParams.hardforks),u=c.next();!u.done;u=c.next()){var f=u.value;f.forkHash||(f.forkHash=s._calcForkHash(f.name))}}catch(e){n={error:e}}finally{try{u&&!u.done&&(a=c.return)&&a.call(c)}finally{if(n)throw n.error}}return s._hardfork=s.DEFAULT_HARDFORK,t.supportedHardforks&&(s._supportedHardforks=t.supportedHardforks),t.hardfork&&s.setHardfork(t.hardfork),t.eips&&s.setEIPs(t.eips),s}return i(t,e),t.custom=function(e,n){var a;void 0===n&&(n={});var r=null!==(a=n.baseChain)&&void 0!==a?a:"mainnet",i=s({},t._getChainParams(r));if(i.name="custom-chain","string"!=typeof e)return new t(s({chain:s(s({},i),e)},n));if(e===c.PolygonMainnet)return t.custom({name:c.PolygonMainnet,chainId:137,networkId:137},n);if(e===c.PolygonMumbai)return t.custom({name:c.PolygonMumbai,chainId:80001,networkId:80001},n);if(e===c.ArbitrumRinkebyTestnet)return t.custom({name:c.ArbitrumRinkebyTestnet,chainId:421611,networkId:421611},n);if(e===c.xDaiChain)return t.custom({name:c.xDaiChain,chainId:100,networkId:100},n);if(e===c.OptimisticKovan)return t.custom({name:c.OptimisticKovan,chainId:69,networkId:69},s({hardfork:d.Berlin},n));if(e===c.OptimisticEthereum)return t.custom({name:c.OptimisticEthereum,chainId:10,networkId:10},s({hardfork:d.Berlin},n));throw new Error("Custom chain ".concat(e," not supported"))},t.forCustomChain=function(e,n,a,r){var i=t._getChainParams(e);return new t({chain:s(s({},i),n),hardfork:a,supportedHardforks:r})},t.isSupportedChainId=function(e){var t=(0,m._getInitializedChains)();return Boolean(t.names[e.toString()])},t._getChainParams=function(e,t){var n=(0,m._getInitializedChains)(t);if("number"==typeof e||y.BN.isBN(e)){if(e=e.toString(),n.names[e])return n[n.names[e]];throw new Error("Chain with ID ".concat(e," not supported"))}if(n[e])return n[e];throw new Error("Chain with name ".concat(e," not supported"))},t.prototype.setChain=function(e){var n,a;if("number"==typeof e||"string"==typeof e||y.BN.isBN(e)){var r;r=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,r)}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 i=o(["networkId","genesis","hardforks","bootstrapNodes"]),s=i.next();!s.done;s=i.next()){var c=s.value;if(void 0===e[c])throw new Error("Missing required chain parameter: ".concat(c))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.error}}this._chainParams=e}return this._chainParams},t.prototype.setHardfork=function(e){var t,n;if(!this._isSupportedHardfork(e))throw new Error("Hardfork ".concat(e," not set as supported in supportedHardforks"));var a=!1;try{for(var r=o(h.hardforks),i=r.next();!i.done;i=r.next())i.value[0]===e&&(this._hardfork!==e&&(this._hardfork=e,this.emit("hardforkChanged",e)),a=!0)}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}if(!a)throw new Error("Hardfork with name ".concat(e," not supported"))},t.prototype.getHardforkByBlockNumber=function(e,t){var n,a;e=(0,y.toType)(e,y.TypeOutput.BN),t=(0,y.toType)(t,y.TypeOutput.BN);var r,i,s,c=d.Chainstart;try{for(var u=o(this.hardforks()),f=u.next();!f.done;f=u.next()){var l=f.value;if(null!==l.block)e.gte(new y.BN(l.block))&&(c=l.name),t&&l.td&&(t.gte(new y.BN(l.td))?r=l.name:i=s),s=l.name;else if(null!=t&&void 0!==l.td&&null!==l.td&&t.gte(new y.BN(l.td)))return l.name}}catch(e){n={error:e}}finally{try{f&&!f.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}if(t){var p="block number: ".concat(e," (-> ").concat(c,"), ");if(r&&!this.hardforkGteHardfork(c,r)){var b="HF determined by block number is lower than the minimum total difficulty HF";throw p+="total difficulty: ".concat(t," (-> ").concat(r,")"),new Error("".concat(b,": ").concat(p))}if(i&&!this.hardforkGteHardfork(i,c))throw b="Maximum HF determined by total difficulty is lower than the block number HF",p+="total difficulty: ".concat(t," (-> ").concat(i,")"),new Error("".concat(b,": ").concat(p))}return c},t.prototype.setHardforkByBlockNumber=function(e,t){var n=this.getHardforkByBlockNumber(e,t);return this.setHardfork(n),n},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,n,a=this.hardforks();try{for(var r=o(a),i=r.next();!i.done;i=r.next()){var s=i.value;if(s.name===e)return s}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}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,n;if(!(this._supportedHardforks.length>0))return!0;try{for(var a=o(this._supportedHardforks),r=a.next();!r.done;r=a.next())if(e===r.value)return!0}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return!1},t.prototype.setEIPs=function(e){var t,n,a=this;void 0===e&&(e=[]);var r=function(t){if(!(t in x.EIPs))throw new Error("".concat(t," not supported"));var n=i.gteHardfork(x.EIPs[t].minimumHardfork);if(!n)throw new Error("".concat(t," cannot be activated on hardfork ").concat(i.hardfork(),", minimumHardfork: ").concat(n));x.EIPs[t].requiredEIPs&&x.EIPs[t].requiredEIPs.forEach((function(n){if(!e.includes(n)&&!a.isActivatedEIP(n))throw new Error("".concat(t," requires EIP ").concat(n,", but is not included in the EIP list"))}))},i=this;try{for(var s=o(e),c=s.next();!c.done;c=s.next())r(c.value)}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}this._eips=e},t.prototype.param=function(e,t){var n,a,r=null;try{for(var i=o(this._eips),s=i.next();!s.done;s=i.next()){var c=s.value;if(null!==(r=this.paramByEIP(e,t,c)))return r}}catch(e){n={error:e}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.error}}return this.paramByHardfork(e,t,this._hardfork)},t.prototype.paramByHardfork=function(e,t,n){var a,r,i,s;n=this._chooseHardfork(n);var c=null;try{for(var d=o(h.hardforks),u=d.next();!u.done;u=d.next()){var f=u.value;if("eips"in f[1]){var l=f[1].eips;try{for(var p=(i=void 0,o(l)),b=p.next();!b.done;b=p.next()){var y=b.value,m=this.paramByEIP(e,t,y);c=null!==m?m:c}}catch(e){i={error:e}}finally{try{b&&!b.done&&(s=p.return)&&s.call(p)}finally{if(i)throw i.error}}}else{if(!f[1][e])throw new Error("Topic ".concat(e," not defined"));void 0!==f[1][e][t]&&(c=f[1][e][t].v)}if(f[0]===n)break}}catch(e){a={error:e}}finally{try{u&&!u.done&&(r=d.return)&&r.call(d)}finally{if(a)throw a.error}}return c},t.prototype.paramByEIP=function(e,t,n){if(!(n in x.EIPs))throw new Error("".concat(n," not supported"));var a=x.EIPs[n];if(!(e in a))throw new Error("Topic ".concat(e," not defined"));return void 0===a[e][t]?null:a[e][t].v},t.prototype.paramByBlock=function(e,t,n){var a=this.activeHardforks(n),r=a[a.length-1].name;return this.paramByHardfork(e,t,r)},t.prototype.isActivatedEIP=function(e){var t,n;if(this.eips().includes(e))return!0;try{for(var a=o(h.hardforks),r=a.next();!r.done;r=a.next()){var i=r.value[1];if(this.gteHardfork(i.name)&&"eips"in i&&i.eips.includes(e))return!0}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return!1},t.prototype.hardforkIsActiveOnBlock=function(e,t,n){var a;void 0===n&&(n={}),t=(0,y.toType)(t,y.TypeOutput.BN);var r=null!==(a=n.onlySupported)&&void 0!==a&&a;e=this._chooseHardfork(e,r);var i=this.hardforkBlockBN(e);return!(!i||!t.gte(i))},t.prototype.activeOnBlock=function(e,t){return this.hardforkIsActiveOnBlock(null,e,t)},t.prototype.hardforkGteHardfork=function(e,t,n){var a,r;void 0===n&&(n={});var i,s=void 0!==n.onlyActive&&n.onlyActive;e=this._chooseHardfork(e,n.onlySupported),i=s?this.activeHardforks(null,n):this.hardforks();var c=-1,d=-1,u=0;try{for(var f=o(i),l=f.next();!l.done;l=f.next()){var p=l.value;p.name===e&&(c=u),p.name===t&&(d=u),u+=1}}catch(e){a={error:e}}finally{try{l&&!l.done&&(r=f.return)&&r.call(f)}finally{if(a)throw a.error}}return c>=d&&-1!==d},t.prototype.gteHardfork=function(e,t){return this.hardforkGteHardfork(null,e,t)},t.prototype.hardforkIsActiveOnChain=function(e,t){var n,a,r;void 0===t&&(t={});var i=null!==(r=t.onlySupported)&&void 0!==r&&r;e=this._chooseHardfork(e,i);try{for(var s=o(this.hardforks()),c=s.next();!c.done;c=s.next()){var d=c.value;if(d.name===e&&null!==d.block)return!0}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}return!1},t.prototype.activeHardforks=function(e,t){var n,a;void 0===t&&(t={});var r=[],i=this.hardforks();try{for(var s=o(i),c=s.next();!c.done;c=s.next()){var d=c.value;if(null!==d.block){if(null!=e&&e<d.block)break;t.onlySupported&&!this._isSupportedHardfork(d.name)||r.push(d)}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}return r},t.prototype.activeHardfork=function(e,t){void 0===t&&(t={});var n=this.activeHardforks(e,t);if(n.length>0)return n[n.length-1].name;throw new Error("No (supported) active hardfork found")},t.prototype.hardforkBlock=function(e){var t=this.hardforkBlockBN(e);return(0,y.toType)(t,y.TypeOutput.Number)},t.prototype.hardforkBlockBN=function(e){e=this._chooseHardfork(e,!1);var t=this._getHardfork(e).block;return null==t?null:new y.BN(t)},t.prototype.hardforkTD=function(e){e=this._chooseHardfork(e,!1);var t=this._getHardfork(e).td;return null==t?null:new y.BN(t)},t.prototype.isHardforkBlock=function(e,t){e=(0,y.toType)(e,y.TypeOutput.BN),t=this._chooseHardfork(t,!1);var n=this.hardforkBlockBN(t);return!!n&&n.eq(e)},t.prototype.nextHardforkBlock=function(e){var t=this.nextHardforkBlockBN(e);return(0,y.toType)(t,y.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,n){var a=new y.BN(n.block);return a.gt(t)&&null===e?a:e}),null)},t.prototype.isNextHardforkBlock=function(e,t){e=(0,y.toType)(e,y.TypeOutput.BN),t=this._chooseHardfork(t,!1);var n=this.nextHardforkBlockBN(t);return null!==n&&n.eq(e)},t.prototype._calcForkHash=function(e){var t,n,a=r.from(this.genesis().hash.substr(2),"hex"),i=r.alloc(0),s=0;try{for(var c=o(this.hardforks()),d=c.next();!d.done;d=c.next()){var u=d.value,f=u.block;if(0!==f&&null!==f&&f!==s){var l=r.from(f.toString(16).padStart(16,"0"),"hex");i=r.concat([i,l])}if(u.name===e)break;null!==f&&(s=f)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}var p=r.concat([a,i]),m=(0,y.intToBuffer)((0,b.buf)(p)>>>0).toString("hex");return"0x".concat(m)},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 n(31617);case"ropsten":return n(53712);case"rinkeby":return n(3023);case"kovan":return n(28777);case"goerli":return n(15382);case"sepolia":return n(81847)}if(this._customChains&&this._customChains.length>0&&Array.isArray(this._customChains[0]))try{for(var a=o(this._customChains),r=a.next();!r.done;r=a.next()){var i=r.value;if(i[0].name===this.chainName())return i[1]}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=a.return)&&t.call(a)}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,y.toType)(this.chainIdBN(),y.TypeOutput.Number)},t.prototype.chainIdBN=function(){return new y.BN(this._chainParams.chainId)},t.prototype.chainName=function(){return this._chainParams.name},t.prototype.networkId=function(){return(0,y.toType)(this.networkIdBN(),y.TypeOutput.Number)},t.prototype.networkIdBN=function(){return new y.BN(this._chainParams.networkId)},t.prototype.eips=function(){return this._eips},t.prototype.consensusType=function(){var e,t,n,a=this.hardfork();try{for(var r=o(h.hardforks),i=r.next();!i.done;i=r.next()){var s=i.value;if("consensus"in s[1]&&(n=s[1].consensus.type),s[0]===a)break}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n||this._chainParams.consensus.type},t.prototype.consensusAlgorithm=function(){var e,t,n,a=this.hardfork();try{for(var r=o(h.hardforks),i=r.next();!i.done;i=r.next()){var s=i.value;if("consensus"in s[1]&&(n=s[1].consensus.algorithm),s[0]===a)break}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n||this._chainParams.consensus.algorithm},t.prototype.consensusConfig=function(){var e,t,n,a=this.hardfork();try{for(var r=o(h.hardforks),i=r.next();!i.done;i=r.next()){var s=i.value;if("consensus"in s[1]&&(n=s[1].consensus[s[1].consensus.algorithm]),s[0]===a)break}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}if(n)return n;var c=this.consensusAlgorithm();return this._chainParams.consensus[c]},t.prototype.copy=function(){var e=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return e.removeAllListeners(),e},t}(p.EventEmitter);t.default=g},36225:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,r)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return r(t,e),t},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=i.next()).done;)s.push(a.value)}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTransaction=void 0;var c=i(n(2832)),d=n(22751),u=n(63458),f=function(){function e(e){this.cache={hash:void 0,dataFee:void 0},this.activeCapabilities=[],this.DEFAULT_CHAIN=c.Chain.Mainnet,this.DEFAULT_HARDFORK=c.Hardfork.Istanbul;var t=e.nonce,n=e.gasLimit,a=e.to,r=e.value,i=e.data,s=e.v,o=e.r,u=e.s,f=e.type;this._type=new d.BN((0,d.toBuffer)(f)).toNumber();var l=(0,d.toBuffer)(""===a?"0x":a),p=(0,d.toBuffer)(""===s?"0x":s),b=(0,d.toBuffer)(""===o?"0x":o),y=(0,d.toBuffer)(""===u?"0x":u);this.nonce=new d.BN((0,d.toBuffer)(""===t?"0x":t)),this.gasLimit=new d.BN((0,d.toBuffer)(""===n?"0x":n)),this.to=l.length>0?new d.Address(l):void 0,this.value=new d.BN((0,d.toBuffer)(""===r?"0x":r)),this.data=(0,d.toBuffer)(""===i?"0x":i),this.v=p.length>0?new d.BN(p):void 0,this.r=b.length>0?new d.BN(b):void 0,this.s=y.length>0?new d.BN(y):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"),n=0,a=0;a<this.data.length;a++)0===this.data[a]?n+=e:n+=t;if(n=new d.BN(n),(void 0===this.to||null===this.to)&&this.common.isActivatedEIP(3860)){var r=Math.ceil(this.data.length/32),i=new d.BN(this.common.param("gasPrices","initCodeWordCost")).imuln(r);n.iadd(i)}return n},e.prototype.toCreationAddress=function(){return void 0===this.to||0===this.to.buf.length},e.prototype.isSigned=function(){var e=this,t=e.v,n=e.r,a=e.s;return 0===this.type?!!(t&&n&&a):!(void 0===t||!n||!a)},e.prototype.verifySignature=function(){try{var e=this.getSenderPublicKey();return 0!==(0,d.unpadBuffer)(e).length}catch(e){return!1}},e.prototype.getSenderAddress=function(){return new d.Address((0,d.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 n=!1;0===this.type&&this.common.gteHardfork("spuriousDragon")&&!this.supports(u.Capability.EIP155ReplayProtection)&&(this.activeCapabilities.push(u.Capability.EIP155ReplayProtection),n=!0);var a=this.getMessageToSign(!0),r=(0,d.ecsign)(a,e),i=r.v,s=r.r,o=r.s,c=this._processSignature(i,s,o);if(n){var f=this.activeCapabilities.indexOf(u.Capability.EIP155ReplayProtection);f>-1&&this.activeCapabilities.splice(f,1)}return c},e.prototype._getCommon=function(e,t){var n;if(t){var a=new d.BN((0,d.toBuffer)(t));if(e){if(!e.chainIdBN().eq(a)){var r=this._errorMsg("The chain ID does not match the chain ID of Common");throw new Error(r)}return e.copy()}return c.default.isSupportedChainId(a)?new c.default({chain:a,hardfork:this.DEFAULT_HARDFORK}):c.default.forCustomChain(this.DEFAULT_CHAIN,{name:"custom-chain",networkId:a,chainId:a},this.DEFAULT_HARDFORK)}return null!==(n=null==e?void 0:e.copy())&&void 0!==n?n:new c.default({chain:this.DEFAULT_CHAIN,hardfork:this.DEFAULT_HARDFORK})},e.prototype._validateCannotExceedMaxInteger=function(e,t,n){var a,r;void 0===t&&(t=256),void 0===n&&(n=!1);try{for(var i=s(Object.entries(e)),c=i.next();!c.done;c=i.next()){var u=o(c.value,2),f=u[0],l=u[1];switch(t){case 64:if(n){if(null==l?void 0:l.gte(d.MAX_UINT64)){var p=this._errorMsg("".concat(f," cannot equal or exceed MAX_UINT64 (2^64-1), given ").concat(l));throw new Error(p)}}else if(null==l?void 0:l.gt(d.MAX_UINT64))throw p=this._errorMsg("".concat(f," cannot exceed MAX_UINT64 (2^64-1), given ").concat(l)),new Error(p);break;case 256:if(n){if(null==l?void 0:l.gte(d.MAX_INTEGER))throw p=this._errorMsg("".concat(f," cannot equal or exceed MAX_INTEGER (2^256-1), given ").concat(l)),new Error(p)}else if(null==l?void 0:l.gt(d.MAX_INTEGER))throw p=this._errorMsg("".concat(f," cannot exceed MAX_INTEGER (2^256-1), given ").concat(l)),new Error(p);break;default:throw p=this._errorMsg("unimplemented bits value"),new Error(p)}}}catch(e){a={error:e}}finally{try{c&&!c.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}},e.prototype._getSharedErrorPostfix=function(){var e="";try{e=this.isSigned()?(0,d.bufferToHex)(this.hash()):"not available (unsigned)"}catch(t){e="error"}var t="";try{t=this.isSigned().toString()}catch(t){e="error"}var n="";try{n=this.common.hardfork()}catch(e){n="error"}return"tx type=".concat(this.type," hash=").concat(e," nonce=").concat(this.nonce," value=").concat(this.value," ")+"signed=".concat(t," hf=").concat(n)},e}();t.BaseTransaction=f},47669:function(e,t,n){"use strict";var a,r=n(48764).Buffer,i=this&&this.__extends||(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},a(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 n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=i.next()).done;)s.push(a.value)}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var c=n(22751),d=n(36225),u=n(63458),f=n(82942),l=r.from(2..toString(16).padStart(2,"0"),"hex"),p=function(e){function t(t,n){void 0===n&&(n={});var a,r,i=this;(i=e.call(this,s(s({},t),{type:2}))||this).DEFAULT_HARDFORK="london";var o=t.chainId,d=t.accessList,l=t.maxFeePerGas,p=t.maxPriorityFeePerGas;if(i.common=i._getCommon(n.common,o),i.chainId=i.common.chainIdBN(),!i.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");i.activeCapabilities=i.activeCapabilities.concat([1559,2718,2930]);var b=f.AccessLists.getAccessListData(null!=d?d:[]);if(i.accessList=b.accessList,i.AccessListJSON=b.AccessListJSON,f.AccessLists.verifyAccessList(i.accessList),i.maxFeePerGas=new c.BN((0,c.toBuffer)(""===l?"0x":l)),i.maxPriorityFeePerGas=new c.BN((0,c.toBuffer)(""===p?"0x":p)),i._validateCannotExceedMaxInteger({maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}),i.gasLimit.mul(i.maxFeePerGas).gt(c.MAX_INTEGER)){var y=i._errorMsg("gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)");throw new Error(y)}if(i.maxFeePerGas.lt(i.maxPriorityFeePerGas))throw y=i._errorMsg("maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)"),new Error(y);if(i.v&&!i.v.eqn(0)&&!i.v.eqn(1))throw y=i._errorMsg("The y-parity of the transaction should either be 0 or 1"),new Error(y);if(i.common.gteHardfork("homestead")&&(null===(a=i.s)||void 0===a?void 0:a.gt(u.N_DIV_2)))throw y=i._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid"),new Error(y);return i.common.isActivatedEIP(3860)&&(0,f.checkMaxInitCodeSize)(i.common,i.data.length),(null===(r=null==n?void 0:n.freeze)||void 0===r||r)&&Object.freeze(i),i}return i(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,n){return void 0===n&&(n={}),new t(e,n)},t.fromSerializedTx=function(e,n){if(void 0===n&&(n={}),!e.slice(0,1).equals(l))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 a=c.rlp.decode(e.slice(1));if(!Array.isArray(a))throw new Error("Invalid serialized tx input: must be array");return t.fromValuesArray(a,n)},t.fromRlpSerializedTx=function(e,n){return void 0===n&&(n={}),t.fromSerializedTx(e,n)},t.fromValuesArray=function(e,n){if(void 0===n&&(n={}),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 a=o(e,12),r=a[0],i=a[1],s=a[2],d=a[3],u=a[4],f=a[5],l=a[6],p=a[7],b=a[8],y=a[9],m=a[10],h=a[11];return(0,c.validateNoLeadingZeroes)({nonce:i,maxPriorityFeePerGas:s,maxFeePerGas:d,gasLimit:u,value:l,v:y,r:m,s:h}),new t({chainId:new c.BN(r),nonce:i,maxPriorityFeePerGas:s,maxFeePerGas:d,gasLimit:u,to:f,value:l,data:p,accessList:null!=b?b:[],v:void 0!==y?new c.BN(y):void 0,r:m,s:h},n)},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(f.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 c.BN(0));var t=c.BN.min(this.maxPriorityFeePerGas,this.maxFeePerGas.sub(e)).add(e);return this.gasLimit.mul(t).add(this.value)},t.prototype.raw=function(){return[(0,c.bnToUnpaddedBuffer)(this.chainId),(0,c.bnToUnpaddedBuffer)(this.nonce),(0,c.bnToUnpaddedBuffer)(this.maxPriorityFeePerGas),(0,c.bnToUnpaddedBuffer)(this.maxFeePerGas),(0,c.bnToUnpaddedBuffer)(this.gasLimit),void 0!==this.to?this.to.buf:r.from([]),(0,c.bnToUnpaddedBuffer)(this.value),this.data,this.accessList,void 0!==this.v?(0,c.bnToUnpaddedBuffer)(this.v):r.from([]),void 0!==this.r?(0,c.bnToUnpaddedBuffer)(this.r):r.from([]),void 0!==this.s?(0,c.bnToUnpaddedBuffer)(this.s):r.from([])]},t.prototype.serialize=function(){var e=this.raw();return r.concat([l,c.rlp.encode(e)])},t.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,9),n=r.concat([l,c.rlp.encode(t)]);return e?(0,c.keccak256)(n):n},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,c.keccak256)(this.serialize())),this.cache.hash):(0,c.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 n=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(u.N_DIV_2)))throw t=this._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid"),new Error(t);var a=this,r=a.v,i=a.r,s=a.s;try{return(0,c.ecrecover)(n,r.addn(27),(0,c.bnToUnpaddedBuffer)(i),(0,c.bnToUnpaddedBuffer)(s))}catch(e){throw t=this._errorMsg("Invalid Signature"),new Error(t)}},t.prototype._processSignature=function(e,n,a){var r={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 c.BN(e-27),r:new c.BN(n),s:new c.BN(a)},r)},t.prototype.toJSON=function(){var e=f.AccessLists.getAccessListJSON(this.accessList);return{chainId:(0,c.bnToHex)(this.chainId),nonce:(0,c.bnToHex)(this.nonce),maxPriorityFeePerGas:(0,c.bnToHex)(this.maxPriorityFeePerGas),maxFeePerGas:(0,c.bnToHex)(this.maxFeePerGas),gasLimit:(0,c.bnToHex)(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:(0,c.bnToHex)(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?(0,c.bnToHex)(this.v):void 0,r:void 0!==this.r?(0,c.bnToHex)(this.r):void 0,s:void 0!==this.s?(0,c.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}(d.BaseTransaction);t.default=p},29325:function(e,t,n){"use strict";var a,r=n(48764).Buffer,i=this&&this.__extends||(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},a(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 n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=i.next()).done;)s.push(a.value)}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var c=n(22751),d=n(36225),u=n(63458),f=n(82942),l=r.from(1..toString(16).padStart(2,"0"),"hex"),p=function(e){function t(t,n){void 0===n&&(n={});var a,r,i=this;(i=e.call(this,s(s({},t),{type:1}))||this).DEFAULT_HARDFORK="berlin";var o=t.chainId,d=t.accessList,l=t.gasPrice;if(i.common=i._getCommon(n.common,o),i.chainId=i.common.chainIdBN(),!i.common.isActivatedEIP(2930))throw new Error("EIP-2930 not enabled on Common");i.activeCapabilities=i.activeCapabilities.concat([2718,2930]);var p=f.AccessLists.getAccessListData(null!=d?d:[]);if(i.accessList=p.accessList,i.AccessListJSON=p.AccessListJSON,f.AccessLists.verifyAccessList(i.accessList),i.gasPrice=new c.BN((0,c.toBuffer)(""===l?"0x":l)),i._validateCannotExceedMaxInteger({gasPrice:i.gasPrice}),i.gasPrice.mul(i.gasLimit).gt(c.MAX_INTEGER)){var b=i._errorMsg("gasLimit * gasPrice cannot exceed MAX_INTEGER");throw new Error(b)}if(i.v&&!i.v.eqn(0)&&!i.v.eqn(1))throw b=i._errorMsg("The y-parity of the transaction should either be 0 or 1"),new Error(b);if(i.common.gteHardfork("homestead")&&(null===(a=i.s)||void 0===a?void 0:a.gt(u.N_DIV_2)))throw b=i._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid"),new Error(b);return i.common.isActivatedEIP(3860)&&(0,f.checkMaxInitCodeSize)(i.common,i.data.length),(null===(r=null==n?void 0:n.freeze)||void 0===r||r)&&Object.freeze(i),i}return i(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,n){return void 0===n&&(n={}),new t(e,n)},t.fromSerializedTx=function(e,n){if(void 0===n&&(n={}),!e.slice(0,1).equals(l))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 a=c.rlp.decode(e.slice(1));if(!Array.isArray(a))throw new Error("Invalid serialized tx input: must be array");return t.fromValuesArray(a,n)},t.fromRlpSerializedTx=function(e,n){return void 0===n&&(n={}),t.fromSerializedTx(e,n)},t.fromValuesArray=function(e,n){if(void 0===n&&(n={}),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 a=o(e,11),r=a[0],i=a[1],s=a[2],d=a[3],u=a[4],f=a[5],l=a[6],p=a[7],b=a[8],y=a[9],m=a[10];return(0,c.validateNoLeadingZeroes)({nonce:i,gasPrice:s,gasLimit:d,value:f,v:b,r:y,s:m}),new t({chainId:new c.BN(r),nonce:i,gasPrice:s,gasLimit:d,to:u,value:f,data:l,accessList:null!=p?p:[],v:void 0!==b?new c.BN(b):void 0,r:y,s:m},n)},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(f.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,c.bnToUnpaddedBuffer)(this.chainId),(0,c.bnToUnpaddedBuffer)(this.nonce),(0,c.bnToUnpaddedBuffer)(this.gasPrice),(0,c.bnToUnpaddedBuffer)(this.gasLimit),void 0!==this.to?this.to.buf:r.from([]),(0,c.bnToUnpaddedBuffer)(this.value),this.data,this.accessList,void 0!==this.v?(0,c.bnToUnpaddedBuffer)(this.v):r.from([]),void 0!==this.r?(0,c.bnToUnpaddedBuffer)(this.r):r.from([]),void 0!==this.s?(0,c.bnToUnpaddedBuffer)(this.s):r.from([])]},t.prototype.serialize=function(){var e=this.raw();return r.concat([l,c.rlp.encode(e)])},t.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,8),n=r.concat([l,c.rlp.encode(t)]);return e?(0,c.keccak256)(n):n},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,c.keccak256)(this.serialize())),this.cache.hash):(0,c.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 n=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(u.N_DIV_2)))throw t=this._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid"),new Error(t);var a=this,r=a.yParity,i=a.r,s=a.s;try{return(0,c.ecrecover)(n,r.addn(27),(0,c.bnToUnpaddedBuffer)(i),(0,c.bnToUnpaddedBuffer)(s))}catch(e){throw t=this._errorMsg("Invalid Signature"),new Error(t)}},t.prototype._processSignature=function(e,n,a){var r={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 c.BN(e-27),r:new c.BN(n),s:new c.BN(a)},r)},t.prototype.toJSON=function(){var e=f.AccessLists.getAccessListJSON(this.accessList);return{chainId:(0,c.bnToHex)(this.chainId),nonce:(0,c.bnToHex)(this.nonce),gasPrice:(0,c.bnToHex)(this.gasPrice),gasLimit:(0,c.bnToHex)(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:(0,c.bnToHex)(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?(0,c.bnToHex)(this.v):void 0,r:void 0!==this.r?(0,c.bnToHex)(this.r):void 0,s:void 0!==this.s?(0,c.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}(d.BaseTransaction);t.default=p},66052:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,r)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)},i=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 s=n(35534);Object.defineProperty(t,"Transaction",{enumerable:!0,get:function(){return i(s).default}});var o=n(29325);Object.defineProperty(t,"AccessListEIP2930Transaction",{enumerable:!0,get:function(){return i(o).default}});var c=n(31932);Object.defineProperty(t,"TransactionFactory",{enumerable:!0,get:function(){return i(c).default}});var d=n(47669);Object.defineProperty(t,"FeeMarketEIP1559Transaction",{enumerable:!0,get:function(){return i(d).default}}),r(n(63458),t)},35534:function(e,t,n){"use strict";var a,r=n(48764).Buffer,i=this&&this.__extends||(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},a(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 n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=i.next()).done;)s.push(a.value)}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var c=n(22751),d=n(63458),u=n(36225),f=n(82942),l=function(e){function t(t,n){void 0===n&&(n={});var a,r=this;if((r=e.call(this,s(s({},t),{type:0}))||this).common=r._validateTxV(r.v,n.common),r.gasPrice=new c.BN((0,c.toBuffer)(""===t.gasPrice?"0x":t.gasPrice)),r.gasPrice.mul(r.gasLimit).gt(c.MAX_INTEGER)){var i=r._errorMsg("gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)");throw new Error(i)}if(r._validateCannotExceedMaxInteger({gasPrice:r.gasPrice}),r.common.gteHardfork("spuriousDragon"))if(r.isSigned()){var o=r.v,u=r.common.chainIdBN().muln(2);(o.eq(u.addn(35))||o.eq(u.addn(36)))&&r.activeCapabilities.push(d.Capability.EIP155ReplayProtection)}else r.activeCapabilities.push(d.Capability.EIP155ReplayProtection);return r.common.isActivatedEIP(3860)&&(0,f.checkMaxInitCodeSize)(r.common,r.data.length),(null===(a=null==n?void 0:n.freeze)||void 0===a||a)&&Object.freeze(r),r}return i(t,e),t.fromTxData=function(e,n){return void 0===n&&(n={}),new t(e,n)},t.fromSerializedTx=function(e,t){void 0===t&&(t={});var n=c.rlp.decode(e);if(!Array.isArray(n))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(n,t)},t.fromRlpSerializedTx=function(e,n){return void 0===n&&(n={}),t.fromSerializedTx(e,n)},t.fromValuesArray=function(e,n){if(void 0===n&&(n={}),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 a=o(e,9),r=a[0],i=a[1],s=a[2],d=a[3],u=a[4],f=a[5],l=a[6],p=a[7],b=a[8];return(0,c.validateNoLeadingZeroes)({nonce:r,gasPrice:i,gasLimit:s,value:u,v:l,r:p,s:b}),new t({nonce:r,gasPrice:i,gasLimit:s,to:d,value:u,data:f,v:l,r:p,s:b},n)},t.prototype.raw=function(){return[(0,c.bnToUnpaddedBuffer)(this.nonce),(0,c.bnToUnpaddedBuffer)(this.gasPrice),(0,c.bnToUnpaddedBuffer)(this.gasLimit),void 0!==this.to?this.to.buf:r.from([]),(0,c.bnToUnpaddedBuffer)(this.value),this.data,void 0!==this.v?(0,c.bnToUnpaddedBuffer)(this.v):r.from([]),void 0!==this.r?(0,c.bnToUnpaddedBuffer)(this.r):r.from([]),void 0!==this.s?(0,c.bnToUnpaddedBuffer)(this.s):r.from([])]},t.prototype.serialize=function(){return c.rlp.encode(this.raw())},t.prototype._getMessageToSign=function(){var e=[(0,c.bnToUnpaddedBuffer)(this.nonce),(0,c.bnToUnpaddedBuffer)(this.gasPrice),(0,c.bnToUnpaddedBuffer)(this.gasLimit),void 0!==this.to?this.to.buf:r.from([]),(0,c.bnToUnpaddedBuffer)(this.value),this.data];return this.supports(d.Capability.EIP155ReplayProtection)&&(e.push((0,c.toBuffer)(this.common.chainIdBN())),e.push((0,c.unpadBuffer)((0,c.toBuffer)(0))),e.push((0,c.unpadBuffer)((0,c.toBuffer)(0)))),e},t.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this._getMessageToSign();return e?(0,c.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,c.rlphash)(this.raw())),this.cache.hash):(0,c.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,c.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(d.N_DIV_2))){var n=this._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");throw new Error(n)}var a=this,r=a.v,i=a.r,s=a.s;try{return(0,c.ecrecover)(t,r,(0,c.bnToUnpaddedBuffer)(i),(0,c.bnToUnpaddedBuffer)(s),this.supports(d.Capability.EIP155ReplayProtection)?this.common.chainIdBN():void 0)}catch(e){throw n=this._errorMsg("Invalid Signature"),new Error(n)}},t.prototype._processSignature=function(e,n,a){var r=new c.BN(e);this.supports(d.Capability.EIP155ReplayProtection)&&r.iadd(this.common.chainIdBN().muln(2).addn(8));var i={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:r,r:new c.BN(n),s:new c.BN(a)},i)},t.prototype.toJSON=function(){return{nonce:(0,c.bnToHex)(this.nonce),gasPrice:(0,c.bnToHex)(this.gasPrice),gasLimit:(0,c.bnToHex)(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:(0,c.bnToHex)(this.value),data:"0x"+this.data.toString("hex"),v:void 0!==this.v?(0,c.bnToHex)(this.v):void 0,r:void 0!==this.r?(0,c.bnToHex)(this.r):void 0,s:void 0!==this.s?(0,c.bnToHex)(this.s):void 0}},t.prototype._validateTxV=function(e,t){var n;if(void 0!==e&&!e.eqn(0)&&(!t||t.gteHardfork("spuriousDragon"))&&!e.eqn(27)&&!e.eqn(28))if(t){var a=t.chainIdBN()