i(c,r)))break e;e[n]=c,e[l]=r,n=l}}}return t}function i(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}if("object"===typeof performance&&"function"===typeof performance.now){var a=performance;t.unstable_now=function(){return a.now()}}else{var u=Date,s=u.now();t.unstable_now=function(){return u.now()-s}}var l=[],c=[],f=1,d=null,p=3,h=!1,m=!1,v=!1,g="function"===typeof setTimeout?setTimeout:null,y="function"===typeof clearTimeout?clearTimeout:null,b="undefined"!==typeof setImmediate?setImmediate:null;function w(e){for(var t=n(c);null!==t;){if(null===t.callback)o(c);else{if(!(t.startTime<=e))break;o(c),t.sortIndex=t.expirationTime,r(l,t)}t=n(c)}}function k(e){if(v=!1,w(e),!m)if(null!==n(l))m=!0,I(x);else{var t=n(c);null!==t&&N(k,t.startTime-e)}}function x(e,r){m=!1,v&&(v=!1,y(S),S=-1),h=!0;var i=p;try{for(w(r),d=n(l);null!==d&&(!(d.expirationTime>r)||e&&!T());){var a=d.callback;if("function"===typeof a){d.callback=null,p=d.priorityLevel;var u=a(d.expirationTime<=r);r=t.unstable_now(),"function"===typeof u?d.callback=u:d===n(l)&&o(l),w(r)}else o(l);d=n(l)}if(null!==d)var s=!0;else{var f=n(c);null!==f&&N(k,f.startTime-r),s=!1}return s}finally{d=null,p=i,h=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var E,C=!1,A=null,S=-1,P=5,R=-1;function T(){return!(t.unstable_now()-Re||125a?(e.sortIndex=i,r(c,e),null===n(l)&&e===n(c)&&(v?(y(S),S=-1):v=!0,N(k,i-a))):(e.sortIndex=u,r(l,e),m||h||(m=!0,I(x))),e},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(e){var t=p;return function(){var r=p;p=t;try{return e.apply(this,arguments)}finally{p=r}}}},5296:function(e,t,r){"use strict";e.exports=r(6813)},143:function(e,t,r){"use strict";r.d(t,{i:function(){return n}});var n="abi/5.7.0"},1379:function(e,t,r){"use strict";r.d(t,{R:function(){return F},$:function(){return D}});var n=r(5671),o=r(3144),i=r(2571),a=r(2554),u=r(5137),s=r(143),l=r(7455),c=r(136),f=r(9388),d=r(6945),p=function(e){(0,c.Z)(r,e);var t=(0,f.Z)(r);function r(e){return(0,n.Z)(this,r),t.call(this,"address","address",e,!1)}return(0,o.Z)(r,[{key:"defaultValue",value:function(){return"0x0000000000000000000000000000000000000000"}},{key:"encode",value:function(e,t){try{t=(0,d.getAddress)(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}},{key:"decode",value:function(e){return(0,d.getAddress)((0,i.hexZeroPad)(e.readValue().toHexString(),20))}}]),r}(l.XI),h=function(e){(0,c.Z)(r,e);var t=(0,f.Z)(r);function r(e){var o;return(0,n.Z)(this,r),(o=t.call(this,e.name,e.type,void 0,e.dynamic)).coder=e,o}return(0,o.Z)(r,[{key:"defaultValue",value:function(){return this.coder.defaultValue()}},{key:"encode",value:function(e,t){return this.coder.encode(e,t)}},{key:"decode",value:function(e){return this.coder.decode(e)}}]),r}(l.XI),m=new u.Logger(s.i);function v(e,t,r){var n=null;if(Array.isArray(r))n=r;else if(r&&"object"===typeof r){var o={};n=t.map((function(e){var t=e.localName;return t||m.throwError("cannot encode object for signature with missing names",u.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),o[t]&&m.throwError("cannot encode object for signature with duplicate names",u.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),o[t]=!0,r[t]}))}else m.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&m.throwArgumentError("types/value length mismatch","tuple",r);var i=new l.QV(e.wordSize),a=new l.QV(e.wordSize),s=[];t.forEach((function(e,t){var r=n[t];if(e.dynamic){var o=a.length;e.encode(a,r);var u=i.writeUpdatableValue();s.push((function(e){u(e+o)}))}else e.encode(i,r)})),s.forEach((function(e){e(i.length)}));var c=e.appendWriter(i);return c+=e.appendWriter(a)}function g(e,t){var r=[],n=e.subReader(0);t.forEach((function(t){var o=null;if(t.dynamic){var i=e.readValue(),a=n.subReader(i.toNumber());try{o=t.decode(a)}catch(s){if(s.code===u.Logger.errors.BUFFER_OVERRUN)throw s;(o=s).baseType=t.name,o.name=t.localName,o.type=t.type}}else try{o=t.decode(e)}catch(s){if(s.code===u.Logger.errors.BUFFER_OVERRUN)throw s;(o=s).baseType=t.name,o.name=t.localName,o.type=t.type}void 0!=o&&r.push(o)}));var o=t.reduce((function(e,t){var r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach((function(e,t){var n=e.localName;if(n&&1===o[n]&&("length"===n&&(n="_length"),null==r[n])){var i=r[t];i instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:function(){throw i}}):r[n]=i}}));for(var i=function(e){var t=r[e];t instanceof Error&&Object.defineProperty(r,e,{enumerable:!0,get:function(){throw t}})},a=0;a=0?o:"")+"]",s=-1===o||e.dynamic;return(a=t.call(this,"array",u,i,s)).coder=e,a.length=o,a}return(0,o.Z)(r,[{key:"defaultValue",value:function(){for(var e=this.coder.defaultValue(),t=[],r=0;re._data.length&&m.throwError("insufficient data length",u.Logger.errors.BUFFER_OVERRUN,{length:e._data.length,count:t});for(var r=[],n=0;n256||n%8!==0)&&I.throwArgumentError("invalid "+r[1]+" bit length","param",e),new R(n/8,"int"===r[1],e.name)}if(r=e.type.match(N)){var o=parseInt(r[1]);return(0===o||o>32)&&I.throwArgumentError("invalid bytes length","param",e),new C(o,e.name)}return I.throwArgumentError("invalid type","type",e.type)}},{key:"_getWordSize",value:function(){return 32}},{key:"_getReader",value:function(e,t){return new l.Ej(e,this._getWordSize(),this.coerceFunc,t)}},{key:"_getWriter",value:function(){return new l.QV(this._getWordSize())}},{key:"getDefaultValue",value:function(e){var t=this,r=e.map((function(e){return t._getCoder(O._R.from(e))}));return new M(r,"_").defaultValue()}},{key:"encode",value:function(e,t){var r=this;e.length!==t.length&&I.throwError("types/values length mismatch",u.Logger.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});var n=e.map((function(e){return r._getCoder(O._R.from(e))})),o=new M(n,"_"),i=this._getWriter();return o.encode(i,t),i.data}},{key:"decode",value:function(e,t,r){var n=this,o=e.map((function(e){return n._getCoder(O._R.from(e))}));return new M(o,"_").decode(this._getReader((0,i.arrayify)(t),r))}}]),e}(),D=new F},7455:function(e,t,r){"use strict";r.d(t,{BR:function(){return f},Ej:function(){return h},QV:function(){return p},XI:function(){return d}});var n=r(5671),o=r(3144),i=r(2571),a=r(7556),u=r(2554),s=r(5137),l=r(143),c=new s.Logger(l.i);function f(e){var t=[];return function e(r,n){if(Array.isArray(n))for(var o in n){var i=r.slice();i.push(o);try{e(i,n[o])}catch(a){t.push({path:i,error:a})}}}([],e),t}var d=function(){function e(t,r,o,i){(0,n.Z)(this,e),this.name=t,this.type=r,this.localName=o,this.dynamic=i}return(0,o.Z)(e,[{key:"_throwError",value:function(e,t){c.throwArgumentError(e,this.localName,t)}}]),e}(),p=function(){function e(t){(0,n.Z)(this,e),(0,u.defineReadOnly)(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}return(0,o.Z)(e,[{key:"data",get:function(){return(0,i.hexConcat)(this._data)}},{key:"length",get:function(){return this._dataLength}},{key:"_writeData",value:function(e){return this._data.push(e),this._dataLength+=e.length,e.length}},{key:"appendWriter",value:function(e){return this._writeData((0,i.concat)(e._data))}},{key:"writeBytes",value:function(e){var t=(0,i.arrayify)(e),r=t.length%this.wordSize;return r&&(t=(0,i.concat)([t,this._padding.slice(r)])),this._writeData(t)}},{key:"_getValue",value:function(e){var t=(0,i.arrayify)(a.O$.from(e));return t.length>this.wordSize&&c.throwError("value out-of-bounds",s.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=(0,i.concat)([this._padding.slice(t.length%this.wordSize),t])),t}},{key:"writeValue",value:function(e){return this._writeData(this._getValue(e))}},{key:"writeUpdatableValue",value:function(){var e=this,t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,function(r){e._data[t]=e._getValue(r)}}}]),e}(),h=function(){function e(t,r,o,a){(0,n.Z)(this,e),(0,u.defineReadOnly)(this,"_data",(0,i.arrayify)(t)),(0,u.defineReadOnly)(this,"wordSize",r||32),(0,u.defineReadOnly)(this,"_coerceFunc",o),(0,u.defineReadOnly)(this,"allowLoose",a),this._offset=0}return(0,o.Z)(e,[{key:"data",get:function(){return(0,i.hexlify)(this._data)}},{key:"consumed",get:function(){return this._offset}},{key:"coerce",value:function(t,r){return this._coerceFunc?this._coerceFunc(t,r):e.coerce(t,r)}},{key:"_peekBytes",value:function(e,t,r){var n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:c.throwError("data out-of-bounds",s.Logger.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}},{key:"subReader",value:function(t){return new e(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}},{key:"readBytes",value:function(e,t){var r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}},{key:"readValue",value:function(){return a.O$.from(this.readBytes(this.wordSize))}}],[{key:"coerce",value:function(e,t){var r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}}]),e}()},5533:function(e,t,r){"use strict";r.d(t,{HY:function(){return k},IC:function(){return T},QV:function(){return x},Xg:function(){return S},YW:function(){return P},_R:function(){return b},pc:function(){return g}});var n=r(136),o=r(9388),i=r(5671),a=r(3144),u=r(7556),s=r(2554),l=r(5137),c=r(143),f=new l.Logger(c.i),d={},p={calldata:!0,memory:!0,storage:!0},h={calldata:!0,memory:!0};function m(e,t){if("bytes"===e||"string"===e){if(p[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&h[t])return!0;return(p[t]||"payable"===t)&&f.throwArgumentError("invalid modifier","name",t),!1}function v(e,t){for(var r in t)(0,s.defineReadOnly)(e,r,t[r])}var g=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),y=new RegExp(/^(.*)\[([0-9]*)\]$/),b=function(){function e(t,r){(0,i.Z)(this,e),t!==d&&f.throwError("use fromString",l.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),v(this,r);var n=this.type.match(y);v(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}return(0,a.Z)(e,[{key:"format",value:function(e){if(e||(e=g.sighash),g[e]||f.throwArgumentError("invalid format type","format",e),e===g.json){var t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"===typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((function(t){return JSON.parse(t.format(e))}))),JSON.stringify(t)}var r="";return"array"===this.baseType?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==g.sighash&&(r+=this.type),r+="("+this.components.map((function(t){return t.format(e)})).join(e===g.full?", ":",")+")"):r+=this.type,e!==g.sighash&&(!0===this.indexed&&(r+=" indexed"),e===g.full&&this.name&&(r+=" "+this.name)),r}}],[{key:"from",value:function(t,r){return"string"===typeof t?e.fromString(t,r):e.fromObject(t)}},{key:"fromObject",value:function(t){return e.isParamType(t)?t:new e(d,{name:t.name||null,type:_(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}},{key:"fromString",value:function(t,r){return n=function(e,t){var r=e;function n(t){f.throwArgumentError("unexpected character at position ".concat(t),"param",e)}function o(e){var r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},a=i,u=0;u2&&f.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||f.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=u.O$.from(r[1]),r[0]):e}function C(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((function(e){switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function A(e){var t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&f.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&f.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||f.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&f.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&f.throwArgumentError("unable to determine stateMutability","value",e),t}var S=function(e){(0,n.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,a.Z)(r,[{key:"format",value:function(e){if(e||(e=g.sighash),g[e]||f.throwArgumentError("invalid format type","format",e),e===g.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});e===g.sighash&&f.throwError("cannot format a constructor for sighash",l.Logger.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});var t="constructor("+this.inputs.map((function(t){return t.format(e)})).join(e===g.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}}],[{key:"from",value:function(e){return"string"===typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isConstructorFragment(e))return e;"constructor"!==e.type&&f.throwArgumentError("invalid constructor object","value",e);var t=A(e);t.constant&&f.throwArgumentError("constructor cannot be constant","value",e);var n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(b.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?u.O$.from(e.gas):null};return new r(d,n)}},{key:"fromString",value:function(e){var t={type:"constructor"},n=(e=E(e,t)).match(I);return n&&"constructor"===n[1].trim()||f.throwArgumentError("invalid constructor string","value",e),t.inputs=w(n[2].trim(),!1),C(n[3].trim(),t),r.fromObject(t)}},{key:"isConstructorFragment",value:function(e){return e&&e._isFragment&&"constructor"===e.type}}]),r}(k),P=function(e){(0,n.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,a.Z)(r,[{key:"format",value:function(e){if(e||(e=g.sighash),g[e]||f.throwArgumentError("invalid format type","format",e),e===g.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))})),outputs:this.outputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==g.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===g.full?", ":",")+") ",e!==g.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((function(t){return t.format(e)})).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}}],[{key:"from",value:function(e){return"string"===typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isFunctionFragment(e))return e;"function"!==e.type&&f.throwArgumentError("invalid function object","value",e);var t=A(e),n={type:e.type,name:O(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(b.fromObject):[],outputs:e.outputs?e.outputs.map(b.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?u.O$.from(e.gas):null};return new r(d,n)}},{key:"fromString",value:function(e){var t={type:"function"},n=(e=E(e,t)).split(" returns ");n.length>2&&f.throwArgumentError("invalid function string","value",e);var o=n[0].match(I);if(o||f.throwArgumentError("invalid function signature","value",e),t.name=o[1].trim(),t.name&&O(t.name),t.inputs=w(o[2],!1),C(o[3].trim(),t),n.length>1){var i=n[1].match(I);""==i[1].trim()&&""==i[3].trim()||f.throwArgumentError("unexpected tokens","value",e),t.outputs=w(i[2],!1)}else t.outputs=[];return r.fromObject(t)}},{key:"isFunctionFragment",value:function(e){return e&&e._isFragment&&"function"===e.type}}]),r}(S);function R(e){var t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||f.throwArgumentError("cannot specify user defined ".concat(t," error"),"fragment",e),e}var T=function(e){(0,n.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,a.Z)(r,[{key:"format",value:function(e){if(e||(e=g.sighash),g[e]||f.throwArgumentError("invalid format type","format",e),e===g.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==g.sighash&&(t+="error "),(t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===g.full?", ":",")+") ").trim()}}],[{key:"from",value:function(e){return"string"===typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isErrorFragment(e))return e;"error"!==e.type&&f.throwArgumentError("invalid error object","value",e);var t={type:e.type,name:O(e.name),inputs:e.inputs?e.inputs.map(b.fromObject):[]};return R(new r(d,t))}},{key:"fromString",value:function(e){var t={type:"error"},n=e.match(I);return n||f.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&O(t.name),t.inputs=w(n[2],!1),R(r.fromObject(t))}},{key:"isErrorFragment",value:function(e){return e&&e._isFragment&&"error"===e.type}}]),r}(k);function _(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var M=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function O(e){return e&&e.match(M)||f.throwArgumentError('invalid identifier "'.concat(e,'"'),"value",e),e}var I=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$")},8782:function(e,t,r){"use strict";r.r(t),r.d(t,{AbiCoder:function(){return o.R},ConstructorFragment:function(){return n.Xg},ErrorFragment:function(){return n.IC},EventFragment:function(){return n.QV},FormatTypes:function(){return n.pc},Fragment:function(){return n.HY},FunctionFragment:function(){return n.YW},Indexed:function(){return i.Hk},Interface:function(){return i.vU},LogDescription:function(){return i.CC},ParamType:function(){return n._R},TransactionDescription:function(){return i.vk},checkResultErrors:function(){return a.BR},defaultAbiCoder:function(){return o.$}});var n=r(5533),o=r(1379),i=r(8468),a=r(7455)},8468:function(e,t,r){"use strict";r.d(t,{CC:function(){return y},Hk:function(){return k},vU:function(){return C},vk:function(){return b}});var n=r(3144),o=r(5671),i=r(136),a=r(9388),u=r(6945),s=r(7556),l=r(2571),c=r(7745),f=r(438),d=r(2554),p=r(1379),h=r(5533),m=r(5137),v=r(143),g=new m.Logger(v.i),y=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){return(0,o.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r)}(d.Description),b=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){return(0,o.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r)}(d.Description),w=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){return(0,o.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r)}(d.Description),k=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){return(0,o.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r,null,[{key:"isIndexed",value:function(e){return!(!e||!e._isIndexed)}}]),r}(d.Description),x={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function E(e,t){var r=new Error("deferred error during ABI decoding triggered accessing ".concat(e));return r.error=t,r}var C=function(){function e(t){var r=this;(0,o.Z)(this,e);var n=[];n="string"===typeof t?JSON.parse(t):t,(0,d.defineReadOnly)(this,"fragments",n.map((function(e){return h.HY.from(e)})).filter((function(e){return null!=e}))),(0,d.defineReadOnly)(this,"_abiCoder",(0,d.getStatic)(this instanceof e?this.constructor:void 0,"getAbiCoder")()),(0,d.defineReadOnly)(this,"functions",{}),(0,d.defineReadOnly)(this,"errors",{}),(0,d.defineReadOnly)(this,"events",{}),(0,d.defineReadOnly)(this,"structs",{}),this.fragments.forEach((function(e){var t=null;switch(e.type){case"constructor":return r.deploy?void g.warn("duplicate definition - constructor"):void(0,d.defineReadOnly)(r,"deploy",e);case"function":t=r.functions;break;case"event":t=r.events;break;case"error":t=r.errors;break;default:return}var n=e.format();t[n]?g.warn("duplicate definition - "+n):t[n]=e})),this.deploy||(0,d.defineReadOnly)(this,"deploy",h.Xg.from({payable:!1,type:"constructor"})),(0,d.defineReadOnly)(this,"_isInterface",!0)}return(0,n.Z)(e,[{key:"format",value:function(e){e||(e=h.pc.full),e===h.pc.sighash&&g.throwArgumentError("interface does not support formatting sighash","format",e);var t=this.fragments.map((function(t){return t.format(e)}));return e===h.pc.json?JSON.stringify(t.map((function(e){return JSON.parse(e)}))):t}},{key:"getFunction",value:function(e){if((0,l.isHexString)(e)){for(var t in this.functions)if(e===this.getSighash(t))return this.functions[t];g.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){var r=e.trim(),n=Object.keys(this.functions).filter((function(e){return e.split("(")[0]===r}));return 0===n.length?g.throwArgumentError("no matching function","name",r):n.length>1&&g.throwArgumentError("multiple matching functions","name",r),this.functions[n[0]]}var o=this.functions[h.YW.fromString(e).format()];return o||g.throwArgumentError("no matching function","signature",e),o}},{key:"getEvent",value:function(e){if((0,l.isHexString)(e)){var t=e.toLowerCase();for(var r in this.events)if(t===this.getEventTopic(r))return this.events[r];g.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){var n=e.trim(),o=Object.keys(this.events).filter((function(e){return e.split("(")[0]===n}));return 0===o.length?g.throwArgumentError("no matching event","name",n):o.length>1&&g.throwArgumentError("multiple matching events","name",n),this.events[o[0]]}var i=this.events[h.QV.fromString(e).format()];return i||g.throwArgumentError("no matching event","signature",e),i}},{key:"getError",value:function(e){if((0,l.isHexString)(e)){var t=(0,d.getStatic)(this.constructor,"getSighash");for(var r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}g.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){var n=e.trim(),o=Object.keys(this.errors).filter((function(e){return e.split("(")[0]===n}));return 0===o.length?g.throwArgumentError("no matching error","name",n):o.length>1&&g.throwArgumentError("multiple matching errors","name",n),this.errors[o[0]]}var i=this.errors[h.YW.fromString(e).format()];return i||g.throwArgumentError("no matching error","signature",e),i}},{key:"getSighash",value:function(e){if("string"===typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(r){throw t}}return(0,d.getStatic)(this.constructor,"getSighash")(e)}},{key:"getEventTopic",value:function(e){return"string"===typeof e&&(e=this.getEvent(e)),(0,d.getStatic)(this.constructor,"getEventTopic")(e)}},{key:"_decodeParams",value:function(e,t){return this._abiCoder.decode(e,t)}},{key:"_encodeParams",value:function(e,t){return this._abiCoder.encode(e,t)}},{key:"encodeDeploy",value:function(e){return this._encodeParams(this.deploy.inputs,e||[])}},{key:"decodeErrorResult",value:function(e,t){"string"===typeof e&&(e=this.getError(e));var r=(0,l.arrayify)(t);return(0,l.hexlify)(r.slice(0,4))!==this.getSighash(e)&&g.throwArgumentError("data signature does not match error ".concat(e.name,"."),"data",(0,l.hexlify)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeErrorResult",value:function(e,t){return"string"===typeof e&&(e=this.getError(e)),(0,l.hexlify)((0,l.concat)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionData",value:function(e,t){"string"===typeof e&&(e=this.getFunction(e));var r=(0,l.arrayify)(t);return(0,l.hexlify)(r.slice(0,4))!==this.getSighash(e)&&g.throwArgumentError("data signature does not match function ".concat(e.name,"."),"data",(0,l.hexlify)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeFunctionData",value:function(e,t){return"string"===typeof e&&(e=this.getFunction(e)),(0,l.hexlify)((0,l.concat)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionResult",value:function(e,t){"string"===typeof e&&(e=this.getFunction(e));var r=(0,l.arrayify)(t),n=null,o="",i=null,a=null,u=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(f){}break;case 4:var s=(0,l.hexlify)(r.slice(0,4)),c=x[s];if(c)i=this._abiCoder.decode(c.inputs,r.slice(4)),a=c.name,u=c.signature,c.reason&&(n=i[0]),"Error"===a?o="; VM Exception while processing transaction: reverted with reason string ".concat(JSON.stringify(i[0])):"Panic"===a&&(o="; VM Exception while processing transaction: reverted with panic code ".concat(i[0]));else try{var f=this.getError(s);i=this._abiCoder.decode(f.inputs,r.slice(4)),a=f.name,u=f.format()}catch(f){}}return g.throwError("call revert exception"+o,m.Logger.errors.CALL_EXCEPTION,{method:e.format(),data:(0,l.hexlify)(t),errorArgs:i,errorName:a,errorSignature:u,reason:n})}},{key:"encodeFunctionResult",value:function(e,t){return"string"===typeof e&&(e=this.getFunction(e)),(0,l.hexlify)(this._abiCoder.encode(e.outputs,t||[]))}},{key:"encodeFilterTopics",value:function(e,t){var r=this;"string"===typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&g.throwError("too many arguments for "+e.format(),m.Logger.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});var n=[];e.anonymous||n.push(this.getEventTopic(e));var o=function(e,t){return"string"===e.type?(0,c.id)(t):"bytes"===e.type?(0,f.keccak256)((0,l.hexlify)(t)):("bool"===e.type&&"boolean"===typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=s.O$.from(t).toHexString()),"address"===e.type&&r._abiCoder.encode(["address"],[t]),(0,l.hexZeroPad)((0,l.hexlify)(t),32))};for(t.forEach((function(t,r){var i=e.inputs[r];i.indexed?null==t?n.push(null):"array"===i.baseType||"tuple"===i.baseType?g.throwArgumentError("filtering with tuples or arrays not supported","contract."+i.name,t):Array.isArray(t)?n.push(t.map((function(e){return o(i,e)}))):n.push(o(i,t)):null!=t&&g.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+i.name,t)}));n.length&&null===n[n.length-1];)n.pop();return n}},{key:"encodeEventLog",value:function(e,t){var r=this;"string"===typeof e&&(e=this.getEvent(e));var n=[],o=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&g.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((function(e,a){var u=t[a];if(e.indexed)if("string"===e.type)n.push((0,c.id)(u));else if("bytes"===e.type)n.push((0,f.keccak256)(u));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(r._abiCoder.encode([e.type],[u]))}else o.push(e),i.push(u)})),{data:this._abiCoder.encode(o,i),topics:n}}},{key:"decodeEventLog",value:function(e,t,r){if("string"===typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){var n=this.getEventTopic(e);(0,l.isHexString)(r[0],32)&&r[0].toLowerCase()===n||g.throwError("fragment/topic mismatch",m.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,value:r[0]}),r=r.slice(1)}var o=[],i=[],a=[];e.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(o.push(h._R.fromObject({type:"bytes32",name:e.name})),a.push(!0)):(o.push(e),a.push(!1)):(i.push(e),a.push(!1))}));var u=null!=r?this._abiCoder.decode(o,(0,l.concat)(r)):null,s=this._abiCoder.decode(i,t,!0),c=[],f=0,d=0;e.inputs.forEach((function(e,t){if(e.indexed)if(null==u)c[t]=new k({_isIndexed:!0,hash:null});else if(a[t])c[t]=new k({_isIndexed:!0,hash:u[d++]});else try{c[t]=u[d++]}catch(n){c[t]=n}else try{c[t]=s[f++]}catch(n){c[t]=n}if(e.name&&null==c[e.name]){var r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{enumerable:!0,get:function(){throw E("property ".concat(JSON.stringify(e.name)),r)}}):c[e.name]=r}}));for(var p=function(e){var t=c[e];t instanceof Error&&Object.defineProperty(c,e,{enumerable:!0,get:function(){throw E("index ".concat(e),t)}})},v=0;v=0)throw e;return d.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",c.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:r})}))),null==r.chainId?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then((function(t){return 0!==t[1]&&t[0]!==t[1]&&d.throwArgumentError("chainId address mismatch","transaction",e),t[0]})),t.next=23,(0,l.resolveProperties)(r);case 23:return t.abrupt("return",t.sent);case 24:case"end":return t.stop()}}),t,this)})))}},{key:"_checkProvider",value:function(e){this.provider||d.throwError("missing provider",c.Logger.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}}],[{key:"isSigner",value:function(e){return!(!e||!e._isSigner)}}]),e}(),v=function(e){(0,o.Z)(r,e);var t=(0,i.Z)(r);function r(e,o){var i;return(0,u.Z)(this,r),i=t.call(this),(0,l.defineReadOnly)((0,n.Z)(i),"address",e),(0,l.defineReadOnly)((0,n.Z)(i),"provider",o||null),i}return(0,s.Z)(r,[{key:"getAddress",value:function(){return Promise.resolve(this.address)}},{key:"_fail",value:function(e,t){return Promise.resolve().then((function(){d.throwError(e,c.Logger.errors.UNSUPPORTED_OPERATION,{operation:t})}))}},{key:"signMessage",value:function(e){return this._fail("VoidSigner cannot sign messages","signMessage")}},{key:"signTransaction",value:function(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}},{key:"_signTypedData",value:function(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}},{key:"connect",value:function(e){return new r(this.address,e)}}]),r}(m)},6945:function(e,t,r){"use strict";r.r(t),r.d(t,{getAddress:function(){return m},getContractAddress:function(){return y},getCreate2Address:function(){return b},getIcapAddress:function(){return g},isAddress:function(){return v}});var n=r(2571),o=r(7556),i=r(438),a=r(113),u=new(r(5137).Logger)("address/5.7.0");function s(e){(0,n.isHexString)(e,20)||u.throwArgumentError("invalid address","address",e);for(var t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),o=0;o<40;o++)r[o]=t[o].charCodeAt(0);for(var a=(0,n.arrayify)((0,i.keccak256)(r)),s=0;s<40;s+=2)a[s>>1]>>4>=8&&(t[s]=t[s].toUpperCase()),(15&a[s>>1])>=8&&(t[s+1]=t[s+1].toUpperCase());return"0x"+t.join("")}for(var l={},c=0;c<10;c++)l[String(c)]=String(c);for(var f=0;f<26;f++)l[String.fromCharCode(65+f)]=String(10+f);var d,p=Math.floor((d=9007199254740991,Math.log10?Math.log10(d):Math.log(d)/Math.LN10));function h(e){for(var t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((function(e){return l[e]})).join("");t.length>=p;){var r=t.substring(0,p);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=String(98-parseInt(t,10)%97);n.length<2;)n="0"+n;return n}function m(e){var t=null;if("string"!==typeof e&&u.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=s(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&u.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==h(e)&&u.throwArgumentError("bad icap checksum","address",e),t=(0,o.g$)(e.substring(4));t.length<40;)t="0"+t;t=s("0x"+t)}else u.throwArgumentError("invalid address","address",e);return t}function v(e){try{return m(e),!0}catch(t){}return!1}function g(e){for(var t=(0,o.t2)(m(e).substring(2)).toUpperCase();t.length<30;)t="0"+t;return"XE"+h("XE00"+t)+t}function y(e){var t=null;try{t=m(e.from)}catch(s){u.throwArgumentError("missing from address","transaction",e)}var r=(0,n.stripZeros)((0,n.arrayify)(o.O$.from(e.nonce).toHexString()));return m((0,n.hexDataSlice)((0,i.keccak256)((0,a.encode)([t,r])),12))}function b(e,t,r){return 32!==(0,n.hexDataLength)(t)&&u.throwArgumentError("salt must be 32 bytes","salt",t),32!==(0,n.hexDataLength)(r)&&u.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),m((0,n.hexDataSlice)((0,i.keccak256)((0,n.concat)(["0xff",m(e),t,r])),12))}},3690:function(e,t,r){"use strict";r.d(t,{J:function(){return o},c:function(){return i}});var n=r(2571);function o(e){e=atob(e);for(var t=[],r=0;r0;)r.push(o%this.base),o=o/this.base|0}for(var u="",s=0;0===t[s]&&s=0;--l)u+=this.alphabet[r[l]];return u}},{key:"decode",value:function(e){if("string"!==typeof e)throw new TypeError("Expected String");var t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(var r=0;r>=8;for(;o>0;)t.push(255&o),o>>=8}for(var u=0;e[u]===this._leader&&u0&&(10===arguments[0]?m||(m=!0,f.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?f.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",s.Logger.errors.UNEXPECTED_ARGUMENT,{}):f.throwError("BigNumber.toString does not accept parameters",s.Logger.errors.UNEXPECTED_ARGUMENT,{})),b(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(e){return{type:"BigNumber",hex:this.toHexString()}}}],[{key:"from",value:function(t){if(t instanceof e)return t;if("string"===typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(d,g(t)):t.match(/^-?[0-9]+$/)?new e(d,g(new c(t))):f.throwArgumentError("invalid BigNumber string","value",t);if("number"===typeof t)return t%1&&w("underflow","BigNumber.from",t),(t>=p||t<=-p)&&w("overflow","BigNumber.from",t),e.from(String(t));var r=t;if("bigint"===typeof r)return e.from(r.toString());if((0,u.isBytes)(r))return e.from((0,u.hexlify)(r));if(r)if(r.toHexString){var n=r.toHexString();if("string"===typeof n)return e.from(n)}else{var o=r._hex;if(null==o&&"BigNumber"===r.type&&(o=r.hex),"string"===typeof o&&((0,u.isHexString)(o)||"-"===o[0]&&(0,u.isHexString)(o.substring(1))))return e.from(o)}return f.throwArgumentError("invalid BigNumber value","value",t)}},{key:"isBigNumber",value:function(e){return!(!e||!e._isBigNumber)}}]),e}();function g(e){if("string"!==typeof e)return g(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&f.throwArgumentError("invalid hex","value",e),"0x00"===(e=g(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function y(e){return v.from(g(e))}function b(e){var t=v.from(e).toHexString();return"-"===t[0]?new c("-"+t.substring(3),16):new c(t.substring(2),16)}function w(e,t,r){var n={fault:e,operation:t};return null!=r&&(n.value=r),f.throwError(e,s.Logger.errors.NUMERIC_FAULT,n)}function k(e){return new c(e,36).toString(16)}function x(e){return new c(e,16).toString(36)}},6402:function(e,t,r){"use strict";r.d(t,{Ox:function(){return g},S5:function(){return v},xO:function(){return y},xs:function(){return b}});var n=r(5671),o=r(3144),i=r(2571),a=r(5137),u=r(8589),s=r(7556),l=new a.Logger(u.i),c={},f=s.O$.from(0),d=s.O$.from(-1);function p(e,t,r,n){var o={fault:t,operation:r};return void 0!==n&&(o.value=n),l.throwError(e,a.Logger.errors.NUMERIC_FAULT,o)}for(var h="0";h.length<256;)h+=h;function m(e){if("number"!==typeof e)try{e=s.O$.from(e).toNumber()}catch(t){}return"number"===typeof e&&e>=0&&e<=256&&!(e%1)?"1"+h.substring(0,e):l.throwArgumentError("invalid decimal size","decimals",e)}function v(e,t){null==t&&(t=0);var r=m(t),n=(e=s.O$.from(e)).lt(f);n&&(e=e.mul(d));for(var o=e.mod(r).toString();o.length2&&l.throwArgumentError("too many decimal points","value",e);var i=o[0],a=o[1];for(i||(i="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>r.length-1&&p("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length80&&l.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",o),new e(c,r,n,o)}}]),e}(),b=function(){function e(t,r,o,i){(0,n.Z)(this,e),t!==c&&l.throwError("cannot use FixedNumber constructor; use FixedNumber.from",a.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=o,this._isFixedNumber=!0,Object.freeze(this)}return(0,o.Z)(e,[{key:"_checkFormat",value:function(e){this.format.name!==e.format.name&&l.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}},{key:"addUnsafe",value:function(t){this._checkFormat(t);var r=g(this._value,this.format.decimals),n=g(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}},{key:"subUnsafe",value:function(t){this._checkFormat(t);var r=g(this._value,this.format.decimals),n=g(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}},{key:"mulUnsafe",value:function(t){this._checkFormat(t);var r=g(this._value,this.format.decimals),n=g(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}},{key:"divUnsafe",value:function(t){this._checkFormat(t);var r=g(this._value,this.format.decimals),n=g(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}},{key:"floor",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var r=e.from(t[0],this.format),n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(w.toFormat(r.format))),r}},{key:"ceiling",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var r=e.from(t[0],this.format),n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(w.toFormat(r.format))),r}},{key:"round",value:function(t){null==t&&(t=0);var r=this.toString().split(".");if(1===r.length&&r.push("0"),(t<0||t>80||t%1)&&l.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;var n=e.from("1"+h.substring(0,t),this.format),o=k.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(o).floor().divUnsafe(n)}},{key:"isZero",value:function(){return"0.0"===this._value||"0"===this._value}},{key:"isNegative",value:function(){return"-"===this._value[0]}},{key:"toString",value:function(){return this._value}},{key:"toHexString",value:function(e){if(null==e)return this._hex;e%8&&l.throwArgumentError("invalid byte width","width",e);var t=s.O$.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return(0,i.hexZeroPad)(t,e/8)}},{key:"toUnsafeFloat",value:function(){return parseFloat(this.toString())}},{key:"toFormat",value:function(t){return e.fromString(this._value,t)}}],[{key:"fromValue",value:function(t,r,n){return null!=n||null==r||(0,s.Zm)(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(v(t,r),y.from(n))}},{key:"fromString",value:function(t,r){null==r&&(r="fixed");var n=y.from(r),o=g(t,n.decimals);!n.signed&&o.lt(f)&&p("unsigned value cannot be negative","overflow","value",t);var a=null;n.signed?a=o.toTwos(n.width).toHexString():(a=o.toHexString(),a=(0,i.hexZeroPad)(a,n.width/8));var u=v(o,n.decimals);return new e(c,a,u,n)}},{key:"fromBytes",value:function(t,r){null==r&&(r="fixed");var n=y.from(r);if((0,i.arrayify)(t).length>n.width/8)throw new Error("overflow");var o=s.O$.from(t);n.signed&&(o=o.fromTwos(n.width));var a=o.toTwos((n.signed?0:1)+n.width).toHexString(),u=v(o,n.decimals);return new e(c,a,u,n)}},{key:"from",value:function(t,r){if("string"===typeof t)return e.fromString(t,r);if((0,i.isBytes)(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(n){if(n.code!==a.Logger.errors.INVALID_ARGUMENT)throw n}return l.throwArgumentError("invalid FixedNumber value","value",t)}},{key:"isFixedNumber",value:function(e){return!(!e||!e._isFixedNumber)}}]),e}(),w=b.from(1),k=b.from("0.5")},23:function(e,t,r){"use strict";r.r(t),r.d(t,{BigNumber:function(){return n.O$},FixedFormat:function(){return o.xO},FixedNumber:function(){return o.xs},_base16To36:function(){return n.t2},_base36To16:function(){return n.g$},formatFixed:function(){return o.S5},parseFixed:function(){return o.Ox}});var n=r(7556),o=r(6402)},2571:function(e,t,r){"use strict";r.r(t),r.d(t,{arrayify:function(){return l},concat:function(){return c},hexConcat:function(){return y},hexDataLength:function(){return v},hexDataSlice:function(){return g},hexStripZeros:function(){return w},hexValue:function(){return b},hexZeroPad:function(){return k},hexlify:function(){return m},isBytes:function(){return s},isBytesLike:function(){return a},isHexString:function(){return p},joinSignature:function(){return E},splitSignature:function(){return x},stripZeros:function(){return f},zeroPad:function(){return d}});var n=new(r(5137).Logger)("bytes/5.7.0");function o(e){return!!e.toHexString}function i(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return i(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function a(e){return p(e)&&!(e.length%2)||s(e)}function u(e){return"number"===typeof e&&e==e&&e%1===0}function s(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!u(e.length)||e.length<0)return!1;for(var t=0;t=256)return!1}return!0}function l(e,t){if(t||(t={}),"number"===typeof e){n.checkSafeUint53(e,"invalid arrayify value");for(var r=[];e;)r.unshift(255&e),e=parseInt(String(e/256));return 0===r.length&&r.push(0),i(new Uint8Array(r))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),o(e)&&(e=e.toHexString()),p(e)){var a=e.substring(2);a.length%2&&("left"===t.hexPad?a="0"+a:"right"===t.hexPad?a+="0":n.throwArgumentError("hex data is odd-length","value",e));for(var u=[],l=0;lt&&n.throwArgumentError("value out of range","value",arguments[0]);var r=new Uint8Array(t);return r.set(e,t-e.length),i(r)}function p(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}var h="0123456789abcdef";function m(e,t){if(t||(t={}),"number"===typeof e){n.checkSafeUint53(e,"invalid hexlify value");for(var r="";e;)r=h[15&e]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if("bigint"===typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),o(e))return e.toHexString();if(p(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":n.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(s(e)){for(var i="0x",a=0;a>4]+h[15&u]}return i}return n.throwArgumentError("invalid hexlify value","value",e)}function v(e){if("string"!==typeof e)e=m(e);else if(!p(e)||e.length%2)return null;return(e.length-2)/2}function g(e,t,r){return"string"!==typeof e?e=m(e):(!p(e)||e.length%2)&&n.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function y(e){var t="0x";return e.forEach((function(e){t+=m(e).substring(2)})),t}function b(e){var t=w(m(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function w(e){"string"!==typeof e&&(e=m(e)),p(e)||n.throwArgumentError("invalid hex string","value",e),e=e.substring(2);for(var t=0;t2*t+2&&n.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function x(e){var t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(a(e)){var r=l(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=m(r.slice(0,32)),t.s=m(r.slice(32,64))):65===r.length?(t.r=m(r.slice(0,32)),t.s=m(r.slice(32,64)),t.v=r[64]):n.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:n.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=m(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){var o=d(l(t._vs),32);t._vs=m(o);var i=o[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),o[0]&=127;var u=m(o);null==t.s?t.s=u:t.s!==u&&n.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?n.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{var s=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==s&&n.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&p(t.r)?t.r=k(t.r,32):n.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&p(t.s)?t.s=k(t.s,32):n.throwArgumentError("signature missing or invalid s","signature",e);var c=l(t.s);c[0]>=128&&n.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(c[0]|=128);var f=m(c);t._vs&&(p(t._vs)||n.throwArgumentError("signature invalid _vs","signature",e),t._vs=k(t._vs,32)),null==t._vs?t._vs=f:t._vs!==f&&n.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function E(e){return m(c([(e=x(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},4651:function(e,t,r){"use strict";r.d(t,{d:function(){return n}});var n="0x0000000000000000000000000000000000000000"},8887:function(e,t,r){"use strict";r.d(t,{$B:function(){return c},Bz:function(){return l},Ce:function(){return s},PS:function(){return f},Py:function(){return u},_Y:function(){return i},fh:function(){return a},tL:function(){return o}});var n=r(7556),o=n.O$.from(-1),i=n.O$.from(0),a=n.O$.from(1),u=n.O$.from(2),s=n.O$.from("1000000000000000000"),l=n.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),c=n.O$.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),f=n.O$.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")},249:function(e,t,r){"use strict";r.d(t,{R:function(){return n}});var n="0x0000000000000000000000000000000000000000000000000000000000000000"},6980:function(e,t,r){"use strict";r.r(t),r.d(t,{AddressZero:function(){return n.d},EtherSymbol:function(){return a},HashZero:function(){return i.R},MaxInt256:function(){return o.PS},MaxUint256:function(){return o.Bz},MinInt256:function(){return o.$B},NegativeOne:function(){return o.tL},One:function(){return o.fh},Two:function(){return o.Py},WeiPerEther:function(){return o.Ce},Zero:function(){return o._Y}});var n=r(4651),o=r(8887),i=r(249),a="\u039e"},823:function(e,t,r){"use strict";r.r(t),r.d(t,{BaseContract:function(){return F},Contract:function(){return D},ContractFactory:function(){return B}});var n=r(2982),o=r(7326),i=r(1752),a=r(1120),u=r(136),s=r(9388),l=r(5671),c=r(3144),f=r(4165),d=r(7455),p=r(8468),h=r(2853),m=r(3100),v=r(6945),g=r(7556),y=r(2571),b=r(2554),w=r(7102),k=r(5137),x=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(t){i(t)}}function u(e){try{s(n.throw(e))}catch(t){i(t)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},E=new k.Logger("contracts/5.7.0"),C={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function A(e,t){return x(this,void 0,void 0,(0,f.Z)().mark((function r(){var n,o;return(0,f.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t;case 2:return"string"!==typeof(n=r.sent)&&E.throwArgumentError("invalid address or ENS name","name",n),r.prev=4,r.abrupt("return",(0,v.getAddress)(n));case 8:r.prev=8,r.t0=r.catch(4);case 10:return e||E.throwError("a provider or signer is needed to resolve ENS names",k.Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"}),r.next=13,e.resolveName(n);case 13:return null==(o=r.sent)&&E.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r.abrupt("return",o);case 16:case"end":return r.stop()}}),r,null,[[4,8]])})))}function S(e,t,r){return x(this,void 0,void 0,(0,f.Z)().mark((function n(){return(0,f.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!Array.isArray(r)){n.next=4;break}return n.next=3,Promise.all(r.map((function(r,n){return S(e,Array.isArray(t)?t[n]:t[r.name],r)})));case 3:case 7:case 11:case 17:return n.abrupt("return",n.sent);case 4:if("address"!==r.type){n.next=8;break}return n.next=7,A(e,t);case 8:if("tuple"!==r.type){n.next=12;break}return n.next=11,S(e,t,r.components);case 12:if("array"!==r.baseType){n.next=18;break}if(Array.isArray(t)){n.next=15;break}return n.abrupt("return",Promise.reject(E.makeError("invalid value for array",k.Logger.errors.INVALID_ARGUMENT,{argument:"value",value:t})));case 15:return n.next=17,Promise.all(t.map((function(t){return S(e,t,r.arrayChildren)})));case 18:return n.abrupt("return",t);case 19:case"end":return n.stop()}}),n)})))}function P(e,t,r){return x(this,void 0,void 0,(0,f.Z)().mark((function n(){var o,i,a,u,s,l,c,d,p,h,m=this;return(0,f.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o={},r.length===t.inputs.length+1&&"object"===typeof r[r.length-1]&&(o=(0,b.shallowCopy)(r.pop())),E.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?o.from?o.from=(0,b.resolveProperties)({override:A(e.signer,o.from),signer:e.signer.getAddress()}).then((function(e){return x(m,void 0,void 0,(0,f.Z)().mark((function t(){return(0,f.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(0,v.getAddress)(e.signer)!==e.override&&E.throwError("Contract with a Signer cannot override from",k.Logger.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.abrupt("return",e.override);case 2:case"end":return t.stop()}}),t)})))})):o.from=e.signer.getAddress():o.from&&(o.from=A(e.provider,o.from)),n.next=6,(0,b.resolveProperties)({args:S(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:(0,b.resolveProperties)(o)||{}});case 6:if(i=n.sent,a=e.interface.encodeFunctionData(t,i.args),u={data:a,to:i.address},null!=(s=i.overrides).nonce&&(u.nonce=g.O$.from(s.nonce).toNumber()),null!=s.gasLimit&&(u.gasLimit=g.O$.from(s.gasLimit)),null!=s.gasPrice&&(u.gasPrice=g.O$.from(s.gasPrice)),null!=s.maxFeePerGas&&(u.maxFeePerGas=g.O$.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(u.maxPriorityFeePerGas=g.O$.from(s.maxPriorityFeePerGas)),null!=s.from&&(u.from=s.from),null!=s.type&&(u.type=s.type),null!=s.accessList&&(u.accessList=(0,w.accessListify)(s.accessList)),null==u.gasLimit&&null!=t.gas){for(l=21e3,c=(0,y.arrayify)(a),d=0;d1)){e=e.substring(1);var r=t[0];try{null==o[e]&&(0,b.defineReadOnly)(o,e,o[r])}catch(n){}null==o.functions[e]&&(0,b.defineReadOnly)(o.functions,e,o.functions[r]),null==o.callStatic[e]&&(0,b.defineReadOnly)(o.callStatic,e,o.callStatic[r]),null==o.populateTransaction[e]&&(0,b.defineReadOnly)(o.populateTransaction,e,o.populateTransaction[r]),null==o.estimateGas[e]&&(0,b.defineReadOnly)(o.estimateGas,e,o.estimateGas[r])}}))}return(0,c.Z)(e,[{key:"deployed",value:function(){return this._deployed()}},{key:"_deployed",value:function(e){var t=this;return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((function(){return t})):this._deployedPromise=this.provider.getCode(this.address,e).then((function(e){return"0x"===e&&E.throwError("contract not deployed",k.Logger.errors.UNSUPPORTED_OPERATION,{contractAddress:t.address,operation:"getDeployed"}),t}))),this._deployedPromise}},{key:"fallback",value:function(e){var t=this;this.signer||E.throwError("sending a transactions require a signer",k.Logger.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});var r=(0,b.shallowCopy)(e||{});return["from","to"].forEach((function(e){null!=r[e]&&E.throwError("cannot override "+e,k.Logger.errors.UNSUPPORTED_OPERATION,{operation:e})})),r.to=this.resolvedAddress,this.deployed().then((function(){return t.signer.sendTransaction(r)}))}},{key:"connect",value:function(e){"string"===typeof e&&(e=new m.VoidSigner(e,this.provider));var t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&(0,b.defineReadOnly)(t,"deployTransaction",this.deployTransaction),t}},{key:"attach",value:function(e){return new this.constructor(e,this.interface,this.signer||this.provider)}},{key:"_normalizeRunningEvent",value:function(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}},{key:"_getRunningEvent",value:function(e){if("string"===typeof e){if("error"===e)return this._normalizeRunningEvent(new I);if("event"===e)return this._normalizeRunningEvent(new O("event",null));if("*"===e)return this._normalizeRunningEvent(new L(this.address,this.interface));var t=this.interface.getEvent(e);return this._normalizeRunningEvent(new N(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{var r=e.topics[0];if("string"!==typeof r)throw new Error("invalid topic");var n=this.interface.getEvent(r);return this._normalizeRunningEvent(new N(this.address,this.interface,n,e.topics))}catch(i){}var o={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new O(M(o),o))}return this._normalizeRunningEvent(new L(this.address,this.interface))}},{key:"_checkRunningEvents",value:function(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];var t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}},{key:"_wrapEvent",value:function(e,t,r){var n=this,o=(0,b.deepCopy)(t);return o.removeListener=function(){r&&(e.removeListener(r),n._checkRunningEvents(e))},o.getBlock=function(){return n.provider.getBlock(t.blockHash)},o.getTransaction=function(){return n.provider.getTransaction(t.transactionHash)},o.getTransactionReceipt=function(){return n.provider.getTransactionReceipt(t.transactionHash)},e.prepareEvent(o),o}},{key:"_addEventListener",value:function(e,t,r){var o=this;if(this.provider||E.throwError("events require a provider or a signer with a provider",k.Logger.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){var i=function(r){var i=o._wrapEvent(e,r,t);if(null==i.decodeError)try{var a=e.getEmit(i);o.emit.apply(o,[e.filter].concat((0,n.Z)(a)))}catch(u){i.decodeError=u.error}null!=e.filter&&o.emit("event",i),null!=i.decodeError&&o.emit("error",i.decodeError,i)};this._wrappedEmits[e.tag]=i,null!=e.filter&&this.provider.on(e.filter,i)}}},{key:"queryFilter",value:function(e,t,r){var n=this,o=this._getRunningEvent(e),i=(0,b.shallowCopy)(o.filter);return"string"===typeof t&&(0,y.isHexString)(t,32)?(null!=r&&E.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((function(e){return e.map((function(e){return n._wrapEvent(o,e,null)}))}))}},{key:"on",value:function(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}},{key:"once",value:function(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}},{key:"emit",value:function(e){if(!this.provider)return!1;for(var t=this._getRunningEvent(e),r=arguments.length,n=new Array(r>1?r-1:0),o=1;o0;return this._checkRunningEvents(t),i}},{key:"listenerCount",value:function(e){var t=this;return this.provider?null==e?Object.keys(this._runningEvents).reduce((function(e,r){return e+t._runningEvents[r].listenerCount()}),0):this._getRunningEvent(e).listenerCount():0}},{key:"listeners",value:function(e){var t=this;if(!this.provider)return[];if(null==e){var r=function(){var e=[];for(var r in t._runningEvents)t._runningEvents[r].listeners().forEach((function(t){e.push(t)}));return{v:e}}();if("object"===typeof r)return r.v}return this._getRunningEvent(e).listeners()}},{key:"removeAllListeners",value:function(e){if(!this.provider)return this;if(null==e){for(var t in this._runningEvents){var r=this._runningEvents[t];r.removeAllListeners(),this._checkRunningEvents(r)}return this}var n=this._getRunningEvent(e);return n.removeAllListeners(),this._checkRunningEvents(n),this}},{key:"off",value:function(e,t){if(!this.provider)return this;var r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}},{key:"removeListener",value:function(e,t){return this.off(e,t)}}],[{key:"getContractAddress",value:function(e){return(0,v.getContractAddress)(e)}},{key:"getInterface",value:function(e){return p.vU.isInterface(e)?e:new p.vU(e)}},{key:"isIndexed",value:function(e){return p.Hk.isIndexed(e)}}]),e}(),D=function(e){(0,u.Z)(r,e);var t=(0,s.Z)(r);function r(){return(0,l.Z)(this,r),t.apply(this,arguments)}return(0,c.Z)(r)}(F),B=function(){function e(t,r,n){(0,l.Z)(this,e);var o=null;"0x"!==(o="string"===typeof r?r:(0,y.isBytes)(r)?(0,y.hexlify)(r):r&&"string"===typeof r.object?r.object:"!").substring(0,2)&&(o="0x"+o),(!(0,y.isHexString)(o)||o.length%2)&&E.throwArgumentError("invalid bytecode","bytecode",r),n&&!m.Signer.isSigner(n)&&E.throwArgumentError("invalid signer","signer",n),(0,b.defineReadOnly)(this,"bytecode",o),(0,b.defineReadOnly)(this,"interface",(0,b.getStatic)(this instanceof e?this.constructor:void 0,"getInterface")(t)),(0,b.defineReadOnly)(this,"signer",n||null)}return(0,c.Z)(e,[{key:"getDeployTransaction",value:function(){for(var e={},t=arguments.length,r=new Array(t),n=0;n0&&Array.isArray(t)?e(t,o-1):r.push(t)}))}(e,t),r}function f(e){return function(e){var t=0;return function(){return e[t++]}}(function(e){var t=0;function r(){return e[t++]<<8|e[t++]}for(var n=r(),o=1,i=[0,1],a=1;a>--l&1}for(var d=Math.pow(2,31),p=d>>>1,h=p>>1,m=d-1,v=0,g=0;g<31;g++)v=v<<1|f();for(var y=[],b=0,w=d;;){for(var k=Math.floor(((v-b+1)*o-1)/w),x=0,E=n;E-x>1;){var C=x+E>>>1;k>>1|f(),A=A<<1^p,S=(S^p)<<1|p|1;b=A,w=1+S-A}var P=n-4;return y.map((function(t){switch(t-P){case 3:return P+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return P+256+(e[s++]<<8|e[s++]);case 1:return P+e[s++];default:return t-1}}))}(e))}function d(e){return 1&e?~e>>1:e>>1}function p(e,t){for(var r=Array(e),n=0,o=-1;n>=1),check:2==i}}()}(b);function C(e){return(0,o.XL)(e)}function A(e){return e.filter((function(e){return 65039!=e}))}function S(e){var t,r=(0,l.Z)(e.split("."));try{for(r.s();!(t=r.n()).done;){var n=t.value,o=C(n);try{for(var i=o.lastIndexOf(95)-1;i>=0;i--)if(95!==o[i])throw new Error("underscore only allowed at start");if(o.length>=4&&o.every((function(e){return e<128}))&&45===o[2]&&45===o[3])throw new Error("invalid label extension")}catch(a){throw new Error('Invalid label "'.concat(n,'": ').concat(a.message))}}}catch(a){r.e(a)}finally{r.f()}return e}function P(e){return S(function(e,t){var r=C(e).reverse(),n=[];for(;r.length;){var o=R(r);if(o)n.push.apply(n,(0,s.Z)(t(o)));else{var i=r.pop();if(w.has(i))n.push(i);else if(!k.has(i)){var a=x[i];if(!a)throw new Error("Disallowed codepoint: 0x".concat(i.toString(16).toUpperCase()));n.push.apply(n,(0,s.Z)(a))}}}return S((u=String.fromCodePoint.apply(String,n),u.normalize("NFC")));var u}(e,A))}function R(e,t){var r,n,o,i=E,a=[],u=e.length;t&&(t.length=0);for(var l=function(){var l=e[--u];if(!(i=null===(r=i.branches.find((function(e){return e.set.has(l)})))||void 0===r?void 0:r.node))return"break";if(i.save)o=l;else if(i.check&&l===o)return"break";a.push(l),i.fe0f&&(a.push(65039),u>0&&65039==e[u-1]&&u--),i.valid&&(n=a.slice(),2==i.valid&&n.splice(1,1),t&&t.push.apply(t,(0,s.Z)(e.slice(u).reverse())),e.length=u)};u;){if("break"===l())break}return n}var T=new a.Logger(u.i),_=new Uint8Array(32);function M(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function O(e){var t=(0,o.Y0)(P(e)),r=[];if(0===e.length)return r;for(var n=0,i=0;i=t.length)throw new Error("invalid ENS name; empty component");return r.push(M(t.slice(n))),r}function I(e){return O(e).map((function(e){return(0,o.ZN)(e)})).join(".")}function N(e){try{return 0!==O(e).length}catch(t){}return!1}function L(e){"string"!==typeof e&&T.throwArgumentError("invalid ENS name; not a string","name",e);for(var t=_,r=O(e);r.length;)t=(0,i.keccak256)((0,n.concat)([t,(0,i.keccak256)(r.pop())]));return(0,n.hexlify)(t)}function F(e){return(0,n.hexlify)((0,n.concat)(O(e).map((function(e){if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");var t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"}_.fill(0)},6239:function(e,t,r){"use strict";r.d(t,{E:function(){return T}});var n=r(4165),o=r(5671),i=r(3144),a=r(6945),u=r(7556),s=r(2571),l=r(438),c=r(2554),f=r(5137),d=r(3634),p=r(7745),h=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(t){i(t)}}function u(e){try{s(n.throw(e))}catch(t){i(t)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},m=new f.Logger(d.i),v=new Uint8Array(32);v.fill(0);var g=u.O$.from(-1),y=u.O$.from(0),b=u.O$.from(1),w=u.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var k=(0,s.hexZeroPad)(b.toHexString(),32),x=(0,s.hexZeroPad)(y.toHexString(),32),E={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},C=["name","version","chainId","verifyingContract","salt"];function A(e){return function(t){return"string"!==typeof t&&m.throwArgumentError("invalid domain value for ".concat(JSON.stringify(e)),"domain.".concat(e),t),t}}var S={name:A("name"),version:A("version"),chainId:function(e){try{return u.O$.from(e).toString()}catch(t){}return m.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return(0,a.getAddress)(e).toLowerCase()}catch(t){}return m.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{var t=(0,s.arrayify)(e);if(32!==t.length)throw new Error("bad length");return(0,s.hexlify)(t)}catch(r){}return m.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function P(e){var t=e.match(/^(u?)int(\d*)$/);if(t){var r=""===t[1],n=parseInt(t[2]||"256");(n%8!==0||n>256||t[2]&&t[2]!==String(n))&&m.throwArgumentError("invalid numeric width","type",e);var o=w.mask(r?n-1:n),i=r?o.add(b).mul(g):y;return function(t){var r=u.O$.from(t);return(r.lt(i)||r.gt(o))&&m.throwArgumentError("value out-of-bounds for ".concat(e),"value",t),(0,s.hexZeroPad)(r.toTwos(256).toHexString(),32)}}var c=e.match(/^bytes(\d+)$/);if(c){var f=parseInt(c[1]);return(0===f||f>32||c[1]!==String(f))&&m.throwArgumentError("invalid bytes width","type",e),function(t){return(0,s.arrayify)(t).length!==f&&m.throwArgumentError("invalid length for ".concat(e),"value",t),function(e){var t=(0,s.arrayify)(e),r=t.length%32;return r?(0,s.hexConcat)([t,v.slice(r)]):(0,s.hexlify)(t)}(t)}}switch(e){case"address":return function(e){return(0,s.hexZeroPad)((0,a.getAddress)(e),32)};case"bool":return function(e){return e?k:x};case"bytes":return function(e){return(0,l.keccak256)(e)};case"string":return function(e){return(0,p.id)(e)}}return null}function R(e,t){return"".concat(e,"(").concat(t.map((function(e){var t=e.name;return e.type+" "+t})).join(","),")")}var T=function(){function e(t){(0,o.Z)(this,e),(0,c.defineReadOnly)(this,"types",Object.freeze((0,c.deepCopy)(t))),(0,c.defineReadOnly)(this,"_encoderCache",{}),(0,c.defineReadOnly)(this,"_types",{});var r={},n={},i={};Object.keys(t).forEach((function(e){r[e]={},n[e]=[],i[e]={}}));var a=function(e){var o={};t[e].forEach((function(i){o[i.name]&&m.throwArgumentError("duplicate variable name ".concat(JSON.stringify(i.name)," in ").concat(JSON.stringify(e)),"types",t),o[i.name]=!0;var a=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===e&&m.throwArgumentError("circular type reference to ".concat(JSON.stringify(a)),"types",t),P(a)||(n[a]||m.throwArgumentError("unknown type ".concat(JSON.stringify(a)),"types",t),n[a].push(e),r[e][a]=!0)}))};for(var u in t)a(u);var s=Object.keys(n).filter((function(e){return 0===n[e].length}));for(var l in 0===s.length?m.throwArgumentError("missing primary type","types",t):s.length>1&&m.throwArgumentError("ambiguous primary types or unused types: ".concat(s.map((function(e){return JSON.stringify(e)})).join(", ")),"types",t),(0,c.defineReadOnly)(this,"primaryType",s[0]),function e(o,a){a[o]&&m.throwArgumentError("circular type reference to ".concat(JSON.stringify(o)),"types",t),a[o]=!0,Object.keys(r[o]).forEach((function(t){n[t]&&(e(t,a),Object.keys(a).forEach((function(e){i[e][t]=!0})))})),delete a[o]}(this.primaryType,{}),i){var f=Object.keys(i[l]);f.sort(),this._types[l]=R(l,t[l])+f.map((function(e){return R(e,t[e])})).join("")}}return(0,i.Z)(e,[{key:"getEncoder",value:function(e){var t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}},{key:"_getEncoder",value:function(e){var t=this,r=P(e);if(r)return r;var n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){var o=n[1],i=this.getEncoder(o),a=parseInt(n[3]);return function(e){a>=0&&e.length!==a&&m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);var r=e.map(i);return t._types[o]&&(r=r.map(l.keccak256)),(0,l.keccak256)((0,s.hexConcat)(r))}}var u=this.types[e];if(u){var c=(0,p.id)(this._types[e]);return function(e){var r=u.map((function(r){var n=r.name,o=r.type,i=t.getEncoder(o)(e[n]);return t._types[o]?(0,l.keccak256)(i):i}));return r.unshift(c),(0,s.hexConcat)(r)}}return m.throwArgumentError("unknown type: ".concat(e),"type",e)}},{key:"encodeType",value:function(e){var t=this._types[e];return t||m.throwArgumentError("unknown type: ".concat(JSON.stringify(e)),"name",e),t}},{key:"encodeData",value:function(e,t){return this.getEncoder(e)(t)}},{key:"hashStruct",value:function(e,t){return(0,l.keccak256)(this.encodeData(e,t))}},{key:"encode",value:function(e){return this.encodeData(this.primaryType,e)}},{key:"hash",value:function(e){return this.hashStruct(this.primaryType,e)}},{key:"_visit",value:function(e,t,r){var n=this;if(P(e))return r(e,t);var o=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(o){var i=o[1],a=parseInt(o[3]);return a>=0&&t.length!==a&&m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((function(e){return n._visit(i,e,r)}))}var u=this.types[e];return u?u.reduce((function(e,o){var i=o.name,a=o.type;return e[i]=n._visit(a,t[i],r),e}),{}):m.throwArgumentError("unknown type: ".concat(e),"type",e)}},{key:"visit",value:function(e,t){return this._visit(this.primaryType,e,t)}}],[{key:"from",value:function(t){return new e(t)}},{key:"getPrimaryType",value:function(t){return e.from(t).primaryType}},{key:"hashStruct",value:function(t,r,n){return e.from(r).hashStruct(t,n)}},{key:"hashDomain",value:function(t){var r=[];for(var n in t){var o=E[n];o||m.throwArgumentError("invalid typed-data domain key: ".concat(JSON.stringify(n)),"domain",t),r.push({name:n,type:o})}return r.sort((function(e,t){return C.indexOf(e.name)-C.indexOf(t.name)})),e.hashStruct("EIP712Domain",{EIP712Domain:r},t)}},{key:"encode",value:function(t,r,n){return(0,s.hexConcat)(["0x1901",e.hashDomain(t),e.from(r).hash(n)])}},{key:"hash",value:function(t,r,n){return(0,l.keccak256)(e.encode(t,r,n))}},{key:"resolveNames",value:function(t,r,o,i){return h(this,void 0,void 0,(0,n.Z)().mark((function a(){var u,l,f;return(0,n.Z)().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:t=(0,c.shallowCopy)(t),u={},t.verifyingContract&&!(0,s.isHexString)(t.verifyingContract,20)&&(u[t.verifyingContract]="0x"),(l=e.from(r)).visit(o,(function(e,t){return"address"!==e||(0,s.isHexString)(t,20)||(u[t]="0x"),t})),a.t0=(0,n.Z)().keys(u);case 6:if((a.t1=a.t0()).done){a.next=13;break}return f=a.t1.value,a.next=10,i(f);case 10:u[f]=a.sent,a.next=6;break;case 13:return t.verifyingContract&&u[t.verifyingContract]&&(t.verifyingContract=u[t.verifyingContract]),o=l.visit(o,(function(e,t){return"address"===e&&u[t]?u[t]:t})),a.abrupt("return",{domain:t,value:o});case 16:case"end":return a.stop()}}),a)})))}},{key:"getPayload",value:function(t,r,n){e.hashDomain(t);var o={},i=[];C.forEach((function(e){var r=t[e];null!=r&&(o[e]=S[e](r),i.push({name:e,type:E[e]}))}));var a=e.from(r),l=(0,c.shallowCopy)(r);return l.EIP712Domain?m.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=i,a.encode(n),{types:l,domain:o,primaryType:a.primaryType,message:a.visit(n,(function(e,t){if(e.match(/^bytes(\d*)/))return(0,s.hexlify)((0,s.arrayify)(t));if(e.match(/^u?int/))return u.O$.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!==typeof t&&m.throwArgumentError("invalid string","value",t),t}return m.throwArgumentError("unsupported type","type",e)}))}}}]),e}()},579:function(e,t,r){"use strict";r.r(t),r.d(t,{HDNode:function(){return S},defaultPath:function(){return A},entropyToMnemonic:function(){return T},getAccountPath:function(){return M},isValidMnemonic:function(){return _},mnemonicToEntropy:function(){return R},mnemonicToSeed:function(){return P}});var n=r(5671),o=r(3144),i=r(416),a=r(2571),u=r(7556),s=r(3224),l=r(7979),c=r(2554),f=r(9951),d=r(9680),p=r(1532),h=r(7102),m=r(9892),v=new(r(5137).Logger)("hdnode/5.7.0"),g=u.O$.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),y=(0,s.Y0)("Bitcoin seed"),b=2147483648;function w(e){return(1<=256)throw new Error("Depth too large!");return x((0,a.concat)([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",(0,a.hexlify)(this.depth),this.parentFingerprint,(0,a.hexZeroPad)((0,a.hexlify)(this.index),4),this.chainCode,null!=this.privateKey?(0,a.concat)(["0x00",this.privateKey]):this.publicKey]))}},{key:"neuter",value:function(){return new e(C,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}},{key:"_derive",value:function(t){if(t>4294967295)throw new Error("invalid index - "+String(t));var r=this.path;r&&(r+="/"+(2147483647&t));var n=new Uint8Array(37);if(t&b){if(!this.privateKey)throw new Error("cannot derive child of neutered node");n.set((0,a.arrayify)(this.privateKey),1),r&&(r+="'")}else n.set((0,a.arrayify)(this.publicKey));for(var o=24;o>=0;o-=8)n[33+(o>>3)]=t>>24-o&255;var i=(0,a.arrayify)((0,d.Gy)(p.p.sha512,this.chainCode,n)),s=i.slice(0,32),l=i.slice(32),c=null,h=null;this.privateKey?c=k(u.O$.from(s).add(this.privateKey).mod(g)):h=new f.SigningKey((0,a.hexlify)(s))._addPoint(this.publicKey);var m=r,v=this.mnemonic;return v&&(m=Object.freeze({phrase:v.phrase,path:r,locale:v.locale||"en"})),new e(C,c,h,this.fingerprint,k(l),t,this.depth+1,m)}},{key:"derivePath",value:function(e){var t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();for(var r=this,n=0;n=b)throw new Error("invalid path index - "+o);r=r._derive(b+i)}else{if(!o.match(/^[0-9]+$/))throw new Error("invalid path component - "+o);var a=parseInt(o);if(a>=b)throw new Error("invalid path index - "+o);r=r._derive(a)}}return r}}],[{key:"_fromSeed",value:function(t,r){var n=(0,a.arrayify)(t);if(n.length<16||n.length>64)throw new Error("invalid seed");var o=(0,a.arrayify)((0,d.Gy)(p.p.sha512,y,n));return new e(C,k(o.slice(0,32)),null,"0x00000000",k(o.slice(32)),0,0,r)}},{key:"fromMnemonic",value:function(t,r,n){return t=T(R(t,n=E(n)),n),e._fromSeed(P(t,r),{phrase:t,path:"m",locale:n.locale})}},{key:"fromSeed",value:function(t){return e._fromSeed(t,null)}},{key:"fromExtendedKey",value:function(t){var r=i.Base58.decode(t);82===r.length&&x(r.slice(0,78))===t||v.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");var n=r[4],o=(0,a.hexlify)(r.slice(5,9)),u=parseInt((0,a.hexlify)(r.slice(9,13)).substring(2),16),s=(0,a.hexlify)(r.slice(13,45)),l=r.slice(45,78);switch((0,a.hexlify)(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new e(C,null,(0,a.hexlify)(l),o,s,u,n,null);case"0x0488ade4":case"0x04358394 ":if(0!==l[0])break;return new e(C,(0,a.hexlify)(l.slice(1)),null,o,s,u,n,null)}return v.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}]),e}();function P(e,t){t||(t="");var r=(0,s.Y0)("mnemonic"+t,s.Uj.NFKD);return(0,l.n)((0,s.Y0)(e,s.Uj.NFKD),r,2048,64,"sha512")}function R(e,t){t=E(t),v.checkNormalize();var r=t.split(e);if(r.length%3!==0)throw new Error("invalid mnemonic");for(var n=(0,a.arrayify)(new Uint8Array(Math.ceil(11*r.length/8))),o=0,i=0;i>3]|=1<<7-o%8),o++}var l=32*r.length/3,c=w(r.length/3);if(((0,a.arrayify)((0,d.JQ)(n.slice(0,l/8)))[0]&c)!==(n[n.length-1]&c))throw new Error("invalid checksum");return(0,a.hexlify)(n.slice(0,l/8))}function T(e,t){if(t=E(t),(e=(0,a.arrayify)(e)).length%4!==0||e.length<16||e.length>32)throw new Error("invalid entropy");for(var r=[0],n=11,o=0;o8?(r[r.length-1]<<=8,r[r.length-1]|=e[o],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[o]>>8-n,r.push(e[o]&(1<<8-n)-1),n+=3);var i=e.length/4,u=(0,a.arrayify)((0,d.JQ)(e))[0]&w(i);return r[r.length-1]<<=i,r[r.length-1]|=u>>8-i,t.join(r.map((function(e){return t.getWord(e)})))}function _(e,t){try{return R(e,t),!0}catch(r){}return!1}function M(e){return("number"!==typeof e||e<0||e>=b||e%1)&&v.throwArgumentError("invalid account index","index",e),"m/44'/60'/".concat(e,"'/0/0")}},840:function(e,t,r){"use strict";r.d(t,{i:function(){return n}});var n="json-wallets/5.7.0"},8109:function(e,t,r){"use strict";r.r(t),r.d(t,{decryptCrowdsale:function(){return w},decryptJsonWallet:function(){return E},decryptJsonWalletSync:function(){return C},decryptKeystore:function(){return x.pe},decryptKeystoreSync:function(){return x.hb},encryptKeystore:function(){return x.HI},getJsonWalletAddress:function(){return k.Rb},isCrowdsaleWallet:function(){return k.LW},isKeystoreWallet:function(){return k.aO}});var n=r(5671),o=r(3144),i=r(136),a=r(9388),u=r(3890),s=r.n(u),l=r(6945),c=r(2571),f=r(438),d=r(7979),p=r(3224),h=r(2554),m=r(5137),v=r(840),g=r(6581),y=new m.Logger(v.i),b=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){return(0,n.Z)(this,r),t.apply(this,arguments)}return(0,o.Z)(r,[{key:"isCrowdsaleAccount",value:function(e){return!(!e||!e._isCrowdsaleAccount)}}]),r}(h.Description);function w(e,t){var r=JSON.parse(e);t=(0,g.Ij)(t);var n=(0,l.getAddress)((0,g.gx)(r,"ethaddr")),o=(0,g.p3)((0,g.gx)(r,"encseed"));o&&o.length%16===0||y.throwArgumentError("invalid encseed","json",e);for(var i=(0,c.arrayify)((0,d.n)(t,t,2e3,32,"sha256")).slice(0,16),a=o.slice(0,16),u=o.slice(16),h=new(s().ModeOfOperation.cbc)(i,a),m=s().padding.pkcs7.strip((0,c.arrayify)(h.decrypt(u))),v="",w=0;wu[r]||console.log.apply(console,t)}},{key:"debug",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n>4],r+=p[15&t[i]];o.push(e+"=Uint8Array(0x"+r+")")}else o.push(e+"="+JSON.stringify(t))}catch(l){o.push(e+"="+JSON.stringify(n[e].toString()))}})),o.push("code=".concat(r)),o.push("version=".concat(this.version));var i=t,u="";switch(r){case f.NUMERIC_FAULT:u="NUMERIC_FAULT";var s=t;switch(s){case"overflow":case"underflow":case"division-by-zero":u+="-"+s;break;case"negative-power":case"negative-width":u+="-unsupported";break;case"unbound-bitwise-result":u+="-unbound-result"}break;case f.CALL_EXCEPTION:case f.INSUFFICIENT_FUNDS:case f.MISSING_NEW:case f.NONCE_EXPIRED:case f.REPLACEMENT_UNDERPRICED:case f.TRANSACTION_REPLACED:case f.UNPREDICTABLE_GAS_LIMIT:u=r}u&&(t+=" [ See: https://links.ethers.org/v5-errors-"+u+" ]"),o.length&&(t+=" ("+o.join(", ")+")");var l=new Error(t);return l.reason=i,l.code=r,Object.keys(n).forEach((function(e){l[e]=n[e]})),l}},{key:"throwError",value:function(e,t,r){throw this.makeError(e,t,r)}},{key:"throwArgumentError",value:function(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}},{key:"assert",value:function(e,t,r,n){e||this.throwError(t,r,n)}},{key:"assertArgument",value:function(e,t,r,n){e||this.throwArgumentError(t,r,n)}},{key:"checkNormalize",value:function(t){null==t&&(t="platform missing String.prototype.normalize"),d&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:d})}},{key:"checkSafeUint53",value:function(t,r){"number"===typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}},{key:"checkArgumentCount",value:function(t,r,n){n=n?": "+n:"",tr&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}},{key:"checkNew",value:function(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}},{key:"checkAbstract",value:function(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}}],[{key:"globalLogger",value:function(){return l||(l=new e("logger/5.7.0")),l}},{key:"setCensorship",value:function(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),i){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}a=!!t,i=!!r}},{key:"setLogLevel",value:function(t){var r=u[t.toLowerCase()];null!=r?s=r:e.globalLogger().warn("invalid log level - "+t)}},{key:"from",value:function(t){return new e(t)}}]),e}();h.errors=f,h.levels=c},8218:function(e,t,r){"use strict";r.d(t,{H:function(){return c}});var n=new(r(5137).Logger)("networks/5.7.1");function o(e){var t=function(t,r){null==r&&(r={});var n=[];if(t.InfuraProvider&&"-"!==r.infura)try{n.push(new t.InfuraProvider(e,r.infura))}catch(u){}if(t.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(u){}if(t.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(u){}if(t.PocketProvider&&"-"!==r.pocket){try{var o=new t.PocketProvider(e,r.pocket);o.network&&-1===["goerli","ropsten","rinkeby","sepolia"].indexOf(o.network.name)&&n.push(o)}catch(u){}}if(t.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new t.CloudflareProvider(e))}catch(u){}if(t.AnkrProvider&&"-"!==r.ankr)try{var i=new t.AnkrProvider(e,r.ankr);i.network&&-1===["ropsten"].indexOf(i.network.name)&&n.push(i)}catch(u){}if(0===n.length)return null;if(t.FallbackProvider){var a=1;return null!=r.quorum?a=r.quorum:"homestead"===e&&(a=2),new t.FallbackProvider(n,a)}return n[0]};return t.renetwork=function(e){return o(e)},t}function i(e,t){var r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return i(e,t)},r}var a={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:o("homestead")},u={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:o("ropsten")},s={chainId:63,name:"classicMordor",_defaultProvider:i("https://www.ethercluster.com/mordor","classicMordor")},l={unspecified:{chainId:0,name:"unspecified"},homestead:a,mainnet:a,morden:{chainId:2,name:"morden"},ropsten:u,testnet:u,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:o("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:o("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:o("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:o("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:i("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:s,classicTestnet:s,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:i("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:o("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:o("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function c(e){if(null==e)return null;if("number"===typeof e){for(var t in l){var r=l[t];if(r.chainId===e)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"===typeof e){var o=l[e];return null==o?null:{name:o.name,chainId:o.chainId,ensAddress:o.ensAddress,_defaultProvider:o._defaultProvider||null}}var i=l[e.name];if(!i)return"number"!==typeof e.chainId&&n.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==i.chainId&&n.throwArgumentError("network chainId mismatch","network",e);var a,u=e._defaultProvider||null;return null==u&&i._defaultProvider&&(u=(a=i._defaultProvider)&&"function"===typeof a.renetwork?i._defaultProvider.renetwork(e):i._defaultProvider),{name:e.name,chainId:i.chainId,ensAddress:e.ensAddress||i.ensAddress||null,_defaultProvider:u}}},7979:function(e,t,r){"use strict";r.d(t,{n:function(){return i}});var n=r(2571),o=r(9680);function i(e,t,r,i,a){var u;e=(0,n.arrayify)(e),t=(0,n.arrayify)(t);var s,l,c=1,f=new Uint8Array(i),d=new Uint8Array(t.length+4);d.set(t);for(var p=1;p<=c;p++){d[t.length]=p>>24&255,d[t.length+1]=p>>16&255,d[t.length+2]=p>>8&255,d[t.length+3]=255&p;var h=(0,n.arrayify)((0,o.Gy)(a,e,d));u||(u=h.length,l=new Uint8Array(u),s=i-((c=Math.ceil(i/u))-1)*u),l.set(h);for(var m=1;m0&&null==e[e.length-1];)e.pop();return e.map((function(e){if(Array.isArray(e)){var t={};e.forEach((function(e){t[R(e)]=!0}));var r=Object.keys(t);return r.sort(),r.join("|")}return R(e)})).join("&")}function _(e){if("string"===typeof e){if(e=e.toLowerCase(),32===(0,p.hexDataLength)(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+T(e);if(l.Sg.isForkEvent(e))throw P.warn("not implemented"),new Error("not implemented");if(e&&"object"===typeof e)return"filter:"+(e.address||"*")+":"+T(e.topics||[])}throw new Error("invalid event - "+e)}function M(){return(new Date).getTime()}function O(e){return new Promise((function(t){setTimeout(t,e)}))}var I=["block","network","pending","poll"],N=function(){function e(t,r,n){(0,u.Z)(this,e),(0,g.defineReadOnly)(this,"tag",t),(0,g.defineReadOnly)(this,"listener",r),(0,g.defineReadOnly)(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}return(0,s.Z)(e,[{key:"event",get:function(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}},{key:"type",get:function(){return this.tag.split(":")[0]}},{key:"hash",get:function(){var e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}},{key:"filter",get:function(){var e=this.tag.split(":");if("filter"!==e[0])return null;var t,r=e[1],n=""===(t=e[2])?[]:t.split(/&/g).map((function(e){if(""===e)return[];var t=e.split("|").map((function(e){return"null"===e?null:e}));return 1===t.length?t[0]:t})),o={};return n.length>0&&(o.topics=n),r&&"*"!==r&&(o.address=r),o}},{key:"pollable",value:function(){return this.tag.indexOf(":")>=0||I.indexOf(this.tag)>=0}}]),e}(),L={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function F(e){return(0,p.hexZeroPad)(d.O$.from(e).toHexString(),32)}function D(e){return f.Base58.encode((0,p.concat)([e,(0,p.hexDataSlice)((0,y.JQ)((0,y.JQ)(e)),0,4)]))}var B=new RegExp("^(ipfs)://(.*)$","i"),j=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),B,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function z(e,t){try{return(0,b.ZN)(Z(e,t))}catch(r){}return null}function Z(e,t){if("0x"===e)return null;var r=d.O$.from((0,p.hexDataSlice)(e,t,t+32)).toNumber(),n=d.O$.from((0,p.hexDataSlice)(e,r,r+32)).toNumber();return(0,p.hexDataSlice)(e,r+32,r+32+n)}function U(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):P.throwArgumentError("unsupported IPFS format","link",e),"https://gateway.ipfs.io/ipfs/".concat(e)}function H(e){var t=(0,p.arrayify)(e);if(t.length>32)throw new Error("internal; should not happen");var r=new Uint8Array(32);return r.set(t,32-t.length),r}function V(e){if(e.length%32===0)return e;var t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function G(e){for(var t=[],r=0,n=0;n=1&&i<=75)return D((0,p.concat)([[r.p2pkh],"0x"+o[2]]))}}if(null!=r.p2sh){var a=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(a){var u=parseInt(a[1],16);if(a[2].length===2*u&&u>=1&&u<=75)return D((0,p.concat)([[r.p2sh],"0x"+a[2]]))}}if(null!=r.prefix){var s=n[1],l=n[0];if(0===l?20!==s&&32!==s&&(l=-1):l=-1,l>=0&&n.length===2+s&&s>=1&&s<=75){var c=x().toWords(n.slice(2));return c.unshift(l),x().encode(r.prefix,c)}}return null}},{key:"getAddress",value:function(e){return S(this,void 0,void 0,(0,a.Z)().mark((function t(){var r,n,o;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==e&&(e=60),60!==e){t.next=16;break}return t.prev=2,t.next=5,this._fetch("0x3b3b57de");case 5:if("0x"!==(r=t.sent)&&r!==h.R){t.next=8;break}return t.abrupt("return",null);case 8:return t.abrupt("return",this.provider.formatter.callAddress(r));case 11:if(t.prev=11,t.t0=t.catch(2),t.t0.code!==E.Logger.errors.CALL_EXCEPTION){t.next=15;break}return t.abrupt("return",null);case 15:throw t.t0;case 16:return t.next=18,this._fetchBytes("0xf1cb7e06",F(e));case 18:if(null!=(n=t.sent)&&"0x"!==n){t.next=21;break}return t.abrupt("return",null);case 21:return null==(o=this._getAddress(e,n))&&P.throwError("invalid or unsupported coin data",E.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress(".concat(e,")"),coinType:e,data:n}),t.abrupt("return",o);case 24:case"end":return t.stop()}}),t,this,[[2,11]])})))}},{key:"getAvatar",value:function(){return S(this,void 0,void 0,(0,a.Z)().mark((function e(){var t,r,n,o,i,u,s,l,c,f,h,m,v,g,y,b;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[{type:"name",content:this.name}],e.prev=1,e.next=4,this.getText("avatar");case 4:if(null!=(r=e.sent)){e.next=7;break}return e.abrupt("return",null);case 7:n=0;case 8:if(!(n=0?null:JSON.stringify({data:i,sender:o}),n.next=12,(0,w.fetchJson)({url:c,errorPassThrough:!0},f,(function(e,t){return e.status=t.statusCode,e}));case 12:if(!(d=n.sent).data){n.next=15;break}return n.abrupt("return",d.data);case 15:if(p=d.message||"unknown error",!(d.status>=400&&d.status<500)){n.next=18;break}return n.abrupt("return",P.throwError("response not found during CCIP fetch: ".concat(p),E.Logger.errors.SERVER_ERROR,{url:l,errorMessage:p}));case 18:u.push(p);case 19:s++,n.next=6;break;case 22:return n.abrupt("return",P.throwError("error encountered during CCIP fetch: ".concat(u.map((function(e){return JSON.stringify(e)})).join(", ")),E.Logger.errors.SERVER_ERROR,{urls:r,errorMessages:u}));case 23:case"end":return n.stop()}}),n,this)})))}},{key:"_getInternalBlockNumber",value:function(e){return S(this,void 0,void 0,(0,a.Z)().mark((function t(){var r,n,o,i,u=this;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._ready();case 2:if(!(e>0)){t.next=20;break}case 3:if(!this._internalBlockNumber){t.next=20;break}return r=this._internalBlockNumber,t.prev=5,t.next=8,r;case 8:if(n=t.sent,!(M()-n.respTime<=e)){t.next=11;break}return t.abrupt("return",n.blockNumber);case 11:return t.abrupt("break",20);case 14:if(t.prev=14,t.t0=t.catch(5),this._internalBlockNumber!==r){t.next=18;break}return t.abrupt("break",20);case 18:t.next=3;break;case 20:return o=M(),i=(0,g.resolveProperties)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((function(e){return null}),(function(e){return e}))}).then((function(e){var t=e.blockNumber,r=e.networkError;if(r)throw u._internalBlockNumber===i&&(u._internalBlockNumber=null),r;var n=M();return(t=d.O$.from(t).toNumber())1e3)P.warn("network block skew detected; skipping block events (emitted=".concat(this._emitted.block," blockNumber").concat(n,")")),this.emit("error",P.makeError("network block skew detected",E.Logger.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(o=this._emitted.block+1;o<=n;o++)this.emit("block",o);return this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((function(e){if("block"!==e){var t=i._emitted[e];"pending"!==t&&n-t>12&&delete i._emitted[e]}}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((function(e){switch(e.type){case"tx":var t=e.hash,o=i.getTransactionReceipt(t).then((function(e){return e&&null!=e.blockNumber?(i._emitted["t:"+t]=e.blockNumber,i.emit(t,e),null):null})).catch((function(e){i.emit("error",e)}));r.push(o);break;case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);var a=e.filter;a.fromBlock=e._lastBlockNumber+1,a.toBlock=n;var u=a.toBlock-i._maxFilterBlockRange;u>a.fromBlock&&(a.fromBlock=u),a.fromBlock<0&&(a.fromBlock=0);var s=i.getLogs(a).then((function(t){e._inflight=!1,0!==t.length&&t.forEach((function(t){t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),i._emitted["b:"+t.blockHash]=t.blockNumber,i._emitted["t:"+t.transactionHash]=t.blockNumber,i.emit(a,t)}))})).catch((function(t){i.emit("error",t),e._inflight=!1}));r.push(s)}}})),this._lastBlockNumber=n,Promise.all(r).then((function(){i.emit("didPoll",t)})).catch((function(e){i.emit("error",e)})),e.abrupt("return");case 26:case"end":return e.stop()}}),e,this,[[3,9]])})))}},{key:"resetEventsBlock",value:function(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}},{key:"network",get:function(){return this._network}},{key:"detectNetwork",value:function(){return S(this,void 0,void 0,(0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",P.throwError("provider does not support network detection",E.Logger.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"}));case 1:case"end":return e.stop()}}),e)})))}},{key:"getNetwork",value:function(){return S(this,void 0,void 0,(0,a.Z)().mark((function e(){var t,r,n;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ready();case 2:return t=e.sent,e.next=5,this.detectNetwork();case 5:if(r=e.sent,t.chainId===r.chainId){e.next=23;break}if(!this.anyNetwork){e.next=20;break}return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,t),e.next=19,O(0);case 19:return e.abrupt("return",this._network);case 20:throw n=P.makeError("underlying network changed",E.Logger.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:r}),this.emit("error",n),n;case 23:return e.abrupt("return",t);case 24:case"end":return e.stop()}}),e,this)})))}},{key:"blockNumber",get:function(){var e=this;return this._getInternalBlockNumber(100+this.pollingInterval/2).then((function(t){e._setFastBlockNumber(t)}),(function(e){})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}},{key:"polling",get:function(){return null!=this._poller},set:function(e){var t=this;e&&!this._poller?(this._poller=setInterval((function(){t.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((function(){t.poll(),t._bootstrapPoll=setTimeout((function(){t._poller||t.poll(),t._bootstrapPoll=null}),t.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}},{key:"pollingInterval",get:function(){return this._pollingInterval},set:function(e){var t=this;if("number"!==typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){t.poll()}),this._pollingInterval))}},{key:"_getFastBlockNumber",value:function(){var e=this,t=M();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((function(t){return(null==e._fastBlockNumber||t>e._fastBlockNumber)&&(e._fastBlockNumber=t),e._fastBlockNumber}))),this._fastBlockNumberPromise}},{key:"_setFastBlockNumber",value:function(e){null!=this._fastBlockNumber&ðis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}},{key:"waitForTransaction",value:function(e,t,r){return S(this,void 0,void 0,(0,a.Z)().mark((function n(){return(0,a.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",this._waitForTransaction(e,null==t?1:t,r||0,null));case 1:case"end":return n.stop()}}),n,this)})))}},{key:"_waitForTransaction",value:function(e,t,r,n){return S(this,void 0,void 0,(0,a.Z)().mark((function o(){var i,u=this;return(0,a.Z)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this.getTransactionReceipt(e);case 2:if(!(((i=o.sent)?i.confirmations:0)>=t)){o.next=5;break}return o.abrupt("return",i);case 5:return o.abrupt("return",new Promise((function(o,i){var s=[],l=!1,c=function(){return!!l||(l=!0,s.forEach((function(e){e()})),!1)},f=function(e){e.confirmations0){var m=setTimeout((function(){c()||i(P.makeError("timeout exceeded",E.Logger.errors.TIMEOUT,{timeout:r}))}),r);m.unref&&m.unref(),s.push((function(){clearTimeout(m)}))}})));case 6:case"end":return o.stop()}}),o,this)})))}},{key:"getBlockNumber",value:function(){return S(this,void 0,void 0,(0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._getInternalBlockNumber(0));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"getGasPrice",value:function(){return S(this,void 0,void 0,(0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getNetwork();case 2:return e.next=4,this.perform("getGasPrice",{});case 4:return t=e.sent,e.prev=5,e.abrupt("return",d.O$.from(t));case 9:return e.prev=9,e.t0=e.catch(5),e.abrupt("return",P.throwError("bad result from backend",E.Logger.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e.t0}));case 12:case"end":return e.stop()}}),e,this,[[5,9]])})))}},{key:"getBalance",value:function(e,t){return S(this,void 0,void 0,(0,a.Z)().mark((function r(){var n,o;return(0,a.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,(0,g.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return n=r.sent,r.next=7,this.perform("getBalance",n);case 7:return o=r.sent,r.prev=8,r.abrupt("return",d.O$.from(o));case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",P.throwError("bad result from backend",E.Logger.errors.SERVER_ERROR,{method:"getBalance",params:n,result:o,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"getTransactionCount",value:function(e,t){return S(this,void 0,void 0,(0,a.Z)().mark((function r(){var n,o;return(0,a.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,(0,g.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return n=r.sent,r.next=7,this.perform("getTransactionCount",n);case 7:return o=r.sent,r.prev=8,r.abrupt("return",d.O$.from(o).toNumber());case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",P.throwError("bad result from backend",E.Logger.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:o,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"getCode",value:function(e,t){return S(this,void 0,void 0,(0,a.Z)().mark((function r(){var n,o;return(0,a.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,(0,g.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return n=r.sent,r.next=7,this.perform("getCode",n);case 7:return o=r.sent,r.prev=8,r.abrupt("return",(0,p.hexlify)(o));case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",P.throwError("bad result from backend",E.Logger.errors.SERVER_ERROR,{method:"getCode",params:n,result:o,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"getStorageAt",value:function(e,t,r){return S(this,void 0,void 0,(0,a.Z)().mark((function n(){var o,i;return(0,a.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.getNetwork();case 2:return n.next=4,(0,g.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((function(e){return(0,p.hexValue)(e)}))});case 4:return o=n.sent,n.next=7,this.perform("getStorageAt",o);case 7:return i=n.sent,n.prev=8,n.abrupt("return",(0,p.hexlify)(i));case 12:return n.prev=12,n.t0=n.catch(8),n.abrupt("return",P.throwError("bad result from backend",E.Logger.errors.SERVER_ERROR,{method:"getStorageAt",params:o,result:i,error:n.t0}));case 15:case"end":return n.stop()}}),n,this,[[8,12]])})))}},{key:"_wrapTransaction",value:function(e,t,r){var n=this;if(null!=t&&32!==(0,p.hexDataLength)(t))throw new Error("invalid response - sendTransaction");var o=e;return null!=t&&e.hash!==t&&P.throwError("Transaction hash mismatch from Provider.sendTransaction.",E.Logger.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),o.wait=function(t,o){return S(n,void 0,void 0,(0,a.Z)().mark((function n(){var i,u;return(0,a.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return null==t&&(t=1),null==o&&(o=0),i=void 0,0!==t&&null!=r&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r}),n.next=6,this._waitForTransaction(e.hash,t,o,i);case 6:if(null!=(u=n.sent)||0!==t){n.next=9;break}return n.abrupt("return",null);case 9:return this._emitted["t:"+e.hash]=u.blockNumber,0===u.status&&P.throwError("transaction failed",E.Logger.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:u}),n.abrupt("return",u);case 12:case"end":return n.stop()}}),n,this)})))},o}},{key:"sendTransaction",value:function(e){return S(this,void 0,void 0,(0,a.Z)().mark((function t(){var r,n,o,i;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNetwork();case 2:return t.next=4,Promise.resolve(e).then((function(e){return(0,p.hexlify)(e)}));case 4:return r=t.sent,null==(n=this.formatter.transaction(e)).confirmations&&(n.confirmations=0),t.next=9,this._getInternalBlockNumber(100+2*this.pollingInterval);case 9:return o=t.sent,t.prev=10,t.next=13,this.perform("sendTransaction",{signedTransaction:r});case 13:return i=t.sent,t.abrupt("return",this._wrapTransaction(n,i,o));case 17:throw t.prev=17,t.t0=t.catch(10),t.t0.transaction=n,t.t0.transactionHash=n.hash,t.t0;case 22:case"end":return t.stop()}}),t,this,[[10,17]])})))}},{key:"_getTransactionRequest",value:function(e){return S(this,void 0,void 0,(0,a.Z)().mark((function t(){var r,n,o=this;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:return r=t.sent,n={},["from","to"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return e?o._getAddress(e):null})))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return e?d.O$.from(e):null})))})),["type"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return null!=e?e:null})))})),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return e?(0,p.hexlify)(e):null})))})),t.t0=this.formatter,t.next=12,(0,g.resolveProperties)(n);case 12:return t.t1=t.sent,t.abrupt("return",t.t0.transactionRequest.call(t.t0,t.t1));case 14:case"end":return t.stop()}}),t,this)})))}},{key:"_getFilter",value:function(e){return S(this,void 0,void 0,(0,a.Z)().mark((function t(){var r,n=this;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:return e=t.sent,r={},null!=e.address&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach((function(t){null!=e[t]&&(r[t]=e[t])})),["fromBlock","toBlock"].forEach((function(t){null!=e[t]&&(r[t]=n._getBlockTag(e[t]))})),t.t0=this.formatter,t.next=10,(0,g.resolveProperties)(r);case 10:return t.t1=t.sent,t.abrupt("return",t.t0.filter.call(t.t0,t.t1));case 12:case"end":return t.stop()}}),t,this)})))}},{key:"_call",value:function(e,t,r){return S(this,void 0,void 0,(0,a.Z)().mark((function n(){var o,i,u,s,l,c,f,h,m,v,g,y,b,w,k;return(0,a.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r>=10&&P.throwError("CCIP read exceeded maximum redirections",E.Logger.errors.SERVER_ERROR,{redirects:r,transaction:e}),o=e.to,n.next=4,this.perform("call",{transaction:e,blockTag:t});case 4:if(i=n.sent,!(r>=0&&"latest"===t&&null!=o&&"0x556f1830"===i.substring(0,10)&&(0,p.hexDataLength)(i)%32===4)){n.next=31;break}for(n.prev=6,u=(0,p.hexDataSlice)(i,4),s=(0,p.hexDataSlice)(u,0,32),d.O$.from(s).eq(o)||P.throwError("CCIP Read sender did not match",E.Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),l=[],c=d.O$.from((0,p.hexDataSlice)(u,32,64)).toNumber(),f=d.O$.from((0,p.hexDataSlice)(u,c,c+32)).toNumber(),h=(0,p.hexDataSlice)(u,c+32),m=0;mthis._emitted.block)){e.next=10;break}return e.abrupt("return",null);case 10:return e.abrupt("return",void 0);case 11:if(!t){e.next=34;break}i=null,u=0;case 14:if(!(u0}},{key:"_stopEvent",value:function(e){this.polling=this._events.filter((function(e){return e.pollable()})).length>0}},{key:"_addEventListener",value:function(e,t,r){var n=new N(_(e),t,r);return this._events.push(n),this._startEvent(n),this}},{key:"on",value:function(e,t){return this._addEventListener(e,t,!1)}},{key:"once",value:function(e,t){return this._addEventListener(e,t,!0)}},{key:"emit",value:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),o=1;ot?null:(n+o)/2}function C(e){if(null===e)return"null";if("number"===typeof e||"boolean"===typeof e)return JSON.stringify(e);if("string"===typeof e)return e;if(c.O$.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map((function(e){return C(e)})));if("object"===typeof e){var t=Object.keys(e);return t.sort(),"{"+t.map((function(t){var r=e[t];return r="function"===typeof r?"[function]":C(r),JSON.stringify(t)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}var A=1;function S(e){var t=null,r=null,n=new Promise((function(n){t=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(t,e)}));return{cancel:t,getPromise:function(){return n},wait:function(e){return n=n.then(e)}}}var P=[g.Logger.errors.CALL_EXCEPTION,g.Logger.errors.INSUFFICIENT_FUNDS,g.Logger.errors.NONCE_EXPIRED,g.Logger.errors.REPLACEMENT_UNDERPRICED,g.Logger.errors.UNPREDICTABLE_GAS_LIMIT],R=["address","args","errorArgs","errorSignature","method","transaction"];function T(e,t){var r={weight:e.weight};return Object.defineProperty(r,"provider",{get:function(){return e.provider}}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function _(e,t,r){var n=C;switch(t){case"getBlockNumber":return function(t){var r=t.map((function(e){return e.result})),n=E(t.map((function(e){return e.result})),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=e._highestBlockNumber&&(e._highestBlockNumber=n),e._highestBlockNumber};case"getGasPrice":return function(e){var t=e.map((function(e){return e.result}));return t.sort(),t[Math.floor(t.length/2)]};case"getEtherPrice":return function(e){return E(e.map((function(e){return e.result})))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(e){return null==e?null:((e=(0,d.shallowCopy)(e)).confirmations=-1,C(e))};break;case"getBlock":n=r.includeTransactions?function(e){return null==e?null:((e=(0,d.shallowCopy)(e)).transactions=e.transactions.map((function(e){return(e=(0,d.shallowCopy)(e)).confirmations=-1,e})),C(e))}:function(e){return null==e?null:C(e)};break;default:throw new Error("unknown method: "+t)}return function(e,t){return function(r){var n={};r.forEach((function(t){var r=e(t.result);n[r]||(n[r]={count:0,result:t.result}),n[r].count++}));for(var o=Object.keys(n),i=0;i=t)return a.result}}}(n,e.quorum)}function M(e,t){return b(this,void 0,void 0,(0,s.Z)().mark((function r(){var n;return(0,s.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(null!=(n=e.provider).blockNumber&&n.blockNumber>=t||-1===t)){r.next=3;break}return r.abrupt("return",n);case 3:return r.abrupt("return",(0,h.poll)((function(){return new Promise((function(r,o){setTimeout((function(){return n.blockNumber>=t?r(n):e.cancelled?r(null):r(void 0)}),0)}))}),{oncePoll:n}));case 4:case"end":return r.stop()}}),r)})))}function O(e,t,r,n){return b(this,void 0,void 0,(0,s.Z)().mark((function o(){var i,a;return(0,s.Z)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:i=e.provider,o.t0=r,o.next="getBlockNumber"===o.t0||"getGasPrice"===o.t0?4:"getEtherPrice"===o.t0?5:"getBalance"===o.t0||"getTransactionCount"===o.t0||"getCode"===o.t0?8:"getStorageAt"===o.t0?13:"getBlock"===o.t0?18:"call"===o.t0||"estimateGas"===o.t0?23:"getTransaction"===o.t0||"getTransactionReceipt"===o.t0?30:"getLogs"===o.t0?31:37;break;case 4:return o.abrupt("return",i[r]());case 5:if(!i.getEtherPrice){o.next=7;break}return o.abrupt("return",i.getEtherPrice());case 7:return o.abrupt("break",37);case 8:if(!n.blockTag||!(0,f.isHexString)(n.blockTag)){o.next=12;break}return o.next=11,M(e,t);case 11:i=o.sent;case 12:return o.abrupt("return",i[r](n.address,n.blockTag||"latest"));case 13:if(!n.blockTag||!(0,f.isHexString)(n.blockTag)){o.next=17;break}return o.next=16,M(e,t);case 16:i=o.sent;case 17:return o.abrupt("return",i.getStorageAt(n.address,n.position,n.blockTag||"latest"));case 18:if(!n.blockTag||!(0,f.isHexString)(n.blockTag)){o.next=22;break}return o.next=21,M(e,t);case 21:i=o.sent;case 22:return o.abrupt("return",i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash));case 23:if(!n.blockTag||!(0,f.isHexString)(n.blockTag)){o.next=27;break}return o.next=26,M(e,t);case 26:i=o.sent;case 27:if("call"!==r||!n.blockTag){o.next=29;break}return o.abrupt("return",i[r](n.transaction,n.blockTag));case 29:return o.abrupt("return",i[r](n.transaction));case 30:return o.abrupt("return",i[r](n.transactionHash));case 31:if(!((a=n.filter).fromBlock&&(0,f.isHexString)(a.fromBlock)||a.toBlock&&(0,f.isHexString)(a.toBlock))){o.next=36;break}return o.next=35,M(e,t);case 35:i=o.sent;case 36:return o.abrupt("return",i.getLogs(a));case 37:return o.abrupt("return",w.throwError("unknown method error",g.Logger.errors.UNKNOWN_ERROR,{method:r,params:n}));case 38:case"end":return o.stop()}}),o)})))}var I=function(e){(0,a.Z)(r,e);var t=(0,u.Z)(r);function r(e,o){var a;(0,n.Z)(this,r),0===e.length&&w.throwArgumentError("missing providers","providers",e);var u=e.map((function(e,t){if(l.zt.isProvider(e)){var r=(0,v.Gp)(e)?2e3:750;return Object.freeze({provider:e,weight:1,stallTimeout:r,priority:1})}var n=(0,d.shallowCopy)(e);null==n.priority&&(n.priority=1),null==n.stallTimeout&&(n.stallTimeout=(0,v.Gp)(e)?2e3:750),null==n.weight&&(n.weight=1);var o=n.weight;return(o%1||o>512||o<1)&&w.throwArgumentError("invalid weight; must be integer in [1, 512]","providers[".concat(t,"].weight"),o),Object.freeze(n)})),s=u.reduce((function(e,t){return e+t.weight}),0);null==o?o=s/2:o>s&&w.throwArgumentError("quorum will always fail; larger than total weight","quorum",o);var c=x(u.map((function(e){return e.provider.network})));return null==c&&(c=new Promise((function(e,t){setTimeout((function(){a.detectNetwork().then(e,t)}),0)}))),a=t.call(this,c),(0,d.defineReadOnly)((0,i.Z)(a),"providerConfigs",Object.freeze(u)),(0,d.defineReadOnly)((0,i.Z)(a),"quorum",o),a._highestBlockNumber=-1,a}return(0,o.Z)(r,[{key:"detectNetwork",value:function(){return b(this,void 0,void 0,(0,s.Z)().mark((function e(){var t;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(this.providerConfigs.map((function(e){return e.provider.getNetwork()})));case 2:return t=e.sent,e.abrupt("return",x(t));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"perform",value:function(e,t){return b(this,void 0,void 0,(0,s.Z)().mark((function r(){var n,o,i,a,u,l,c,f,h,m,v=this;return(0,s.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if("sendTransaction"!==e){r.next=13;break}return r.next=3,Promise.all(this.providerConfigs.map((function(e){return e.provider.sendTransaction(t.signedTransaction).then((function(e){return e.hash}),(function(e){return e}))})));case 3:n=r.sent,o=0;case 5:if(!(o=v.quorum)){r.next=19;break}if(void 0===(m=a(h))){r.next=15;break}return u.forEach((function(e){e.staller&&e.staller.cancel(),e.cancelled=!0})),r.abrupt("return",{v:m});case 15:if(f){r.next=18;break}return r.next=18,S(100).getPromise();case 18:f=!1;case 19:if(g=u.reduce((function(e,t){if(!t.done||null==t.error)return e;var r=t.error.code;return P.indexOf(r)>=0&&(e[r]||(e[r]={error:t.error,weight:0}),e[r].weight+=t.weight),e}),{}),Object.keys(g).forEach((function(e){var t=g[e];if(!(t.weight=0&&(t.throttleRetry=!0),t}return e.result}function B(e){if(e&&0==e.status&&"NOTOK"==e.message&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){var t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if("2.0"!=e.jsonrpc){var r=new Error("invalid response");throw r.result=JSON.stringify(e),r}if(e.error){var n=new Error(e.error.message||"unknown error");throw e.error.code&&(n.code=e.error.code),e.error.data&&(n.data=e.error.data),n}return e.result}function j(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}function z(e,t,r){if("call"===e&&t.code===h.Logger.errors.SERVER_ERROR){var n=t.error;if(n&&(n.message.match(/reverted/i)||n.message.match(/VM execution error/i))){var o=n.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),(0,M.isHexString)(o))return o;L.throwError("missing revert data in call exception",h.Logger.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}var i=t.message;throw t.code===h.Logger.errors.SERVER_ERROR&&(t.error&&"string"===typeof t.error.message?i=t.error.message:"string"===typeof t.body?i=t.body:"string"===typeof t.responseText&&(i=t.responseText)),(i=(i||"").toLowerCase()).match(/insufficient funds/)&&L.throwError("insufficient funds for intrinsic transaction cost",h.Logger.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&L.throwError("nonce has already been used",h.Logger.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),i.match(/another transaction with same nonce/)&&L.throwError("replacement fee too low",h.Logger.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),i.match(/execution failed due to an exception|execution reverted/)&&L.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",h.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}var Z=function(e){(0,l.Z)(r,e);var t=(0,c.Z)(r);function r(e,n){var o;return(0,a.Z)(this,r),o=t.call(this,e),(0,f.defineReadOnly)((0,s.Z)(o),"baseUrl",o.getBaseUrl()),(0,f.defineReadOnly)((0,s.Z)(o),"apiKey",n||null),o}return(0,u.Z)(r,[{key:"getBaseUrl",value:function(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return L.throwArgumentError("unsupported network","network",this.network.name)}},{key:"getUrl",value:function(e,t){var r=Object.keys(t).reduce((function(e,r){var n=t[r];return null!=n&&(e+="&".concat(r,"=").concat(n)),e}),""),n=this.apiKey?"&apikey=".concat(this.apiKey):"";return"".concat(this.baseUrl,"/api?module=").concat(e).concat(r).concat(n)}},{key:"getPostUrl",value:function(){return"".concat(this.baseUrl,"/api")}},{key:"getPostData",value:function(e,t){return t.module=e,t.apikey=this.apiKey,t}},{key:"fetch",value:function(e,t,r){return N(this,void 0,void 0,(0,A.Z)().mark((function n(){var o,i,a,u,s,l,c=this;return(0,A.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=r?this.getPostUrl():this.getUrl(e,t),i=r?this.getPostData(e,t):null,a="proxy"===e?B:D,this.emit("debug",{action:"request",request:o,provider:this}),u={url:o,throttleSlotInterval:1e3,throttleCallback:function(e,t){return c.isCommunityResource()&&(0,d.vh)(),Promise.resolve(!0)}},s=null,i&&(u.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},s=Object.keys(i).map((function(e){return"".concat(e,"=").concat(i[e])})).join("&")),n.next=9,(0,I.fetchJson)(u,s,a||B);case 9:return l=n.sent,this.emit("debug",{action:"response",request:o,response:(0,f.deepCopy)(l),provider:this}),n.abrupt("return",l);case 12:case"end":return n.stop()}}),n,this)})))}},{key:"detectNetwork",value:function(){return N(this,void 0,void 0,(0,A.Z)().mark((function e(){return(0,A.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.network);case 1:case"end":return e.stop()}}),e,this)})))}},{key:"perform",value:function(e,t){var n=this,o=Object.create(null,{perform:{get:function(){return(0,S.Z)((0,P.Z)(r.prototype),"perform",n)}}});return N(this,void 0,void 0,(0,A.Z)().mark((function r(){var n,i,a,u,s,l,c,f,d;return(0,A.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:r.t0=e,r.next="getBlockNumber"===r.t0?3:"getGasPrice"===r.t0?4:"getBalance"===r.t0?5:"getTransactionCount"===r.t0?6:"getCode"===r.t0?7:"getStorageAt"===r.t0?8:"sendTransaction"===r.t0?9:"getBlock"===r.t0?10:"getTransaction"===r.t0?13:"getTransactionReceipt"===r.t0?14:"call"===r.t0?15:"estimateGas"===r.t0?29:"getLogs"===r.t0?41:"getEtherPrice"===r.t0?65:72;break;case 3:return r.abrupt("return",this.fetch("proxy",{action:"eth_blockNumber"}));case 4:return r.abrupt("return",this.fetch("proxy",{action:"eth_gasPrice"}));case 5:return r.abrupt("return",this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag}));case 6:return r.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag}));case 7:return r.abrupt("return",this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag}));case 8:return r.abrupt("return",this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag}));case 9:return r.abrupt("return",this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch((function(e){return z("sendTransaction",e,t.signedTransaction)})));case 10:if(!t.blockTag){r.next=12;break}return r.abrupt("return",this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"}));case 12:throw new Error("getBlock by blockHash not implemented");case 13:return r.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash}));case 14:return r.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash}));case 15:if("latest"===t.blockTag){r.next=17;break}throw new Error("EtherscanProvider does not support blockTag for call");case 17:return(n=F(t.transaction)).module="proxy",n.action="eth_call",r.prev=20,r.next=23,this.fetch("proxy",n,!0);case 23:return r.abrupt("return",r.sent);case 26:return r.prev=26,r.t1=r.catch(20),r.abrupt("return",z("call",r.t1,t.transaction));case 29:return(i=F(t.transaction)).module="proxy",i.action="eth_estimateGas",r.prev=32,r.next=35,this.fetch("proxy",i,!0);case 35:return r.abrupt("return",r.sent);case 38:return r.prev=38,r.t2=r.catch(32),r.abrupt("return",z("estimateGas",r.t2,t.transaction));case 41:return a={action:"getLogs"},t.filter.fromBlock&&(a.fromBlock=j(t.filter.fromBlock)),t.filter.toBlock&&(a.toBlock=j(t.filter.toBlock)),t.filter.address&&(a.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&L.throwError("unsupported topic count",h.Logger.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length&&("string"===typeof(u=t.filter.topics[0])&&66===u.length||L.throwError("unsupported topic format",h.Logger.errors.UNSUPPORTED_OPERATION,{topic0:u}),a.topic0=u)),r.next=48,this.fetch("logs",a);case 48:s=r.sent,l={},c=0;case 51:if(!(c=0&&a.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&E.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",b.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function P(e){return new Promise((function(t){setTimeout(t,e)}))}function R(e){if(e.error){var t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function T(e){return e?e.toLowerCase():e}var _={},M=function(e){(0,l.Z)(r,e);var t=(0,c.Z)(r);function r(e,n,o){var i;if((0,a.Z)(this,r),i=t.call(this),e!==_)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return(0,m.defineReadOnly)((0,s.Z)(i),"provider",n),null==o&&(o=0),"string"===typeof o?((0,m.defineReadOnly)((0,s.Z)(i),"_address",i.provider.formatter.address(o)),(0,m.defineReadOnly)((0,s.Z)(i),"_index",null)):"number"===typeof o?((0,m.defineReadOnly)((0,s.Z)(i),"_index",o),(0,m.defineReadOnly)((0,s.Z)(i),"_address",null)):E.throwArgumentError("invalid address or index","addressOrIndex",o),i}return(0,u.Z)(r,[{key:"connect",value:function(e){return E.throwError("cannot alter JSON-RPC Signer connection",b.Logger.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}},{key:"connectUnchecked",value:function(){return new O(_,this.provider,this._address||this._index)}},{key:"getAddress",value:function(){var e=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(t){return t.length<=e._index&&E.throwError("unknown account #"+e._index,b.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),e.provider.formatter.address(t[e._index])}))}},{key:"sendUncheckedTransaction",value:function(e){var t=this;e=(0,m.shallowCopy)(e);var r=this.getAddress().then((function(e){return e&&(e=e.toLowerCase()),e}));if(null==e.gasLimit){var n=(0,m.shallowCopy)(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((function(e){return x(t,void 0,void 0,(0,i.Z)().mark((function t(){var r;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=e){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this.provider.resolveName(e);case 4:return null==(r=t.sent)&&E.throwArgumentError("provided ENS name resolves to null","tx.to",e),t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)})))}))),(0,m.resolveProperties)({tx:(0,m.resolveProperties)(e),sender:r}).then((function(r){var n=r.tx,o=r.sender;null!=n.from?n.from.toLowerCase()!==o&&E.throwArgumentError("from address mismatch","transaction",e):n.from=o;var i=t.provider.constructor.hexlifyTransaction(n,{from:!0});return t.provider.send("eth_sendTransaction",[i]).then((function(e){return e}),(function(e){return"string"===typeof e.message&&e.message.match(/user denied/i)&&E.throwError("user rejected transaction",b.Logger.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),S("sendTransaction",e,i)}))}))}},{key:"signTransaction",value:function(e){return E.throwError("signing transactions is unsupported",b.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}},{key:"sendTransaction",value:function(e){return x(this,void 0,void 0,(0,i.Z)().mark((function t(){var r,n,o=this;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval);case 2:return r=t.sent,t.next=5,this.sendUncheckedTransaction(e);case 5:return n=t.sent,t.prev=6,t.next=9,(0,y.poll)((function(){return x(o,void 0,void 0,(0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.provider.getTransaction(n);case 2:if(null!==(t=e.sent)){e.next=5;break}return e.abrupt("return",void 0);case 5:return e.abrupt("return",this.provider._wrapTransaction(t,n,r));case 6:case"end":return e.stop()}}),e,this)})))}),{oncePoll:this.provider});case 9:return t.abrupt("return",t.sent);case 12:throw t.prev=12,t.t0=t.catch(6),t.t0.transactionHash=n,t.t0;case 16:case"end":return t.stop()}}),t,this,[[6,12]])})))}},{key:"signMessage",value:function(e){return x(this,void 0,void 0,(0,i.Z)().mark((function t(){var r,n;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="string"===typeof e?(0,v.Y0)(e):e,t.next=3,this.getAddress();case 3:return n=t.sent,t.prev=4,t.next=7,this.provider.send("personal_sign",[(0,p.hexlify)(r),n.toLowerCase()]);case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),"string"===typeof t.t0.message&&t.t0.message.match(/user denied/i)&&E.throwError("user rejected signing",b.Logger.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),t.t0;case 14:case"end":return t.stop()}}),t,this,[[4,10]])})))}},{key:"_legacySignMessage",value:function(e){return x(this,void 0,void 0,(0,i.Z)().mark((function t(){var r,n;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="string"===typeof e?(0,v.Y0)(e):e,t.next=3,this.getAddress();case 3:return n=t.sent,t.prev=4,t.next=7,this.provider.send("eth_sign",[n.toLowerCase(),(0,p.hexlify)(r)]);case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),"string"===typeof t.t0.message&&t.t0.message.match(/user denied/i)&&E.throwError("user rejected signing",b.Logger.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),t.t0;case 14:case"end":return t.stop()}}),t,this,[[4,10]])})))}},{key:"_signTypedData",value:function(e,t,r){return x(this,void 0,void 0,(0,i.Z)().mark((function n(){var o,a,u=this;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,h.E.resolveNames(e,t,r,(function(e){return u.provider.resolveName(e)}));case 2:return o=n.sent,n.next=5,this.getAddress();case 5:return a=n.sent,n.prev=6,n.next=9,this.provider.send("eth_signTypedData_v4",[a.toLowerCase(),JSON.stringify(h.E.getPayload(o.domain,t,o.value))]);case 9:return n.abrupt("return",n.sent);case 12:throw n.prev=12,n.t0=n.catch(6),"string"===typeof n.t0.message&&n.t0.message.match(/user denied/i)&&E.throwError("user rejected signing",b.Logger.errors.ACTION_REJECTED,{action:"_signTypedData",from:a,messageData:{domain:o.domain,types:t,value:o.value}}),n.t0;case 16:case"end":return n.stop()}}),n,this,[[6,12]])})))}},{key:"unlock",value:function(e){return x(this,void 0,void 0,(0,i.Z)().mark((function t(){var r,n;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.provider,t.next=3,this.getAddress();case 3:return n=t.sent,t.abrupt("return",r.send("personal_unlockAccount",[n.toLowerCase(),e,null]));case 5:case"end":return t.stop()}}),t,this)})))}}]),r}(f.Signer),O=function(e){(0,l.Z)(r,e);var t=(0,c.Z)(r);function r(){return(0,a.Z)(this,r),t.apply(this,arguments)}return(0,u.Z)(r,[{key:"sendTransaction",value:function(e){var t=this;return this.sendUncheckedTransaction(e).then((function(e){return{hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:function(r){return t.provider.waitForTransaction(e,r)}}}))}}]),r}(M),I={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0},N=function(e){(0,l.Z)(r,e);var t=(0,c.Z)(r);function r(e,n){var o;(0,a.Z)(this,r);var i=n;return null==i&&(i=new Promise((function(e,t){setTimeout((function(){o.detectNetwork().then((function(t){e(t)}),(function(e){t(e)}))}),0)}))),o=t.call(this,i),e||(e=(0,m.getStatic)(o.constructor,"defaultUrl")()),"string"===typeof e?(0,m.defineReadOnly)((0,s.Z)(o),"connection",Object.freeze({url:e})):(0,m.defineReadOnly)((0,s.Z)(o),"connection",Object.freeze((0,m.shallowCopy)(e))),o._nextId=42,o}return(0,u.Z)(r,[{key:"_cache",get:function(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}},{key:"detectNetwork",value:function(){var e=this;return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((function(){e._cache.detectNetwork=null}),0)),this._cache.detectNetwork}},{key:"_uncachedDetectNetwork",value:function(){return x(this,void 0,void 0,(0,i.Z)().mark((function e(){var t,r;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,P(0);case 2:return t=null,e.prev=3,e.next=6,this.send("eth_chainId",[]);case 6:t=e.sent,e.next=19;break;case 9:return e.prev=9,e.t0=e.catch(3),e.prev=11,e.next=14,this.send("net_version",[]);case 14:t=e.sent,e.next=19;break;case 17:e.prev=17,e.t1=e.catch(11);case 19:if(null==t){e.next=28;break}return r=(0,m.getStatic)(this.constructor,"getNetwork"),e.prev=21,e.abrupt("return",r(d.O$.from(t).toNumber()));case 25:return e.prev=25,e.t2=e.catch(21),e.abrupt("return",E.throwError("could not detect network",b.Logger.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e.t2}));case 28:return e.abrupt("return",E.throwError("could not detect network",b.Logger.errors.NETWORK_ERROR,{event:"noNetwork"}));case 29:case"end":return e.stop()}}),e,this,[[3,9],[11,17],[21,25]])})))}},{key:"getSigner",value:function(e){return new M(_,this,e)}},{key:"getUncheckedSigner",value:function(e){return this.getSigner(e).connectUnchecked()}},{key:"listAccounts",value:function(){var e=this;return this.send("eth_accounts",[]).then((function(t){return t.map((function(t){return e.formatter.address(t)}))}))}},{key:"send",value:function(e,t){var r=this,n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,m.deepCopy)(n),provider:this});var o=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(o&&this._cache[e])return this._cache[e];var i=(0,y.fetchJson)(this.connection,JSON.stringify(n),R).then((function(e){return r.emit("debug",{action:"response",request:n,response:e,provider:r}),e}),(function(e){throw r.emit("debug",{action:"response",error:e,request:n,provider:r}),e}));return o&&(this._cache[e]=i,setTimeout((function(){r._cache[e]=null}),0)),i}},{key:"prepareRequest",value:function(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[T(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[T(t.address),t.blockTag]];case"getCode":return["eth_getCode",[T(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[T(t.address),(0,p.hexZeroPad)(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[(0,m.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,m.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=T(t.filter.address)),["eth_getLogs",[t.filter]]}return null}},{key:"perform",value:function(e,t){return x(this,void 0,void 0,(0,i.Z)().mark((function r(){var n,o,a;return(0,i.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if("call"!==e&&"estimateGas"!==e){r.next=8;break}if(!(n=t.transaction)||null==n.type||!d.O$.from(n.type).isZero()){r.next=8;break}if(null!=n.maxFeePerGas||null!=n.maxPriorityFeePerGas){r.next=8;break}return r.next=6,this.getFeeData();case 6:null==(o=r.sent).maxFeePerGas&&null==o.maxPriorityFeePerGas&&((t=(0,m.shallowCopy)(t)).transaction=(0,m.shallowCopy)(n),delete t.transaction.type);case 8:return null==(a=this.prepareRequest(e,t))&&E.throwError(e+" not implemented",b.Logger.errors.NOT_IMPLEMENTED,{operation:e}),r.prev=10,r.next=13,this.send(a[0],a[1]);case 13:return r.abrupt("return",r.sent);case 16:return r.prev=16,r.t0=r.catch(10),r.abrupt("return",S(e,r.t0,t));case 19:case"end":return r.stop()}}),r,this,[[10,16]])})))}},{key:"_startEvent",value:function(e){"pending"===e.tag&&this._startPending(),(0,n.Z)((0,o.Z)(r.prototype),"_startEvent",this).call(this,e)}},{key:"_startPending",value:function(){if(null==this._pendingFilter){var e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;var n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return P(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){n()}),0),null;e.send("eth_uninstallFilter",[r])})).catch((function(e){}))}(),r})).catch((function(e){}))}}},{key:"_stopEvent",value:function(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),(0,n.Z)((0,o.Z)(r.prototype),"_stopEvent",this).call(this,e)}}],[{key:"defaultUrl",value:function(){return"http://localhost:8545"}},{key:"hexlifyTransaction",value:function(e,t){var r=(0,m.shallowCopy)(I);if(t)for(var n in t)t[n]&&(r[n]=!0);(0,m.checkProperties)(e,r);var o={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null!=e[t]){var r=(0,p.hexValue)(d.O$.from(e[t]));"gasLimit"===t&&(t="gas"),o[t]=r}})),["from","to","data"].forEach((function(t){null!=e[t]&&(o[t]=(0,p.hexlify)(e[t]))})),e.accessList&&(o.accessList=(0,g.accessListify)(e.accessList)),o}}]),r}(k.Zk)},2833:function(e,t,r){"use strict";r.d(t,{c:function(){return g},l:function(){return y}});var n=r(7326),o=r(4165),i=r(5671),a=r(3144),u=r(1752),s=r(1120),l=r(136),c=r(9388),f=r(2554),d=r(5137),p=r(8878),h=r(5509),m=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(t){i(t)}}function u(e){try{s(n.throw(e))}catch(t){i(t)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},v=new d.Logger(p.i),g=function(e){(0,l.Z)(r,e);var t=(0,c.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,a.Z)(r,[{key:"detectNetwork",value:function(){var e=this,t=Object.create(null,{detectNetwork:{get:function(){return(0,u.Z)((0,s.Z)(r.prototype),"detectNetwork",e)}}});return m(this,void 0,void 0,(0,o.Z)().mark((function e(){var r;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(r=this.network)){e.next=7;break}return e.next=4,t.detectNetwork.call(this);case 4:(r=e.sent)||v.throwError("no network detected",d.Logger.errors.UNKNOWN_ERROR,{}),null==this._network&&((0,f.defineReadOnly)(this,"_network",r),this.emit("network",r,null));case 7:return e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)})))}}]),r}(h.r),y=function(e){(0,l.Z)(r,e);var t=(0,c.Z)(r);function r(e,o){var a;(0,i.Z)(this,r),v.checkAbstract(this instanceof r?this.constructor:void 0,r),e=(0,f.getStatic)(this instanceof r?this.constructor:void 0,"getNetwork")(e),o=(0,f.getStatic)(this instanceof r?this.constructor:void 0,"getApiKey")(o);var u=(0,f.getStatic)(this instanceof r?this.constructor:void 0,"getUrl")(e,o);return a=t.call(this,u,e),"string"===typeof o?(0,f.defineReadOnly)((0,n.Z)(a),"apiKey",o):null!=o&&Object.keys(o).forEach((function(e){(0,f.defineReadOnly)((0,n.Z)(a),e,o[e])})),a}return(0,a.Z)(r,[{key:"_startPending",value:function(){v.warn("WARNING: API provider does not support pending filters")}},{key:"isCommunityResource",value:function(){return!1}},{key:"getSigner",value:function(e){return v.throwError("API provider does not support signing",d.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}},{key:"listAccounts",value:function(){return Promise.resolve([])}}],[{key:"getApiKey",value:function(e){return e}},{key:"getUrl",value:function(e,t){return v.throwError("not implemented; sub-classes must override getUrl",d.Logger.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}]),r}(g)},6525:function(e,t,r){"use strict";r.d(t,{Q:function(){return m}});var n=r(5671),o=r(3144),i=r(7326),a=r(136),u=r(9388),s=r(2554),l=r(5137),c=r(8878),f=r(5509),d=new l.Logger(c.i),p=1;function h(e,t){var r="Web3LegacyFetcher";return function(e,n){var o=this,i={method:e,params:n,id:p++,jsonrpc:"2.0"};return new Promise((function(e,n){o.emit("debug",{action:"request",fetcher:r,request:(0,s.deepCopy)(i),provider:o}),t(i,(function(t,a){if(t)return o.emit("debug",{action:"response",fetcher:r,error:t,request:i,provider:o}),n(t);if(o.emit("debug",{action:"response",fetcher:r,request:i,response:a,provider:o}),a.error){var u=new Error(a.error.message);return u.code=a.error.code,u.data=a.error.data,n(u)}e(a.result)}))}))}}var m=function(e){(0,a.Z)(r,e);var t=(0,u.Z)(r);function r(e,o){var a;(0,n.Z)(this,r),null==e&&d.throwArgumentError("missing provider","provider",e);var u=null,l=null,c=null;return"function"===typeof e?(u="unknown:",l=e):(!(u=e.host||e.path||"")&&e.isMetaMask&&(u="metamask"),c=e,e.request?(""===u&&(u="eip-1193:"),l=function(e){return function(t,r){var n=this;null==r&&(r=[]);var o={method:t,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,s.deepCopy)(o),provider:this}),e.request(o).then((function(e){return n.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:o,response:e,provider:n}),e}),(function(e){throw n.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:o,error:e,provider:n}),e}))}}(e)):e.sendAsync?l=h(0,e.sendAsync.bind(e)):e.send?l=h(0,e.send.bind(e)):d.throwArgumentError("unsupported provider","provider",e),u||(u="unknown:")),a=t.call(this,u,o),(0,s.defineReadOnly)((0,i.Z)(a),"jsonRpcFetchFunc",l),(0,s.defineReadOnly)((0,i.Z)(a),"provider",c),a}return(0,o.Z)(r,[{key:"send",value:function(e,t){return this.jsonRpcFetchFunc(e,t)}}]),r}(f.r)},5362:function(e,t,r){"use strict";r.d(t,{q:function(){return x}});var n=r(4165),o=r(5671),i=r(3144),a=r(2963),u=r(7326),s=r(136),l=r(9388),c=r(1752),f=r(1120),d=r(7556),p=r(2554),h=r(5509),m=r(5137),v=r(8878),g=null;try{if(null==(g=WebSocket))throw new Error("inject please")}catch(E){var y=new m.Logger(v.i);g=function(){y.throwError("WebSockets not supported in this environment",m.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var b=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(t){i(t)}}function u(e){try{s(n.throw(e))}catch(t){i(t)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},w=new m.Logger(v.i),k=1,x=function(e){(0,s.Z)(r,e);var t=(0,l.Z)(r);function r(e,n){var i,s;(0,o.Z)(this,r),"any"===n&&w.throwError("WebSocketProvider does not support 'any' network yet",m.Logger.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),(s="string"===typeof e?t.call(this,e,n):t.call(this,"_websocket",n))._pollingInterval=-1,s._wsReady=!1,"string"===typeof e?(0,p.defineReadOnly)((0,u.Z)(s),"_websocket",new g(s.connection.url)):(0,p.defineReadOnly)((0,u.Z)(s),"_websocket",e),(0,p.defineReadOnly)((0,u.Z)(s),"_requests",{}),(0,p.defineReadOnly)((0,u.Z)(s),"_subs",{}),(0,p.defineReadOnly)((0,u.Z)(s),"_subIds",{}),(0,p.defineReadOnly)((0,u.Z)(s),"_detectNetwork",(0,c.Z)((i=(0,u.Z)(s),(0,f.Z)(r.prototype)),"detectNetwork",i).call(i)),s.websocket.onopen=function(){s._wsReady=!0,Object.keys(s._requests).forEach((function(e){s.websocket.send(s._requests[e].payload)}))},s.websocket.onmessage=function(e){var t=e.data,r=JSON.parse(t);if(null!=r.id){var n=String(r.id),o=s._requests[n];if(delete s._requests[n],void 0!==r.result)o.callback(null,r.result),s.emit("debug",{action:"response",request:JSON.parse(o.payload),response:r.result,provider:(0,u.Z)(s)});else{var i=null;r.error?(i=new Error(r.error.message||"unknown error"),(0,p.defineReadOnly)(i,"code",r.error.code||null),(0,p.defineReadOnly)(i,"response",t)):i=new Error("unknown error"),o.callback(i,void 0),s.emit("debug",{action:"response",error:i,request:JSON.parse(o.payload),provider:(0,u.Z)(s)})}}else if("eth_subscription"===r.method){var a=s._subs[r.params.subscription];a&&a.processFunc(r.params.result)}else console.warn("this should not happen")};var l=setInterval((function(){s.emit("poll")}),1e3);return l.unref&&l.unref(),(0,a.Z)(s)}return(0,i.Z)(r,[{key:"websocket",get:function(){return this._websocket}},{key:"detectNetwork",value:function(){return this._detectNetwork}},{key:"pollingInterval",get:function(){return 0},set:function(e){w.throwError("cannot set polling interval on WebSocketProvider",m.Logger.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}},{key:"resetEventsBlock",value:function(e){w.throwError("cannot reset events block on WebSocketProvider",m.Logger.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}},{key:"poll",value:function(){return b(this,void 0,void 0,(0,n.Z)().mark((function e(){return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null);case 1:case"end":return e.stop()}}),e)})))}},{key:"polling",set:function(e){e&&w.throwError("cannot set polling on WebSocketProvider",m.Logger.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}},{key:"send",value:function(e,t){var r=this,n=k++;return new Promise((function(o,i){var a=JSON.stringify({method:e,params:t,id:n,jsonrpc:"2.0"});r.emit("debug",{action:"request",request:JSON.parse(a),provider:r}),r._requests[String(n)]={callback:function(e,t){return e?i(e):o(t)},payload:a},r._wsReady&&r.websocket.send(a)}))}},{key:"_subscribe",value:function(e,t,r){return b(this,void 0,void 0,(0,n.Z)().mark((function o(){var i,a,u=this;return(0,n.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return null==(i=this._subIds[e])&&(i=Promise.all(t).then((function(e){return u.send("eth_subscribe",e)})),this._subIds[e]=i),n.next=4,i;case 4:a=n.sent,this._subs[a]={tag:e,processFunc:r};case 6:case"end":return n.stop()}}),o,this)})))}},{key:"_startEvent",value:function(e){var t=this;switch(e.type){case"block":this._subscribe("block",["newHeads"],(function(e){var r=d.O$.from(e.number).toNumber();t._emitted.block=r,t.emit("block",r)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(function(e){t.emit("pending",e)}));break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],(function(r){null==r.removed&&(r.removed=!1),t.emit(e.filter,t.formatter.filterLog(r))}));break;case"tx":var r=function(e){var r=e.hash;t.getTransactionReceipt(r).then((function(e){e&&t.emit(r,e)}))};r(e),this._subscribe("tx",["newHeads"],(function(e){t._events.filter((function(e){return"tx"===e.type})).forEach(r)}));break;case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e)}}},{key:"_stopEvent",value:function(e){var t=this,r=e.tag;if("tx"===e.type){if(this._events.filter((function(e){return"tx"===e.type})).length)return;r="tx"}else if(this.listenerCount(e.event))return;var n=this._subIds[r];n&&(delete this._subIds[r],n.then((function(e){t._subs[e]&&(delete t._subs[e],t.send("eth_unsubscribe",[e]))})))}},{key:"destroy",value:function(){return b(this,void 0,void 0,(0,n.Z)().mark((function e(){var t=this;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.websocket.readyState!==g.CONNECTING){e.next=3;break}return e.next=3,new Promise((function(e){t.websocket.onopen=function(){e(!0)},t.websocket.onerror=function(){e(!1)}}));case 3:this.websocket.close(1e3);case 4:case"end":return e.stop()}}),e,this)})))}}],[{key:"defaultUrl",value:function(){return"ws://localhost:8546"}}]),r}(h.r)},315:function(e,t,r){"use strict";r.r(t),r.d(t,{randomBytes:function(){return n.O},shuffled:function(){return o.y}});var n=r(9253),o=r(5700)},9253:function(e,t,r){"use strict";r.d(t,{O:function(){return s}});var n=r(2571),o=r(5137),i=new o.Logger("random/5.7.0");var a=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof r.g)return r.g;throw new Error("unable to locate global object")}(),u=a.crypto||a.msCrypto;function s(e){(e<=0||e>1024||e%1||e!=e)&&i.throwArgumentError("invalid length","length",e);var t=new Uint8Array(e);return u.getRandomValues(t),(0,n.arrayify)(t)}u&&u.getRandomValues||(i.warn("WARNING: Missing strong random number source"),u={getRandomValues:function(e){return i.throwError("no secure random source avaialble",o.Logger.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}})},5700:function(e,t,r){"use strict";function n(e){for(var t=(e=e.slice()).length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}r.d(t,{y:function(){return n}})},113:function(e,t,r){"use strict";r.r(t),r.d(t,{decode:function(){return d},encode:function(){return l}});var n=r(2571),o=r(5137),i=new o.Logger("rlp/5.7.0");function a(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function u(e,t,r){for(var n=0,o=0;ot+1+n&&i.throwError("child data too short",o.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:a}}function f(e,t){if(0===e.length&&i.throwError("data too short",o.Logger.errors.BUFFER_OVERRUN,{}),e[t]>=248){var r=e[t]-247;t+1+r>e.length&&i.throwError("data short segment too short",o.Logger.errors.BUFFER_OVERRUN,{});var a=u(e,t+1,r);return t+1+r+a>e.length&&i.throwError("data long segment too short",o.Logger.errors.BUFFER_OVERRUN,{}),c(e,t,t+1+r,r+a)}if(e[t]>=192){var s=e[t]-192;return t+1+s>e.length&&i.throwError("data array too short",o.Logger.errors.BUFFER_OVERRUN,{}),c(e,t,t+1,s)}if(e[t]>=184){var l=e[t]-183;t+1+l>e.length&&i.throwError("data array too short",o.Logger.errors.BUFFER_OVERRUN,{});var f=u(e,t+1,l);return t+1+l+f>e.length&&i.throwError("data array too short",o.Logger.errors.BUFFER_OVERRUN,{}),{consumed:1+l+f,result:(0,n.hexlify)(e.slice(t+1+l,t+1+l+f))}}if(e[t]>=128){var d=e[t]-128;return t+1+d>e.length&&i.throwError("data too short",o.Logger.errors.BUFFER_OVERRUN,{}),{consumed:1+d,result:(0,n.hexlify)(e.slice(t+1,t+1+d))}}return{consumed:1,result:(0,n.hexlify)(e[t])}}function d(e){var t=(0,n.arrayify)(e),r=f(t,0);return r.consumed!==t.length&&i.throwArgumentError("invalid rlp data","data",e),r.result}},5493:function(e,t,r){"use strict";r.r(t),r.d(t,{SupportedAlgorithm:function(){return o.p},computeHmac:function(){return n.Gy},ripemd160:function(){return n.bP},sha256:function(){return n.JQ},sha512:function(){return n.o}});var n=r(9680),o=r(1532)},9680:function(e,t,r){"use strict";r.d(t,{Gy:function(){return d},bP:function(){return l},JQ:function(){return c},o:function(){return f}});var n=r(1442),o=r.n(n),i=r(2571),a=r(1532),u=r(5137),s=new u.Logger("sha2/5.7.0");function l(e){return"0x"+o().ripemd160().update((0,i.arrayify)(e)).digest("hex")}function c(e){return"0x"+o().sha256().update((0,i.arrayify)(e)).digest("hex")}function f(e){return"0x"+o().sha512().update((0,i.arrayify)(e)).digest("hex")}function d(e,t,r){return a.p[e]||s.throwError("unsupported algorithm "+e,u.Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+o().hmac(o()[e],(0,i.arrayify)(t)).update((0,i.arrayify)(r)).digest("hex")}},1532:function(e,t,r){"use strict";var n;r.d(t,{p:function(){return n}}),function(e){e.sha256="sha256",e.sha512="sha512"}(n||(n={}))},9951:function(e,t,r){"use strict";r.r(t),r.d(t,{SigningKey:function(){return J},computePublicKey:function(){return X},recoverPublicKey:function(){return Y}});var n=r(5671),o=r(3144),i=r(2194),a=r.n(i),u=r(1442),s=r.n(u);"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof r.g?r.g:"undefined"!==typeof self&&self;function l(e,t,r){return r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&r.path)}},e(r,r.exports),r.exports}var c=f;function f(e,t){if(!e)throw new Error(t||"Assertion failed")}f.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var d=l((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r>8,a=255&o;i?r.push(i,a):r.push(a)}return r},r.zero2=n,r.toHex=o,r.encode=function(e,t){return"hex"===t?o(e):e}})),p=l((function(e,t){var r=t;r.assert=c,r.toArray=d.toArray,r.zero2=d.zero2,r.toHex=d.toHex,r.encode=d.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var o=1<(o>>1)-1?(o>>1)-s:s,i.isubn(u)):u=0,n[a]=u,i.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,i=0;e.cmpn(-o)>0||t.cmpn(-i)>0;){var a,u,s=e.andln(3)+o&3,l=t.andln(3)+i&3;3===s&&(s=-1),3===l&&(l=-1),a=0===(1&s)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==l?s:-s,r[0].push(a),u=0===(1&l)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==s?l:-l,r[1].push(u),2*o===a+1&&(o=1-o),2*i===u+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new(a())(e,"hex","le")}})),h=p.getNAF,m=p.getJSF,v=p.assert;function g(e,t){this.type=e,this.p=new(a())(t.p,16),this.red=t.prime?a().red(t.prime):a().mont(this.p),this.zero=new(a())(0).toRed(this.red),this.one=new(a())(1).toRed(this.red),this.two=new(a())(2).toRed(this.red),this.n=t.n&&new(a())(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var y=g;function b(e,t){this.curve=e,this.type=t,this.precomputed=null}g.prototype.point=function(){throw new Error("Not implemented")},g.prototype.validate=function(){throw new Error("Not implemented")},g.prototype._fixedNafMul=function(e,t){v(e.precomputed);var r=e._getDoubles(),n=h(t,1,this._bitLength),o=(1<=i;s--)a=(a<<1)+n[s];u.push(a)}for(var l=this.jpoint(null,null,null),c=this.jpoint(null,null,null),f=o;f>0;f--){for(i=0;i=0;u--){for(var s=0;u>=0&&0===i[u];u--)s++;if(u>=0&&s++,a=a.dblp(s),u<0)break;var l=i[u];v(0!==l),a="affine"===e.type?l>0?a.mixedAdd(o[l-1>>1]):a.mixedAdd(o[-l-1>>1].neg()):l>0?a.add(o[l-1>>1]):a.add(o[-l-1>>1].neg())}return"affine"===e.type?a.toP():a},g.prototype._wnafMulAdd=function(e,t,r,n,o){var i,a,u,s=this._wnafT1,l=this._wnafT2,c=this._wnafT3,f=0;for(i=0;i=1;i-=2){var p=i-1,v=i;if(1===s[p]&&1===s[v]){var g=[t[p],null,null,t[v]];0===t[p].y.cmp(t[v].y)?(g[1]=t[p].add(t[v]),g[2]=t[p].toJ().mixedAdd(t[v].neg())):0===t[p].y.cmp(t[v].y.redNeg())?(g[1]=t[p].toJ().mixedAdd(t[v]),g[2]=t[p].add(t[v].neg())):(g[1]=t[p].toJ().mixedAdd(t[v]),g[2]=t[p].toJ().mixedAdd(t[v].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],b=m(r[p],r[v]);for(f=Math.max(b[0].length,f),c[p]=new Array(f),c[v]=new Array(f),a=0;a=0;i--){for(var C=0;i>=0;){var A=!0;for(a=0;a=0&&C++,x=x.dblp(C),i<0)break;for(a=0;a0?u=l[a][S-1>>1]:S<0&&(u=l[a][-S-1>>1].neg()),x="affine"===u.type?x.mixedAdd(u):x.add(u))}}for(i=0;i=Math.ceil((e.bitLength()+1)/t.step)},b.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o=0&&(i=t,u=r),n.negative&&(n=n.neg(),o=o.neg()),i.negative&&(i=i.neg(),u=u.neg()),[{a:n,b:o},{a:i,b:u}]},x.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),a=o.mul(r.a),u=i.mul(n.a),s=o.mul(r.b),l=i.mul(n.b);return{k1:e.sub(a).sub(u),k2:s.add(l).neg()}},x.prototype.pointFromX=function(e,t){(e=new(a())(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},x.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},x.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,i=0;i":""},C.prototype.isInfinity=function(){return this.inf},C.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},C.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,a)},C.prototype.getX=function(){return this.x.fromRed()},C.prototype.getY=function(){return this.y.fromRed()},C.prototype.mul=function(e){return e=new(a())(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},C.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},C.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},C.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},C.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},C.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},w(A,y.BasePoint),x.prototype.jpoint=function(e,t,r){return new A(this,e,t,r)},A.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},A.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},A.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),u=n.redSub(o),s=i.redSub(a);if(0===u.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=u.redSqr(),c=l.redMul(u),f=n.redMul(l),d=s.redSqr().redIAdd(c).redISub(f).redISub(f),p=s.redMul(f.redISub(d)).redISub(i.redMul(c)),h=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(d,p,h)},A.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,i=e.y.redMul(t).redMul(this.z),a=r.redSub(n),u=o.redSub(i);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var s=a.redSqr(),l=s.redMul(a),c=r.redMul(s),f=u.redSqr().redIAdd(l).redISub(c).redISub(c),d=u.redMul(c.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(a);return this.curve.jpoint(f,d,p)},A.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t