quartz/wallet/node_modules/@3rdweb/sdk/dist/sdk.cjs.production.min.js
2022-03-04 20:05:23 +08:00

3 lines
333 KiB
JavaScript

"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e.default=t,e}Object.defineProperty(exports,"__esModule",{value:!0});var r=t(require("node-fetch")),n=require("@ethersproject/bytes"),a=require("@ethersproject/contracts"),s=require("@3rdweb/contracts"),i=require("@ethersproject/constants"),o=require("@ethersproject/units"),u=require("ethers"),c=require("ts-enum-util"),p=require("@ethersproject/bignumber"),d=require("ethers/lib/utils"),l=require("uuid"),f=require("@ethersproject/providers"),h=require("eventemitter2"),m=require("json2typescript"),y=require("merkletreejs"),x=t(y),v=require("tslib"),g=require("@ethersproject/address"),b=require("crypto-js");function w(t,e,r,n,a,s,i){try{var o=t[s](i),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(n,a)}function k(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var s=t.apply(e,r);function i(t){w(s,n,a,i,o,"next",t)}function o(t){w(s,n,a,i,o,"throw",t)}i(void 0)}))}}function C(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function T(t,e,r){return e&&C(t.prototype,e),r&&C(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function M(){return(M=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function S(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,O(t,e)}function A(t){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function O(t,e){return(O=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function R(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function P(t,e,r){return(P=R()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var a=new(Function.bind.apply(t,n));return r&&O(a,r.prototype),a}).apply(null,arguments)}function _(t){var e="function"==typeof Map?new Map:void 0;return(_=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return P(t,arguments,A(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),O(r,t)})(t)}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function E(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return B(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var N,F=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",s=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function o(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var a=Object.create((e&&e.prototype instanceof d?e:d).prototype),s=new C(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(a,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw s;return{value:void 0,done:!0}}for(r.method=a,r.arg=s;;){var i=r.delegate;if(i){var o=b(i,r);if(o){if(o===p)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,s),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var p={};function d(){}function l(){}function f(){}var h={};o(h,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(T([])));y&&y!==e&&r.call(y,a)&&(h=y);var x=f.prototype=d.prototype=Object.create(h);function v(t){["next","throw","return"].forEach((function(e){o(t,e,(function(t){return this._invoke(e,t)}))}))}function g(t,e){var n;this._invoke=function(a,s){function i(){return new e((function(n,i){!function n(a,s,i,o){var u=c(t[a],t,s);if("throw"!==u.type){var p=u.arg,d=p.value;return d&&"object"==typeof d&&r.call(d,"__await")?e.resolve(d.__await).then((function(t){n("next",t,i,o)}),(function(t){n("throw",t,i,o)})):e.resolve(d).then((function(t){p.value=t,i(p)}),(function(t){return n("throw",t,i,o)}))}o(u.arg)}(a,s,n,i)}))}return n=n?n.then(i,i):i()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,p;var a=n.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function T(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,s=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return s.next=s}}return{next:M}}function M(){return{value:void 0,done:!0}}return l.prototype=f,o(x,"constructor",f),o(f,"constructor",l),l.displayName=o(f,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,o(t,i,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},v(g.prototype),o(g.prototype,s,(function(){return this})),t.AsyncIterator=g,t.async=function(e,r,n,a,s){void 0===s&&(s=Promise);var i=new g(u(e,r,n,a),s);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},v(x),o(x,i,"Generator"),o(x,a,(function(){return this})),o(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=T,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(o&&u){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=t,i.arg=e,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;k(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(N={exports:{}}),N.exports),L=function(t){function e(e){return t.call(this,e?"Object with id "+e+" NOT FOUND":"NOT_FOUND")||this}return S(e,t),e}(_(Error)),I=function(t){function e(e){return t.call(this,e?"'"+e+"' is an invalid address":"Invalid address passed")||this}return S(e,t),e}(_(Error)),D=function(t){function e(e,r){return t.call(this,"MISSING ROLE: "+e+" does not have the '"+r+"' role")||this}return S(e,t),e}(_(Error)),U=function(t){function e(e){return void 0===e&&(e="The asset you're trying to use could not be found."),t.call(this,"message: "+e)||this}return S(e,t),e}(_(Error)),V=function(t){function e(e){return t.call(this,"UPLOAD_FAILED: "+e)||this}return S(e,t),e}(_(Error)),j=function(t){function e(){return t.call(this,"File name is required when object is not a `File` type object.")||this}return S(e,t),e}(_(Error)),q=function(t){function e(e){return t.call(this,"DUPLICATE_FILE_NAME_ERROR: File name "+e+" was passed for more than one file.")||this}return S(e,t),e}(_(Error)),J=function(t){function e(e,r,n){return t.call(this,"BALANCE ERROR: you do not have enough balance on contract "+e+" to use "+r+" tokens. You have "+n+" tokens available.")||this}return S(e,t),e}(_(Error)),W=function(t){function e(){return t.call(this,"LIST ERROR: you should be the owner of the token to list it.")||this}return S(e,t),e}(_(Error)),G=function(t){function e(e){return t.call(this,"BUY ERROR: You cannot buy more than "+e+" tokens")||this}return S(e,t),e}(_(Error)),Z=function(t){function e(e,r){var n;return(n=t.call(this,"FETCH_FAILED: "+e)||this).innerError=void 0,n.innerError=r,n}return S(e,t),e}(_(Error)),z=function(t){function e(e){return t.call(this,"DUPLICATE_LEAFS"+(e?" : "+e:""))||this}return S(e,t),e}(_(Error)),H=function(t){function e(e){return t.call(this,"Auction already started with existing bid"+(e?", id: "+e:""))||this}return S(e,t),e}(_(Error)),K=function(t){function e(e){return t.call(this,"FUNCTION DEPRECATED. "+(e?"Use "+e+" instead":""))||this}return S(e,t),e}(_(Error)),Q=function(t){function e(e,r){return t.call(this,"Could not find listing."+(e?" marketplace address: "+e:"")+(r?" listing id: "+r:""))||this}return S(e,t),e}(_(Error)),Y=function(t){function e(e,r,n,a){return t.call(this,"Incorrect listing type. Are you sure you're using the right method?."+(e?" marketplace address: "+e:"")+(r?" listing id: "+r:"")+(a?" expected type: "+a:"")+(n?" actual type: "+n:""))||this}return S(e,t),e}(_(Error)),X=function(t){function e(e){return t.call(this,"Failed to transfer asset, transfer is restricted."+(e?" Address : "+e:""))||this}return S(e,t),e}(_(Error)),$=function(t){function e(e,r,n){return void 0===n&&(n="Failed to execute transaction"),t.call(this,n+", admin role is missing"+(e?" on address: "+e:"")+(r?" on contract: "+r:""))||this}return S(e,t),e}(_(Error)),tt=function(t){function e(e,r){return t.call(this,"Auction has not ended yet"+(e?", id: "+e:"")+(r?", end time: "+r.toString():""))||this}return S(e,t),e}(_(Error));function et(t,e){return"object"==typeof t&&Object.keys(t).forEach((function(r){"object"==typeof t[r]?t[r]=et(t[r],e):"string"==typeof t[r]&&(t[r]=e.resolveFullUrl(t[r]))})),t}function rt(t,e,r){return nt.apply(this,arguments)}function nt(){return(nt=k(F.mark((function t(e,r,n){var a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a={"X-App-Name":"CONSOLE-TS-SDK-"+r,"X-Public-Address":n||""},(s=new FormData).append("file",e),t.next=5,fetch("https://upload.nftlabs.co/upload",{method:"POST",body:s,headers:a});case 5:return i=t.sent,t.prev=6,t.next=9,i.json();case 9:return t.abrupt("return",t.sent.IpfsUri);case 13:throw t.prev=13,t.t0=t.catch(6),new V("Failed to upload to IPFS: "+t.t0);case 16:case"end":return t.stop()}}),t,null,[[6,13]])})))).apply(this,arguments)}function at(t,e,r){return st.apply(this,arguments)}function st(){return(st=k(F.mark((function t(e,r,n){var a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s=function(){return(s=k(F.mark((function t(e){var s,i,o,u;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:s=Object.keys(e),t.t0=F.keys(s);case 2:if((t.t1=t.t0()).done){t.next=18;break}if(!(u=(o=e[s[i=t.t1.value]])instanceof File||o instanceof Buffer)){t.next=10;break}return t.next=9,rt(e[s[i]],r,n);case 9:e[s[i]]=t.sent;case 10:if(!u||"string"==typeof e[s[i]]){t.next=12;break}throw new Error("Upload to IPFS failed");case 12:if("object"!=typeof o){t.next=16;break}return t.next=15,a(e[s[i]]);case 15:e[s[i]]=t.sent;case 16:t.next=2;break;case 18:return t.abrupt("return",e);case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)},a=function(t){return s.apply(this,arguments)},"string"!=typeof e){t.next=4;break}return t.abrupt("return",e);case 4:return t.next=6,a(e);case 6:return e=t.sent,t.next=9,rt(JSON.stringify(e),r,n);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}globalThis.FormData||(globalThis.FormData=require("form-data")),globalThis.File||(globalThis.File=require("@web-std/file").File);var it,ot=n.arrayify("0x80ac58cd"),ut=n.arrayify("0xd9b67a26"),ct=[{inputs:[],name:"contractURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];function pt(t,e,r,n){return dt.apply(this,arguments)}function dt(){return(dt=k(F.mark((function t(e,r,n,s){var i,o,u,c,p;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===s&&(s=!1),i=new a.Contract(r,ct,e),t.next=4,i.contractURI();case 4:return o=t.sent,t.next=7,n.get(o);case 7:return u=t.sent,t.prev=8,c=JSON.parse(u),s&&(c=et(c,n)),p=M({},c),t.abrupt("return",p);case 15:throw t.prev=15,t.t0=t.catch(8),new Error("Failed to parse metadata for contract "+r+" with uri "+o);case 18:case"end":return t.stop()}}),t,null,[[8,15]])})))).apply(this,arguments)}function lt(t,e){return ft.apply(this,arguments)}function ft(){return(ft=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getCode(r);case 2:return t.t0=t.sent,t.abrupt("return","0x"!==t.t0);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}!function(t){t[t.Mainnet=1]="Mainnet",t[t.Ropsten=3]="Ropsten",t[t.Rinkeby=4]="Rinkeby",t[t.Goerli=5]="Goerli",t[t.Kovan=42]="Kovan",t[t.BSC=56]="BSC",t[t.xDai=100]="xDai",t[t.Polygon=137]="Polygon",t[t.Moonriver=1285]="Moonriver",t[t.Mumbai=80001]="Mumbai",t[t.Harmony=16666e5]="Harmony",t[t.Localhost=1337]="Localhost",t[t.Hardhat=31337]="Hardhat",t[t.Fantom=250]="Fantom",t[t.FantomTestnet=4002]="FantomTestnet",t[t.Avalanche=43114]="Avalanche",t[t.AvalancheFujiTestnet=43113]="AvalancheFujiTestnet"}(it||(it={}));var ht,mt,yt=[it.Mainnet,it.Rinkeby,it.Polygon,it.Mumbai,it.Fantom,it.FantomTestnet,it.Avalanche,it.AvalancheFujiTestnet],xt="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",vt=((ht={})[it.Mainnet]={name:"Ether",symbol:"ETH",decimals:18,wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",name:"Wrapped Ether",symbol:"WETH"}},ht[it.Rinkeby]={name:"Ether",symbol:"ETH",decimals:18,wrapped:{address:"0xc778417E063141139Fce010982780140Aa0cD5Ab",name:"Wrapped Ether",symbol:"WETH"}},ht[it.Polygon]={name:"Matic",symbol:"MATIC",decimals:18,wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",name:"Wrapped Matic",symbol:"WMATIC"}},ht[it.Mumbai]={name:"Matic",symbol:"MATIC",decimals:18,wrapped:{address:"0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889",name:"Wrapped Matic",symbol:"WMATIC"}},ht[it.Avalanche]={name:"Avalanche",symbol:"AVAX",decimals:18,wrapped:{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",name:"Wrapped AVAX",symbol:"WAVAX"}},ht[it.AvalancheFujiTestnet]={name:"Avalanche",symbol:"AVAX",decimals:18,wrapped:{address:"0xd00ae08403B9bbb9124bB305C09058E32C39A48c",name:"Wrapped AVAX",symbol:"WAVAX"}},ht[it.Fantom]={name:"Fantom",symbol:"FTM",decimals:18,wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",name:"Wrapped Fantom",symbol:"WFTM"}},ht[it.FantomTestnet]={name:"Fantom",symbol:"FTM",decimals:18,wrapped:{address:"0xf1277d1Ed8AD466beddF92ef448A132661956621",name:"Wrapped Fantom",symbol:"WFTM"}},ht[it.Hardhat]={name:"Ether",symbol:"ETH",decimals:18,wrapped:{address:"0x5FbDB2315678afecb367f032d93F642f64180aa3",name:"Wrapped Ether",symbol:"WETH"}},ht);function gt(t,e){return bt.apply(this,arguments)}function bt(){return(bt=k(F.mark((function t(e,r){var n,a,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!Ct(r)){t.next=10;break}return n=u.Signer.isSigner(e)?e.provider:e,t.next=5,n.getNetwork();case 5:return a=At(t.sent.chainId),t.abrupt("return",{name:a.name,symbol:a.symbol,decimals:a.decimals});case 10:return i=s.ERC20__factory.connect(r,e),t.next=13,Promise.all([i.name(),i.symbol(),i.decimals()]);case 13:return t.abrupt("return",{name:(o=t.sent)[0],symbol:o[1],decimals:o[2]});case 18:t.next=22;break;case 20:t.prev=20,t.t0=t.catch(0);case 22:return t.abrupt("return",{name:"",symbol:"",decimals:0});case 23:case"end":return t.stop()}}),t,null,[[0,20]])})))).apply(this,arguments)}function wt(t,e,r){return kt.apply(this,arguments)}function kt(){return(kt=k(F.mark((function t(e,r,n){var a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,gt(e,r);case 2:return t.abrupt("return",M({},a=t.sent,{value:n.toString(),displayValue:o.formatUnits(n,a.decimals)}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ct(t){return t.toLowerCase()===xt||t.toLowerCase()===i.AddressZero}function Tt(t,e,r){return Mt.apply(this,arguments)}function Mt(){return(Mt=k(F.mark((function t(e,r,n){var a,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=St(e),!Ct(r)){t.next=7;break}return t.next=4,a.getBalance(n);case 4:i=t.sent,t.next=18;break;case 7:return t.prev=7,o=s.ERC20__factory.connect(r,a),t.next=11,o.balanceOf(n);case 11:i=t.sent,t.next=18;break;case 14:throw t.prev=14,t.t0=t.catch(7),console.error(t.t0),new Error("invalid ERC20 token address");case 18:return t.abrupt("return",wt(e,r,i));case 19:case"end":return t.stop()}}),t,null,[[7,14]])})))).apply(this,arguments)}function St(t){return u.Signer.isSigner(t)?t.provider:t}function At(t){return vt[t]}var Ot,Rt=((mt={})[it.Polygon]={vrfCoordinator:"0x3d2341ADb2D31f1c5530cDC622016af293177AE0",linkTokenAddress:"0xb0897686c545045aFc77CF20eC7A532E3120E0F1",keyHash:"0xf86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da",fees:u.ethers.utils.parseEther("0.0001")},mt[it.Mumbai]={vrfCoordinator:"0x8C7382F9D8f56b33781fE506E897a4F1e2d17255",linkTokenAddress:"0x326C977E6efc84E512bB9C30f76E30c160eD06FB",keyHash:"0x6e75b569a01ef56d18cab6a8e71e6600d6ce853834d4a5748b720d06f878b3a4",fees:u.ethers.utils.parseEther("0.0001")},mt[it.Rinkeby]={vrfCoordinator:"0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B",linkTokenAddress:"0x01be23585060835e02b77ef475b0cc51aa1e0709",keyHash:"0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311",fees:u.ethers.utils.parseEther("0.1")},mt[it.Mainnet]={vrfCoordinator:"0xf0d54349aDdcf704F77AE15b96510dEA15cb7952",linkTokenAddress:"0x514910771AF9Ca656af840dff83E8264EcF986CA",keyHash:"0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445",fees:u.ethers.utils.parseEther("2")},mt[it.Hardhat]={vrfCoordinator:"0x8C7382F9D8f56b33781fE506E897a4F1e2d17255",linkTokenAddress:"0x326C977E6efc84E512bB9C30f76E30c160eD06FB",keyHash:"0x6e75b569a01ef56d18cab6a8e71e6600d6ce853834d4a5748b720d06f878b3a4",fees:u.ethers.utils.parseEther("0.0001")},mt);(Ot=exports.ModuleType||(exports.ModuleType={}))[Ot.CURRENCY=0]="CURRENCY",Ot[Ot.TOKEN=0]="TOKEN",Ot[Ot.COLLECTION=1]="COLLECTION",Ot[Ot.BUNDLE=1]="BUNDLE",Ot[Ot.NFT=2]="NFT",Ot[Ot.DYNAMIC_NFT=3]="DYNAMIC_NFT",Ot[Ot.ACCESS_NFT=4]="ACCESS_NFT",Ot[Ot.PACK=5]="PACK",Ot[Ot.MARKET=6]="MARKET",Ot[Ot.DROP=7]="DROP",Ot[Ot.DATASTORE=8]="DATASTORE",Ot[Ot.SPLITS=9]="SPLITS",Ot[Ot.VOTE=10]="VOTE",Ot[Ot.BUNDLE_DROP=11]="BUNDLE_DROP",Ot[Ot.MARKETPLACE=12]="MARKETPLACE",Ot[Ot.BUNDLE_SIGNATURE=13]="BUNDLE_SIGNATURE";var Pt=[{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];function _t(t,e,r,n){return Bt.apply(this,arguments)}function Bt(){return(Bt=k(F.mark((function t(e,r,n,s){var i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=new a.Contract(r,Pt,e),t.abrupt("return",Et(i,n,s));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Et(t,e,r){return Nt.apply(this,arguments)}function Nt(){return(Nt=k(F.mark((function t(e,r,n){var a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,It(e,r);case 2:if(a=t.sent){t.next=5;break}throw new L;case 5:return t.prev=5,t.next=8,n.get(a);case 8:return s=et(JSON.parse(t.sent),n),i=M({},s,{id:r,uri:a}),t.abrupt("return",i);case 14:return t.prev=14,t.t0=t.catch(5),console.error("failed to fetch nft",t.t0),t.abrupt("return",{id:r,uri:a});case 18:case"end":return t.stop()}}),t,null,[[5,14]])})))).apply(this,arguments)}function Ft(t,e,r,n){return Lt.apply(this,arguments)}function Lt(){return(Lt=k(F.mark((function t(e,r,n,s){var i,o,u,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=new a.Contract(e,Pt,r),t.next=3,It(i,n);case 3:if(o=t.sent){t.next=6;break}throw new L;case 6:return t.prev=6,t.t0=JSON,t.next=10,s.get(o);case 10:return t.t1=t.sent,u=t.t0.parse.call(t.t0,t.t1),c=M({},u,{id:n}),t.abrupt("return",c);case 16:return t.prev=16,t.t2=t.catch(6),console.error("failed to fetch nft",t.t2),t.abrupt("return",{id:n,uri:o});case 20:case"end":return t.stop()}}),t,null,[[6,16]])})))).apply(this,arguments)}function It(t,e){return Dt.apply(this,arguments)}function Dt(){return(Dt=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n="",t.prev=1,t.next=4,e.tokenURI(r);case 4:n=t.sent,t.next=9;break;case 7:t.prev=7,t.t0=t.catch(1);case 9:if(n){t.next=18;break}return t.prev=10,t.next=13,e.uri(r);case 13:n=t.sent,t.next=18;break;case 16:t.prev=16,t.t1=t.catch(10);case 18:if(n){t.next=27;break}return t.prev=19,t.next=22,e.uri(r);case 22:n=t.sent,t.next=27;break;case 25:t.prev=25,t.t2=t.catch(19);case 27:return t.abrupt("return",n);case 28:case"end":return t.stop()}}),t,null,[[1,7],[10,16],[19,25]])})))).apply(this,arguments)}var Ut,Vt={admin:"admin",minter:"minter",pauser:"pauser",transfer:"transfer",editor:"editor",lister:"lister",asset:"asset"},jt={admin:"",transfer:"TRANSFER_ROLE",minter:"MINTER_ROLE",pauser:"PAUSER_ROLE",editor:"EDITOR_ROLE",lister:"LISTER_ROLE",asset:"ASSET_ROLE"};function qt(t){return"admin"===t?u.ethers.utils.hexZeroPad([0],32):u.ethers.utils.id(jt[t])}function Jt(t){return t&&t===it.Polygon?"https://gasstation-mainnet.matic.network":null}function Wt(t,e,r){return Gt.apply(this,arguments)}function Gt(){return(Gt=k(F.mark((function t(e,r,n){var a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=Jt(e)){t.next=3;break}return t.abrupt("return",null);case 3:return t.prev=3,t.next=6,fetch(a);case 6:return t.next=8,t.sent.json();case 8:if(s=t.sent[r],e!==it.Polygon&&e!==it.Mumbai||(s=Math.max(s,31)),!(s>0)){t.next=13;break}return t.abrupt("return",Math.min(s,n));case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(3),console.error("failed to fetch gas",t.t0);case 18:return t.abrupt("return",null);case 19:case"end":return t.stop()}}),t,null,[[3,15]])})))).apply(this,arguments)}function Zt(t,e){if(!t)throw new Error(e)}function zt(t,e,r,n){return Ht.apply(this,arguments)}function Ht(){return(Ht=k(F.mark((function t(e,r,n,a){var s,i,o,c,p;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=null==e?void 0:e.provider){t.next=3;break}throw new Error("missing provider");case 3:if(o=u.ethers.utils._TypedDataEncoder.getPayload(r,n,a),c="",null==i||null==(s=i.provider)||!s.isWalletConnect){t.next=17;break}return t.t0=i,t.next=9,e.getAddress();case 9:return t.t1=t.sent.toLowerCase(),t.t2=JSON.stringify(o),t.t3=[t.t1,t.t2],t.next=14,t.t0.send.call(t.t0,"eth_signTypedData",t.t3);case 14:c=t.sent,t.next=38;break;case 17:return t.prev=17,t.next=20,e._signTypedData(r,n,a);case 20:c=t.sent,t.next=38;break;case 23:if(t.prev=23,t.t4=t.catch(17),null==t.t4||null==(p=t.t4.message)||!p.includes("Method eth_signTypedData_v4 not supported")){t.next=37;break}return t.t5=i,t.next=29,e.getAddress();case 29:return t.t6=t.sent.toLowerCase(),t.t7=JSON.stringify(o),t.t8=[t.t6,t.t7],t.next=34,t.t5.send.call(t.t5,"eth_signTypedData",t.t8);case 34:c=t.sent,t.next=38;break;case 37:throw t.t4;case 38:return t.abrupt("return",{payload:o,signature:u.ethers.utils.joinSignature(u.ethers.utils.splitSignature(c))});case 39:case"end":return t.stop()}}),t,null,[[17,23]])})))).apply(this,arguments)}!function(t){t.Transaction="transaction",t.Signature="signature"}(Ut||(Ut={}));var Kt,Qt=function(){function t(t,e,r,n){this.address=void 0,this.ipfsGatewayUrl=void 0,this.options=void 0,this.sdk=void 0,this._providerOrSigner=null,this._signer=null,this.contract=void 0,this.readOnlyContract=void 0,this.address=e,this.options=r,this.ipfsGatewayUrl=r.ipfsGatewayUrl,this.setProviderOrSigner(t),this.contract=this.connectContract(),this.readOnlyContract=this.options.readOnlyRpcUrl?this.contract.connect(u.ethers.getDefaultProvider(this.options.readOnlyRpcUrl)):this.contract,this.sdk=n}var e=t.prototype;return e.exists=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getProvider();case 2:return(e=t.sent)||Zt(!1),t.abrupt("return",lt(e,this.address));case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.getMetadata=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=!0),t.next=3,this.exists();case 3:if(t.sent){t.next=7;break}Zt(!1),t.next=8;break;case 7:case 8:return r=this.connectContract(),n=this.getModuleType(),t.t0=pt,t.next=13,this.getProvider();case 13:return t.t1=t.sent,t.t2=r.address,t.t3=this.sdk.getStorage(),t.t4=e,t.next=19,(0,t.t0)(t.t1,t.t2,t.t3,t.t4);case 19:return t.t5=t.sent,t.t6=r.address,t.t7=n,t.abrupt("return",{metadata:t.t5,address:t.t6,type:t.t7});case 23:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.setMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.exists();case 2:if(t.sent){t.next=6;break}Zt(!1),t.next=7;break;case 6:case 7:return t.next=9,at(e);case 9:return r=t.sent,t.next=12,this.sendTransaction("setContractURI",[r]);case 12:return t.abrupt("return",this.getMetadata());case 13:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.setProviderOrSigner=function(t){this.providerOrSigner=t,u.Signer.isSigner(t)&&(this.signer=t),this.contract=this.connectContract(),this.readOnlyContract=this.options.readOnlyRpcUrl?this.contract.connect(u.ethers.getDefaultProvider(this.options.readOnlyRpcUrl)):this.contract},e.clearSigner=function(){this.signer=null},e.getProviderOrSigner=function(){return this.signer||this.providerOrSigner},e.getSigner=function(){return u.Signer.isSigner(this.signer)?this.signer:null},e.hasValidSigner=function(){return u.Signer.isSigner(this.signer)},e.getSignerAddress=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(e=this.getSigner())||Zt(!1),t.next=4,e.getAddress();case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.getProvider=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.provider);case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.getChainID=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getProvider();case 2:return(e=t.sent)||Zt(!1),t.next=6,e.getNetwork();case 6:return t.abrupt("return",t.sent.chainId);case 9:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.connectContract=function(){throw new Error("connectContract has to be implemented")},e.getModuleType=function(){throw new Error("getModuleType has to be implemented")},e.getCallOverrides=function(){var t=k(F.mark((function t(){var e,r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getChainID();case 2:return e=t.sent,r=this.options.gasSpeed,n=this.options.maxGasPriceInGwei,t.next=7,Wt(e,r,n);case 7:if(a=t.sent){t.next=10;break}return t.abrupt("return",{});case 10:return t.abrupt("return",{gasPrice:u.ethers.utils.parseUnits(a.toString(),"gwei")});case 11:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.emitTransactionEvent=function(t,e){this.sdk.event.emit(Ut.Transaction,{status:t,transactionHash:e})},e.sendTransaction=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.sendContractTransaction(this.contract,e,r,n));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.sendContractTransaction=function(){var t=k(F.mark((function t(e,r,n,a){var s,i,o,u,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a){t.next=4;break}return t.next=3,this.getCallOverrides();case 3:a=t.sent;case 4:if(!this.options.transactionRelayerUrl&&!this.options.gasless.biconomy.apiKey){t.next=19;break}return t.next=7,this.getProvider();case 7:return s=t.sent,t.next=10,this.sendGaslessTransaction(e,r,n,a);case 10:return this.emitTransactionEvent("submitted",i=t.sent),t.next=14,s.waitForTransaction(i);case 14:return o=t.sent,this.emitTransactionEvent("completed",i),t.abrupt("return",o);case 19:return t.next=21,this.sendTransactionByFunction(e,r,n,a);case 21:return this.emitTransactionEvent("submitted",(u=t.sent).hash),c=u.wait(),this.emitTransactionEvent("completed",u.hash),t.abrupt("return",c);case 26:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),e.sendTransactionByFunction=function(){var t=k(F.mark((function t(e,r,n,a){var s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s=e.functions[r]){t.next=3;break}throw new Error("invalid function");case 3:return t.next=5,s.apply(void 0,n.concat([a]));case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),e.sendGaslessTransaction=function(){var t=k(F.mark((function t(e,r,n,a){var s,i,o,c,p,d,l,f;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.getSigner()||Zt(!1),t.next=4,this.getProvider();case 4:return t.sent||Zt(!1),t.next=8,this.getChainID();case 8:return i=t.sent,t.next=11,this.getSignerAddress();case 11:if(o=t.sent,c=this.address,!u.BigNumber.from((null==a?void 0:a.value)||0).gt(0)){t.next=16;break}throw new Error("Cannot send native token value with gasless transaction");case 16:return p=e.interface.encodeFunctionData(r,n),t.next=19,(s=e.estimateGas)[r].apply(s,n);case 19:return l=(d=t.sent).mul(2),d.lt(25e3)&&(l=u.BigNumber.from(5e5)),f={from:o,to:c,data:p,chainId:i,gasLimit:l,functionName:r,functionArgs:n,callOverrides:a},t.next=25,this.options.gaslessSendFunction(e,f);case 25:return t.abrupt("return",t.sent);case 27:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),e.signTypedDataEmitEvent=function(){var t=k(F.mark((function t(e,r,n,a){var s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sdk.event.emit(Ut.Signature,{status:"submitted",message:a,signature:s=""}),t.next=4,zt(e,r,n,a);case 4:return this.sdk.event.emit(Ut.Signature,{status:"completed",message:a,signature:s=t.sent.signature}),t.abrupt("return",s);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),e.parseEventLogs=function(t,e){if(!e)return null;for(var r,n=E(e);!(r=n()).done;){var a=r.value;try{return this.contract.interface.decodeEventLog(t,a.data,a.topics)}catch(t){}}return null},e.parseLogs=function(t,e,r){if(void 0===r&&(r=this.contract),!e||0===e.length)return[];var n=r.interface.getEventTopic(t);return e.filter((function(t){return t.topics.indexOf(n)>=0})).map((function(t){return r.interface.parseLog(t)}))},T(t,[{key:"providerOrSigner",get:function(){return this.signer||this._providerOrSigner||this.getProviderOrSigner()},set:function(t){this._providerOrSigner=t}},{key:"signer",get:function(){return this._signer},set:function(t){this._signer=t}}]),t}(),Yt=function(t){S(r,t);var e=r.prototype;function r(e,r,n,a){return t.call(this,e,r,n,a)||this}return e.getModuleRoles=function(){throw new Error("getModuleRoles has to be implemented by a subclass")},e.getRoleMembers=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.roles.includes(e)||Zt(!1),r=this.readOnlyContract,n=qt(e),t.next=5,r.getRoleMemberCount(n);case 5:return a=t.sent.toNumber(),t.next=8,Promise.all(Array.from(Array(a).keys()).map((function(t){return r.getRoleMember(n,t)})));case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.getAllRoleMembers=function(){var t=k(F.mark((function t(){var e,r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.roles.length||Zt(!1),e={},r=E(this.roles);case 3:if((n=r()).done){t.next=10;break}return a=n.value,t.next=7,this.getRoleMembers(a);case 7:e[a]=t.sent;case 8:t.next=3;break;case 10:return t.abrupt("return",e);case 11:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.setAllRoleMembers=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(r=Object.keys(e)).length||Zt(!1),r.every((function(t){return s.roles.includes(t)}))||Zt(!1),t.next=5,this.getAllRoleMembers();case 5:return n=t.sent,a=[],r.sort((function(t){return"admin"===t?1:-1})).forEach(function(){var t=k(F.mark((function t(r){var i,o,u,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=n[r]||[],u=(i=e[r]||[]).filter((function(t){return!o.includes(t)})),c=o.filter((function(t){return!i.includes(t)})),u.length&&u.forEach((function(t){a.push(s.contract.interface.encodeFunctionData("grantRole",[qt(r),t]))})),c.length&&c.forEach(function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.getRevokeRoleFunctionName(e);case 2:a.push(s.contract.interface.encodeFunctionData(t.sent,[qt(r),e]));case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),t.next=10,this.sendTransaction("multicall",[a]);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.revokeAllRolesFromAddress=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAllRoleMembers();case 2:return r=t.sent,n=[],a=[],Object.keys(r).sort((function(t){return"admin"===t?1:-1})).forEach(function(){var t=k(F.mark((function t(i){var o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==(o=r[i])||!o.includes(e)){t.next=6;break}return t.next=3,s.getRevokeRoleFunctionName(e);case 3:n.push(s.contract.interface.encodeFunctionData(t.sent,[qt(i),e])),a.push(i);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),t.next=8,this.sendTransaction("multicall",[n]);case 8:return t.abrupt("return",a);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.grantRole=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.roles.includes(e)||Zt(!1),t.next=3,this.sendTransaction("grantRole",[qt(e),r]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.revokeRole=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.roles.includes(e)||Zt(!1),t.next=3,this.getRevokeRoleFunctionName(r);case 3:return n=t.sent,t.next=6,this.sendTransaction(n,[qt(e),r]);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.getRevokeRoleFunctionName=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerAddress();case 2:if(t.sent.toLowerCase()!==e.toLowerCase()){t.next=5;break}return t.abrupt("return","renounceRole");case 5:return t.abrupt("return","revokeRole");case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.prepareMetadata=function(){var t=k(F.mark((function t(e){var r,n=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e){t.next=2;break}return t.abrupt("return",e);case 2:return r=function(){var t=k(F.mark((function t(e){var a,s,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=Object.keys(e),t.t0=F.keys(a);case 2:if((t.t1=t.t0()).done){t.next=18;break}if(!(o=(i=e[a[s=t.t1.value]])instanceof File||i instanceof Buffer)){t.next=10;break}return t.next=9,n.sdk.getStorage().upload(e[a[s]]);case 9:e[a[s]]=t.sent;case 10:if(!o||"string"==typeof e[a[s]]){t.next=12;break}throw new Error("Upload to IPFS failed");case 12:if("object"!=typeof i){t.next=16;break}return t.next=15,r(e[a[s]]);case 15:e[a[s]]=t.sent;case 16:t.next=2;break;case 18:return t.abrupt("return",e);case 19:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t.next=5,r(e);case 5:return e=t.sent,t.abrupt("return",JSON.stringify(e));case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),e.prepareBatchMetadata=function(){var t=k(F.mark((function t(e){var r=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(e.map(function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.prepareMetadata(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),e.onlyRoles=function(){var t=k(F.mark((function t(e,r){var n=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(e.map(function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getRoleMembers(e);case 2:if(t.sent.map((function(t){return t.toLowerCase()})).includes(r.toLowerCase())){t.next=5;break}throw new D(r,e);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 2:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),T(r,[{key:"roles",get:function(){return this.getModuleRoles()}}]),r}(Qt),Xt=[{name:"to",type:"address"},{name:"royaltyRecipient",type:"address"},{name:"royaltyBps",type:"uint256"},{name:"primarySaleRecipient",type:"address"},{name:"tokenId",type:"uint256"},{name:"uri",type:"string"},{name:"quantity",type:"uint256"},{name:"pricePerToken",type:"uint256"},{name:"currency",type:"address"},{name:"validityStartTimestamp",type:"uint128"},{name:"validityEndTimestamp",type:"uint128"},{name:"uid",type:"bytes32"}],$t=function(t){function e(){return t.apply(this,arguments)||this}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.SignatureMint1155__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.get=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=Promise,t.t1=Et(this.readOnlyContract,e,this.sdk.getStorage()),t.t2=this.readOnlyContract.totalSupply(e).catch((function(){return p.BigNumber.from("0")})),!r){t.next=9;break}return t.next=6,this.balanceOf(r,e);case 6:t.t3=t.sent.toNumber(),t.next=10;break;case 9:t.t3=0;case 10:return t.t4=t.t3,t.t5=[t.t1,t.t2,t.t4],t.next=14,t.t0.all.call(t.t0,t.t5);case 14:return t.abrupt("return",{supply:(n=t.sent)[1],metadata:n[0],quantityOwnedByAddress:p.BigNumber.from(n[2])});case 19:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getAll=function(){var t=k(F.mark((function t(e){var r,n=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.nextTokenIdToMint();case 2:return r=t.sent.toNumber(),t.next=5,Promise.all(Array.from(Array(r).keys()).map((function(t){return n.get(t.toString(),e)})));case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balanceOf=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.balanceOf(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.readOnlyContract,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.balanceOf.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.isApproved=function(){var t=k(F.mark((function t(e,r,n,a){var i,o,u;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n){t.next=4;break}return t.next=3,this.readOnlyContract.isApprovedForAll(e,r);case 3:return t.abrupt("return",t.sent);case 4:if(a){t.next=6;break}throw new Error("tokenId is required");case 6:return i=s.ERC721__factory.connect(n,this.providerOrSigner),t.t0=i,t.next=10,this.getSignerAddress();case 10:return t.t1=t.sent,t.t2=this.address,t.next=14,t.t0.isApprovedForAll.call(t.t0,t.t1,t.t2);case 14:return o=t.sent,t.next=17,i.getApproved(a);case 17:return t.t3=t.sent.toLowerCase(),t.t4=this.address.toLowerCase(),u=t.t3===t.t4,t.abrupt("return",o||u);case 21:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.setApproval=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=!0),t.next=3,this.sendTransaction("setApprovalForAll",[e,r]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transfer=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.t3={tokenId:r,amount:n},t.t4=[0],t.next=9,t.t0.transferFrom.call(t.t0,t.t1,t.t2,t.t3,t.t4);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.createAndMint=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.createAndMintTo.call(t.t0,t.t1,t.t2);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.createAndMintTo=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(r.metadata);case 2:return n=t.sent,t.next=5,this.sendTransaction("mintTo",[e,u.ethers.constants.MaxUint256,n,r.supply]);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.createAndMintBatch=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.createAndMintBatchTo.call(t.t0,t.t1,t.t2);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.createAndMintBatchTo=function(){var t=k(F.mark((function t(e,r){var n,a,s,i=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.map((function(t){return t.metadata})),a=r.map((function(t){return t.supply})),t.next=4,this.sdk.getStorage().uploadMetadataBatch(n);case 4:return s=t.sent.metadataUris.map((function(t,r){return i.readOnlyContract.interface.encodeFunctionData("mintTo",[e,u.ethers.constants.MaxUint256,t,a[r]])})),t.next=9,this.sendTransaction("multicall",[s]);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.mintAdditionalCopiesTo=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("mintTo",[e,r.tokenId,"",r.amount]);case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.mintAdditionalCopiesBatchTo=function(){var t=k(F.mark((function t(e,r){var n,a,s,i=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.map((function(t){return t.tokenId})),a=r.map((function(t){return t.amount})),s=n.map((function(t,r){return i.readOnlyContract.interface.encodeFunctionData("mintTo",[e,t,"",a[r]])})),t.next=5,this.sendTransaction("multicall",[s]);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.burn=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.burnFrom.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.burnBatch=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.burnBatchFrom.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.burnFrom=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("burn",[e,r.tokenId,r.amount]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.burnBatchFrom=function(){var t=k(F.mark((function t(e,r){var n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.map((function(t){return t.tokenId})),a=r.map((function(t){return t.amount})),t.next=4,this.sendTransaction("burnBatch",[e,n,a]);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transferFrom=function(){var t=k(F.mark((function t(e,r,n,a){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[0]),t.next=3,this.sendTransaction("safeTransferFrom",[e,r,n.tokenId,n.amount,a]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.transferBatchFrom=function(){var t=k(F.mark((function t(e,r,n,a){var s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[0]),s=n.map((function(t){return t.tokenId})),i=n.map((function(t){return t.amount})),t.next=5,this.sendTransaction("safeBatchTransferFrom",[e,r,s,i,a]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.setDefaultRoyaltyInfo=function(){var t=k(F.mark((function t(e,r){var n,a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata(!1);case 2:if(a=[],n=t.sent.metadata){t.next=7;break}throw new Error("No metadata found, this module might be invalid!");case 7:return n.fee_recipient=e,n.seller_fee_basis_points=r,t.t0=this.sdk.getStorage(),t.t1=M({},n),t.t2=this.address,t.next=14,this.getSignerAddress();case 14:return t.t3=t.sent,t.next=17,t.t0.uploadMetadata.call(t.t0,t.t1,t.t2,t.t3);case 17:return s=t.sent,a.push(this.contract.interface.encodeFunctionData("setDefaultRoyaltyInfo",[e,r])),a.push(this.contract.interface.encodeFunctionData("setContractURI",[s])),t.next=22,this.sendTransaction("multicall",[a]);case 22:return t.abrupt("return",t.sent);case 23:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setTokenRoyaltyInfo=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("setRoyaltyInfoForToken",[e,r,n]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getOwned=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}t.t0=e,t.next=7;break;case 4:return t.next=6,this.getSignerAddress();case 6:t.t0=t.sent;case 7:return r=t.t0,t.next=10,this.readOnlyContract.nextTokenIdToMint();case 10:return n=t.sent,t.next=13,this.readOnlyContract.balanceOfBatch(Array(n.toNumber()).fill(r),Array.from(Array(n.toNumber()).keys()));case 13:return a=t.sent.map((function(t,e){return{tokenId:e,balance:t}})).filter((function(t){return t.balance.gt(0)})),t.next=17,Promise.all(a.map(function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.get(e.tokenId.toString());case 2:return t.abrupt("return",M({},t.sent,{ownedByAddress:e.balance}));case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 17:return t.abrupt("return",t.sent);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getDefaultRoyaltyInfo=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getDefaultRoyaltyInfo();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getTokenRoyaltyInfo=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getRoyaltyInfoForToken(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.isTransferRestricted=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.transfersRestricted());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setRestrictedTransfer=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=!1),t.t0=this,t.t1=["admin"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sendTransaction("setRestrictedTransfer",[e]);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.mintWithSignature=function(){var t=k(F.mark((function t(e,r){var n,a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=M({},this.mapPayload(e),{uri:e.uri}),t.next=3,this.getCallOverrides();case 3:return a=t.sent,t.next=6,this.setAllowance(p.BigNumber.from(n.pricePerToken).mul(e.quantity),e.currencyAddress,a);case 6:return t.next=8,this.sendTransaction("mintWithSignature",[n,r],a);case 8:return s=t.sent,t.next=11,this.parseLogs("MintWithSignature",s.logs);case 11:if(0!==(i=t.sent).length){t.next=14;break}throw new Error("No MintWithSignature event found");case 14:return t.abrupt("return",i[0].args.tokenIdMinted);case 15:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.verify=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.mapPayload(e),t.next=3,this.readOnlyContract.verify(M({},n,{uri:e.uri}),r);case 3:return t.abrupt("return",t.sent[0]);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.generateSignatureBatch=function(){var t=k(F.mark((function t(e){var r,a,s,i,o=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=function(t){if(void 0===t.id){var e=Buffer.alloc(16);return l.v4({},e),n.hexlify(d.toUtf8Bytes(e.toString("hex")))}return n.hexlify(t.id)},t.t0=this,t.t1=["minter"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sdk.getStorage().uploadMetadataBatch(e.map((function(t){return t.metadata})));case 10:return a=t.sent.metadataUris,t.next=14,this.getChainID();case 14:return s=t.sent,i=this.getSigner(),t.next=18,Promise.all(e.map(function(){var t=k(F.mark((function t(e,n){var u,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=r(e),t.t0=M({},e,{id:u,uri:c=a[n]}),t.next=5,o.signTypedDataEmitEvent(i,{name:"SignatureMint1155",version:"1",chainId:s,verifyingContract:o.address},{MintRequest:Xt},M({uri:c},o.mapPayload(e),{uid:u}));case 5:return t.t1=t.sent.toString(),t.abrupt("return",{payload:t.t0,signature:t.t1});case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()));case 18:return t.abrupt("return",t.sent);case 19:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.generateSignature=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.generateSignatureBatch([e]);case 2:return t.abrupt("return",t.sent[0]);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.mapPayload=function(t){return{to:t.to,royaltyRecipient:t.royaltyRecipient,royaltyBps:t.royaltyBps,primarySaleRecipient:t.primarySaleRecipient,tokenId:t.tokenId,quantity:t.quantity,pricePerToken:t.price,currency:t.currencyAddress,validityEndTimestamp:t.mintEndTimeEpochSeconds,validityStartTimestamp:t.mintStartTimeEpochSeconds,uid:t.id}},r.setAllowance=function(){var t=k(F.mark((function t(e,r,n){var a,o,u,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r!==xt&&r!==i.AddressZero){t.next=4;break}n.value=e,t.next=16;break;case 4:return a=s.ERC20__factory.connect(r,this.providerOrSigner),t.next=7,this.getSignerAddress();case 7:return o=t.sent,u=this.address,t.next=11,a.allowance(o,u);case 11:if(!(c=t.sent).lt(e)){t.next=15;break}return t.next=15,this.sendContractTransaction(a,"increaseAllowance",[u,e.sub(c)]);case 15:return t.abrupt("return",n);case 16:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e}(Yt);$t.moduleType=exports.ModuleType.BUNDLE_SIGNATURE,$t.roles=[Vt.admin,Vt.minter,Vt.pauser,Vt.transfer];var te=((Kt={})[it.Mainnet]={registry:"0x902a29f2cfe9f8580ad672AaAD7E917d85ca9a2E",biconomyForwarder:"0x84a0856b038eaAd1cC7E297cF34A7e72685A8693"},Kt[it.Rinkeby]={registry:"0x902a29f2cfe9f8580ad672AaAD7E917d85ca9a2E",biconomyForwarder:"0xFD4973FeB2031D4409fB57afEE5dF2051b171104"},Kt[it.Polygon]={registry:"0x902a29f2cfe9f8580ad672AaAD7E917d85ca9a2E",biconomyForwarder:"0x86C80a8aa58e0A4fa09A69624c31Ab2a6CAD56b8"},Kt[it.Mumbai]={registry:"0x902a29f2cfe9f8580ad672AaAD7E917d85ca9a2E",biconomyForwarder:"0x9399BB24DBB5C4b782C70c2969F58716Ebbd6a3b"},Kt[it.Avalanche]={registry:"0x902a29f2cfe9f8580ad672AaAD7E917d85ca9a2E",biconomyForwarder:"0x64CD353384109423a966dCd3Aa30D884C9b2E057"},Kt[it.AvalancheFujiTestnet]={registry:"0x902a29f2cfe9f8580ad672AaAD7E917d85ca9a2E",biconomyForwarder:"0x6271Ca63D30507f2Dcbf99B52787032506D75BBF"},Kt[it.Fantom]={registry:"0x902a29f2cfe9f8580ad672AaAD7E917d85ca9a2E",biconomyForwarder:u.ethers.constants.AddressZero},Kt[it.FantomTestnet]={registry:"0x902a29f2cfe9f8580ad672AaAD7E917d85ca9a2E",biconomyForwarder:u.ethers.constants.AddressZero},Kt[it.Hardhat]={registry:"0x902a29f2cfe9f8580ad672AaAD7E917d85ca9a2E",biconomyForwarder:u.ethers.constants.AddressZero},Kt);function ee(t,e){return void 0===e&&(e="registry"),te[t][e]}var re=[{name:"from",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"gas",type:"uint256"},{name:"nonce",type:"uint256"},{name:"data",type:"bytes"}],ne=[{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"uint256",name:"batchId",type:"uint256"}],name:"getNonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],ae={},se={};function ie(t,e,r){return oe.apply(this,arguments)}function oe(){return(oe=k(F.mark((function t(e,r,n){var a,s,i,o,c,p;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=n.join("|"),s=se[a],i=Date.now()-s>=2e3,a in ae&&!i){t.next=9;break}return t.next=6,(o=e.functions)[r].apply(o,n);case 6:c=t.sent,ae[a]=Array.isArray(c)&&c.length>0?u.BigNumber.from(c[0]):u.BigNumber.from(c),se[a]=Date.now();case 9:return p=ae[a],ae[a]=u.BigNumber.from(ae[a]).add(1),t.abrupt("return",p);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var ue=[{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],ce=[{constant:!0,inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{inputs:[],name:"getDomainSeperator",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],pe=[{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"getNonce",outputs:[{internalType:"uint256",name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"}];function de(t,e){return le.apply(this,arguments)}function le(){return(le=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new u.Contract(r,pe,e),t.prev=1,t.t0=n,t.next=5,e.getAddress();case 5:return t.t1=t.sent,t.next=8,t.t0.nonces.call(t.t0,t.t1);case 8:return t.abrupt("return",t.sent);case 11:return t.prev=11,t.t2=t.catch(1),t.t3=n,t.next=16,e.getAddress();case 16:return t.t4=t.sent,t.next=19,t.t3.getNonce.call(t.t3,t.t4);case 19:return t.abrupt("return",t.sent);case 20:case"end":return t.stop()}}),t,null,[[1,11]])})))).apply(this,arguments)}function fe(t,e){return he.apply(this,arguments)}function he(){return(he=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new u.Contract(r,ce,e),t.prev=1,t.next=4,n.DOMAIN_SEPARATOR();case 4:return t.abrupt("return",t.sent);case 7:return t.prev=7,t.t0=t.catch(1),t.next=11,n.getDomainSeperator();case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,null,[[1,7]])})))).apply(this,arguments)}function me(t,e){return ye.apply(this,arguments)}function ye(){return(ye=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new u.Contract(r,ue,e).name());case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function xe(t,e){return ve.apply(this,arguments)}function ve(){return(ve=k(F.mark((function t(e,r){var n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fe(e,r.verifyingContract);case 2:if(n=t.sent,a={name:r.name,version:r.version,verifyingContract:r.verifyingContract,salt:u.ethers.utils.hexZeroPad(u.BigNumber.from(r.chainId).toHexString(),32)},u.ethers.utils._TypedDataEncoder.hashDomain(a)!==n){t.next=6;break}return t.abrupt("return",a);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ge(t,e,r,n,a,s,i){return be.apply(this,arguments)}function be(){return(be=k(F.mark((function t(e,r,n,a,s,i,o){var c,p,d,l,f;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=xe,t.t1=e,t.next=4,me(e,r);case 4:return t.t2=t.sent,t.next=7,e.getChainId();case 7:return t.t3=t.sent,t.t4=r,t.t5={name:t.t2,version:"1",chainId:t.t3,verifyingContract:t.t4},t.next=12,(0,t.t0)(t.t1,t.t5);case 12:if(d=t.sent,null==(c=o)){t.next=17;break}t.t6=c,t.next=20;break;case 17:return t.next=19,de(e,r);case 19:t.t6=t.sent.toString();case 20:return i=null!=(p=i)?p:u.ethers.constants.MaxUint256,l={owner:n,spender:a,value:s,nonce:o=t.t6,deadline:i},f={Permit:[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},t.next=26,zt(e,d,f,l);case 26:return t.abrupt("return",{message:l,signature:t.sent.signature});case 29:case"end":return t.stop()}}),t)})))).apply(this,arguments)}exports.CommonModuleMetadata=function(){this.name="",this.description=void 0,this.image=void 0,this.externalLink=void 0},v.__decorate([m.JsonProperty("name",String)],exports.CommonModuleMetadata.prototype,"name",void 0),v.__decorate([m.JsonProperty("description",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.CommonModuleMetadata.prototype,"description",void 0),v.__decorate([m.JsonProperty("image",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.CommonModuleMetadata.prototype,"image",void 0),v.__decorate([m.JsonProperty("external_link",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.CommonModuleMetadata.prototype,"externalLink",void 0),exports.CommonModuleMetadata=v.__decorate([m.JsonObject("CommonModuleMetadata")],exports.CommonModuleMetadata);var we=exports.CommonModuleMetadata;exports.BundleDropModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).sellerFeeBasisPoints=0,e.primarySaleFeeBasisPoints=0,e.feeRecipient=void 0,e.primarySaleRecipientAddress="",e}return S(e,t),e}(we),v.__decorate([m.JsonProperty("seller_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.BundleDropModuleMetadata.prototype,"sellerFeeBasisPoints",void 0),v.__decorate([m.JsonProperty("primary_sale_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.BundleDropModuleMetadata.prototype,"primarySaleFeeBasisPoints",void 0),v.__decorate([m.JsonProperty("fee_recipient",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.BundleDropModuleMetadata.prototype,"feeRecipient",void 0),v.__decorate([m.JsonProperty("primary_sale_recipient_address",String)],exports.BundleDropModuleMetadata.prototype,"primarySaleRecipientAddress",void 0),exports.BundleDropModuleMetadata=v.__decorate([m.JsonObject("BundleDropModuleMetadata")],exports.BundleDropModuleMetadata),exports.BundleModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).sellerFeeBasisPoints=0,e.feeRecipient=void 0,e}return S(e,t),e}(we),v.__decorate([m.JsonProperty("seller_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.BundleModuleMetadata.prototype,"sellerFeeBasisPoints",void 0),v.__decorate([m.JsonProperty("fee_recipient",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.BundleModuleMetadata.prototype,"feeRecipient",void 0),exports.BundleModuleMetadata=v.__decorate([m.JsonObject("CollectionModuleMetadata")],exports.BundleModuleMetadata),exports.CurrencyModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).symbol="",e}return S(e,t),e}(exports.CommonModuleMetadata),v.__decorate([m.JsonProperty("symbol",String)],exports.CurrencyModuleMetadata.prototype,"symbol",void 0),exports.CurrencyModuleMetadata=v.__decorate([m.JsonObject("CurrencyModuleMetadata")],exports.CurrencyModuleMetadata),exports.DatastoreModuleMetadata=function(t){function e(){return t.apply(this,arguments)||this}return S(e,t),e}(exports.CommonModuleMetadata),exports.DatastoreModuleMetadata=v.__decorate([m.JsonObject("DatastoreModuleMetadata")],exports.DatastoreModuleMetadata),exports.DropModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).sellerFeeBasisPoints=0,e.primarySaleFeeBasisPoints=0,e.feeRecipient=void 0,e.symbol=void 0,e.maxSupply=1,e.primarySaleRecipientAddress="",e.baseTokenUri="",e}return S(e,t),e}(exports.CommonModuleMetadata),v.__decorate([m.JsonProperty("seller_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.DropModuleMetadata.prototype,"sellerFeeBasisPoints",void 0),v.__decorate([m.JsonProperty("primary_sale_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.DropModuleMetadata.prototype,"primarySaleFeeBasisPoints",void 0),v.__decorate([m.JsonProperty("fee_recipient",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.DropModuleMetadata.prototype,"feeRecipient",void 0),v.__decorate([m.JsonProperty("symbol",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.DropModuleMetadata.prototype,"symbol",void 0),v.__decorate([m.JsonProperty("max_supply",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.DropModuleMetadata.prototype,"maxSupply",void 0),v.__decorate([m.JsonProperty("primary_sale_recipient_address",String)],exports.DropModuleMetadata.prototype,"primarySaleRecipientAddress",void 0),v.__decorate([m.JsonProperty("base_token_uri",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.DropModuleMetadata.prototype,"baseTokenUri",void 0),exports.DropModuleMetadata=v.__decorate([m.JsonObject("DropModuleMetadata")],exports.DropModuleMetadata),exports.MarketModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).marketFeeBasisPoints=0,e}return S(e,t),e}(we),v.__decorate([m.JsonProperty("seller_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.MarketModuleMetadata.prototype,"marketFeeBasisPoints",void 0),exports.MarketModuleMetadata=v.__decorate([m.JsonObject("MarketModuleMetadata")],exports.MarketModuleMetadata),exports.MarketplaceModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).marketFeeBasisPoints=0,e}return S(e,t),e}(we),v.__decorate([m.JsonProperty("seller_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.MarketplaceModuleMetadata.prototype,"marketFeeBasisPoints",void 0),exports.MarketplaceModuleMetadata=v.__decorate([m.JsonObject("MarketplaceModuleMetadata")],exports.MarketplaceModuleMetadata);var ke,Ce=exports.MarketplaceModuleMetadata;exports.NftModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).sellerFeeBasisPoints=0,e.feeRecipient=void 0,e.symbol=void 0,e.defaultSaleRecipientAddress="",e.primarySaleFeeBasisPoints=0,e}return S(e,t),e}(we),v.__decorate([m.JsonProperty("seller_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.NftModuleMetadata.prototype,"sellerFeeBasisPoints",void 0),v.__decorate([m.JsonProperty("fee_recipient",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.NftModuleMetadata.prototype,"feeRecipient",void 0),v.__decorate([m.JsonProperty("symbol",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.NftModuleMetadata.prototype,"symbol",void 0),v.__decorate([m.JsonProperty("default_sale_recipient_address",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.NftModuleMetadata.prototype,"defaultSaleRecipientAddress",void 0),v.__decorate([m.JsonProperty("sale_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.NftModuleMetadata.prototype,"primarySaleFeeBasisPoints",void 0),exports.NftModuleMetadata=v.__decorate([m.JsonObject("NftModuleMetadata")],exports.NftModuleMetadata),exports.PackModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).sellerFeeBasisPoints=0,e.feeRecipient=void 0,e}return S(e,t),e}(we),v.__decorate([m.JsonProperty("seller_fee_basis_points",Number,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.PackModuleMetadata.prototype,"sellerFeeBasisPoints",void 0),v.__decorate([m.JsonProperty("fee_recipient",String,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.PackModuleMetadata.prototype,"feeRecipient",void 0),exports.PackModuleMetadata=v.__decorate([m.JsonObject("PackModuleMetadata")],exports.PackModuleMetadata),exports.SplitsModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).recipientSplits=[],e.isRoyalty=!1,e}return S(e,t),e}(we),v.__decorate([m.JsonProperty("is_royalty",Boolean,m.PropertyConvertingMode.IGNORE_NULLABLE)],exports.SplitsModuleMetadata.prototype,"isRoyalty",void 0),exports.SplitsModuleMetadata=v.__decorate([m.JsonObject("SplitsModuleMetadata")],exports.SplitsModuleMetadata),exports.TokenModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).symbol="",e}return S(e,t),e}(we),v.__decorate([m.JsonProperty("symbol",String)],exports.TokenModuleMetadata.prototype,"symbol",void 0),exports.TokenModuleMetadata=v.__decorate([m.JsonObject("TokenModuleMetadata")],exports.TokenModuleMetadata),exports.VoteModuleMetadata=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).proposalStartWaitTimeInSeconds=0,e.proposalVotingTimeInSeconds=0,e.votingDelay=0,e.votingPeriod=0,e.votingTokenAddress="",e.votingQuorumFraction=0,e.minimumNumberOfTokensNeededToPropose="0",e}return S(e,t),e}(we),v.__decorate([m.JsonProperty("proposal_start_time_in_seconds",Number)],exports.VoteModuleMetadata.prototype,"proposalStartWaitTimeInSeconds",void 0),v.__decorate([m.JsonProperty("proposal_voting_time_in_seconds",Number)],exports.VoteModuleMetadata.prototype,"proposalVotingTimeInSeconds",void 0),v.__decorate([m.JsonProperty("voting_delay",Number)],exports.VoteModuleMetadata.prototype,"votingDelay",void 0),v.__decorate([m.JsonProperty("voting_period",Number)],exports.VoteModuleMetadata.prototype,"votingPeriod",void 0),v.__decorate([m.JsonProperty("voting_token_address",String)],exports.VoteModuleMetadata.prototype,"votingTokenAddress",void 0),v.__decorate([m.JsonProperty("voting_quorum_fraction",Number)],exports.VoteModuleMetadata.prototype,"votingQuorumFraction",void 0),v.__decorate([m.JsonProperty("proposal_token_threshold",String)],exports.VoteModuleMetadata.prototype,"minimumNumberOfTokensNeededToPropose",void 0),exports.VoteModuleMetadata=v.__decorate([m.JsonObject("VoteModuleMetadata")],exports.VoteModuleMetadata);var Te=((ke={})[it.Mainnet]={secondsBetweenBlocks:15,synced:!1},ke[it.Rinkeby]={secondsBetweenBlocks:15,synced:!1},ke[it.Polygon]={secondsBetweenBlocks:2.5,synced:!1},ke[it.Mumbai]={secondsBetweenBlocks:2.5,synced:!1},ke[it.Fantom]={secondsBetweenBlocks:1,synced:!1},ke[it.FantomTestnet]={secondsBetweenBlocks:1,synced:!1},ke[it.Avalanche]={secondsBetweenBlocks:1,synced:!1},ke[it.AvalancheFujiTestnet]={secondsBetweenBlocks:1,synced:!1},ke[it.Hardhat]={secondsBetweenBlocks:1,synced:!1},ke);function Me(){return(Me=k(F.mark((function t(e,r){var n,a,s,i,o,u;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Math.floor(e-Date.now()/1e3),t.next=3,r.getNetwork();case 3:if(yt.includes(a=t.sent.chainId)||Zt(!1),e>=Date.now()/1e3||Zt(!1),s=function(){var t=k(F.mark((function t(){var e,n,a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=[],t.next=3,r.getBlock("latest");case 3:n=t.sent,a=0;case 5:if(!(a<5)){t.next=17;break}return t.next=8,r.getBlock(n.number-a);case 8:return s=t.sent,t.next=11,r.getBlock(n.number-a-1);case 11:e.push(s.timestamp-t.sent.timestamp);case 14:a++,t.next=5;break;case 17:return i=e.reduce((function(t,e){return t+e}),0),t.abrupt("return",i/e.length);case 19:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),!Te[a].synced){t.next=9;break}return t.abrupt("return",Te[a].secondsBetweenBlocks);case 9:return t.next=11,r.getBlock("latest");case 11:return i=t.sent,t.prev=12,t.next=15,s();case 15:Te[a]={synced:!0,secondsBetweenBlocks:o=t.sent},t.next=22;break;case 19:t.prev=19,t.t0=t.catch(12),o=Te[a].secondsBetweenBlocks;case 22:return console.log("Seconds until block",n),u=Math.ceil(n/o),t.abrupt("return",i.number+u);case 25:case"end":return t.stop()}}),t,null,[[12,19]])})))).apply(this,arguments)}var Se=function(t){function e(){return t.apply(this,arguments)||this}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.Coin__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.get=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,gt(this.providerOrSigner,this.address);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getValue=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,wt(this.providerOrSigner,this.address,u.BigNumber.from(e));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.totalSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.totalSupply();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.balanceOf.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.balanceOf=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.readOnlyContract.balanceOf(e);case 3:return t.t1=t.sent,t.next=6,t.t0.getValue.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.allowance=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.allowanceOf.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.allowanceOf=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.allowance(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getVoteBalance=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.getVoteBalanceOf.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getVoteBalanceOf=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getVotes(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getDelegation=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.getDelegationOf.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getDelegationOf=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.delegates(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.delegateTo=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("delegate",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.transfer=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("transfer",[e,r]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setAllowance=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("approve",[e,r]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.mint=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.mintTo.call(t.t0,t.t1,t.t2);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.mintTo=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("mint",[e,r]);case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.mintBatchTo=function(){var t=k(F.mark((function t(e){var r,n,a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=[],n=E(e);!(a=n()).done;)r.push(this.contract.interface.encodeFunctionData("mint",[(s=a.value).address,s.amount]));return t.next=4,this.sendTransaction("multicall",[r]);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllHolderBalances=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.contract.queryFilter(this.contract.filters.Transfer());case 2:return e=t.sent.map((function(t){return t.args})),r={},e.forEach((function(t){var e=t.from,n=t.to,a=t.value;e!==i.AddressZero&&(e in r||(r[e]=u.BigNumber.from(0)),r[e]=r[e].sub(a)),n!==i.AddressZero&&(n in r||(r[n]=u.BigNumber.from(0)),r[n]=r[n].add(a))})),t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.burn=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("burn",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.burnFrom=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("burnFrom",[e,r]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transferFrom=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("transferFrom",[e,r,n]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.transferBatch=function(){var t=k(F.mark((function t(e){var r,n=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return n.contract.interface.encodeFunctionData("transfer",[t.address,t.amount])})),t.next=3,this.sendTransaction("multicall",[r]);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.transferFromBatch=function(){var t=k(F.mark((function t(e){var r,n=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return n.contract.interface.encodeFunctionData("transferFrom",[t.fromAddress,t.address,t.amount])})),t.next=3,this.sendTransaction("multicall",[r]);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.isTransferRestricted=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.transfersRestricted());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setRestrictedTransfer=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=!1),t.t0=this,t.t1=["admin"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sendTransaction("setRestrictedTransfer",[e]);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Yt);Se.moduleType=exports.ModuleType.CURRENCY,Se.roles=[Vt.admin,Vt.minter,Vt.pauser,Vt.transfer];var Ae=function(t){function e(){return t.apply(this,arguments)||this}return S(e,t),e}(Se),Oe=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this)._shouldCheckVersion=!0,e._isV1=!1,e.jsonConvert=new m.JsonConvert,e.moduleType=-1,e}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return Ae.roles},r.connectContract=function(){return s.ProtocolControl__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return this.moduleType},r.getModuleAddress=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getAllModulesOfType(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getNFTAddress=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.getModuleAddress(exports.ModuleType.NFT));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getBundleAddress=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.getModuleAddress(exports.ModuleType.BUNDLE));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getPackAddress=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.getModuleAddress(exports.ModuleType.PACK));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getCurrencyAddress=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.getModuleAddress(exports.ModuleType.CURRENCY));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getMarketAddress=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.getModuleAddress(exports.ModuleType.MARKET));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getDropAddress=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.getModuleAddress(exports.ModuleType.DROP));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getDatastoreAddress=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.getModuleAddress(exports.ModuleType.DATASTORE));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getRoyaltyTreasury=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getRoyaltyTreasury(e||i.AddressZero);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllContractMetadata=function(){var t=k(F.mark((function t(e,r){var n,a=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=!0),t.next=3,Promise.all(e.map((function(t){return pt(a.providerOrSigner,t,a.sdk.getStorage(),r)})));case 3:return n=t.sent,t.abrupt("return",e.filter((function(t){return t})).map((function(t,e){return{address:t,metadata:n[e]}})));case 5:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),r.getPackModules=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getPackAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.getAllContractMetadata.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent.map((function(t){return M({},t,{type:exports.ModuleType.PACK})})));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getNFTModules=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getNFTAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.getAllContractMetadata.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent.map((function(t){return M({},t,{type:exports.ModuleType.NFT})})));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getCollectionModules=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getBundleModules();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getBundleModules=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getBundleAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.getAllContractMetadata.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent.map((function(t){return M({},t,{type:exports.ModuleType.BUNDLE})})));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getCurrencyModules=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getCurrencyAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.getAllContractMetadata.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent.map((function(t){return M({},t,{type:exports.ModuleType.CURRENCY})})));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getDatastoreModules=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getDatastoreAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.getAllContractMetadata.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent.map((function(t){return M({},t,{type:exports.ModuleType.DATASTORE})})));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getMarketModules=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getMarketAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.getAllContractMetadata.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent.map((function(t){return M({},t,{type:exports.ModuleType.MARKET})})));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getDropModules=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getDropAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.getAllContractMetadata.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent.map((function(t){return M({},t,{type:exports.ModuleType.DROP})})));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getAllModuleMetadata=function(){var t=k(F.mark((function t(e,r){var n,a=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=!0),n=e||[exports.ModuleType.NFT,exports.ModuleType.BUNDLE,exports.ModuleType.PACK,exports.ModuleType.TOKEN,exports.ModuleType.MARKET,exports.ModuleType.DATASTORE,exports.ModuleType.DROP,exports.ModuleType.BUNDLE_DROP,exports.ModuleType.VOTE],t.next=4,Promise.all(n.map(function(){var t=k(F.mark((function t(e){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,a.getModuleAddress(e);case 2:return n=t.sent,t.next=5,a.getAllContractMetadata(n,r);case 5:return t.abrupt("return",t.sent.map((function(t){return M({},t,{type:e})})));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 4:return t.abrupt("return",t.sent.reduce((function(t,e){return t.concat(e)}),[]));case 5:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),r.getForwarder=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getForwarder();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setForwarder=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.contract.setForwarder(e);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setRoyaltyTreasury=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.sendTransaction("setRoyaltyTreasury",[e]);case 3:return t.abrupt("return",t.sent);case 6:if(t.prev=6,t.t0=t.catch(0),null==t.t0||null==(r=t.t0.message)||!r.includes("provider shares too low")){t.next=10;break}throw new Error('Missing thirdweb fees. Please set it to a Royalty Splits address, which can deployed using "deployRoyaltySplitsModule({...})".');case 10:throw t.t0;case 11:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.setModuleRoyaltyTreasury=function(){var t=k(F.mark((function t(e,r){var n,a,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new u.Contract(e,s.ProtocolControl__factory.createInterface(),this.providerOrSigner),t.next=3,pt(this.providerOrSigner,e,this.sdk.getStorage(),!1);case 3:return a=t.sent,t.next=6,this.sdk.getStorage().uploadMetadata(M({},a,{fee_recipient:r}));case 6:return i=t.sent,t.prev=7,t.next=10,this.contract.callStatic.setModuleRoyaltyTreasury(e,r);case 10:return t.next=12,n.callStatic.setContractURI(i);case 12:t.next=19;break;case 14:if(t.prev=14,t.t0=t.catch(7),null==t.t0||null==(o=t.t0.message)||!o.includes("provider shares too low")){t.next=18;break}throw new Error('Missing thirdweb fees. Please set it to a Royalty Splits address, which can deployed using "deployRoyaltySplitsModule({...})".');case 18:throw t.t0;case 19:return t.next=21,this.sendContractTransaction(n,"setContractURI",[i]);case 21:return t.next=23,this.sendTransaction("setModuleRoyaltyTreasury",[e,r]);case 23:return t.abrupt("return",t.sent);case 24:case"end":return t.stop()}}),t,this,[[7,14]])})));return function(e,r){return t.apply(this,arguments)}}(),r.isValidRoyaltyRecipient=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.toLowerCase()!==this.address.toLowerCase()){t.next=2;break}return t.abrupt("return",!0);case 2:return r=this.sdk.getSplitsModule(e),t.prev=3,t.next=6,r.balanceOf(this.address);case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}}),t,this,[[3,9]])})));return function(e){return t.apply(this,arguments)}}(),r.withdrawFunds=function(){var t=k(F.mark((function t(e,r){var n,a,i,o,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.readOnlyContract.provider,a=null,(i=Ct(r))&&(r=u.ethers.constants.AddressZero),t.next=6,Tt(n,r,this.address);case 6:if(!u.BigNumber.from(t.sent.value).gt(0)){t.next=16;break}return t.next=11,this.isV1();case 11:if(t.sent&&!i){t.next=16;break}return t.next=15,this.sendTransaction("withdrawFunds",[e,r]);case 15:a=t.sent;case 16:return t.next=18,this.getRoyaltyTreasury();case 18:if((o=t.sent)===this.address){t.next=34;break}return t.next=22,Tt(n,r,o);case 22:if(!u.BigNumber.from(t.sent.value).gt(0)){t.next=34;break}if(c=s.Royalty__factory.connect(o,this.getSigner()),!i){t.next=31;break}return t.next=28,this.sendContractTransaction(c,"distribute()",[]);case 28:a=t.sent,t.next=34;break;case 31:return t.next=33,this.sendContractTransaction(c,"distribute(address)",[r]);case 33:a=t.sent;case 34:if(a){t.next=36;break}throw new Error("no funds to withdraw");case 36:return t.abrupt("return",a);case 37:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r._prepareMetadata=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e.image){t.next=2;break}return t.abrupt("return",Promise.resolve(e));case 2:if(void 0!==e.image){t.next=4;break}return t.abrupt("return",Promise.resolve(e));case 4:return t.t0=this.sdk.getStorage(),t.t1=e.image,t.t2=this.address,t.next=9,this.getSignerAddress();case 9:return t.t3=t.sent,t.next=12,t.t0.upload.call(t.t0,t.t1,t.t2,t.t3);case 12:return e.image=t.sent,t.abrupt("return",Promise.resolve(e));case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r._deployModule=function(){var t=k(F.mark((function t(e,r,n){var a,s,i,o,c,p;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.t1=["admin"],t.next=4,this.getSignerAddress();case 4:return t.t2=t.sent,t.next=7,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 7:return t.next=9,this.sdk.getGasPrice();case 9:return i=(s=t.sent)?{gasPrice:u.ethers.utils.parseUnits(s.toString(),"gwei")}:{},t.next=13,(a=new u.ethers.ContractFactory(n.abi,n.bytecode).connect(this.signer)).deploy.apply(a,r.concat([i]));case 13:return o=t.sent,t.next=16,o.deployed();case 16:return c=o.address,t.next=19,this.contract.addModule(c,e,i);case 19:return p=t.sent,t.next=22,p.wait();case 22:return t.abrupt("return",c);case 23:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.verifyMetadata=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.feeRecipient&&e.feeRecipient!==this.address,t.next=3,this.isValidRoyaltyRecipient(e.feeRecipient?e.feeRecipient:this.address);case 3:if(n=t.sent,!r||n){t.next=6;break}throw new Error("Invalid fee recipient, can only be the Project address or a Splits module address");case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployBundleModule=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.jsonConvert,t.next=3,this._prepareMetadata(e);case 3:return t.t1=t.sent,t.t2=exports.BundleModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.next=8,this.verifyMetadata(e);case 8:return t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=13,this.getSignerAddress();case 13:return t.t6=t.sent,t.next=16,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 16:return n=t.sent,t.t7=this,t.t8=exports.ModuleType.COLLECTION,t.t9=this.address,t.next=22,this.getForwarder();case 22:return t.t10=t.sent,t.t11=n,t.t12=u.BigNumber.from(e.sellerFeeBasisPoints?e.sellerFeeBasisPoints:0),t.t13=[t.t9,t.t10,t.t11,t.t12],t.t14=s.NFTCollection__factory,t.next=29,t.t7._deployModule.call(t.t7,t.t8,t.t13,t.t14);case 29:if(a=t.sent,t.t15=e.feeRecipient,!t.t15){t.next=37;break}return t.t16=e.feeRecipient,t.next=35,this.getRoyaltyTreasury();case 35:t.t17=t.sent,t.t15=t.t16!==t.t17;case 37:if(!t.t15){t.next=40;break}return t.next=40,this.setModuleRoyaltyTreasury(a,e.feeRecipient);case 40:return t.abrupt("return",this.sdk.getBundleModule(a));case 41:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deploySplitsModule=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.jsonConvert,t.next=3,this._prepareMetadata(e);case 3:return t.t1=t.sent,t.t2=exports.SplitsModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=11,this.getSignerAddress();case 11:return t.t6=t.sent,t.next=14,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 14:return n=t.sent,t.t7=this,t.t8=exports.ModuleType.SPLITS,t.t9=this.address,t.next=20,this.getForwarder();case 20:return t.t10=t.sent,t.t11=n,t.t12=e.recipientSplits.map((function(t){return t.address})),t.t13=e.recipientSplits.map((function(t){return t.shares})),t.t14=[t.t9,t.t10,t.t11,t.t12,t.t13],t.t15=e.isRoyalty?s.Royalty__factory:s.Splits__factory,t.next=28,t.t7._deployModule.call(t.t7,t.t8,t.t14,t.t15);case 28:return t.abrupt("return",this.sdk.getSplitsModule(t.sent));case 30:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployRoyaltySplitsModule=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isRoyalty=!0,t.t0=this.jsonConvert,t.next=4,this._prepareMetadata(e);case 4:return t.t1=t.sent,t.t2=exports.SplitsModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=12,this.getSignerAddress();case 12:return t.t6=t.sent,t.next=15,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 15:return n=t.sent,t.t7=this,t.t8=exports.ModuleType.SPLITS,t.t9=this.address,t.next=21,this.getForwarder();case 21:return t.t10=t.sent,t.t11=n,t.t12=e.recipientSplits.map((function(t){return t.address})),t.t13=e.recipientSplits.map((function(t){return t.shares})),t.t14=[t.t9,t.t10,t.t11,t.t12,t.t13],t.t15=s.Royalty__factory,t.next=29,t.t7._deployModule.call(t.t7,t.t8,t.t14,t.t15);case 29:return t.abrupt("return",this.sdk.getSplitsModule(t.sent));case 31:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployNftModule=function(){var t=k(F.mark((function t(e){var r,n,a,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.jsonConvert,t.next=3,this._prepareMetadata(e);case 3:return t.t1=t.sent,t.t2=exports.NftModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.next=8,this.verifyMetadata(e);case 8:return t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=13,this.getSignerAddress();case 13:return t.t6=t.sent,t.next=16,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 16:return n=t.sent,t.t7=At,t.next=20,this.getChainID();case 20:return t.t8=t.sent,a=(0,t.t7)(t.t8).wrapped.address,t.t9=this,t.t10=exports.ModuleType.NFT,t.t11=e.name,t.t12=e.symbol?e.symbol:"",t.t13=n,t.t14=this.address,t.next=30,this.getForwarder();case 30:if(t.t15=t.sent,t.t16=a,!e.defaultSaleRecipientAddress){t.next=36;break}t.t17=e.defaultSaleRecipientAddress,t.next=39;break;case 36:return t.next=38,this.getSignerAddress();case 38:t.t17=t.sent;case 39:return t.t18=t.t17,t.t19=e.sellerFeeBasisPoints,t.t20=e.primarySaleFeeBasisPoints?e.primarySaleFeeBasisPoints:0,t.t21=[t.t11,t.t12,t.t13,t.t14,t.t15,t.t16,t.t18,t.t19,t.t20],t.t22=s.SignatureMint721__factory,t.next=46,t.t9._deployModule.call(t.t9,t.t10,t.t21,t.t22);case 46:if(i=t.sent,t.t23=e.feeRecipient,!t.t23){t.next=54;break}return t.t24=e.feeRecipient,t.next=52,this.getRoyaltyTreasury();case 52:t.t25=t.sent,t.t23=t.t24!==t.t25;case 54:if(!t.t23){t.next=57;break}return t.next=57,this.setModuleRoyaltyTreasury(i,e.feeRecipient);case 57:return t.abrupt("return",this.sdk.getNFTModule(i));case 58:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployCurrencyModule=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.jsonConvert,t.next=3,this._prepareMetadata(e);case 3:return t.t1=t.sent,t.t2=exports.CurrencyModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=11,this.getSignerAddress();case 11:return t.t6=t.sent,t.next=14,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 14:return n=t.sent,t.t7=this,t.t8=exports.ModuleType.CURRENCY,t.t9=this.address,t.t10=e.name,t.t11=e.symbol?e.symbol:"",t.next=22,this.getForwarder();case 22:return t.t12=t.sent,t.t13=n,t.t14=[t.t9,t.t10,t.t11,t.t12,t.t13],t.t15=s.Coin__factory,t.next=28,t.t7._deployModule.call(t.t7,t.t8,t.t14,t.t15);case 28:return t.abrupt("return",this.sdk.getCurrencyModule(t.sent));case 30:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployTokenModule=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.jsonConvert,t.next=3,this._prepareMetadata(e);case 3:return t.t1=t.sent,t.t2=exports.CurrencyModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=11,this.getSignerAddress();case 11:return t.t6=t.sent,t.next=14,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 14:return n=t.sent,t.t7=this,t.t8=exports.ModuleType.CURRENCY,t.t9=this.address,t.t10=e.name,t.t11=e.symbol?e.symbol:"",t.next=22,this.getForwarder();case 22:return t.t12=t.sent,t.t13=n,t.t14=[t.t9,t.t10,t.t11,t.t12,t.t13],t.t15=s.Coin__factory,t.next=28,t.t7._deployModule.call(t.t7,t.t8,t.t14,t.t15);case 28:return t.abrupt("return",this.sdk.getTokenModule(t.sent));case 30:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployMarketModule=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.jsonConvert,t.next=3,this._prepareMetadata(e);case 3:return t.t1=t.sent,t.t2=exports.MarketModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=11,this.getSignerAddress();case 11:return t.t6=t.sent,t.next=14,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 14:return n=t.sent,t.t7=this,t.t8=exports.ModuleType.MARKET,t.t9=this.address,t.next=20,this.getForwarder();case 20:return t.t10=t.sent,t.t11=n,t.t12=e.marketFeeBasisPoints?e.marketFeeBasisPoints:0,t.t13=[t.t9,t.t10,t.t11,t.t12],t.t14=s.Market__factory,t.next=27,t.t7._deployModule.call(t.t7,t.t8,t.t13,t.t14);case 27:return t.abrupt("return",this.sdk.getMarketModule(t.sent));case 29:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployPackModule=function(){var t=k(F.mark((function t(e){var r,n,a,i,o,u,c,p;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.jsonConvert,t.next=3,this._prepareMetadata(e);case 3:return t.t1=t.sent,t.t2=exports.PackModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.next=8,this.verifyMetadata(e);case 8:return t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=13,this.getSignerAddress();case 13:return t.t6=t.sent,t.next=16,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 16:return n=t.sent,t.next=19,this.getChainID();case 19:return i=(a=Rt[t.sent]).vrfCoordinator,o=a.linkTokenAddress,u=a.keyHash,c=a.fees,t.t7=this,t.t8=exports.ModuleType.PACK,t.t9=this.address,t.t10=n,t.t11=i,t.t12=o,t.t13=u,t.t14=c,t.next=31,this.getForwarder();case 31:return t.t15=t.sent,t.t16=e.sellerFeeBasisPoints?e.sellerFeeBasisPoints:0,t.t17=[t.t9,t.t10,t.t11,t.t12,t.t13,t.t14,t.t15,t.t16],t.t18=s.Pack__factory,t.next=37,t.t7._deployModule.call(t.t7,t.t8,t.t17,t.t18);case 37:if(p=t.sent,t.t19=e.feeRecipient,!t.t19){t.next=45;break}return t.t20=e.feeRecipient,t.next=43,this.getRoyaltyTreasury();case 43:t.t21=t.sent,t.t19=t.t20!==t.t21;case 45:if(!t.t19){t.next=48;break}return t.next=48,this.setModuleRoyaltyTreasury(p,e.feeRecipient);case 48:return t.abrupt("return",this.sdk.getPackModule(p));case 49:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployDropModule=function(){var t=k(F.mark((function t(e){var r,n,a,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return""!==e.primarySaleRecipientAddress&&d.isAddress(e.primarySaleRecipientAddress)||Zt(!1),t.t0=this.jsonConvert,t.next=4,this._prepareMetadata(e);case 4:return t.t1=t.sent,t.t2=exports.DropModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.next=9,this.verifyMetadata(e);case 9:return t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=14,this.getSignerAddress();case 14:return t.t6=t.sent,t.next=17,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 17:return n=t.sent,t.t7=At,t.next=21,this.getChainID();case 21:return t.t8=t.sent,a=(0,t.t7)(t.t8).wrapped.address,t.t9=this,t.t10=exports.ModuleType.DROP,t.t11=e.name,t.t12=e.symbol?e.symbol:"",t.t13=n,t.t14=this.address,t.next=31,this.getForwarder();case 31:return t.t15=t.sent,t.t16=a,t.t17=e.primarySaleRecipientAddress,t.t18=e.sellerFeeBasisPoints?e.sellerFeeBasisPoints:0,t.t19=e.primarySaleFeeBasisPoints?e.primarySaleFeeBasisPoints:0,t.t20=[t.t11,t.t12,t.t13,t.t14,t.t15,t.t16,t.t17,t.t18,t.t19],t.t21=s.LazyMintERC721__factory,t.next=40,t.t9._deployModule.call(t.t9,t.t10,t.t20,t.t21);case 40:if(i=t.sent,t.t22=e.feeRecipient,!t.t22){t.next=48;break}return t.t23=e.feeRecipient,t.next=46,this.getRoyaltyTreasury();case 46:t.t24=t.sent,t.t22=t.t23!==t.t24;case 48:if(!t.t22){t.next=51;break}return t.next=51,this.setModuleRoyaltyTreasury(i,e.feeRecipient);case 51:return t.abrupt("return",this.sdk.getDropModule(i));case 52:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployBundleSignatureModule=function(){var t=k(F.mark((function t(e){var r,n,a,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return""!==e.primarySaleRecipientAddress&&d.isAddress(e.primarySaleRecipientAddress)||Zt(!1),t.t0=this.jsonConvert,t.next=4,this._prepareMetadata(e);case 4:return t.t1=t.sent,t.t2=exports.DropModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.next=9,this.verifyMetadata(e);case 9:return t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=14,this.getSignerAddress();case 14:return t.t6=t.sent,t.next=17,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 17:return n=t.sent,t.t7=At,t.next=21,this.getChainID();case 21:return t.t8=t.sent,a=(0,t.t7)(t.t8).wrapped.address,t.next=25,this.getRoyaltyTreasury();case 25:return i=t.sent,t.t9=this,t.t10=exports.ModuleType.BUNDLE_SIGNATURE,t.t11=n,t.t12=this.address,t.next=32,this.getForwarder();case 32:return t.t13=t.sent,t.t14=a,t.t15=e.primarySaleRecipientAddress,t.t16=e.feeRecipient?e.feeRecipient:i,t.t17=e.sellerFeeBasisPoints?e.sellerFeeBasisPoints:0,t.t18=e.primarySaleFeeBasisPoints?e.primarySaleFeeBasisPoints:0,t.t19=[t.t11,t.t12,t.t13,t.t14,t.t15,t.t16,t.t17,t.t18],t.t20=s.SignatureMint1155__factory,t.next=42,t.t9._deployModule.call(t.t9,t.t10,t.t19,t.t20);case 42:if(o=t.sent,!e.feeRecipient||e.feeRecipient===i){t.next=46;break}return t.next=46,this.setModuleRoyaltyTreasury(o,e.feeRecipient);case 46:return t.abrupt("return",this.sdk.getBundleSignatureModule(o));case 47:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployBundleDropModule=function(){var t=k(F.mark((function t(e){var r,n,a,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return""!==e.primarySaleRecipientAddress&&d.isAddress(e.primarySaleRecipientAddress)||Zt(!1),t.next=3,this.verifyMetadata(e);case 3:return t.t0=this.jsonConvert,t.next=6,this._prepareMetadata(e);case 6:return t.t1=t.sent,t.t2=exports.DropModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=14,this.getSignerAddress();case 14:return t.t6=t.sent,t.next=17,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 17:return n=t.sent,t.t7=At,t.next=21,this.getChainID();case 21:return t.t8=t.sent,a=(0,t.t7)(t.t8).wrapped.address,t.t9=this,t.t10=exports.ModuleType.BUNDLE_DROP,t.t11=n,t.t12=this.address,t.next=29,this.getForwarder();case 29:return t.t13=t.sent,t.t14=a,t.t15=e.primarySaleRecipientAddress,t.t16=e.sellerFeeBasisPoints?e.sellerFeeBasisPoints:0,t.t17=e.primarySaleFeeBasisPoints?e.primarySaleFeeBasisPoints:0,t.t18=[t.t11,t.t12,t.t13,t.t14,t.t15,t.t16,t.t17],t.t19=s.LazyMintERC1155__factory,t.next=38,t.t9._deployModule.call(t.t9,t.t10,t.t18,t.t19);case 38:if(i=t.sent,t.t20=e.feeRecipient,!t.t20){t.next=46;break}return t.t21=e.feeRecipient,t.next=44,this.getRoyaltyTreasury();case 44:t.t22=t.sent,t.t20=t.t21!==t.t22;case 46:if(!t.t20){t.next=49;break}return t.next=49,this.setModuleRoyaltyTreasury(i,e.feeRecipient);case 49:return t.abrupt("return",this.sdk.getBundleDropModule(i));case 50:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployDatastoreModule=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.jsonConvert,t.next=3,this._prepareMetadata(e);case 3:return t.t1=t.sent,t.t2=exports.DatastoreModuleMetadata,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=11,this.getSignerAddress();case 11:return t.t6=t.sent,t.next=14,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 14:return n=t.sent,t.t7=this,t.t8=exports.ModuleType.DATASTORE,t.t9=this.address,t.next=20,this.getForwarder();case 20:return t.t10=t.sent,t.t11=n,t.t12=[t.t9,t.t10,t.t11],t.t13=s.DataStore__factory,t.next=26,t.t7._deployModule.call(t.t7,t.t8,t.t12,t.t13);case 26:return t.abrupt("return",this.sdk.getDatastoreModule(t.sent));case 28:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.deployVoteModule=function(){var t=k(F.mark((function t(e){var r,n,a,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return""!==e.votingTokenAddress&&d.isAddress(e.votingTokenAddress)||Zt(!1),e.votingQuorumFraction>=0&&e.votingQuorumFraction<=100||Zt(!1),t.next=4,this.getChainID();case 4:return n=e.proposalVotingTimeInSeconds/(r=Te[t.sent]).secondsBetweenBlocks,e.votingDelay=e.proposalStartWaitTimeInSeconds/r.secondsBetweenBlocks,e.votingPeriod=n,t.prev=10,t.next=13,s.Coin__factory.connect(e.votingTokenAddress,this.readOnlyContract.provider).callStatic.getPastTotalSupply(0);case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(10),Zt(!1);case 18:return t.t1=this.jsonConvert,t.next=21,this._prepareMetadata(e);case 21:return t.t2=t.sent,t.t3=exports.VoteModuleMetadata,a=t.t1.serializeObject.call(t.t1,t.t2,t.t3),t.t4=this.sdk.getStorage(),t.t5=a,t.t6=this.address,t.next=29,this.getSignerAddress();case 29:return t.t7=t.sent,t.next=32,t.t4.uploadMetadata.call(t.t4,t.t5,t.t6,t.t7);case 32:return i=t.sent,t.t8=this,t.t9=exports.ModuleType.VOTE,t.t10=e.name,t.t11=e.votingTokenAddress,t.t12=u.BigNumber.from(Math.ceil(e.votingDelay)),t.t13=u.BigNumber.from(Math.ceil(e.votingPeriod)),t.t14=u.BigNumber.from(e.minimumNumberOfTokensNeededToPropose),t.t15=e.votingQuorumFraction,t.next=43,this.getForwarder();case 43:return t.t16=t.sent,t.t17=i,t.t18=[t.t10,t.t11,t.t12,t.t13,t.t14,t.t15,t.t16,t.t17],t.t19=s.VotingGovernor__factory,t.next=49,t.t8._deployModule.call(t.t8,t.t9,t.t18,t.t19);case 49:return t.abrupt("return",this.sdk.getVoteModule(t.sent));case 51:case"end":return t.stop()}}),t,this,[[10,15]])})));return function(e){return t.apply(this,arguments)}}(),r.shouldUpgradeToV2=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV1();case 2:if(t.t0=t.sent,!t.t0){t.next=5;break}t.t0=this.hasValidSigner();case 5:if(!t.t0){t.next=23;break}return t.t1=this.readOnlyContract,t.t2=u.ethers.utils.hexZeroPad([0],32),t.next=10,this.getSignerAddress();case 10:return t.t3=t.sent,t.next=13,t.t1.hasRole.call(t.t1,t.t2,t.t3);case 13:if(t.t4=t.sent,!t.t4){t.next=21;break}return t.next=18,this.getRoyaltyTreasury();case 18:t.t5=t.sent,t.t6=this.address,t.t4=t.t5===t.t6;case 21:if(!t.t4){t.next=23;break}return t.abrupt("return",!0);case 23:return t.abrupt("return",!1);case 24:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.shouldUpgradeModuleList=function(){var t=k(F.mark((function t(){var e=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV1();case 2:if(t.sent){t.next=4;break}return t.abrupt("return",[]);case 4:return t.next=6,this.getRoyaltyTreasury();case 6:if(t.t0=t.sent,t.t1=this.address,t.t0!==t.t1){t.next=10;break}return t.abrupt("return",[]);case 10:return t.next=12,this.getAllModuleMetadata([exports.ModuleType.NFT,exports.ModuleType.BUNDLE,exports.ModuleType.PACK,exports.ModuleType.DROP,exports.ModuleType.BUNDLE_DROP],!1);case 12:return t.abrupt("return",t.sent.filter((function(t){var r,n;return(null==(r=t.metadata)||null==(n=r.fee_recipient)?void 0:n.toLowerCase())===e.address.toLowerCase()})));case 14:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.upgradeModuleList=function(){var t=k(F.mark((function t(e){var r,n,a,s,i,o,u,c,p=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(r=this.getSigner())||Zt(!1),t.next=4,this.shouldUpgradeModuleList();case 4:return n=t.sent.filter((function(t){return e.includes(t.address)})),t.next=8,this.getRoyaltyTreasury();case 8:return a=t.sent,t.next=11,Promise.all(n.map((function(t){return p.sdk.getStorage().uploadMetadata(M({},t.metadata,{fee_recipient:a}))})));case 11:return s=t.sent,t.next=14,r.getTransactionCount("pending");case 14:return i=t.sent,o=s.map((function(t){return p.contract.interface.encodeFunctionData("setContractURI",[t])})),u=o.map((function(t,e){return{to:n[e].address,nonce:i+e,data:t}})),t.next=19,Promise.all(u.map((function(t){return r.sendTransaction(t)})));case 19:return c=t.sent,t.next=22,Promise.all(c.map((function(t){return t.wait()})));case 22:return t.abrupt("return",t.sent);case 23:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.upgradeToV2=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e={}),t.next=3,this.isV1UpgradedOrV2();case 3:if(!t.sent){t.next=5;break}return t.abrupt("return");case 5:if(r="",!e.splitsModuleAddress){t.next=10;break}r=e.splitsModuleAddress,t.next=22;break;case 10:if(e.splitsRecipients){t.next=16;break}return t.next=13,this.getSignerAddress();case 13:t.t0=t.sent,t.t1={address:t.t0,shares:100},e.splitsRecipients=[t.t1];case 16:return t.next=18,this.getMetadata();case 18:return n=t.sent.metadata,t.next=21,this.deploySplitsModule({name:(null==n?void 0:n.name)+" Royalty Treasury",recipientSplits:e.splitsRecipients,isRoyalty:!0});case 21:r=t.sent.address;case 22:return t.next=24,this.setRoyaltyTreasury(r);case 24:return t.abrupt("return",t.sent);case 25:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(){var e,r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.provider.getBalance(this.address);case 2:return e=t.sent,r=u.BigNumber.from(0),t.next=6,this.getRoyaltyTreasury();case 6:if((n=t.sent).toLowerCase()===this.address.toLowerCase()){t.next=11;break}return t.next=10,this.readOnlyContract.provider.getBalance(n);case 10:r=t.sent;case 11:return t.abrupt("return",e.add(r));case 12:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.balanceOfToken=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=u.BigNumber.from(0),!Ct(e)){t.next=7;break}return t.next=4,this.balance();case 4:r=t.sent,t.next=39;break;case 7:return n=s.IERC20__factory.connect(e,this.readOnlyContract.provider),t.next=10,this.isV1();case 10:if(t.sent){t.next=23;break}return t.prev=11,t.t0=r,t.next=15,n.balanceOf(this.address);case 15:t.t1=t.sent,r=t.t0.add.call(t.t0,t.t1),t.next=23;break;case 19:throw t.prev=19,t.t2=t.catch(11),console.error(t.t2),new Error("invalid token address");case 23:return t.next=25,this.getRoyaltyTreasury();case 25:if((a=t.sent).toLowerCase()===this.address.toLowerCase()){t.next=39;break}return t.prev=27,t.t3=r,t.next=31,n.balanceOf(a);case 31:t.t4=t.sent,r=t.t3.add.call(t.t3,t.t4),t.next=39;break;case 35:throw t.prev=35,t.t5=t.catch(27),console.error(t.t5),new Error("invalid token address");case 39:return t.next=41,wt(this.providerOrSigner,e,r);case 41:return t.abrupt("return",t.sent);case 42:case"end":return t.stop()}}),t,this,[[11,19],[27,35]])})));return function(e){return t.apply(this,arguments)}}(),r.isV1=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._shouldCheckVersion){t.next=11;break}return t.prev=1,t.next=4,this.readOnlyContract.callStatic.version();case 4:this._isV1=!1,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),this._isV1=!0;case 10:this._shouldCheckVersion=!1;case 11:return t.abrupt("return",this._isV1);case 12:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(){return t.apply(this,arguments)}}(),r.isV1UpgradedOrV2=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV1();case 2:if(t.t0=!t.sent,t.t0){t.next=7;break}return t.next=6,this.shouldUpgradeToV2();case 6:t.t0=!t.sent;case 7:return t.abrupt("return",t.t0);case 8:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.deployMarketplaceModule=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.jsonConvert,t.next=3,this._prepareMetadata(e);case 3:return t.t1=t.sent,t.t2=Ce,r=t.t0.serializeObject.call(t.t0,t.t1,t.t2),t.t3=this.sdk.getStorage(),t.t4=r,t.t5=this.address,t.next=11,this.getSignerAddress();case 11:return t.t6=t.sent,t.next=14,t.t3.uploadMetadata.call(t.t3,t.t4,t.t5,t.t6);case 14:return n=t.sent,t.t7=At,t.next=18,this.getChainID();case 18:return t.t8=t.sent,a=(0,t.t7)(t.t8).wrapped.address,t.t9=this,t.t10=exports.ModuleType.MARKETPLACE,t.t11=this.address,t.next=25,this.getForwarder();case 25:return t.t12=t.sent,t.t13=a,t.t14=n,t.t15=e.marketFeeBasisPoints,t.t16=[t.t11,t.t12,t.t13,t.t14,t.t15],t.t17=s.Marketplace__factory,t.next=33,t.t9._deployModule.call(t.t9,t.t10,t.t16,t.t17);case 33:return t.abrupt("return",this.sdk.getMarketplaceModule(t.sent));case 35:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Yt);Oe.roles=[Vt.admin];var Re,Pe,_e,Be,Ee,Ne=function(t){function e(){return t.apply(this,arguments)||this}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.NFTCollection__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.get=function(){var t=k(F.mark((function t(e,r){var n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=Promise,t.t1=Et(this.readOnlyContract,e,this.sdk.getStorage()),t.t2=this.readOnlyContract.totalSupply(e).catch((function(){return p.BigNumber.from("0")})),!r){t.next=9;break}return t.next=6,this.balanceOf(r,e);case 6:t.t3=t.sent.toNumber(),t.next=10;break;case 9:t.t3=0;case 10:return t.t4=t.t3,t.t5=this.readOnlyContract.tokenState(e),t.t6=[t.t1,t.t2,t.t4,t.t5],t.next=15,t.t0.all.call(t.t0,t.t6);case 15:return t.abrupt("return",{creator:(a=(n=t.sent)[3]).creator,supply:n[1],metadata:n[0],ownedByAddress:p.BigNumber.from(n[2]),underlyingType:a.underlyingType});case 21:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getAll=function(){var t=k(F.mark((function t(e){var r,n=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.nextTokenId();case 2:return r=t.sent.toNumber(),t.next=5,Promise.all(Array.from(Array(r).keys()).map((function(t){return n.get(t.toString(),e)})));case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balanceOf=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.balanceOf(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this.readOnlyContract,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.balanceOf.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.isApproved=function(){var t=k(F.mark((function t(e,r,n,a){var i,o,u;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n){t.next=4;break}return t.next=3,this.readOnlyContract.isApprovedForAll(e,r);case 3:return t.abrupt("return",t.sent);case 4:if(a){t.next=6;break}throw new Error("tokenId is required");case 6:return i=s.ERC721__factory.connect(n,this.providerOrSigner),t.t0=i,t.next=10,this.getSignerAddress();case 10:return t.t1=t.sent,t.t2=this.address,t.next=14,t.t0.isApprovedForAll.call(t.t0,t.t1,t.t2);case 14:return o=t.sent,t.next=17,i.getApproved(a);case 17:return t.t3=t.sent.toLowerCase(),t.t4=this.address.toLowerCase(),u=t.t3===t.t4,t.abrupt("return",o||u);case 21:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.setApproval=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=!0),t.next=3,this.sendTransaction("setApprovalForAll",[e,r]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transfer=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.t3={tokenId:r,amount:n},t.t4=[0],t.next=9,t.t0.transferFrom.call(t.t0,t.t1,t.t2,t.t3,t.t4);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.create=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.createBatch([e]);case 2:return t.abrupt("return",t.sent[0]);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.createBatch=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{metadata:t,supply:0}})),t.abrupt("return",this.createAndMintBatch(r));case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.createAndMint=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.createAndMintBatch([e]);case 2:return t.abrupt("return",t.sent[0]);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.createAndMintBatch=function(){var t=k(F.mark((function t(e){var r,n,a,s,i,o,u,c=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return t.metadata})),t.next=3,this.sdk.getStorage().uploadMetadataBatch(r);case 3:return n=t.sent.metadataUris,a=e.map((function(t){return t.supply})),t.next=8,this.getSignerAddress();case 8:return s=t.sent,t.next=11,this.sendTransaction("createNativeTokens",[s,n,a,[0]]);case 11:return o=this.parseEventLogs("NativeTokens",null==(i=t.sent)?void 0:i.logs),u=null==o?void 0:o.tokenIds,t.next=16,Promise.all(u.map((function(t){return c.get(t.toString())})));case 16:return t.abrupt("return",t.sent);case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.createWithToken=function(){var t=k(F.mark((function t(e,r,n){var a,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=s.ERC20__factory.connect(e,this.providerOrSigner),t.t0=a,t.next=4,this.getSignerAddress();case 4:return t.t1=t.sent,t.t2=this.address,t.next=8,t.t0.allowance.call(t.t0,t.t1,t.t2);case 8:if(!(t.sent<r)){t.next=12;break}return t.next=12,a.increaseAllowance(this.address,r);case 12:return t.next=14,this.sdk.getStorage().uploadMetadata(n.metadata);case 14:return i=t.sent,t.next=17,this.sendTransaction("wrapERC20",[e,r,n.supply,i]);case 17:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.createWithErc20=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.createWithToken(e,r,n));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.createWithNFT=function(){var t=k(F.mark((function t(e,r,n){var a,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=s.ERC721__factory.connect(e,this.providerOrSigner),t.t0=a,t.next=4,this.getSignerAddress();case 4:return t.t1=t.sent,t.t2=this.address,t.next=8,t.t0.isApprovedForAll.call(t.t0,t.t1,t.t2);case 8:if(t.sent){t.next=17;break}return t.next=11,a.getApproved(r);case 11:if(t.t3=t.sent.toLowerCase(),t.t4=this.address.toLowerCase(),t.t3===t.t4){t.next=17;break}return t.next=17,this.sendContractTransaction(a,"setApprovalForAll",[this.address]);case 17:return t.next=19,this.sdk.getStorage().uploadMetadata(n);case 19:return i=t.sent,t.next=22,this.sendTransaction("wrapERC721",[e,r,i]);case 22:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.unwrapNFT=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("redeemERC721",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.unwrapToken=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("redeemERC20",[e,r]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.createWithERC721=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.createWithNFT(e,r,n));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.mint=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.mintTo.call(t.t0,t.t1,t.t2);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.mintTo=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n=[0]),t.next=3,this.sendTransaction("mint",[e,r.tokenId,r.amount,n]);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.mintBatch=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.mintBatchTo.call(t.t0,t.t1,t.t2);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.mintBatchTo=function(){var t=k(F.mark((function t(e,r,n){var a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n=[0]),a=r.map((function(t){return t.tokenId})),s=r.map((function(t){return t.amount})),t.next=5,this.sendTransaction("mintBatch",[e,a,s,n]);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.burn=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.burnFrom.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.burnBatch=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.burnBatchFrom.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.burnFrom=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("burn",[e,r.tokenId,r.amount]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.burnBatchFrom=function(){var t=k(F.mark((function t(e,r){var n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.map((function(t){return t.tokenId})),a=r.map((function(t){return t.amount})),t.next=4,this.sendTransaction("burnBatch",[e,n,a]);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transferFrom=function(){var t=k(F.mark((function t(e,r,n,a){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[0]),t.next=3,this.sendTransaction("safeTransferFrom",[e,r,n.tokenId,n.amount,a]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.transferBatchFrom=function(){var t=k(F.mark((function t(e,r,n,a){var s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[0]),s=n.map((function(t){return t.tokenId})),i=n.map((function(t){return t.amount})),t.next=5,this.sendTransaction("safeBatchTransferFrom",[e,r,s,i,a]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.setRoyaltyBps=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata(!1);case 2:if(n=[],r=t.sent.metadata){t.next=7;break}throw new Error("No metadata found, this module might be invalid!");case 7:return r.seller_fee_basis_points=e,t.t0=this.sdk.getStorage(),t.t1=M({},r),t.t2=this.address,t.next=13,this.getSignerAddress();case 13:return t.t3=t.sent,t.next=16,t.t0.uploadMetadata.call(t.t0,t.t1,t.t2,t.t3);case 16:return a=t.sent,n.push(this.contract.interface.encodeFunctionData("setRoyaltyBps",[e])),n.push(this.contract.interface.encodeFunctionData("setContractURI",[a])),t.next=21,this.sendTransaction("multicall",[n]);case 21:return t.abrupt("return",t.sent);case 22:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getOwned=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}t.t0=e,t.next=7;break;case 4:return t.next=6,this.getSignerAddress();case 6:t.t0=t.sent;case 7:return r=t.t0,t.next=10,this.readOnlyContract.nextTokenId();case 10:return n=t.sent,t.next=13,this.readOnlyContract.balanceOfBatch(Array(n.toNumber()).fill(r),Array.from(Array(n.toNumber()).keys()));case 13:return a=t.sent.map((function(t,e){return{tokenId:e,balance:t}})).filter((function(t){return t.balance.gt(0)})),t.next=17,Promise.all(a.map(function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.get(e.tokenId.toString());case 2:return t.abrupt("return",M({},t.sent,{ownedByAddress:e.balance}));case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 17:return t.abrupt("return",t.sent);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getRoyaltyBps=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.royaltyBps();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getRoyaltyRecipientAddress=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata();case 2:if(void 0===(null==(e=(r=t.sent).metadata)?void 0:e.fee_recipient)){t.next=5;break}return t.abrupt("return",r.metadata.fee_recipient);case 5:return t.abrupt("return","");case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isTransferRestricted=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.transfersRestricted());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setRestrictedTransfer=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=!1),t.t0=this,t.t1=["admin"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sendTransaction("setRestrictedTransfer",[e]);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Yt);function Fe(t,e){if("object"==typeof t&&"object"==typeof e){var r=Object.keys(t).sort(),n=Object.keys(e).sort();if(r===n){for(var a=0;a<r.length;a++)if(!Fe(t[r[a]],e[n[a]]))return!1;return!0}}return t===e}Ne.moduleType=exports.ModuleType.BUNDLE,Ne.roles=[Vt.admin,Vt.minter,Vt.pauser,Vt.transfer],(Re=exports.ListingType||(exports.ListingType={}))[Re.Direct=0]="Direct",Re[Re.Auction=1]="Auction",function(t){t[t.StartTime=0]="StartTime",t[t.LimitPerWallet=1]="LimitPerWallet",t[t.MerkleRoot=2]="MerkleRoot",t[t.WaitTimeBetweenClaims=3]="WaitTimeBetweenClaims"}(Pe||(Pe={})),(_e=exports.ProposalState||(exports.ProposalState={}))[_e.Pending=0]="Pending",_e[_e.Active=1]="Active",_e[_e.Canceled=2]="Canceled",_e[_e.Defeated=3]="Defeated",_e[_e.Succeeded=4]="Succeeded",_e[_e.Queued=5]="Queued",_e[_e.Expired=6]="Expired",_e[_e.Executed=7]="Executed",(Be=exports.VoteType||(exports.VoteType={}))[Be.Against=0]="Against",Be[Be.For=1]="For",Be[Be.Abstain=2]="Abstain",(Ee=exports.ClaimEligibility||(exports.ClaimEligibility={})).NotEnoughSupply="There is not enough supply to claim.",Ee.AddressNotAllowed="This address is not on the allowlist.",Ee.WaitBeforeNextClaimTransaction="Not enough time since last claim transaction. Please wait.",Ee.AlreadyClaimed="You have already claimed the token.",Ee.NotEnoughTokens="There are not enough tokens in the wallet to pay for the claim.",Ee.NoActiveClaimPhase="There is no active claim phase at the moment. Please check back in later.";var Le=function(){function t(t){this._conditionStartTime=Math.floor(Date.now()/1e3),this._currencyAddress="",this._price=0,this._maxQuantity=u.BigNumber.from(0),this._quantityLimitPerTransaction=u.ethers.constants.MaxUint256,this._merkleRootHash=n.hexZeroPad([0],32),this._merkleCondition=void 0,this._snapshot=void 0,this.createSnapshot=void 0,this._waitInSeconds=0,this.createSnapshot=t}var e=t.prototype;return e.setPrice=function(t,e){if(void 0===e&&(e=i.AddressZero),!g.isAddress(e))throw new I(e);return t>=0||Zt(!1),this._price=t,this._currencyAddress=e,this},e.setConditionStartTime=function(t){return this._conditionStartTime="number"==typeof t?Math.floor(t):Math.floor(t.getTime()/1e3),this},e.setMaxQuantity=function(t){return this._maxQuantity=t,this},e.setMaxQuantityPerTransaction=function(t){var e=u.BigNumber.from(t);return e.gte(1)||Zt(!1),this._quantityLimitPerTransaction=e,this},e.setMerkleRoot=function(t){return this._merkleRootHash=t,this},e.setSnapshot=function(t){return this._snapshot=t,this},e.getSnapshot=function(){return this._merkleCondition},e.buildPublicClaimCondition=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._snapshot){t.next=4;break}return t.next=3,this.createSnapshot(this._snapshot);case 3:this._merkleCondition=t.sent;case 4:return t.abrupt("return",{startTimestamp:u.BigNumber.from(this._conditionStartTime.toString()),pricePerToken:this._price,currency:this._currencyAddress||i.AddressZero,maxMintSupply:this._maxQuantity,waitTimeSecondsLimitPerTransaction:this._waitInSeconds,quantityLimitPerTransaction:this._quantityLimitPerTransaction,currentMintSupply:0,merkleRoot:null!=(e=this._merkleCondition)&&e.merkleRoot?this._merkleCondition.merkleRoot:this._merkleRootHash});case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.setWaitTimeBetweenClaims=function(t){return this._waitInSeconds=t,this},t}(),Ie=function(){function t(t){this.phases=[],this.createSnapshot=void 0,this.createSnapshot=t}var e=t.prototype;return e.buildConditions=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=[],t.next=3,Promise.all(this.phases.map((function(t){return t.buildPublicClaimCondition()}))).then((function(t){e=t.sort((function(t,e){return t.startTimestamp.eq(e.startTimestamp)?0:t.startTimestamp.gt(e.startTimestamp)?1:-1}))}));case 3:return t.abrupt("return",e);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.buildConditionsForDropV1=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(this.phases.map((function(t){return t.buildPublicClaimCondition()})));case 2:return e=(e=t.sent).map((function(t){var e=Math.floor(Date.now()/1e3);return M({},t,{startTimestamp:t.startTimestamp.lt(e)?u.BigNumber.from(0):t.startTimestamp.sub(e)})})),r=e.sort((function(t,e){return t.startTimestamp.eq(e.startTimestamp)?0:t.startTimestamp.gt(e.startTimestamp)?1:-1})),t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.fromPublicClaimConditions=function(t){for(var e,r=[],n=E(t);!(e=n()).done;){var a=e.value,s=new Le(this.createSnapshot);a.currency&&s.setPrice(a.pricePerToken,a.currency),a.maxMintSupply&&s.setMaxQuantity(a.maxMintSupply),s.setConditionStartTime(new Date(1e3*a.startTimestamp.toNumber())),r.push(s)}return this.phases=r,this},e.newClaimPhase=function(t){var e=t.startTime,r=t.maxQuantity,n=void 0===r?u.ethers.constants.MaxUint256:r,a=t.maxQuantityPerTransaction,s=void 0===a?u.ethers.constants.MaxUint256:a,i=new Le(this.createSnapshot);return i.setConditionStartTime(e),i.setMaxQuantity(u.BigNumber.from(n)),i.setMaxQuantityPerTransaction(u.BigNumber.from(s)),this.phases.push(i),i},e.deleteClaimPhase=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e<0||e>=this.phases.length)){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,this.buildConditions();case 4:r=t.sent.splice(e-1,1),this.fromPublicClaimConditions(r);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.removeClaimPhase=function(t){throw new K("deleteClaimPhase")},e.allSnapshots=function(){return this.phases.filter((function(t){return void 0!==t.getSnapshot()})).map((function(t){return t.getSnapshot()}))},t}();exports.ClaimProof=function(){this.address="",this.proof=[]},v.__decorate([m.JsonProperty("address",String)],exports.ClaimProof.prototype,"address",void 0),v.__decorate([m.JsonProperty("proof",[String])],exports.ClaimProof.prototype,"proof",void 0),exports.ClaimProof=v.__decorate([m.JsonObject("ClaimProof")],exports.ClaimProof),exports.Snapshot=function(){this.merkleRoot="",this.claims=[]},v.__decorate([m.JsonProperty("merkleRoot",String)],exports.Snapshot.prototype,"merkleRoot",void 0),v.__decorate([m.JsonProperty("claims",[exports.ClaimProof])],exports.Snapshot.prototype,"claims",void 0),exports.Snapshot=v.__decorate([m.JsonObject("Snapshot")],exports.Snapshot);var De=[{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"},{internalType:"uint256",name:"_quantity",type:"uint256"},{internalType:"bytes32[]",name:"_proofs",type:"bytes32[]"}],name:"claim",outputs:[],stateMutability:"payable",type:"function"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"claimConditionIndex",type:"uint256"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"claimer",type:"address"},{indexed:!1,internalType:"uint256",name:"quantityClaimed",type:"uint256"}],name:"ClaimedTokens",type:"event"}],Ue=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this)._shouldCheckVersion=!0,e._isNewClaim=!1,e}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.LazyMintERC1155__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.transformResultToClaimCondition=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,wt(this.providerOrSigner,e.currency,e.pricePerToken);case 2:return r=t.sent,t.abrupt("return",{startTimestamp:new Date(1e3*u.BigNumber.from(e.startTimestamp).toNumber()),maxMintSupply:e.maxClaimableSupply.toString(),currentMintSupply:e.supplyClaimed.toString(),availableSupply:u.BigNumber.from(e.maxClaimableSupply).sub(e.supplyClaimed).toString(),quantityLimitPerTransaction:e.quantityLimitPerTransaction.toString(),waitTimeSecondsLimitPerTransaction:e.waitTimeInSecondsBetweenClaims.toString(),price:u.BigNumber.from(e.pricePerToken),pricePerToken:u.BigNumber.from(e.pricePerToken),currency:e.currency,currencyContract:e.currency,currencyMetadata:r,merkleRoot:e.merkleRoot});case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getTokenMetadata=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Et(this.readOnlyContract,e,this.sdk.getStorage());case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.get=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([this.readOnlyContract.totalSupply(e).catch((function(){return u.BigNumber.from(0)})),this.getTokenMetadata(e)]);case 2:return t.abrupt("return",{supply:(r=t.sent)[0],metadata:r[1]});case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAll=function(){var t=k(F.mark((function t(){var e,r=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.nextTokenIdToMint();case 2:return e=t.sent.toNumber(),t.next=5,Promise.all(Array.from(Array(e).keys()).map((function(t){return r.get(t.toString())})));case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getOwned=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}t.t0=e,t.next=7;break;case 4:return t.next=6,this.getSignerAddress();case 6:t.t0=t.sent;case 7:return r=t.t0,t.next=10,this.readOnlyContract.nextTokenIdToMint();case 10:return n=t.sent,t.next=13,this.readOnlyContract.balanceOfBatch(Array(n.toNumber()).fill(r),Array.from(Array(n.toNumber()).keys()));case 13:return a=t.sent.map((function(t,e){return{tokenId:e,balance:t}})).filter((function(t){return t.balance.gt(0)})),t.next=17,Promise.all(a.map(function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.get(e.tokenId.toString());case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 17:return t.abrupt("return",t.sent);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getActiveClaimCondition=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getIndexOfActiveCondition(e);case 2:return r=t.sent,t.t0=this,t.next=6,this.readOnlyContract.getClaimConditionAtIndex(e,r);case 6:return t.t1=t.sent,t.abrupt("return",t.t0.transformResultToClaimCondition.call(t.t0,t.t1));case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllClaimConditions=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.claimConditions(e);case 2:r=t.sent.totalConditionCount.toNumber(),n=[],a=0;case 6:if(!(a<r)){t.next=15;break}return t.t0=n,t.next=10,this.readOnlyContract.getClaimConditionAtIndex(e,a);case 10:t.t1=t.sent,t.t0.push.call(t.t0,t.t1);case 12:a++,t.next=6;break;case 15:return t.abrupt("return",Promise.all(n.map((function(t){return s.transformResultToClaimCondition(t)}))));case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getDefaultSaleRecipient=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.defaultSaleRecipient();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getSaleRecipient=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.saleRecipient(e);case 2:if((r=t.sent)!==i.AddressZero){t.next=5;break}return t.abrupt("return",this.readOnlyContract.defaultSaleRecipient());case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balanceOf=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.balanceOf(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.balanceOf.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.isApproved=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.isApprovedForAll(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.lazyMintBatch=function(){var t=k(F.mark((function t(e){var r,n=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.createBatch(e);case 2:return r=t.sent,t.next=5,Promise.all(r.map((function(t){return n.get(t.toString())})));case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.createBatch=function(){var t=k(F.mark((function t(e){var r,n,a,s,i,o,u;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.nextTokenIdToMint();case 2:return r=t.sent,t.next=5,this.sdk.getStorage().uploadMetadataBatch(e,this.address,r.toNumber());case 5:return n=t.sent.baseUri,t.next=9,this.sendTransaction("lazyMint",[e.length,""+(n.endsWith("/")?n:n+"/")]);case 9:for(s=this.parseEventLogs("LazyMintedTokens",null==(a=t.sent)?void 0:a.logs),i=s[1],o=[],u=s[0];u.lte(i);u=u.add(1))o.push(u.toString());return t.abrupt("return",o);case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setSaleRecipient=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.sendTransaction("setSaleRecipient",[e,r]));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setDefaultSaleRecipient=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.sendTransaction("setDefaultSaleRecipient",[e]));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setApproval=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=!0),t.next=3,this.sendTransaction("setApprovalForAll",[e,r]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transfer=function(){var t=k(F.mark((function t(e,r,n,a){var s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[0]),t.next=3,this.getSignerAddress();case 3:return s=t.sent,t.next=6,this.sendTransaction("safeTransferFrom",[s,e,r,n,a]);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.setClaimCondition=function(){var t=k(F.mark((function t(e,r){var n,a,s,o,u,c,p,d,l;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.buildConditions();case 2:return n=t.sent.map((function(t){return{startTimestamp:t.startTimestamp,maxClaimableSupply:t.maxMintSupply,supplyClaimed:0,quantityLimitPerTransaction:t.quantityLimitPerTransaction,waitTimeInSecondsBetweenClaims:t.waitTimeSecondsLimitPerTransaction,pricePerToken:t.pricePerToken,currency:t.currency===i.AddressZero?xt:t.currency,merkleRoot:t.merkleRoot}})),a={},r.allSnapshots().forEach((function(t){a[t.merkleRoot]=t.snapshotUri})),t.next=7,this.getMetadata(!1);case 7:(s=t.sent.metadata)||Zt(!1),o=s.merkle,u="merkle"in s?s.merkle:{};for(c=0,p=Object.keys(u);c<p.length;c++)a[d=p[c]]=u[d];if(s.merkle=a,l=[],Fe(o,s.merkle)){t.next=20;break}return t.next=18,this.sdk.getStorage().upload(JSON.stringify(s));case 18:l.push(this.contract.interface.encodeFunctionData("setContractURI",[t.sent]));case 20:return l.push(this.contract.interface.encodeFunctionData("setClaimConditions",[e,n])),t.next=23,this.sendTransaction("multicall",[l]);case 23:return t.abrupt("return",t.sent);case 24:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.updateClaimConditions=function(){var t=k(F.mark((function t(e,r){var n,a,s,o,u,c,p,d,l;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.buildConditions();case 2:return n=t.sent.map((function(t){return{startTimestamp:t.startTimestamp,maxClaimableSupply:t.maxMintSupply,supplyClaimed:0,quantityLimitPerTransaction:t.quantityLimitPerTransaction,waitTimeInSecondsBetweenClaims:t.waitTimeSecondsLimitPerTransaction,pricePerToken:t.pricePerToken,currency:t.currency===i.AddressZero?xt:t.currency,merkleRoot:t.merkleRoot}})),a={},r.allSnapshots().forEach((function(t){a[t.merkleRoot]=t.snapshotUri})),t.next=7,this.getMetadata(!1);case 7:(s=t.sent.metadata)||Zt(!1),o=s.merkle,u="merkle"in s?s.merkle:{};for(c=0,p=Object.keys(u);c<p.length;c++)a[d=p[c]]=u[d];if(s.merkle=a,l=[],Fe(o,s.merkle)){t.next=20;break}return t.next=18,this.sdk.getStorage().upload(JSON.stringify(s));case 18:l.push(this.contract.interface.encodeFunctionData("setContractURI",[t.sent]));case 20:return l.push(this.contract.interface.encodeFunctionData("updateClaimConditions",[e,n])),t.next=23,this.sendTransaction("multicall",[l]);case 23:return t.abrupt("return",t.sent);case 24:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getClaimConditionFactory=function(){var t=this.sdk.createSnapshot.bind(this.sdk);return new Ie(t)},r.setPublicClaimConditions=function(){var t=k(F.mark((function t(e,r){var a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=r.map((function(t){return{startTimestamp:t.startTimestamp||0,maxClaimableSupply:t.maxClaimableSupply,supplyClaimed:0,quantityLimitPerTransaction:t.quantityLimitPerTransaction||t.maxClaimableSupply,waitTimeInSecondsBetweenClaims:t.waitTimeInSecondsBetweenClaims||0,pricePerToken:t.pricePerToken||0,currency:t.currency||i.AddressZero,merkleRoot:t.merkleRoot||n.hexZeroPad([0],32)}})),t.next=3,this.sendTransaction("setClaimConditions",[e,a]);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.prepareClaim=function(){var t=k(F.mark((function t(e,r,a){var o,c,p,d,l,f,h,y,x,v,g,b,w;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[n.hexZeroPad([0],32)]),t.next=3,this.getActiveClaimCondition(e);case 3:return o=t.sent,t.next=6,this.getCallOverrides();case 6:if(t.t0=t.sent,t.t0){t.next=9;break}t.t0={};case 9:return c=t.t0,t.next=12,this.getSignerAddress();case 12:return p=t.sent,t.next=15,this.getMetadata();case 15:if(d=t.sent.metadata,o.merkleRoot.toString().startsWith(i.AddressZero)){t.next=27;break}return t.next=20,this.sdk.getStorage().get(null==d?void 0:d.merkle[o.merkleRoot.toString()]);case 20:if(l=t.sent,f=new m.JsonConvert,h=f.deserializeObject(JSON.parse(l),exports.Snapshot),void 0!==(y=h.claims.find((function(t){return t.address.toLowerCase()===(null==p?void 0:p.toLowerCase())})))){t.next=26;break}throw new Error("No claim found for this address");case 26:a=y.proof;case 27:if(!o.pricePerToken.gt(0)){t.next=44;break}if(!Ct(o.currency)){t.next=32;break}c.value=u.BigNumber.from(o.pricePerToken).mul(r),t.next=44;break;case 32:return x=s.ERC20__factory.connect(o.currency,this.providerOrSigner),t.next=35,this.getSignerAddress();case 35:return v=t.sent,g=this.address,t.next=39,x.allowance(v,g);case 39:if(b=t.sent,w=u.BigNumber.from(o.pricePerToken).mul(u.BigNumber.from(r)),!b.lt(w)){t.next=44;break}return t.next=44,this.sendContractTransaction(x,"approve",[g,b.add(w)]);case 44:return t.abrupt("return",{overrides:c,proofs:a});case 45:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.claim=function(){var t=k(F.mark((function t(e,r,a){var s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[n.hexZeroPad([0],32)]),t.next=3,this.prepareClaim(e,r,a);case 3:return s=t.sent,t.next=6,this.isNewClaim();case 6:if(!t.sent){t.next=21;break}return t.t0=this,t.next=10,this.getSignerAddress();case 10:return t.t1=t.sent,t.t2=e,t.t3=r,t.t4=s.proofs,t.t5=[t.t1,t.t2,t.t3,t.t4],t.t6=s.overrides,t.next=18,t.t0.sendTransaction.call(t.t0,"claim",t.t5,t.t6);case 18:return t.abrupt("return",t.sent);case 21:return t.next=23,this.sendContractTransaction(new u.Contract(this.address,De,this.providerOrSigner),"claim",[e,r,s.proofs],s.overrides);case 23:return t.abrupt("return",t.sent);case 24:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.claimTo=function(){var t=k(F.mark((function t(e,r,a,s){var i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===s&&(s=[n.hexZeroPad([0],32)]),t.next=3,this.prepareClaim(e,r,s);case 3:return i=t.sent,t.next=6,this.isNewClaim();case 6:if(!t.sent){t.next=10;break}return t.next=9,this.sendTransaction("claim",[a,e,r,i.proofs],i.overrides);case 9:return t.abrupt("return",t.sent);case 10:return(o=[]).push(new u.Contract(this.address,De,this.providerOrSigner).interface.encodeFunctionData("claim",[e,r,i.proofs])),t.t0=o,t.t1=this.contract.interface,t.next=16,this.getSignerAddress();case 16:return t.t2=t.sent,t.t3=a,t.t4=e,t.t5=r,t.t6=[0],t.t7=[t.t2,t.t3,t.t4,t.t5,t.t6],t.t8=t.t1.encodeFunctionData.call(t.t1,"safeTransferFrom",t.t7),t.t0.push.call(t.t0,t.t8),t.next=26,this.sendTransaction("multicall",[o],i.overrides);case 26:return t.abrupt("return",t.sent);case 27:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.burn=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerAddress();case 2:return n=t.sent,t.next=5,this.sendTransaction("burn",[n,e,r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transferFrom=function(){var t=k(F.mark((function t(e,r,n,a,s){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===s&&(s=[0]),t.next=3,this.sendTransaction("safeTransferFrom",[e,r,n,a,s]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,s){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setRoyaltyBps=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata(!1);case 2:if(n=[],r=t.sent.metadata){t.next=7;break}throw new Error("No metadata found, this module might be invalid!");case 7:return r.seller_fee_basis_points=e,t.t0=this.sdk.getStorage(),t.t1=M({},r),t.t2=this.address,t.next=13,this.getSignerAddress();case 13:return t.t3=t.sent,t.next=16,t.t0.uploadMetadata.call(t.t0,t.t1,t.t2,t.t3);case 16:return a=t.sent,n.push(this.contract.interface.encodeFunctionData("setRoyaltyBps",[e])),n.push(this.contract.interface.encodeFunctionData("setContractURI",[a])),t.next=21,this.sendTransaction("multicall",[n]);case 21:return t.abrupt("return",t.sent);case 22:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getRoyaltyBps=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.royaltyBps();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getRoyaltyRecipientAddress=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata();case 2:if(void 0===(null==(e=(r=t.sent).metadata)?void 0:e.fee_recipient)){t.next=5;break}return t.abrupt("return",r.metadata.fee_recipient);case 5:return t.abrupt("return","");case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getClaimConditionsFactory=function(){var t=this.sdk.createSnapshot.bind(this.sdk);return new Ie(t)},r.totalSupply=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.totalSupply(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllClaimerAddresses=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.contract.queryFilter(this.contract.filters.ClaimedTokens(null,u.BigNumber.from(e)));case 2:return t.abrupt("return",Array.from(new Set(t.sent.map((function(t){return t.args.claimer})))));case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getClaimIneligibilityReasons=function(){var t=k(F.mark((function t(e,r,n){var a,i,o,c,p,d,l,f,h;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=[],void 0!==n){t.next=3;break}throw new Error("addressToCheck is required");case 3:return t.prev=3,t.next=6,Promise.all([this.readOnlyContract.getIndexOfActiveCondition(e),this.getActiveClaimCondition(e)]);case 6:i=(c=t.sent)[0],o=c[1],t.next=18;break;case 11:if(t.prev=11,t.t0=t.catch(3),!t.t0.message.includes("no public mint condition.")){t.next=16;break}return a.push(exports.ClaimEligibility.NoActiveClaimPhase),t.abrupt("return",a);case 16:throw console.error("Failed to get active claim condition",t.t0),new Error("Failed to get active claim condition");case 18:if(u.BigNumber.from(o.availableSupply).lt(r)&&a.push(exports.ClaimEligibility.NotEnoughSupply),!(u.ethers.utils.stripZeros(o.merkleRoot).length>0)){t.next=26;break}return p=o.merkleRoot.toString(),t.next=24,this.getClaimerProofs(p,n);case 24:0===t.sent.length&&u.ethers.utils.keccak256(n).toLowerCase()!==p&&a.push(exports.ClaimEligibility.AddressNotAllowed);case 26:return t.next=28,this.readOnlyContract.getTimestampForNextValidClaim(e,i,n);case 28:if(d=t.sent,!u.BigNumber.from(Date.now()).div(1e3).lt(d)){t.next=39;break}if(!u.BigNumber.from(o.waitTimeSecondsLimitPerTransaction).eq(d)){t.next=38;break}return t.next=34,this.readOnlyContract.balanceOf(n,e);case 34:t.sent.gte(1)&&a.push(exports.ClaimEligibility.AlreadyClaimed),t.next=39;break;case 38:a.push(exports.ClaimEligibility.WaitBeforeNextClaimTransaction);case 39:if(!o.pricePerToken.gt(0)){t.next=58;break}if(l=o.pricePerToken.mul(r),!Ct(o.currency)){t.next=51;break}return t.next=44,this.getProvider();case 44:return f=t.sent,t.next=47,f.getBalance(n);case 47:t.sent.lt(l)&&a.push(exports.ClaimEligibility.NotEnoughTokens),t.next=58;break;case 51:return t.next=53,this.getProvider();case 53:return h=t.sent,t.next=56,s.ERC20__factory.connect(o.currency,h).balanceOf(n);case 56:t.sent.lt(l)&&a.push(exports.ClaimEligibility.NotEnoughTokens);case 58:return t.abrupt("return",a);case 59:case"end":return t.stop()}}),t,this,[[3,11]])})));return function(e,r,n){return t.apply(this,arguments)}}(),r.canClaim=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n){t.next=4;break}return t.next=3,this.getSignerAddress();case 3:n=t.sent;case 4:return t.next=6,this.getClaimIneligibilityReasons(e,r,n);case 6:return t.t0=t.sent.length,t.abrupt("return",0===t.t0);case 8:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.getClaimerProofs=function(){var t=k(F.mark((function t(e,r){var n,a,s,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=4;break}return t.next=3,this.getSignerAddress();case 3:r=t.sent;case 4:return t.next=6,this.getMetadata();case 6:return n=t.sent.metadata,t.next=10,this.sdk.getStorage().get(null==n?void 0:n.merkle[e]);case 10:if(a=t.sent,s=new m.JsonConvert,i=s.deserializeObject(JSON.parse(a),exports.Snapshot),void 0!==(o=i.claims.find((function(t){var e;return t.address.toLowerCase()===(null==(e=r)?void 0:e.toLowerCase())})))){t.next=16;break}return t.abrupt("return",[]);case 16:return t.abrupt("return",o.proof);case 17:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.isTransferRestricted=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.transfersRestricted());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setRestrictedTransfer=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=!1),t.t0=this,t.t1=["admin"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sendTransaction("setRestrictedTransfer",[e]);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.isNewClaim=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkVersion();case 2:return t.abrupt("return",this._isNewClaim);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.checkVersion=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._shouldCheckVersion){t.next=11;break}return t.prev=1,t.next=4,this.readOnlyContract.VERSION();case 4:this._isNewClaim=!0,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),this._isNewClaim=!1;case 10:this._shouldCheckVersion=!1;case 11:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(){return t.apply(this,arguments)}}(),e}(Yt);Ue.moduleType=exports.ModuleType.BUNDLE_DROP,Ue.roles=[Vt.admin,Vt.minter,Vt.transfer];var Ve=function(t){function e(){return t.apply(this,arguments)||this}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.DataStore__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.getUint=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=u.ethers.utils.id(e.toString()),t.next=3,this.readOnlyContract.getUint(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setUint=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=u.ethers.utils.id(e.toString()),t.next=3,this.sendTransaction("setUint",[n,r]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e}(Yt);Ve.moduleType=exports.ModuleType.DATASTORE,Ve.roles=[Vt.admin,Vt.editor];var je=[{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"claimConditionIndex",type:"uint256"},{indexed:!0,internalType:"address",name:"claimer",type:"address"},{indexed:!1,internalType:"uint256",name:"startTokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantityClaimed",type:"uint256"}],name:"ClaimedTokens",type:"event"},{inputs:[{internalType:"uint256",name:"_quantity",type:"uint256"},{internalType:"bytes32[]",name:"_proofs",type:"bytes32[]"}],name:"claim",outputs:[],stateMutability:"payable",type:"function"}],qe=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"startTokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTokenId",type:"uint256"},{indexed:!1,internalType:"string",name:"baseURI",type:"string"}],name:"LazyMintedTokens",type:"event"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"},{internalType:"string",name:"_baseURIForTokens",type:"string"}],name:"lazyMint",outputs:[],stateMutability:"nonpayable",type:"function"}],Je=function(t){function e(e,r,n,a){var s;return(s=t.call(this,e,r,n,a)||this)._shouldCheckVersion=!0,s._isV0=!1,s._version=0,s.v1Module=void 0,s.v1Module=new We(e,r,n,a),s}S(e,t);var r=e.prototype;return r.setProviderOrSigner=function(e){var r;t.prototype.setProviderOrSigner.call(this,e),null==(r=this.v1Module)||r.setProviderOrSigner(e)},r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.LazyMintERC721__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.getTokenMetadata=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Et(this.readOnlyContract,e,this.sdk.getStorage());case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.get=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([this.ownerOf(e).catch((function(){return i.AddressZero})),this.getTokenMetadata(e)]);case 2:return t.abrupt("return",{owner:(r=t.sent)[0],metadata:r[1]});case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAll=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.getAll(e));case 4:return r=u.BigNumber.from((null==e?void 0:e.start)||0).toNumber(),n=u.BigNumber.from((null==e?void 0:e.count)||100).toNumber(),t.t0=Math,t.next=9,this.readOnlyContract.nextTokenIdToMint();case 9:return t.t1=t.sent.toNumber(),t.t2=r+n,a=t.t0.min.call(t.t0,t.t1,t.t2),t.next=14,Promise.all(Array.from(Array(a-r).keys()).map((function(t){return s.get((r+t).toString())})));case 14:return t.abrupt("return",t.sent);case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllUnclaimed=function(){var t=k(F.mark((function t(e){var r,n,a,s,o=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.getAllUnclaimed());case 4:return r=u.BigNumber.from((null==e?void 0:e.start)||0).toNumber(),n=u.BigNumber.from((null==e?void 0:e.count)||100).toNumber(),t.t0=u.BigNumber,t.t1=Math,t.next=10,this.readOnlyContract.nextTokenIdToMint();case 10:return t.t2=t.sent.toNumber(),t.t3=r+n,t.t4=t.t1.min.call(t.t1,t.t2,t.t3),a=t.t0.from.call(t.t0,t.t4),t.next=16,this.readOnlyContract.nextTokenIdToClaim();case 16:return s=t.sent,t.next=19,Promise.all(Array.from(Array(a.sub(s).toNumber()).keys()).map((function(t){return o.getTokenMetadata(s.add(t).toString())})));case 19:return t.abrupt("return",t.sent.map((function(t){return{owner:i.AddressZero,metadata:t}})));case 20:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllClaimed=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.getAllClaimed());case 4:return r=u.BigNumber.from((null==e?void 0:e.start)||0).toNumber(),n=u.BigNumber.from((null==e?void 0:e.count)||100).toNumber(),t.t0=Math,t.next=9,this.readOnlyContract.nextTokenIdToClaim();case 9:return t.t1=t.sent.toNumber(),t.t2=r+n,a=t.t0.min.call(t.t0,t.t1,t.t2),t.next=14,Promise.all(Array.from(Array(a).keys()).map((function(t){return s.get(t.toString())})));case 14:return t.abrupt("return",t.sent);case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.ownerOf=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.ownerOf(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getDefaultSaleRecipient=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.defaultSaleRecipient();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setDefaultSaleRecipient=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("setDefaultSaleRecipient",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getOwned=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}t.t0=e,t.next=7;break;case 4:return t.next=6,this.getSignerAddress();case 6:t.t0=t.sent;case 7:return r=t.t0,t.next=10,this.readOnlyContract.balanceOf(r);case 10:return n=Array.from(Array(t.sent.toNumber()).keys()),t.next=14,Promise.all(n.map((function(t){return s.readOnlyContract.tokenOfOwnerByIndex(r,t)})));case 14:return a=t.sent,t.next=17,Promise.all(a.map((function(t){return s.get(t.toString())})));case 17:return t.abrupt("return",t.sent);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.transformResultToMintCondition=function(t){return{startTimestamp:t.startTimestamp,maxMintSupply:t.maxClaimableSupply,currentMintSupply:t.supplyClaimed,quantityLimitPerTransaction:t.quantityLimitPerTransaction,waitTimeSecondsLimitPerTransaction:t.waitTimeInSecondsBetweenClaims,pricePerToken:t.pricePerToken,currency:t.currency,merkleRoot:t.merkleRoot}},r.transformResultToClaimCondition=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,wt(this.providerOrSigner,e.currency,e.pricePerToken);case 2:return r=t.sent,t.abrupt("return",{startTimestamp:new Date(1e3*u.BigNumber.from(e.startTimestamp).toNumber()),maxMintSupply:e.maxClaimableSupply.toString(),currentMintSupply:e.supplyClaimed.toString(),availableSupply:u.BigNumber.from(e.maxClaimableSupply).sub(e.supplyClaimed).toString(),quantityLimitPerTransaction:e.quantityLimitPerTransaction.toString(),waitTimeSecondsLimitPerTransaction:e.waitTimeInSecondsBetweenClaims.toString(),price:u.BigNumber.from(e.pricePerToken),pricePerToken:u.BigNumber.from(e.pricePerToken),currency:e.currency,currencyContract:e.currency,currencyMetadata:r,merkleRoot:e.merkleRoot});case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getActiveMintCondition=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.getActiveMintCondition());case 4:return t.next=6,this.readOnlyContract.getIndexOfActiveCondition();case 6:return e=t.sent,t.t0=this,t.next=10,this.readOnlyContract.getClaimConditionAtIndex(e);case 10:return t.t1=t.sent,t.abrupt("return",t.t0.transformResultToMintCondition.call(t.t0,t.t1));case 12:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getActiveClaimCondition=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.getActiveClaimCondition());case 4:return t.next=6,this.readOnlyContract.getIndexOfActiveCondition();case 6:return e=t.sent,t.next=9,this.readOnlyContract.getClaimConditionAtIndex(e);case 9:return r=t.sent,t.next=12,this.transformResultToClaimCondition(r);case 12:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getAllMintConditions=function(){var t=k(F.mark((function t(){var e,r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.getAllMintConditions());case 4:return t.next=6,this.readOnlyContract.claimConditions();case 6:e=t.sent.totalConditionCount.toNumber(),r=[],n=0;case 10:if(!(n<e)){t.next=21;break}return t.t0=r,t.t1=this,t.next=15,this.readOnlyContract.getClaimConditionAtIndex(n);case 15:t.t2=t.sent,t.t3=t.t1.transformResultToMintCondition.call(t.t1,t.t2),t.t0.push.call(t.t0,t.t3);case 18:n++,t.next=10;break;case 21:return t.abrupt("return",r);case 22:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getAllClaimConditions=function(){var t=k(F.mark((function t(){var e,r,n,a=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.getAllClaimConditions());case 4:return t.next=6,this.readOnlyContract.claimConditions();case 6:e=t.sent.totalConditionCount.toNumber(),r=[],n=0;case 10:if(!(n<e)){t.next=19;break}return t.t0=r,t.next=14,this.readOnlyContract.getClaimConditionAtIndex(n);case 14:t.t1=t.sent,t.t0.push.call(t.t0,t.t1);case 16:n++,t.next=10;break;case 19:return t.abrupt("return",Promise.all(r.map((function(t){return a.transformResultToClaimCondition(t)}))));case 20:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.totalSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.totalSupply());case 4:return t.next=6,this.readOnlyContract.nextTokenIdToMint();case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.maxTotalSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.maxTotalSupply());case 4:return t.next=6,this.readOnlyContract.nextTokenIdToMint();case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.totalUnclaimedSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.totalUnclaimedSupply());case 4:return t.next=6,this.readOnlyContract.nextTokenIdToMint();case 6:return t.t0=t.sent,t.next=9,this.totalClaimedSupply();case 9:return t.t1=t.sent,t.abrupt("return",t.t0.sub.call(t.t0,t.t1));case 11:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.totalClaimedSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.totalClaimedSupply());case 4:return t.next=6,this.readOnlyContract.nextTokenIdToClaim();case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.balanceOf=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.balanceOf(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.balanceOf.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isApproved=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.isApprovedForAll(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setApproval=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=!0),t.next=3,this.sendTransaction("setApprovalForAll",[e,r]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transfer=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerAddress();case 2:return n=t.sent,t.next=5,this.sendTransaction("safeTransferFrom(address,address,uint256)",[n,e,r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.lazyMint=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=6;break}return t.next=5,this.v1Module.lazyMint(e);case 5:return t.abrupt("return");case 6:return t.next=8,this.createBatch([e]);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.lazyMintBatch=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=6;break}return t.next=5,this.v1Module.lazyMintBatch(e);case 5:return t.abrupt("return");case 6:return t.next=8,this.createBatch(e);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setMintConditions=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.setMintConditions(e));case 4:return t.abrupt("return",this.setClaimCondition(e));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setClaimConditions=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.setClaimCondition(e));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setClaimCondition=function(){var t=k(F.mark((function t(e){var r,a,s,o,u,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.setClaimCondition(e));case 4:return t.next=6,e.buildConditions();case 6:return r=t.sent.map((function(t){return{startTimestamp:t.startTimestamp,maxClaimableSupply:t.maxMintSupply,supplyClaimed:0,quantityLimitPerTransaction:t.quantityLimitPerTransaction,waitTimeInSecondsBetweenClaims:t.waitTimeSecondsLimitPerTransaction,pricePerToken:t.pricePerToken,currency:t.currency===i.AddressZero?xt:t.currency,merkleRoot:t.merkleRoot}})),a={},e.allSnapshots().forEach((function(t){a[t.merkleRoot]=t.snapshotUri})),t.next=11,this.getMetadata(!1);case 11:if((s=t.sent.metadata)||Zt(!1),o=s.merkle,u=n.hexZeroPad([0],32).toString(),e.allSnapshots().length>0?s.merkle=a:0===r.filter((function(t){return t.merkleRoot!==u})).length&&(s.merkle={}),c=[],Fe(o,s.merkle)){t.next=23;break}return t.next=21,this.sdk.getStorage().upload(JSON.stringify(s));case 21:c.push(this.contract.interface.encodeFunctionData("setContractURI",[t.sent]));case 23:return c.push(this.contract.interface.encodeFunctionData("setClaimConditions",[r])),t.next=26,this.sendTransaction("multicall",[c]);case 26:return t.abrupt("return",t.sent);case 27:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.updateClaimConditions=function(){var t=k(F.mark((function t(e){var r,n,a,s,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.setClaimCondition(e));case 4:return t.next=6,e.buildConditions();case 6:return r=t.sent.map((function(t){return{startTimestamp:t.startTimestamp,maxClaimableSupply:t.maxMintSupply,supplyClaimed:0,quantityLimitPerTransaction:t.quantityLimitPerTransaction,waitTimeInSecondsBetweenClaims:t.waitTimeSecondsLimitPerTransaction,pricePerToken:t.pricePerToken,currency:t.currency===i.AddressZero?xt:t.currency,merkleRoot:t.merkleRoot}})),n={},e.allSnapshots().forEach((function(t){n[t.merkleRoot]=t.snapshotUri})),a=[],t.next=12,this.getMetadata(!1);case 12:if((s=t.sent.metadata)||Zt(!1),o=s.merkle,s.merkle=0===e.allSnapshots().length&&"merkle"in s?{}:n,Fe(o,s.merkle)){t.next=22;break}return t.next=20,this.sdk.getStorage().upload(JSON.stringify(s));case 20:a.push(this.contract.interface.encodeFunctionData("setContractURI",[t.sent]));case 22:return a.push(this.contract.interface.encodeFunctionData("updateClaimConditions",[r])),t.next=25,this.sendTransaction("multicall",[a]);case 25:return t.abrupt("return",t.sent);case 26:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getClaimConditionsFactory=function(){var t=this.sdk.createSnapshot.bind(this.sdk);return new Ie(t)},r.getMintConditionsFactory=function(){return this.getClaimConditionsFactory()},r.setPublicMintConditions=function(){var t=k(F.mark((function t(e){var r,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.setPublicMintConditions(e));case 4:return r=u.BigNumber.from(Date.now()).div(1e3),a=e.map((function(t){return{startTimestamp:r.add(t.startTimestampInSeconds||0),maxClaimableSupply:t.maxMintSupply,supplyClaimed:0,quantityLimitPerTransaction:t.quantityLimitPerTransaction||t.maxMintSupply,waitTimeInSecondsBetweenClaims:t.waitTimeSecondsLimitPerTransaction||0,pricePerToken:t.pricePerToken||0,currency:t.currency||i.AddressZero,merkleRoot:t.merkleRoot||n.hexZeroPad([0],32)}})),t.next=8,this.sendTransaction("setClaimConditions",[a]);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getClaimIneligibilityReasons=function(){var t=k(F.mark((function t(e,r){var n,a,i,o,c,p,d,l,f;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=[],void 0!==r){t.next=3;break}throw new Error("addressToCheck is required");case 3:return t.prev=3,t.next=6,Promise.all([this.readOnlyContract.getIndexOfActiveCondition(),this.getActiveClaimCondition()]);case 6:a=(o=t.sent)[0],i=o[1],t.next=18;break;case 11:if(t.prev=11,t.t0=t.catch(3),!t.t0.message.includes("no public mint condition.")){t.next=16;break}return n.push(exports.ClaimEligibility.NoActiveClaimPhase),t.abrupt("return",n);case 16:throw console.error("Failed to get active claim condition",t.t0),new Error("Failed to get active claim condition");case 18:if(u.BigNumber.from(i.availableSupply).lt(e)&&n.push(exports.ClaimEligibility.NotEnoughSupply),!(u.ethers.utils.stripZeros(i.merkleRoot).length>0)){t.next=26;break}return c=i.merkleRoot.toString(),t.next=24,this.getClaimerProofs(c,r);case 24:0===t.sent.length&&u.ethers.utils.keccak256(r).toLowerCase()!==c&&n.push(exports.ClaimEligibility.AddressNotAllowed);case 26:return t.next=28,this.readOnlyContract.getTimestampForNextValidClaim(a,r);case 28:if(p=t.sent,!u.BigNumber.from(Date.now()).div(1e3).lt(p)){t.next=39;break}if(!u.BigNumber.from(i.waitTimeSecondsLimitPerTransaction).eq(p)){t.next=38;break}return t.next=34,this.readOnlyContract.balanceOf(r);case 34:t.sent.gte(1)&&n.push(exports.ClaimEligibility.AlreadyClaimed),t.next=39;break;case 38:n.push(exports.ClaimEligibility.WaitBeforeNextClaimTransaction);case 39:if(!i.pricePerToken.gt(0)){t.next=58;break}if(d=i.pricePerToken.mul(e),!Ct(i.currency)){t.next=51;break}return t.next=44,this.getProvider();case 44:return l=t.sent,t.next=47,l.getBalance(r);case 47:t.sent.lt(d)&&n.push(exports.ClaimEligibility.NotEnoughTokens),t.next=58;break;case 51:return t.next=53,this.getProvider();case 53:return f=t.sent,t.next=56,s.ERC20__factory.connect(i.currency,f).balanceOf(r);case 56:t.sent.lt(d)&&n.push(exports.ClaimEligibility.NotEnoughTokens);case 58:return t.abrupt("return",n);case 59:case"end":return t.stop()}}),t,this,[[3,11]])})));return function(e,r){return t.apply(this,arguments)}}(),r.canClaim=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==r){t.next=4;break}return t.next=3,this.getSignerAddress();case 3:r=t.sent;case 4:return t.next=6,this.isV0();case 6:if(!t.sent){t.next=8;break}return t.abrupt("return",this.v1Module.canClaim(e,[]));case 8:return t.next=10,this.getClaimIneligibilityReasons(e,r);case 10:return t.t0=t.sent.length,t.abrupt("return",0===t.t0);case 12:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.prepareClaim=function(){var t=k(F.mark((function t(e,r){var a,o,c,p,d,l,f,h,y,x,v,g,b;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=[n.hexZeroPad([0],32)]),t.next=3,this.getActiveClaimCondition();case 3:return a=t.sent,t.next=6,this.getMetadata();case 6:return o=t.sent.metadata,t.next=10,this.getSignerAddress();case 10:if(c=t.sent,a.merkleRoot.toString().startsWith(i.AddressZero)){t.next=21;break}return t.next=14,this.sdk.getStorage().get(null==o?void 0:o.merkle[a.merkleRoot.toString()]);case 14:if(p=t.sent,d=new m.JsonConvert,l=d.deserializeObject(JSON.parse(p),exports.Snapshot),void 0!==(f=l.claims.find((function(t){return t.address.toLowerCase()===c.toLowerCase()})))){t.next=20;break}throw new Error("No claim found for this address");case 20:r=f.proof;case 21:return t.next=23,this.getCallOverrides();case 23:if(t.t0=t.sent,t.t0){t.next=26;break}t.t0={};case 26:if(h=t.t0,!a.pricePerToken.gt(0)){t.next=44;break}if(!Ct(a.currency)){t.next=32;break}h.value=u.BigNumber.from(a.pricePerToken).mul(e),t.next=44;break;case 32:return y=s.ERC20__factory.connect(a.currency,this.providerOrSigner),t.next=35,this.getSignerAddress();case 35:return x=t.sent,v=this.address,t.next=39,y.allowance(x,v);case 39:if(g=t.sent,b=u.BigNumber.from(a.pricePerToken).mul(u.BigNumber.from(e)),!g.lt(b)){t.next=44;break}return t.next=44,this.sendContractTransaction(y,"approve",[v,g.add(b)]);case 44:return t.abrupt("return",{overrides:h,proofs:r});case 45:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.claimTo=function(){var t=k(F.mark((function t(e,r,a){var s,i,o,c,p,d,l,f;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[n.hexZeroPad([0],32)]),t.next=3,this.prepareClaim(e,a);case 3:return s=t.sent,t.next=6,this.isNewClaim();case 6:if(!t.sent){t.next=10;break}return t.next=9,this.sendTransaction("claim",[r,e,s.proofs],s.overrides);case 9:return t.abrupt("return",t.sent);case 10:return i=new u.Contract(this.address,je,this.providerOrSigner),t.next=13,this.sendContractTransaction(i,"claim",[e,s.proofs],s.overrides);case 13:c=[],p=this.parseLogs("ClaimedTokens",null==(o=t.sent)?void 0:o.logs,i),l=(d=p[0].args.startTokenId).add(e),f=d;case 19:if(!f.lt(l)){t.next=33;break}return t.t0=c,t.t1=this.contract.interface,t.next=24,this.getSignerAddress();case 24:t.t2=t.sent,t.t3=r,t.t4=f,t.t5=[t.t2,t.t3,t.t4],t.t6=t.t1.encodeFunctionData.call(t.t1,"transferFrom",t.t5),t.t0.push.call(t.t0,t.t6);case 30:f=f.add(1),t.next=19;break;case 33:return t.next=35,this.sendTransaction("multicall",[c],s.overrides);case 35:return t.abrupt("return",t.sent);case 36:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.claim=function(){var t=k(F.mark((function t(e,r){var a,s,i,o,c,p,d,l,f,h=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=[n.hexZeroPad([0],32)]),t.next=3,this.isV0();case 3:if(!t.sent){t.next=5;break}return t.abrupt("return",this.v1Module.claim(e,r));case 5:return t.next=7,this.prepareClaim(e,r);case 7:return s=t.sent,o=this.contract,t.next=11,this.isNewClaim();case 11:if(!t.sent){t.next=25;break}return t.t0=this,t.next=15,this.getSignerAddress();case 15:return t.t1=t.sent,t.t2=e,t.t3=s.proofs,t.t4=[t.t1,t.t2,t.t3],t.t5=s.overrides,t.next=22,t.t0.sendTransaction.call(t.t0,"claim",t.t4,t.t5);case 22:i=t.sent,t.next=29;break;case 25:return o=new u.Contract(this.address,je,this.providerOrSigner),t.next=28,this.sendContractTransaction(o,"claim",[e,s.proofs],s.overrides);case 28:i=t.sent;case 29:for(c=this.parseLogs("ClaimedTokens",null==(a=i)?void 0:a.logs,o),d=(p=c[0].args.startTokenId).add(e),l=[],f=p;f.lt(d);f=f.add(1))l.push(u.BigNumber.from(f.toString()));return t.next=36,Promise.all(l.map(function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,h.get(e.toString());case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 36:return t.abrupt("return",t.sent);case 37:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.burn=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("burn",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.transferFrom=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("transferFrom",[e,r,n]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setRoyaltyBps=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata(!1);case 2:if(n=[],r=t.sent.metadata){t.next=7;break}throw new Error("No metadata found, this module might be invalid!");case 7:return r.seller_fee_basis_points=e,t.t0=this.sdk.getStorage(),t.t1=M({},r),t.t2=this.address,t.next=13,this.getSignerAddress();case 13:return t.t3=t.sent,t.next=16,t.t0.uploadMetadata.call(t.t0,t.t1,t.t2,t.t3);case 16:return a=t.sent,n.push(this.contract.interface.encodeFunctionData("setRoyaltyBps",[e])),n.push(this.contract.interface.encodeFunctionData("setContractURI",[a])),t.next=21,this.sendTransaction("multicall",[n]);case 21:return t.abrupt("return",t.sent);case 22:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getRoyaltyBps=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.royaltyBps();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getRoyaltyRecipientAddress=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata();case 2:if(void 0===(null==(e=(r=t.sent).metadata)?void 0:e.fee_recipient)){t.next=5;break}return t.abrupt("return",r.metadata.fee_recipient);case 5:return t.abrupt("return","");case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.createBatch=function(){var t=k(F.mark((function t(e){var r,n,a,s,i,o,c,p,d,l;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.createBatch(e));case 4:return t.next=6,this.readOnlyContract.nextTokenIdToMint();case 6:return n=t.sent,t.next=9,this.sdk.getStorage().uploadMetadataBatch(e,this.address,n.toNumber());case 9:return a=t.sent.baseUri,i=this.contract,t.next=14,this.hasDelayedReveal();case 14:if(!t.sent){t.next=20;break}return t.next=17,this.sendTransaction("lazyMint",[e.length,a.endsWith("/")?a:a+"/",u.ethers.utils.toUtf8Bytes("")]);case 17:s=t.sent,t.next=24;break;case 20:return i=new u.Contract(this.address,qe,this.providerOrSigner),t.next=23,this.sendContractTransaction(i,"lazyMint",[e.length,a.endsWith("/")?a:a+"/"]);case 23:s=t.sent;case 24:for(o=this.parseLogs("LazyMintedTokens",null==(r=s)?void 0:r.logs,i),p=(c=o[0].args)[1],d=[],l=c[0];l.lte(p);l=l.add(1))d.push(l.toString());return t.abrupt("return",d);case 29:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.hashDelayRevealPassword=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getChainID();case 2:return t.abrupt("return",u.ethers.utils.solidityKeccak256(["string","uint256","uint256","address"],[r,t.sent,e,this.address]));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.createDelayedRevealBatch=function(){var t=k(F.mark((function t(e,r,n){var a,s,i,o,c,p,d,l,f,h,m;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasDelayedReveal();case 2:if(t.sent){t.next=4;break}throw new Error("delay reveal unsupported");case 4:if(n){t.next=6;break}throw new Error("Password is required");case 6:return t.next=8,this.sdk.getStorage().uploadMetadataBatch([e],this.address);case 8:return a=t.sent.baseUri,t.next=12,this.readOnlyContract.nextTokenIdToMint();case 12:return s=t.sent,t.next=15,this.sdk.getStorage().uploadMetadataBatch(r,this.address,s.toNumber());case 15:return i=t.sent.baseUri,t.next=19,this.readOnlyContract.getBaseURICount();case 19:return o=t.sent,t.t0=this.readOnlyContract,t.t1=u.ethers.utils.toUtf8Bytes(i.endsWith("/")?i:i+"/"),t.next=24,this.hashDelayRevealPassword(o,n);case 24:return t.t2=t.sent,t.next=27,t.t0.encryptDecrypt.call(t.t0,t.t1,t.t2);case 27:return c=t.sent,t.next=30,this.sendTransaction("lazyMint",[r.length,a.endsWith("/")?a:a+"/",c]);case 30:for(d=this.parseLogs("LazyMintedTokens",null==(p=t.sent)?void 0:p.logs),f=(l=d[0].args)[1],h=[],m=l[0];m.lte(f);m=m.add(1))h.push(m.toString());return t.abrupt("return",h);case 36:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.reveal=function(){var t=k(F.mark((function t(e,r){var n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasDelayedReveal();case 2:if(t.sent){t.next=4;break}throw new Error("delay reveal unsupported");case 4:if(r){t.next=6;break}throw new Error("Password is required");case 6:return t.next=8,this.hashDelayRevealPassword(e,r);case 8:return n=t.sent,t.prev=9,t.next=12,this.contract.callStatic.reveal(e,n);case 12:if((a=t.sent).includes("://")&&a.endsWith("/")){t.next=15;break}throw new Error("Error revealing batch "+e+" - make sure your password is correct");case 15:t.next=21;break;case 17:throw t.prev=17,t.t0=t.catch(9),console.log("Error revealing batch "+e,t.t0),new Error("Error revealing batch "+e+" - make sure your password is correct");case 21:return t.next=23,this.sendTransaction("reveal",[e,n]);case 23:case"end":return t.stop()}}),t,this,[[9,17]])})));return function(e,r){return t.apply(this,arguments)}}(),r.getBatchesToReveal=function(){var t=k(F.mark((function t(){var e,r,n,a,s,i,o,c=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasDelayedReveal();case 2:if(t.sent){t.next=4;break}throw new Error("Contract does not support delay reveal");case 4:return t.next=6,this.readOnlyContract.getBaseURICount();case 6:if(!(e=t.sent).isZero()){t.next=9;break}return t.abrupt("return",[]);case 9:return r=Array.from(Array(e.toNumber()).keys()),t.next=12,Promise.all(r.map((function(t){return c.readOnlyContract.baseURIIndices(t)})));case 12:return a=(n=t.sent).slice(0,n.length-1),t.next=16,Promise.all(Array.from([0].concat(a)).map((function(t){return c.readOnlyContract.tokenURI(t)})));case 16:return s=t.sent,t.next=19,Promise.all(Array.from([0].concat(a)).map((function(t){return c.getTokenMetadata(t.toString())})));case 19:return i=t.sent,t.next=22,Promise.all(Array.from([].concat(n)).map((function(t){return c.readOnlyContract.encryptedBaseURI(t)})));case 22:return o=t.sent,t.abrupt("return",s.map((function(t,e){return{batchId:u.BigNumber.from(e),batchUri:t,placeholderMetadata:i[e]}})).filter((function(t,e){return u.ethers.utils.hexDataLength(o[e])>0})));case 24:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.canCreateBatch=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV0();case 2:if(!t.sent){t.next=4;break}return t.abrupt("return",this.v1Module.canCreateBatch());case 4:return t.abrupt("return",!0);case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isV0=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkVersion();case 2:return t.abrupt("return",this._isV0);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isNewClaim=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkVersion();case 2:return t.abrupt("return",this._version>=1);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.hasDelayedReveal=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkVersion();case 2:return t.abrupt("return",this._version>=2);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.checkVersion=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._shouldCheckVersion){t.next=20;break}return t.prev=1,t.next=4,this.readOnlyContract.nextTokenIdToMint();case 4:this._isV0=!1,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),this._isV0=!0;case 10:return t.prev=10,t.next=13,this.readOnlyContract.VERSION();case 13:this._version=t.sent.toNumber(),t.next=19;break;case 16:t.prev=16,t.t1=t.catch(10),this._version=0;case 19:this._shouldCheckVersion=!1;case 20:case"end":return t.stop()}}),t,this,[[1,7],[10,16]])})));return function(){return t.apply(this,arguments)}}(),r.getClaimerProofs=function(){var t=k(F.mark((function t(e,r){var n,a,s,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=4;break}return t.next=3,this.getSignerAddress();case 3:r=t.sent;case 4:return t.next=6,this.getMetadata();case 6:return n=t.sent.metadata,t.next=10,this.sdk.getStorage().get(null==n?void 0:n.merkle[e]);case 10:if(a=t.sent,s=new m.JsonConvert,i=s.deserializeObject(JSON.parse(a),exports.Snapshot),void 0!==(o=i.claims.find((function(t){var e;return t.address.toLowerCase()===(null==(e=r)?void 0:e.toLowerCase())})))){t.next=16;break}return t.abrupt("return",[]);case 16:return t.abrupt("return",o.proof);case 17:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.isTransferRestricted=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.transfersRestricted());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setRestrictedTransfer=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=!1),t.t0=this,t.t1=["admin"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sendTransaction("setRestrictedTransfer",[e]);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Yt);Je.moduleType=exports.ModuleType.DROP,Je.roles=[Vt.admin,Vt.minter,Vt.transfer];var We=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this).storage=e.sdk.getStorage(),e}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return Je.roles},r.connectContract=function(){return s.LazyNFT__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return Je.moduleType},r.getTokenMetadata=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Et(this.readOnlyContract,e,this.sdk.getStorage());case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.get=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([this.ownerOf(e).catch((function(){return i.AddressZero})),this.getTokenMetadata(e)]);case 2:return t.abrupt("return",{owner:(r=t.sent)[0],metadata:r[1]});case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAll=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=u.BigNumber.from((null==e?void 0:e.start)||0).toNumber(),n=u.BigNumber.from((null==e?void 0:e.count)||100).toNumber(),t.t0=Math,t.next=5,this.readOnlyContract.nextTokenId();case 5:return t.t1=t.sent.toNumber(),t.t2=r+n,a=t.t0.min.call(t.t0,t.t1,t.t2),t.next=10,Promise.all(Array.from(Array(a-r).keys()).map((function(t){return s.get((r+t).toString())})));case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllUnclaimed=function(){var t=k(F.mark((function t(e){var r,n,a,s,o=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=u.BigNumber.from((null==e?void 0:e.start)||0).toNumber(),n=u.BigNumber.from((null==e?void 0:e.count)||100).toNumber(),t.t0=u.BigNumber,t.t1=Math,t.next=6,this.readOnlyContract.nextTokenId();case 6:return t.t2=t.sent.toNumber(),t.t3=r+n,t.t4=t.t1.min.call(t.t1,t.t2,t.t3),a=t.t0.from.call(t.t0,t.t4),t.next=12,this.readOnlyContract.nextMintTokenId();case 12:return s=t.sent,t.next=15,Promise.all(Array.from(Array(a.sub(s).toNumber()).keys()).map((function(t){return o.getTokenMetadata(s.add(t).toString())})));case 15:return t.abrupt("return",t.sent.map((function(t){return{owner:i.AddressZero,metadata:t}})));case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllClaimed=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=u.BigNumber.from((null==e?void 0:e.start)||0).toNumber(),n=u.BigNumber.from((null==e?void 0:e.count)||100).toNumber(),t.t0=Math,t.next=5,this.readOnlyContract.nextMintTokenId();case 5:return t.t1=t.sent.toNumber(),t.t2=r+n,a=t.t0.min.call(t.t0,t.t1,t.t2),t.next=10,Promise.all(Array.from(Array(a).keys()).map((function(t){return s.get(t.toString())})));case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.ownerOf=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.ownerOf(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getOwned=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}t.t0=e,t.next=7;break;case 4:return t.next=6,this.getSignerAddress();case 6:t.t0=t.sent;case 7:return r=t.t0,t.next=10,this.readOnlyContract.balanceOf(r);case 10:return n=Array.from(Array(t.sent.toNumber()).keys()),t.next=14,Promise.all(n.map((function(t){return s.readOnlyContract.tokenOfOwnerByIndex(r,t)})));case 14:return a=t.sent,t.next=17,Promise.all(a.map((function(t){return s.get(t.toString())})));case 17:return t.abrupt("return",t.sent);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.transformResultToClaimCondition=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,wt(this.providerOrSigner,e.currency,e.pricePerToken);case 2:return r=t.sent,t.abrupt("return",{startTimestamp:new Date(1e3*u.BigNumber.from(e.startTimestamp).toNumber()),maxMintSupply:e.maxMintSupply.toString(),currentMintSupply:e.currentMintSupply.toString(),availableSupply:u.BigNumber.from(e.maxMintSupply).sub(e.currentMintSupply).toString(),quantityLimitPerTransaction:e.quantityLimitPerTransaction.toString(),waitTimeSecondsLimitPerTransaction:e.waitTimeSecondsLimitPerTransaction.toString(),price:u.BigNumber.from(e.pricePerToken),pricePerToken:u.BigNumber.from(e.pricePerToken),currency:e.currency,currencyContract:e.currency,currencyMetadata:r,merkleRoot:e.merkleRoot});case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getActiveMintCondition=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getLastStartedMintConditionIndex();case 2:return e=t.sent,t.next=5,this.readOnlyContract.mintConditions(e);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getActiveClaimCondition=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getLastStartedMintConditionIndex();case 2:return e=t.sent,t.next=5,this.readOnlyContract.mintConditions(e);case 5:return r=t.sent,t.next=8,this.transformResultToClaimCondition(r);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getAllMintConditions=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],r=0;case 2:return t.prev=2,t.t0=e,t.next=6,this.readOnlyContract.mintConditions(r);case 6:t.t1=t.sent,t.t0.push.call(t.t0,t.t1),t.next=13;break;case 10:return t.prev=10,t.t2=t.catch(2),t.abrupt("break",16);case 13:r++,t.next=2;break;case 16:return t.abrupt("return",e);case 17:case"end":return t.stop()}}),t,this,[[2,10]])})));return function(){return t.apply(this,arguments)}}(),r.getAllClaimConditions=function(){var t=k(F.mark((function t(){var e,r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],r=0;case 2:return t.prev=2,t.next=5,this.readOnlyContract.mintConditions(r);case 5:return n=t.sent,t.t0=e,t.next=9,this.transformResultToClaimCondition(n);case 9:t.t1=t.sent,t.t0.push.call(t.t0,t.t1),t.next=16;break;case 13:return t.prev=13,t.t2=t.catch(2),t.abrupt("break",19);case 16:r++,t.next=2;break;case 19:return t.abrupt("return",e);case 20:case"end":return t.stop()}}),t,this,[[2,13]])})));return function(){return t.apply(this,arguments)}}(),r.totalSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.nextTokenId();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.maxTotalSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.maxTotalSupply();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.totalUnclaimedSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.nextTokenId();case 2:return t.t0=t.sent,t.next=5,this.totalClaimedSupply();case 5:return t.t1=t.sent,t.abrupt("return",t.t0.sub.call(t.t0,t.t1));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.totalClaimedSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.nextMintTokenId();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.balanceOf=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.balanceOf(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.balanceOf.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isApproved=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.isApprovedForAll(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setApproval=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=!0),t.next=3,this.sendTransaction("setApprovalForAll",[e,r]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transfer=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerAddress();case 2:return n=t.sent,t.next=5,this.sendTransaction("safeTransferFrom(address,address,uint256)",[n,e,r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.lazyMint=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.lazyMintBatch([e]);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.pinToIpfs=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.storage.uploadBatch(e,this.address);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.lazyMintBatch=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadataBatch(e);case 2:return r=t.sent.baseUri,n=Array.from(Array(e.length).keys()).map((function(t){return""+r+t+"/"})),t.next=7,this.sendTransaction("lazyMintBatch",[n]);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.lazyMintAmount=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("lazyMintAmount",[e]);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setMintConditions=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.setClaimCondition(e));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setClaimConditions=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.setClaimCondition(e));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setClaimCondition=function(){var t=k(F.mark((function t(e){var r,n,a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.buildConditionsForDropV1();case 2:return r=t.sent,n={},e.allSnapshots().forEach((function(t){n[t.merkleRoot]=t.snapshotUri})),t.next=7,this.getMetadata(!1);case 7:return(a=t.sent.metadata)||Zt(!1),a.merkle=0===e.allSnapshots().length&&"merkle"in a?{}:n,t.next=13,this.storage.upload(JSON.stringify(a));case 13:return s=[this.contract.interface.encodeFunctionData("setContractURI",[t.sent]),this.contract.interface.encodeFunctionData("setPublicMintConditions",[r])],t.next=17,this.sendTransaction("multicall",[s]);case 17:return t.abrupt("return",t.sent);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getClaimConditionsFactory=function(){var t=this.sdk.createSnapshot.bind(this.sdk);return new Ie(t)},r.getMintConditionsFactory=function(){return this.getClaimConditionsFactory()},r.setPublicMintConditions=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{startTimestamp:t.startTimestampInSeconds||0,maxMintSupply:t.maxMintSupply,currentMintSupply:0,quantityLimitPerTransaction:t.quantityLimitPerTransaction||t.maxMintSupply,waitTimeSecondsLimitPerTransaction:t.waitTimeSecondsLimitPerTransaction||0,pricePerToken:t.pricePerToken||0,currency:t.currency||i.AddressZero,merkleRoot:t.merkleRoot||n.hexZeroPad([0],32)}})),t.next=3,this.sendTransaction("setPublicMintConditions",[r]);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.canClaim=function(){var t=k(F.mark((function t(e,r){var a,o,c,p,d,l,f;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=[n.hexZeroPad([0],32)]),t.prev=1,t.next=4,this.getActiveClaimCondition();case 4:return a=t.sent,t.next=7,this.getCallOverrides();case 7:if(t.t0=t.sent,t.t0){t.next=10;break}t.t0={};case 10:return o=t.t0,t.next=13,this.getSignerAddress();case 13:if(c=t.sent,!a.merkleRoot){t.next=18;break}return t.next=17,this.getClaimerProofs(null==a?void 0:a.merkleRoot,c);case 17:r=t.sent;case 18:if(!a.pricePerToken.gt(0)){t.next=30;break}if(a.currency!==i.AddressZero){t.next=23;break}o.value=u.BigNumber.from(a.pricePerToken).mul(e),t.next=30;break;case 23:return p=s.ERC20__factory.connect(a.currency,this.providerOrSigner),d=this.address,t.next=27,p.allowance(c,d);case 27:l=t.sent,f=u.BigNumber.from(a.pricePerToken).mul(u.BigNumber.from(e)),l.lt(f);case 30:return t.next=32,this.contract.callStatic.claim(e,r,o);case 32:return t.abrupt("return",!0);case 35:return t.prev=35,t.t1=t.catch(1),t.abrupt("return",!1);case 38:case"end":return t.stop()}}),t,this,[[1,35]])})));return function(e,r){return t.apply(this,arguments)}}(),r.getClaimerProofs=function(){var t=k(F.mark((function t(e,r){var n,a,s,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=4;break}return t.next=3,this.getSignerAddress();case 3:r=t.sent;case 4:return t.next=6,this.getMetadata();case 6:return n=t.sent.metadata,t.next=10,this.storage.get(null==n?void 0:n.merkle[e]);case 10:if(a=t.sent,s=new m.JsonConvert,i=s.deserializeObject(JSON.parse(a),exports.Snapshot),void 0!==(o=i.claims.find((function(t){var e;return t.address.toLowerCase()===(null==(e=r)?void 0:e.toLowerCase())})))){t.next=16;break}return t.abrupt("return",[]);case 16:return t.abrupt("return",o.proof);case 17:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.claim=function(){var t=k(F.mark((function t(e,r){var a,o,c,p,d,l,f,h,y,x,v,g,b,w,C,T,M,S,A,O=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=[n.hexZeroPad([0],32)]),t.next=3,this.getActiveClaimCondition();case 3:return a=t.sent,t.next=6,this.getMetadata();case 6:return o=t.sent.metadata,t.next=10,this.getSignerAddress();case 10:if(c=t.sent,a.merkleRoot.toString().startsWith(i.AddressZero)){t.next=21;break}return t.next=14,this.storage.get(null==o?void 0:o.merkle[a.merkleRoot.toString()]);case 14:if(p=t.sent,d=new m.JsonConvert,l=d.deserializeObject(JSON.parse(p),exports.Snapshot),void 0!==(f=l.claims.find((function(t){return t.address.toLowerCase()===c.toLowerCase()})))){t.next=20;break}throw new Error("No claim found for this address");case 20:r=f.proof;case 21:return t.next=23,this.getCallOverrides();case 23:if(t.t0=t.sent,t.t0){t.next=26;break}t.t0={};case 26:if(h=t.t0,!a.pricePerToken.gt(0)){t.next=44;break}if(a.currency!==i.AddressZero){t.next=32;break}h.value=u.BigNumber.from(a.pricePerToken).mul(e),t.next=44;break;case 32:return y=s.ERC20__factory.connect(a.currency,this.providerOrSigner),t.next=35,this.getSignerAddress();case 35:return x=t.sent,v=this.address,t.next=39,y.allowance(x,v);case 39:if(g=t.sent,b=u.BigNumber.from(a.pricePerToken).mul(u.BigNumber.from(e)),!g.lt(b)){t.next=44;break}return t.next=44,this.sendContractTransaction(y,"approve",[v,g.add(b)]);case 44:return t.next=46,this.sendTransaction("claim",[e,r],h);case 46:for(C=this.parseEventLogs("Claimed",null==(w=t.sent)?void 0:w.logs),M=(T=C.startTokenId).add(e),S=[],A=T;A.lt(M);A=A.add(1))S.push(u.BigNumber.from(A.toString()));return t.next=54,Promise.all(S.map(function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O.get(e.toString());case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 54:return t.abrupt("return",t.sent);case 55:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.burn=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("burn",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.transferFrom=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("transferFrom",[e,r,n]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.storage.uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setRoyaltyBps=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata();case 2:if(n=[],r=t.sent.metadata){t.next=7;break}throw new Error("No metadata found, this module might be invalid!");case 7:return r.seller_fee_basis_points=e,t.t0=this.storage,t.t1=M({},r),t.t2=this.address,t.next=13,this.getSignerAddress();case 13:return t.t3=t.sent,t.next=16,t.t0.uploadMetadata.call(t.t0,t.t1,t.t2,t.t3);case 16:return a=t.sent,n.push(this.contract.interface.encodeFunctionData("setRoyaltyBps",[e])),n.push(this.contract.interface.encodeFunctionData("setContractURI",[a])),t.next=21,this.sendTransaction("multicall",[n]);case 21:return t.abrupt("return",t.sent);case 22:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setBaseTokenUri=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("setBaseTokenURI",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setMaxTotalSupply=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("setMaxTotalSupply",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getRoyaltyBps=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.royaltyBps();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getRoyaltyRecipientAddress=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata();case 2:if(void 0===(null==(e=(r=t.sent).metadata)?void 0:e.fee_recipient)){t.next=5;break}return t.abrupt("return",r.metadata.fee_recipient);case 5:return t.abrupt("return","");case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.createBatch=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.canCreateBatch();case 2:if(t.sent){t.next=4;break}throw new Error("Batch already created!");case 4:return t.next=6,this.readOnlyContract.nextMintTokenId();case 6:return r=t.sent,t.next=9,this.storage.uploadMetadataBatch(e,this.address,r.toNumber());case 9:return n=[this.contract.interface.encodeFunctionData("setBaseTokenURI",[t.sent.baseUri]),this.contract.interface.encodeFunctionData("lazyMintAmount",[e.length])],t.next=14,this.sendTransaction("multicall",[n]);case 14:return t.abrupt("return",[]);case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.canCreateBatch=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.nextTokenId();case 2:return t.abrupt("return",t.sent.eq(0));case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isTransferRestricted=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.transfersRestricted());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setRestrictedTransfer=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=!1),t.t0=this,t.t1=["admin"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sendTransaction("setRestrictedTransfer",[e]);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Yt);We.moduleType=exports.ModuleType.DROP,We.roles=[Vt.admin,Vt.minter,Vt.transfer];var Ge=function(t){function e(){return t.apply(this,arguments)||this}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.Market__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.transformResultToListing=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=null,t.prev=1,t.next=4,wt(this.providerOrSigner,e.currency,e.pricePerToken);case 4:r=t.sent,t.next=9;break;case 7:t.prev=7,t.t0=t.catch(1);case 9:return n=void 0,t.prev=10,t.next=13,_t(this.providerOrSigner,e.assetContract,e.tokenId.toString(),this.sdk.getStorage());case 13:n=t.sent,t.next=18;break;case 16:t.prev=16,t.t1=t.catch(10);case 18:return t.abrupt("return",{id:e.listingId.toString(),seller:e.seller,tokenId:e.tokenId.toString(),tokenContract:e.assetContract,tokenMetadata:n,quantity:e.quantity,price:e.pricePerToken,currencyContract:e.currency,tokensPerBuyer:e.tokensPerBuyer,currencyMetadata:r,saleStart:e.saleStart.gt(0)?new Date(1e3*e.saleStart.toNumber()):null,saleEnd:e.saleEnd.gt(0)&&e.saleEnd.lte(Number.MAX_SAFE_INTEGER-1)?new Date(1e3*e.saleEnd.toNumber()):null});case 19:case"end":return t.stop()}}),t,this,[[1,7],[10,16]])})));return function(e){return t.apply(this,arguments)}}(),r.getListing=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.get(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllListings=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAll(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.get=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.listings(e);case 2:return r=t.sent,t.next=5,this.transformResultToListing(r);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAll=function(){var t=k(F.mark((function t(e){var r,n=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=[],e){t.next=9;break}return t.t0=r,t.next=5,this.readOnlyContract.getAllListings();case 5:t.t1=t.sent,r=t.t0.concat.call(t.t0,t.t1),t.next=38;break;case 9:if(!e.tokenContract||!e.tokenId){t.next=17;break}return t.t2=r,t.next=13,this.readOnlyContract.getListingsByAsset(e.tokenContract,e.tokenId);case 13:t.t3=t.sent,r=t.t2.concat.call(t.t2,t.t3),t.next=38;break;case 17:if(!e.seller){t.next=25;break}return t.t4=r,t.next=21,this.readOnlyContract.getListingsBySeller(e.seller);case 21:t.t5=t.sent,r=t.t4.concat.call(t.t4,t.t5),t.next=38;break;case 25:if(!e.tokenContract){t.next=33;break}return t.t6=r,t.next=29,this.readOnlyContract.getListingsByAssetContract(e.tokenContract);case 29:t.t7=t.sent,r=t.t6.concat.call(t.t6,t.t7),t.next=38;break;case 33:return t.t8=r,t.next=36,this.readOnlyContract.getAllListings();case 36:t.t9=t.sent,r=t.t8.concat.call(t.t8,t.t9);case 38:return r=r.filter((function(t){if(t.quantity.eq(0))return!1;if(e){var r=(null==e?void 0:e.seller)||"",n=(null==e?void 0:e.tokenContract)||"",a=(null==e?void 0:e.tokenId)||"";if(r&&r.toLowerCase()!==t.seller.toLowerCase())return!1;if(n&&n.toLowerCase()!==t.assetContract.toLowerCase())return!1;if(a&&a.toLowerCase()!==t.tokenId.toString().toLowerCase())return!1}return!0})).map((function(t){return n.transformResultToListing(t)})),t.next=41,Promise.all(r);case 41:return t.abrupt("return",t.sent);case 42:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getMarketFeeBps=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.marketFeeBps();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.list=function(){var t=k(F.mark((function t(e,r,n,a,i,o,u,c){var p,d,l,f,h,m,y,x;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===o&&(o=0),void 0===u&&(u=0),void 0===c&&(c=0),t.prev=3,t.next=6,this.getSignerAddress();case 6:return p=t.sent,d=s.ERC165__factory.connect(e,this.providerOrSigner),i>0||Zt(!1),t.next=11,d.supportsInterface(ot);case 11:if(!t.sent){t.next=28;break}return l=s.ERC721__factory.connect(e,this.providerOrSigner),t.next=16,l.isApprovedForAll(p,this.address);case 16:if(t.sent){t.next=26;break}return t.next=20,l.getApproved(r);case 20:if(t.t0=t.sent.toLowerCase(),t.t1=this.address.toLowerCase(),t.t0===t.t1){t.next=26;break}return t.next=26,this.sendContractTransaction(l,"setApprovalForAll",[this.address,!0]);case 26:t.next=35;break;case 28:return f=s.ERC1155__factory.connect(e,this.providerOrSigner),t.next=31,f.isApprovedForAll(p,this.address);case 31:if(t.sent){t.next=35;break}return t.next=35,this.sendContractTransaction(f,"setApprovalForAll",[this.address,!0]);case 35:return t.next=37,this.sendTransaction("list",[e,r,n,a,i,o,u,c]);case 37:return m=this.parseEventLogs("NewListing",null==(h=t.sent)?void 0:h.logs),y=null==m?void 0:m.listing,t.next=42,this.transformResultToListing(y);case 42:return t.abrupt("return",t.sent);case 45:return t.prev=45,t.t2=t.catch(3),t.next=49,this.getSignerAddress();case 49:return x=t.sent,t.next=52,this.sdk.getNFTModule(e).ownerOf(r);case 52:if(t.t3=t.sent,t.t4=x,t.t3===t.t4){t.next=58;break}throw new W;case 58:return t.next=60,this.readOnlyContract.restrictedListerRoleOnly();case 60:if(t.t6=t.sent,!t.t6){t.next=67;break}return t.t7=x,t.next=65,this.getRoleMembers("lister");case 65:t.t8=t.sent,t.t6=!(t.t7 in t.t8);case 67:if(t.t5=t.t6,!t.t5){t.next=74;break}return t.t9=x,t.next=72,this.getRoleMembers("admin");case 72:t.t10=t.sent,t.t5=!(t.t9 in t.t10);case 74:if(!t.t5){t.next=76;break}throw new D(x,"lister");case 76:throw t.t2;case 77:case"end":return t.stop()}}),t,this,[[3,45]])})));return function(e,r,n,a,s,i,o,u){return t.apply(this,arguments)}}(),r.unlistAll=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.get(e);case 2:return r=t.sent.quantity,t.next=5,this.unlist(e,r);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.unlist=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("unlist",[e,r]);case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setRestrictedListerRoleOnly=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("setRestrictedListerRoleOnly",[e]);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.buy=function(){var t=k(F.mark((function t(e,r){var n,a,o,c,p,d,l,f,h;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.get(e);case 3:return n=t.sent,t.next=6,this.getSignerAddress();case 6:if(a=t.sent,o=this.address,c=n.price.mul(u.BigNumber.from(r)),!n.currencyContract||n.currencyContract===i.AddressZero){t.next=17;break}return p=s.ERC20__factory.connect(n.currencyContract,this.providerOrSigner),t.next=13,p.allowance(a,o);case 13:if(!(d=t.sent).lt(c)){t.next=17;break}return t.next=17,this.sendContractTransaction(p,"approve",[o,d.add(c)]);case 17:return t.next=19,this.sendTransaction("buy",[e,r]);case 19:return f=this.parseEventLogs("NewSale",null==(l=t.sent)?void 0:l.logs),t.next=23,this.transformResultToListing(null==f?void 0:f.listing);case 23:return t.abrupt("return",t.sent);case 26:return t.prev=26,t.t0=t.catch(0),t.next=30,this.get(e);case 30:if(h=t.sent.tokensPerBuyer.toNumber(),!(r>h)){t.next=33;break}throw new G(h.toString());case 33:throw t.t0;case 34:case"end":return t.stop()}}),t,this,[[0,26]])})));return function(e,r){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setMarketFeeBps=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("setMarketFeeBps",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Yt);Ge.moduleType=exports.ModuleType.MARKET,Ge.roles=[Vt.admin,Vt.lister,Vt.pauser];var Ze=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this)._shouldCheckVersion=!0,e._isNewBuy=!1,e}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.Marketplace__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.createDirectListing=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.validateNewListingParam(e),t.t0=this,t.t1=e.assetContractAddress,t.t2=e.tokenId,t.next=6,this.getSignerAddress();case 6:return t.t3=t.sent,t.next=9,t.t0.handleTokenApproval.call(t.t0,t.t1,t.t2,t.t3);case 9:return t.next=11,this.sendTransaction("createListing",[{assetContract:e.assetContractAddress,tokenId:e.tokenId,buyoutPricePerToken:e.buyoutPricePerToken,currencyToAccept:e.currencyContractAddress,listingType:exports.ListingType.Direct,quantityToList:e.quantity,reservePricePerToken:e.buyoutPricePerToken,secondsUntilEndTime:e.listingDurationInSeconds,startTime:e.startTimeInSeconds}]);case 11:return n=this.parseEventLogs("NewListing",null==(r=t.sent)?void 0:r.logs),t.abrupt("return",n.listingId);case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.createAuctionListing=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.validateNewListingParam(e),t.t0=this,t.t1=e.assetContractAddress,t.t2=e.tokenId,t.next=6,this.getSignerAddress();case 6:return t.t3=t.sent,t.next=9,t.t0.handleTokenApproval.call(t.t0,t.t1,t.t2,t.t3);case 9:return t.next=11,this.sendTransaction("createListing",[{assetContract:e.assetContractAddress,tokenId:e.tokenId,buyoutPricePerToken:e.buyoutPricePerToken,currencyToAccept:e.currencyContractAddress,listingType:exports.ListingType.Auction,quantityToList:e.quantity,reservePricePerToken:e.reservePricePerToken,secondsUntilEndTime:e.listingDurationInSeconds,startTime:e.startTimeInSeconds}]);case 11:return n=this.parseEventLogs("NewListing",null==(r=t.sent)?void 0:r.logs),t.abrupt("return",n.listingId);case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.makeDirectListingOffer=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!Ct(e.currencyContractAddress)){t.next=2;break}throw new Error("You must use the wrapped native token address when making an offer with a native token");case 2:return t.prev=2,t.next=5,this.getDirectListing(e.listingId);case 5:t.next=11;break;case 7:throw t.prev=7,t.t0=t.catch(2),console.error("Failed to get listing, err =",t.t0),new Error("Error getting the listing with id "+e.listingId);case 11:return r=u.BigNumber.from(e.quantityDesired),n=u.BigNumber.from(e.pricePerToken).mul(r),t.next=15,this.getCallOverrides();case 15:if(t.t1=t.sent,t.t1){t.next=18;break}t.t1={};case 18:return a=t.t1,t.next=21,this.setAllowance(n,e.currencyContractAddress,a);case 21:return t.next=23,this.sendTransaction("offer",[e.listingId,e.quantityDesired,e.currencyContractAddress,e.pricePerToken],a);case 23:case"end":return t.stop()}}),t,this,[[2,7]])})));return function(e){return t.apply(this,arguments)}}(),r.setAllowance=function(){var t=k(F.mark((function t(e,r,n){var a,i,o,u;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!Ct(r)){t.next=4;break}n.value=e,t.next=15;break;case 4:return a=s.ERC20__factory.connect(r,this.providerOrSigner),t.next=7,this.getSignerAddress();case 7:return i=t.sent,o=this.address,t.next=11,a.allowance(i,o);case 11:if(!(u=t.sent).lt(e)){t.next=15;break}return t.next=15,this.sendContractTransaction(a,"increaseAllowance",[o,e.sub(u)]);case 15:return t.abrupt("return",n);case 16:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.makeAuctionListingBid=function(){var t=k(F.mark((function t(e){var r,n,a,s,i,o,c,p;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.validateAuctionListing(u.BigNumber.from(e.listingId));case 2:return r=t.sent,t.next=5,this.getBidBufferBps();case 5:return n=t.sent,t.next=8,this.getWinningBid(e.listingId);case 8:if(!(a=t.sent)){t.next=16;break}return t.next=12,this.isWinningBid(a.pricePerToken,e.pricePerToken,n);case 12:t.sent||Zt(!1),t.next=19;break;case 16:s=u.BigNumber.from(e.pricePerToken),i=u.BigNumber.from(r.reservePrice),s.gte(i)||Zt(!1);case 19:return o=u.BigNumber.from(r.quantity),c=u.BigNumber.from(e.pricePerToken).mul(o),t.next=23,this.getCallOverrides();case 23:if(t.t0=t.sent,t.t0){t.next=26;break}t.t0={};case 26:return p=t.t0,t.next=29,this.setAllowance(c,r.currencyContractAddress,p);case 29:return t.next=31,this.sendTransaction("offer",[e.listingId,r.quantity,r.currencyContractAddress,e.pricePerToken],p);case 31:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.isWinningBid=function(){var t=k(F.mark((function t(e,r,n){var a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=u.BigNumber.from(n),e=u.BigNumber.from(e),r=u.BigNumber.from(r),a=r.sub(e).mul(1e4).div(e),t.abrupt("return",a.gte(n));case 5:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.getAuctionWinner=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.queryFilter(this.contract.filters.AuctionClosed());case 2:if(r=t.sent.find((function(t){return t.args.listingId.eq(u.BigNumber.from(e))}))){t.next=6;break}throw new Error("Could not find auction with listingId "+e+" in closed auctions");case 6:return t.abrupt("return",r.args.winningBidder);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getDirectListing=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.listings(e);case 2:if((r=t.sent).listingId.toString()===e.toString()){t.next=5;break}throw new Q(this.address,e.toString());case 5:if(r.listingType===exports.ListingType.Direct){t.next=7;break}throw new Y(this.address,e.toString(),"Auction","Direct");case 7:return t.next=9,this.mapDirectListing(r);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAuctionListing=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.listings(e);case 2:if((r=t.sent).listingId.toString()===e.toString()){t.next=5;break}throw new Q(this.address,e.toString());case 5:if(r.listingType===exports.ListingType.Auction){t.next=7;break}throw new Y(this.address,e.toString(),"Direct","Auction");case 7:return t.next=9,this.mapAuctionListing(r);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.mapDirectListing=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=e.assetContract,t.t1=e.buyoutPricePerToken,t.t2=e.currency,t.next=5,wt(this.providerOrSigner,e.currency,e.buyoutPricePerToken);case 5:return t.t3=t.sent,t.t4=e.listingId.toString(),t.t5=e.tokenId,t.t6=e.quantity,t.t7=e.startTime,t.next=12,Ft(e.assetContract,this.providerOrSigner,e.tokenId.toString(),this.sdk.getStorage());case 12:return t.t8=t.sent,t.t9=e.endTime,t.t10=e.tokenOwner,t.t11=exports.ListingType.Direct,t.abrupt("return",{assetContractAddress:t.t0,buyoutPrice:t.t1,currencyContractAddress:t.t2,buyoutCurrencyValuePerToken:t.t3,id:t.t4,tokenId:t.t5,quantity:t.t6,startTimeInSeconds:t.t7,asset:t.t8,secondsUntilEnd:t.t9,sellerAddress:t.t10,type:t.t11});case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.mapAuctionListing=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=e.assetContract,t.t1=e.buyoutPricePerToken,t.t2=e.currency,t.next=5,wt(this.providerOrSigner,e.currency,e.buyoutPricePerToken);case 5:return t.t3=t.sent,t.t4=e.listingId.toString(),t.t5=e.tokenId,t.t6=e.quantity,t.t7=e.startTime,t.next=12,Ft(e.assetContract,this.providerOrSigner,e.tokenId.toString(),this.sdk.getStorage());case 12:return t.t8=t.sent,t.next=15,wt(this.providerOrSigner,e.currency,e.reservePricePerToken);case 15:return t.t9=t.sent,t.t10=e.reservePricePerToken,t.t11=e.endTime,t.t12=e.tokenOwner,t.t13=exports.ListingType.Auction,t.abrupt("return",{assetContractAddress:t.t0,buyoutPrice:t.t1,currencyContractAddress:t.t2,buyoutCurrencyValuePerToken:t.t3,id:t.t4,tokenId:t.t5,quantity:t.t6,startTimeInEpochSeconds:t.t7,asset:t.t8,reservePriceCurrencyValuePerToken:t.t9,reservePrice:t.t10,endTimeInEpochSeconds:t.t11,sellerAddress:t.t12,type:t.t13});case 21:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.handleTokenApproval=function(){var t=k(F.mark((function t(e,r,n){var a,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=s.ERC165__factory.connect(e,this.providerOrSigner),t.next=3,a.supportsInterface(ot);case 3:if(!t.sent){t.next=20;break}return i=s.ERC721__factory.connect(e,this.providerOrSigner),t.next=8,i.isApprovedForAll(n,this.address);case 8:if(t.sent){t.next=18;break}return t.next=12,i.getApproved(r);case 12:if(t.t0=t.sent.toLowerCase(),t.t1=this.address.toLowerCase(),t.t0===t.t1){t.next=18;break}return t.next=18,this.sendContractTransaction(i,"setApprovalForAll",[this.address,!0]);case 18:t.next=27;break;case 20:return o=s.ERC1155__factory.connect(e,this.providerOrSigner),t.next=23,o.isApprovedForAll(n,this.address);case 23:if(t.sent){t.next=27;break}return t.next=27,this.sendContractTransaction(o,"setApprovalForAll",[this.address,!0]);case 27:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.isTokenApprovedForMarketplace=function(){var t=k(F.mark((function t(e,r,n){var a,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,a=s.ERC165__factory.connect(e,this.providerOrSigner),t.next=4,a.supportsInterface(ot);case 4:if(!t.sent){t.next=19;break}return i=s.ERC721__factory.connect(e,this.providerOrSigner),t.next=9,i.isApprovedForAll(n,this.address);case 9:if(!t.sent){t.next=12;break}return t.abrupt("return",!0);case 12:return t.next=14,i.getApproved(r);case 14:return t.t0=t.sent.toLowerCase(),t.t1=this.address.toLowerCase(),t.abrupt("return",t.t0===t.t1);case 19:return o=s.ERC1155__factory.connect(e,this.providerOrSigner),t.next=22,o.isApprovedForAll(n,this.address);case 22:return t.abrupt("return",t.sent);case 23:t.next=29;break;case 25:return t.prev=25,t.t2=t.catch(0),console.error("Failed to check if token is approved",t.t2),t.abrupt("return",!1);case 29:case"end":return t.stop()}}),t,this,[[0,25]])})));return function(e,r,n){return t.apply(this,arguments)}}(),r.isStillValidDirectListing=function(){var t=k(F.mark((function t(e,r){var n,a,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isTokenApprovedForMarketplace(e.assetContractAddress,e.tokenId,e.sellerAddress);case 2:if(t.sent){t.next=5;break}return t.abrupt("return",!1);case 5:return n=s.ERC165__factory.connect(e.assetContractAddress,this.providerOrSigner),t.next=8,n.supportsInterface(ot);case 8:if(!t.sent){t.next=17;break}return a=s.ERC721__factory.connect(e.assetContractAddress,this.providerOrSigner),t.next=13,a.ownerOf(e.tokenId).catch((function(){return i.AddressZero}));case 13:return t.abrupt("return",t.sent.toLowerCase()===e.sellerAddress.toLowerCase());case 17:return o=s.ERC1155__factory.connect(e.assetContractAddress,this.providerOrSigner),t.next=20,o.balanceOf(e.sellerAddress,e.tokenId);case 20:return t.abrupt("return",t.sent.gte(r||e.quantity));case 22:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.validateNewListingParam=function(t){switch(null==t.assetContractAddress&&Zt(!1),null==t.buyoutPricePerToken&&Zt(!1),null==t.listingDurationInSeconds&&Zt(!1),null==t.startTimeInSeconds&&Zt(!1),null==t.tokenId&&Zt(!1),null==t.quantity&&Zt(!1),t.type){case"NewAuctionListing":null==t.reservePricePerToken&&Zt(!1)}},r.validateDirectListing=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getDirectListing(e);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),console.error("Error getting the listing with id "+e),t.t0;case 10:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.validateAuctionListing=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getAuctionListing(e);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),console.error("Error getting the listing with id "+e),t.t0;case 10:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.mapOffer=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=r.quantityDesired,t.t1=r.pricePerToken,t.t2=r.currency,t.t3=r.offeror,t.t4=r.quantityWanted,t.next=7,wt(this.providerOrSigner,r.currency,r.quantityWanted.mul(r.pricePerToken));case 7:return t.t5=t.sent,t.t6=e,t.abrupt("return",{quantity:t.t0,pricePerToken:t.t1,currencyContractAddress:t.t2,buyerAddress:t.t3,quantityDesired:t.t4,currencyValue:t.t5,listingId:t.t6});case 10:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getActiveOffer=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.validateDirectListing(u.BigNumber.from(e)),d.isAddress(r)||Zt(!1),t.next=4,this.readOnlyContract.offers(e,r);case 4:if((n=t.sent).offeror!==i.AddressZero){t.next=7;break}return t.abrupt("return",void 0);case 7:return t.next=9,this.mapOffer(u.BigNumber.from(e),n);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getWinningBid=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.validateAuctionListing(u.BigNumber.from(e)),t.next=3,this.readOnlyContract.winningBid(e);case 3:if((r=t.sent).offeror!==i.AddressZero){t.next=6;break}return t.abrupt("return",void 0);case 6:return t.next=8,this.mapOffer(u.BigNumber.from(e),r);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getBidBufferBps=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.bidBufferBps());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getTimeBufferInSeconds=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.timeBuffer();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.acceptDirectListingOffer=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.validateDirectListing(u.BigNumber.from(e)),t.next=3,this.sendTransaction("acceptOffer",[e,r]);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.buyoutAuctionListing=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.validateAuctionListing(u.BigNumber.from(e));case 2:return r=t.sent,t.next=5,this.makeAuctionListingBid({listingId:e,pricePerToken:r.buyoutPrice});case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.buyoutDirectListing=function(){var t=k(F.mark((function t(e){var r,n,a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.validateDirectListing(u.BigNumber.from(e.listingId));case 2:return r=t.sent,t.next=5,this.isStillValidDirectListing(r,e.quantityDesired);case 5:if(t.sent){t.next=8;break}throw new Error("The asset on this listing has been moved from the listers wallet, this listing is now invalid");case 8:return n=u.BigNumber.from(e.quantityDesired),a=u.BigNumber.from(r.buyoutPrice).mul(n),t.next=12,this.getCallOverrides();case 12:if(t.t0=t.sent,t.t0){t.next=15;break}t.t0={};case 15:return s=t.t0,t.next=18,this.setAllowance(a,r.currencyContractAddress,s);case 18:return t.next=20,this.isNewBuy();case 20:if(!t.sent){t.next=25;break}return t.next=23,this.sendTransaction("buy",[e.listingId,n,r.currencyContractAddress,a],s);case 23:t.next=27;break;case 25:return t.next=27,this.sendContractTransaction(new u.ethers.Contract(this.address,[{inputs:[{internalType:"uint256",name:"_listingId",type:"uint256"},{internalType:"uint256",name:"_quantityToBuy",type:"uint256"}],name:"buy",outputs:[],stateMutability:"payable",type:"function"}],this.providerOrSigner),"buy",[e.listingId,n],s);case 27:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.updateDirectListing=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("updateListing",[e.id,e.quantity,e.buyoutPrice,e.buyoutPrice,e.currencyContractAddress,e.startTimeInSeconds,e.secondsUntilEnd]);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.updateAuctionListing=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("updateListing",[e.id,e.quantity,e.reservePrice,e.buyoutPrice,e.currencyContractAddress,e.startTimeInEpochSeconds,e.endTimeInEpochSeconds]);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.cancelDirectListing=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.validateDirectListing(u.BigNumber.from(e));case 2:return(r=t.sent).quantity=0,t.next=6,this.updateDirectListing(r);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.cancelAuctionListing=function(){var t=k(F.mark((function t(e){var r,n,a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.validateAuctionListing(u.BigNumber.from(e));case 2:return r=t.sent,n=u.BigNumber.from(Math.floor(Date.now()/1e3)),a=u.BigNumber.from(r.startTimeInEpochSeconds),t.next=7,this.readOnlyContract.winningBid(e);case 7:if(s=t.sent,!n.gt(a)||s.offeror===i.AddressZero){t.next=10;break}throw new H(e.toString());case 10:return t.t0=this,t.t1=u.BigNumber.from(e),t.next=14,this.getSignerAddress();case 14:return t.t2=t.sent,t.t3=[t.t1,t.t2],t.next=18,t.t0.sendTransaction.call(t.t0,"closeAuction",t.t3);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.closeAuctionListing=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=4;break}return t.next=3,this.getSignerAddress();case 3:r=t.sent;case 4:return t.next=6,this.validateAuctionListing(u.BigNumber.from(e));case 6:return n=t.sent,t.prev=7,t.next=10,this.sendTransaction("closeAuction",[u.BigNumber.from(e),r]);case 10:t.next=19;break;case 12:if(t.prev=12,t.t0=t.catch(7),!t.t0.message.includes("cannot close auction before it has ended")){t.next=18;break}throw new tt(e.toString(),n.endTimeInEpochSeconds.toString());case 18:throw t.t0;case 19:case"end":return t.stop()}}),t,this,[[7,12]])})));return function(e,r){return t.apply(this,arguments)}}(),r.setBidBufferBps=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.t1=["admin"],t.next=4,this.getSignerAddress();case 4:return t.t2=t.sent,t.next=7,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 7:return t.next=9,this.getTimeBufferInSeconds();case 9:return r=t.sent,t.next=12,this.sendTransaction("setAuctionBuffers",[r,u.BigNumber.from(e)]);case 12:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setTimeBufferInSeconds=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.t1=["admin"],t.next=4,this.getSignerAddress();case 4:return t.t2=t.sent,t.next=7,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 7:return t.next=9,this.getBidBufferBps();case 9:return r=t.sent,t.next=12,this.sendTransaction("setAuctionBuffers",[u.BigNumber.from(e),r]);case 12:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.buyoutListing=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.listings(e);case 2:if((n=t.sent).listingId.toString()===e.toString()){t.next=5;break}throw new Q(this.address,e.toString());case 5:t.t0=n.listingType,t.next=t.t0===exports.ListingType.Direct?8:t.t0===exports.ListingType.Auction?12:15;break;case 8:return void 0===r&&Zt(!1),t.next=11,this.buyoutDirectListing({listingId:e,quantityDesired:r});case 11:return t.abrupt("return",t.sent);case 12:return t.next=14,this.buyoutAuctionListing(e);case 14:return t.abrupt("return",t.sent);case 15:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getListing=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.listings(e);case 2:if((r=t.sent).listingId.toString()===e.toString()){t.next=5;break}throw new Q(this.address,e.toString());case 5:t.t0=r.listingType,t.next=t.t0===exports.ListingType.Auction?8:t.t0===exports.ListingType.Direct?11:14;break;case 8:return t.next=10,this.mapAuctionListing(r);case 10:return t.abrupt("return",t.sent);case 11:return t.next=13,this.mapDirectListing(r);case 13:return t.abrupt("return",t.sent);case 14:throw new Error("Unknown listing type: "+r.listingType);case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllListings=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAllListingsNoFilter();case 2:return r=t.sent,e&&(e.seller&&(r=r.filter((function(t){var r;return t.sellerAddress.toString().toLowerCase()===(null==e||null==(r=e.seller)?void 0:r.toString().toLowerCase())}))),e.tokenContract&&(r=r.filter(e.tokenId?function(t){var r,n;return t.assetContractAddress.toString().toLowerCase()===(null==e||null==(r=e.tokenContract)?void 0:r.toString().toLowerCase())&&t.tokenId.toString()===(null==e||null==(n=e.tokenId)?void 0:n.toString())}:function(t){var r;return t.assetContractAddress.toString().toLowerCase()===(null==e||null==(r=e.tokenContract)?void 0:r.toString().toLowerCase())})),void 0!==e.start&&(n=e.start,r=r.filter((function(t,e){return e>=n})),void 0!==e.count&&r.length>e.count&&(r=r.slice(0,e.count)))),t.abrupt("return",r.filter((function(t){return void 0!==t})));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllListingsNoFilter=function(){var t=k(F.mark((function t(){var e=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Promise,t.t1=Array,t.t2=Array,t.next=5,this.readOnlyContract.totalListings();case 5:return t.t3=t.sent.toNumber(),t.t4=(0,t.t2)(t.t3).keys(),t.t5=t.t1.from.call(t.t1,t.t4).map(function(){var t=k(F.mark((function t(r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.getListing(r);case 3:n=t.sent,t.next=9;break;case 6:return t.prev=6,t.t0=t.catch(0),t.abrupt("return",void 0);case 9:if(n.type!==exports.ListingType.Auction){t.next=11;break}return t.abrupt("return",n);case 11:return t.next=13,e.isStillValidDirectListing(n);case 13:if(t.sent){t.next=16;break}return t.abrupt("return",void 0);case 16:return t.abrupt("return",n);case 17:case"end":return t.stop()}}),t,null,[[0,6]])})));return function(e){return t.apply(this,arguments)}}()),t.next=10,t.t0.all.call(t.t0,t.t5);case 10:return t.abrupt("return",t.sent.filter((function(t){return void 0!==t})));case 12:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isRestrictedListerRoleOnly=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.restrictedListerRoleOnly());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setRestrictedListerRoleOnly=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("setRestrictedListerRoleOnly",[e]);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.allowListingFromSpecificAssetOnly=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV2();case 2:if(t.sent){t.next=4;break}throw Error("Not supported in this version of the contract, please upgrade");case 4:return r=[],t.next=7,this.getRoleMembers(Vt.asset);case 7:return i.AddressZero in t.sent&&r.push(this.contract.interface.encodeFunctionData("revokeRole",[qt(Vt.asset),i.AddressZero])),r.push(this.contract.interface.encodeFunctionData("grantRole",[qt(Vt.asset),e])),t.next=12,this.sendTransaction("multicall",[r]);case 12:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.allowListingFromAnyAsset=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV2();case 2:if(t.sent){t.next=4;break}throw Error("Not supported in this version of the contract, please upgrade");case 4:return e=[],t.next=7,this.getRoleMembers(Vt.asset);case 7:for(r in t.sent)e.push(this.contract.interface.encodeFunctionData("revokeRole",[qt(Vt.asset),r]));return e.push(this.contract.interface.encodeFunctionData("grantRole",[qt(Vt.asset),i.AddressZero])),t.next=12,this.sendTransaction("multicall",[e]);case 12:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isV2=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.VERSION();case 2:return t.abrupt("return",2===t.sent.toNumber());case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isNewBuy=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkVersion();case 2:return t.abrupt("return",this._isNewBuy);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.checkVersion=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._shouldCheckVersion){t.next=11;break}return t.prev=1,t.next=4,this.readOnlyContract.VERSION();case 4:this._isNewBuy=!0,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),this._isNewBuy=!1;case 10:this._shouldCheckVersion=!1;case 11:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(){return t.apply(this,arguments)}}(),e}(Yt);Ze.moduleType=exports.ModuleType.MARKETPLACE,Ze.roles=[Vt.admin,Vt.lister,Vt.asset];var ze,He=[{name:"to",type:"address"},{name:"uri",type:"string"},{name:"price",type:"uint256"},{name:"currency",type:"address"},{name:"validityStartTimestamp",type:"uint128"},{name:"validityEndTimestamp",type:"uint128"},{name:"uid",type:"bytes32"}],Ke=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))||this)._shouldCheckVersion=!0,e._isV1=!1,e.v1Contract=void 0,e}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.SignatureMint721__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.isV1=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._shouldCheckVersion){t.next=12;break}return t.prev=1,t.next=4,this.readOnlyContract.nextTokenIdToMint();case 4:this._isV1=!1,t.next=11;break;case 7:t.prev=7,t.t0=t.catch(1),this._isV1=!0,this.v1Contract=s.NFT__factory.connect(this.address,this.providerOrSigner);case 11:this._shouldCheckVersion=!1;case 12:return t.abrupt("return",this._isV1);case 13:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(){return t.apply(this,arguments)}}(),r.get=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.sdk.getStorage(),t.next=3,this.readOnlyContract.tokenURI(e);case 3:return n=t.sent,t.t0=JSON,t.next=7,r.get(n);case 7:return t.t1=t.sent,a=t.t0.parse.call(t.t0,t.t1),t.abrupt("return",M({},a,{id:e,uri:n,image:r.resolveFullUrl(a.image)}));case 10:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAll=function(){var t=k(F.mark((function t(){var e,r,n,a=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV1();case 2:if(!t.sent){t.next=14;break}return t.next=5,null==(n=this.v1Contract)?void 0:n.nextTokenId();case 5:if(t.t0=r=t.sent,null!=t.t0){t.next=10;break}t.t1=void 0,t.next=11;break;case 10:t.t1=r.toNumber();case 11:e=t.t1,t.next=17;break;case 14:return t.next=16,this.readOnlyContract.nextTokenIdToMint();case 16:e=t.sent.toNumber();case 17:return t.next=19,Promise.all(Array.from(Array(e).keys()).map((function(t){return a.get(t.toString())})));case 19:return t.abrupt("return",t.sent);case 20:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getWithOwner=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([this.ownerOf(e),this.get(e)]);case 2:return t.abrupt("return",{owner:(r=t.sent)[0],metadata:r[1]});case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAllWithOwner=function(){var t=k(F.mark((function t(){var e,r,n,a=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV1();case 2:if(!t.sent){t.next=14;break}return t.next=5,null==(n=this.v1Contract)?void 0:n.nextTokenId();case 5:if(t.t0=r=t.sent,null!=t.t0){t.next=10;break}t.t1=void 0,t.next=11;break;case 10:t.t1=r.toNumber();case 11:e=t.t1,t.next=17;break;case 14:return t.next=16,this.readOnlyContract.nextTokenIdToMint();case 16:e=t.sent.toNumber();case 17:return t.next=19,Promise.all(Array.from(Array(e).keys()).map((function(t){return a.getWithOwner(t.toString())})));case 19:return t.abrupt("return",t.sent);case 20:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.ownerOf=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.readOnlyContract.ownerOf(e);case 3:return t.abrupt("return",t.sent);case 6:return t.prev=6,t.t0=t.catch(0),t.abrupt("return",i.AddressZero);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getOwned=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}t.t0=e,t.next=7;break;case 4:return t.next=6,this.getSignerAddress();case 6:t.t0=t.sent;case 7:return r=t.t0,t.next=10,this.readOnlyContract.balanceOf(r);case 10:return n=Array.from(Array(t.sent.toNumber()).keys()),t.next=14,Promise.all(n.map((function(t){return s.readOnlyContract.tokenOfOwnerByIndex(r,t)})));case 14:return a=t.sent,t.next=17,Promise.all(a.map((function(t){return s.get(t.toString())})));case 17:return t.abrupt("return",t.sent);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.totalSupply=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.totalSupply();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.balanceOf=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.balanceOf(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.next=6,t.t0.balanceOf.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isApproved=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.isApprovedForAll(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setApproval=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=!0),t.next=3,this.sendTransaction("setApprovalForAll",[e,r]);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transfer=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isTransferRestricted();case 2:if(!t.sent){t.next=4;break}throw new X(this.address);case 4:return t.next=6,this.getSignerAddress();case 6:return n=t.sent,t.next=9,this.sendTransaction("safeTransferFrom(address,address,uint256)",[n,e,r]);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.mint=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.mintTo.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r._v1MintTo=function(){var t=k(F.mark((function t(e,r){var n,a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===this.v1Contract&&Zt(!1),t.next=3,this.sdk.getStorage().uploadMetadata(r);case 3:return n=t.sent,t.next=6,this.sendContractTransaction(this.v1Contract,"mintNFT",[e,n]);case 6:if(0!==(s=this.parseLogs("Minted",null==(a=t.sent)?void 0:a.logs,this.v1Contract)).length){t.next=10;break}throw new Error("No Minted event found, failed to mint");case 10:return t.next=12,this.get(s[0].args.tokenId.toString());case 12:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.mintTo=function(){var t=k(F.mark((function t(e,r){var n,a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV1();case 2:if(!t.sent){t.next=6;break}return t.next=5,this._v1MintTo(e,r);case 5:return t.abrupt("return",t.sent);case 6:return t.next=8,this.sdk.getStorage().uploadMetadata(r);case 8:return n=t.sent,t.next=11,this.sendTransaction("mintTo",[e,n]);case 11:if(0!==(s=this.parseLogs("TokenMinted",null==(a=t.sent)?void 0:a.logs)).length){t.next=15;break}throw new Error("TokenMinted event not found");case 15:return i=s[0].args.tokenIdMinted,t.next=18,this.get(i.toString());case 18:return t.abrupt("return",t.sent);case 19:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.mintBatch=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.mintBatchTo.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r._v1MintBatchTo=function(){var t=k(F.mark((function t(e,r){var n,a,s,i,o=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===this.v1Contract&&Zt(!1),t.next=3,this.sdk.getStorage().uploadMetadataBatch(r);case 3:return n=t.sent.metadataUris,t.next=7,this.sendContractTransaction(this.v1Contract,"mintNFTBatch",[e,n]);case 7:if(0!==(s=this.parseLogs("MintedBatch",null==(a=t.sent)?void 0:a.logs,this.v1Contract)).length){t.next=11;break}throw new Error("No MintedBatch event found, failed to mint");case 11:return i=s[0].args.tokenIds,t.next=14,Promise.all(i.map((function(t){return o.get(t.toString())})));case 14:return t.abrupt("return",t.sent);case 15:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.mintBatchTo=function(){var t=k(F.mark((function t(e,r){var n,a,s,i=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.isV1();case 2:if(!t.sent){t.next=6;break}return t.next=5,this._v1MintBatchTo(e,r);case 5:return t.abrupt("return",t.sent);case 6:return t.next=8,this.sdk.getStorage().uploadMetadataBatch(r);case 8:return n=t.sent.metadataUris.map((function(t){return i.contract.interface.encodeFunctionData("mintTo",[e,t])})),t.next=13,this.sendTransaction("multicall",[n]);case 13:if(!(0===(a=this.parseLogs("TokenMinted",t.sent.logs)).length||a.length<r.length)){t.next=17;break}throw new Error("TokenMinted event not found, minting failed");case 17:return s=a.map((function(t){return t.args.tokenIdMinted})),t.next=20,Promise.all(s.map((function(t){return i.get(t.toString())})));case 20:return t.abrupt("return",t.sent);case 21:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.burn=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("burn",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.transferFrom=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("transferFrom",[e,r,n]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.setRoyaltyBps=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata(!1);case 2:if(n=[],r=t.sent.metadata){t.next=7;break}throw new Error("No metadata found, this module might be invalid!");case 7:return r.seller_fee_basis_points=e,t.t0=this.sdk.getStorage(),t.t1=M({},r),t.t2=this.address,t.next=13,this.getSignerAddress();case 13:return t.t3=t.sent,t.next=16,t.t0.uploadMetadata.call(t.t0,t.t1,t.t2,t.t3);case 16:return a=t.sent,n.push(this.contract.interface.encodeFunctionData("setRoyaltyBps",[e])),n.push(this.contract.interface.encodeFunctionData("setContractURI",[a])),t.next=21,this.sendTransaction("multicall",[n]);case 21:return t.abrupt("return",t.sent);case 22:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getRoyaltyBps=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.royaltyBps();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getRoyaltyRecipientAddress=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata();case 2:if(void 0===(null==(e=(r=t.sent).metadata)?void 0:e.fee_recipient)){t.next=5;break}return t.abrupt("return",r.metadata.fee_recipient);case 5:return t.abrupt("return","");case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setPrimarySaleRecipient=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("setDefaultSaleRecipient",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getPrimarySaleRecipient=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.defaultSaleRecipient();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getDefaultSaleRecipient=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.defaultSaleRecipient();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setDefaultSaleRecipient=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("setDefaultSaleRecipient",[e]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.isTransferRestricted=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.transfersRestricted());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setRestrictedTransfer=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=!1),t.t0=this,t.t1=["admin"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sendTransaction("setRestrictedTransfer",[e]);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.mintWithSignature=function(){var t=k(F.mark((function t(e,r){var n,a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=M({},this.mapPayload(e),{uri:e.uri}),t.next=3,this.getCallOverrides();case 3:return a=t.sent,t.next=6,this.setAllowance(u.BigNumber.from(n.price),e.currencyAddress,a);case 6:return t.next=8,this.sendTransaction("mintWithSignature",[n,r],a);case 8:return s=t.sent,t.next=11,this.parseLogs("MintWithSignature",s.logs);case 11:if(0!==(i=t.sent).length){t.next=14;break}throw new Error("No MintWithSignature event found");case 14:return t.abrupt("return",i[0].args.tokenIdMinted);case 15:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.verify=function(){var t=k(F.mark((function t(e,r){var n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.mapPayload(e),t.next=3,this.readOnlyContract.verify(M({},n,{uri:e.uri}),r);case 3:return t.abrupt("return",t.sent[0]);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.generateSignatureBatch=function(){var t=k(F.mark((function t(e){var r,n,a,s,i=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=function(t){if(void 0===t.id){var e=Buffer.alloc(16);return l.v4({},e),d.hexlify(d.toUtf8Bytes(e.toString("hex")))}return d.hexlify(t.id)},t.t0=this,t.t1=["minter"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sdk.getStorage().uploadMetadataBatch(e.map((function(t){return t.metadata})));case 10:return n=t.sent.metadataUris,t.next=14,this.getChainID();case 14:return a=t.sent,s=this.getSigner(),t.next=18,Promise.all(e.map(function(){var t=k(F.mark((function t(e,o){var u,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=r(e),t.t0=M({},e,{id:u,uri:c=n[o]}),t.next=5,i.signTypedDataEmitEvent(s,{name:"SignatureMint721",version:"1",chainId:a,verifyingContract:i.address},{MintRequest:He},M({uri:c},i.mapPayload(e),{uid:u}));case 5:return t.t1=t.sent.toString(),t.abrupt("return",{payload:t.t0,signature:t.t1});case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()));case 18:return t.abrupt("return",t.sent);case 19:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.generateSignature=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.generateSignatureBatch([e]);case 2:return t.abrupt("return",t.sent[0]);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.mapPayload=function(t){return{to:t.to,price:t.price,currency:t.currencyAddress,validityEndTimestamp:t.mintEndTimeEpochSeconds,validityStartTimestamp:t.mintStartTimeEpochSeconds,uid:t.id}},r.setAllowance=function(){var t=k(F.mark((function t(e,r,n){var a,o,u,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r!==xt&&r!==i.AddressZero){t.next=4;break}n.value=e,t.next=16;break;case 4:return a=s.ERC20__factory.connect(r,this.providerOrSigner),t.next=7,this.getSignerAddress();case 7:return o=t.sent,u=this.address,t.next=11,a.allowance(o,u);case 11:if(!(c=t.sent).lt(e)){t.next=15;break}return t.next=15,this.sendContractTransaction(a,"increaseAllowance",[u,e.sub(c)]);case 15:return t.abrupt("return",n);case 16:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e}(Yt);Ke.moduleType=exports.ModuleType.NFT,Ke.roles=[Vt.admin,Vt.minter,Vt.transfer],(ze=exports.UnderlyingType||(exports.UnderlyingType={}))[ze.None=0]="None",ze[ze.ERC20=1]="ERC20",ze[ze.ERC721=2]="ERC721";var Qe=function(t){function e(){return t.apply(this,arguments)||this}S(e,t);var r=e.prototype;return r.getModuleRoles=function(){return e.roles},r.connectContract=function(){return s.Pack__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.open=function(){var t=k(F.mark((function t(e){var r,n,a,s,i,o,u,c,p=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("openPack",[e]);case 2:if(0!==(n=this.parseLogs("PackOpenRequest",null==(r=t.sent)?void 0:r.logs)).length){t.next=6;break}throw new Error("Failed to open pack");case 6:return s=(a=n[0]).args.requestId,i=a.args.opener,t.next=11,new Promise((function(t){p.readOnlyContract.once(p.readOnlyContract.filters.PackOpenFulfilled(null,i),(function(e,r,n,a,i){s===n&&t({packId:e,opener:r,requestId:s,rewardContract:a,rewardIds:i})}))}));case 11:return u=(o=t.sent).rewardIds,c=o.rewardContract,t.next=15,Promise.all(u.map((function(t){return _t(p.providerOrSigner,c,t.toString(),p.sdk.getStorage())})));case 15:return t.abrupt("return",t.sent);case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.get=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([_t(this.providerOrSigner,this.address,e,this.sdk.getStorage()),this.readOnlyContract.getPack(e),this.readOnlyContract.totalSupply(e).catch((function(){return u.BigNumber.from("0")}))]);case 2:return a={id:e,metadata:(r=t.sent)[0],creator:(n=r[1]).creator,currentSupply:r[2],openStart:n.openStart.gt(0)?new Date(1e3*n.openStart.toNumber()):null},t.abrupt("return",a);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAll=function(){var t=k(F.mark((function t(){var e,r=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.nextTokenId();case 2:return e=t.sent.toNumber(),t.next=5,Promise.all(Array.from(Array(e).keys()).map((function(t){return r.get(t.toString())})));case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getNFTs=function(){var t=k(F.mark((function t(e){var r,n=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.getPackWithRewards(e);case 2:if((r=t.sent).source){t.next=5;break}throw new L;case 5:return t.next=7,Promise.all(r.tokenIds.map((function(t){return _t(n.providerOrSigner,r.source,t.toString(),n.sdk.getStorage())})));case 7:return t.abrupt("return",t.sent.map((function(t,e){return{supply:r.amountsPacked[e],metadata:t}})));case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balanceOf=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.balanceOf(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.next=7,t.t0.balanceOf.call(t.t0,t.t1,t.t2);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.isApproved=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.isApprovedForAll(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setApproval=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=!0),t.next=3,this.sendTransaction("setApprovalForAll",[e,r]);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transfer=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this.getSignerAddress();case 3:return t.t1=t.sent,t.t2=e,t.t3=r,t.t4=n,t.t5=[0],t.t6=[t.t1,t.t2,t.t3,t.t4,t.t5],t.next=11,t.t0.sendTransaction.call(t.t0,"safeTransferFrom",t.t6);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.create=function(){var t=k(F.mark((function t(e){var r,n,a,i,o,c,p,d;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=s.ERC1155__factory.connect(e.assetContract,this.providerOrSigner),t.next=3,this.getSignerAddress();case 3:return n=t.sent,a=e.assets.map((function(t){return t.tokenId})),i=e.assets.map((function(t){return t.amount})),t.next=8,this.sdk.getStorage().uploadMetadata(e.metadata);case 8:return o=u.ethers.utils.defaultAbiCoder.encode(["string","uint256","uint256"],[t.sent,e.secondsUntilOpenStart||0,e.rewardsPerOpen||1]),t.t0=r,t.t1=n,t.t2=this.address,t.t3=a,t.t4=i,t.t5=o,t.next=18,this.getCallOverrides();case 18:return t.t6=t.sent,t.next=21,t.t0.safeBatchTransferFrom.call(t.t0,t.t1,t.t2,t.t3,t.t4,t.t5,t.t6);case 21:return c=t.sent,t.next=24,c.wait();case 24:if(0!==(p=this.parseLogs("PackCreated",t.sent.logs)).length){t.next=28;break}throw new Error("PackCreated event not found");case 28:return d=p[0].args.packId,t.next=31,this.get(d.toString());case 31:return t.abrupt("return",t.sent);case 32:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.transferFrom=function(){var t=k(F.mark((function t(e,r,n,a){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[0]),t.next=3,this.sendTransaction("safeTransferFrom",[e,r,n.tokenId,n.amount,a]);case 3:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.transferBatchFrom=function(){var t=k(F.mark((function t(e,r,n,a){var s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[0]),s=n.map((function(t){return t.tokenId})),i=n.map((function(t){return t.amount})),t.next=5,this.sendTransaction("safeBatchTransferFrom",[e,r,s,i,a]);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.getLinkBalance=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getChainID();case 2:return r=s.ERC20__factory.connect((e=Rt[t.sent]).linkTokenAddress,this.providerOrSigner),t.t0=wt,t.t1=this.providerOrSigner,t.t2=e.linkTokenAddress,t.next=10,r.balanceOf(this.address);case 10:return t.t3=t.sent,t.next=13,(0,t.t0)(t.t1,t.t2,t.t3);case 13:return t.abrupt("return",t.sent);case 14:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.depositLink=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getChainID();case 2:return r=s.ERC20__factory.connect(Rt[t.sent].linkTokenAddress,this.providerOrSigner),t.t0=r,t.t1=this.address,t.t2=e,t.next=10,this.getCallOverrides();case 10:return t.t3=t.sent,t.next=13,t.t0.transfer.call(t.t0,t.t1,t.t2,t.t3);case 13:return n=t.sent,t.next=16,n.wait();case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.withdrawLink=function(){var t=k(F.mark((function t(e,r){var n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,n=new u.Contract(this.address,[{inputs:[{internalType:"address",name:"_to",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"transferLink",outputs:[],stateMutability:"nonpayable",type:"function"}],this.providerOrSigner),t.next=4,this.sendContractTransaction(n,"transferLink",[e,r]);case 4:t.next=14;break;case 6:return t.prev=6,t.t0=t.catch(0),t.next=10,this.getChainID();case 10:return a=Rt[t.sent],t.next=14,this.sendTransaction("transferERC20",[a.linkTokenAddress,e,r]);case 14:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e,r){return t.apply(this,arguments)}}(),r.setRoyaltyBps=function(){var t=k(F.mark((function t(e){var r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata(!1);case 2:if(n=[],r=t.sent.metadata){t.next=7;break}throw new Error("No metadata found, this module might be invalid!");case 7:return r.seller_fee_basis_points=e,t.t0=this.sdk.getStorage(),t.t1=M({},r),t.t2=this.address,t.next=13,this.getSignerAddress();case 13:return t.t3=t.sent,t.next=16,t.t0.uploadMetadata.call(t.t0,t.t1,t.t2,t.t3);case 16:return a=t.sent,n.push(this.contract.interface.encodeFunctionData("setRoyaltyBps",[e])),n.push(this.contract.interface.encodeFunctionData("setContractURI",[a])),t.next=21,this.sendTransaction("multicall",[n]);case 21:return t.abrupt("return",t.sent);case 22:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getRoyaltyBps=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.royaltyBps();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getRoyaltyRecipientAddress=function(){var t=k(F.mark((function t(){var e,r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMetadata();case 2:if(void 0===(null==(e=(r=t.sent).metadata)?void 0:e.fee_recipient)){t.next=5;break}return t.abrupt("return",r.metadata.fee_recipient);case 5:return t.abrupt("return","");case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.isTransferRestricted=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.readOnlyContract.transfersRestricted());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setRestrictedTransfer=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=!1),t.t0=this,t.t1=["admin"],t.next=5,this.getSignerAddress();case 5:return t.t2=t.sent,t.next=8,t.t0.onlyRoles.call(t.t0,t.t1,t.t2);case 8:return t.next=10,this.sendTransaction("setRestrictedTransfer",[e]);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getOwned=function(){var t=k(F.mark((function t(e){var r,n,a,s=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}t.t0=e,t.next=7;break;case 4:return t.next=6,this.getSignerAddress();case 6:t.t0=t.sent;case 7:return r=t.t0,t.next=10,this.readOnlyContract.nextTokenId();case 10:return n=t.sent,t.next=13,this.readOnlyContract.balanceOfBatch(Array(n.toNumber()).fill(r),Array.from(Array(n.toNumber()).keys()));case 13:return a=t.sent.map((function(t,e){return{tokenId:e,balance:t}})).filter((function(t){return t.balance.gt(0)})),t.next=17,Promise.all(a.map(function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.tokenId,n=e.balance,t.next=3,s.get(r.toString());case 3:return t.abrupt("return",M({},t.sent,{ownedByAddress:n}));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 17:return t.abrupt("return",t.sent);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Yt);Qe.moduleType=exports.ModuleType.PACK,Qe.roles=[Vt.admin,Vt.minter,Vt.pauser,Vt.transfer];var Ye=function(t){function e(){return t.apply(this,arguments)||this}S(e,t);var r=e.prototype;return r.connectContract=function(){return s.Royalty__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.get=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,gt(this.providerOrSigner,this.address);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getAllRecipients=function(){var t=k(F.mark((function t(){var e,r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=[],r=u.BigNumber.from(0),t.next=4,this.readOnlyContract.payeeCount();case 4:n=t.sent;case 5:if(!r.lt(n)){t.next=27;break}return t.prev=6,t.next=9,this.readOnlyContract.payee(r);case 9:return a=t.sent,t.t0=e,t.next=13,this.getRecipientSplitPercentage(a);case 13:t.t1=t.sent,t.t0.push.call(t.t0,t.t1),r=r.add(1),t.next=25;break;case 18:if(t.prev=18,t.t2=t.catch(6),!("method"in t.t2)||!t.t2.method.toLowerCase().includes("payee(uint256)")){t.next=24;break}return t.abrupt("break",27);case 24:throw t.t2;case 25:t.next=5;break;case 27:return t.abrupt("return",e);case 28:case"end":return t.stop()}}),t,this,[[6,18]])})));return function(){return t.apply(this,arguments)}}(),r.balanceOfAllRecipients=function(){var t=k(F.mark((function t(){var e,r,n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAllRecipients();case 2:e={},r=E(t.sent);case 5:if((n=r()).done){t.next=12;break}return a=n.value,t.next=9,this.balanceOf(a.address);case 9:e[a.address]=t.sent;case 10:t.next=5;break;case 12:return t.abrupt("return",e);case 13:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.balanceOfTokenAllRecipients=function(){var t=k(F.mark((function t(e){var r,n,a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAllRecipients();case 2:r={},n=E(t.sent);case 5:if((a=n()).done){t.next=12;break}return s=a.value,t.next=9,this.balanceOfToken(s.address,e);case 9:r[s.address]=t.sent;case 10:t.next=5;break;case 12:return t.abrupt("return",r);case 13:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getRecipientSplitPercentage=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([this.readOnlyContract.totalShares(),this.readOnlyContract.shares(e)]);case 2:return n=(r=t.sent)[0],t.abrupt("return",{address:e,splitPercentage:r[1].mul(u.BigNumber.from(1e7)).div(n).toNumber()/1e5});case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balanceOf=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.provider.getBalance(this.address);case 2:return r=t.sent,t.next=5,this.readOnlyContract["totalReleased()"]();case 5:return n=r.add(t.sent),t.t0=this,t.t1=e,t.t2=n,t.next=12,this.readOnlyContract["released(address)"](e);case 12:return t.t3=t.sent,t.abrupt("return",t.t0._pendingPayment.call(t.t0,t.t1,t.t2,t.t3));case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.balanceOfToken=function(){var t=k(F.mark((function t(e,r){var n,a,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.ERC20__factory.connect(r,this.providerOrSigner),t.next=3,n.balanceOf(this.address);case 3:return a=t.sent,t.next=6,this.readOnlyContract["totalReleased(address)"](r);case 6:return i=a.add(t.sent),t.t0=this,t.t1=e,t.t2=i,t.next=13,this.readOnlyContract["released(address,address)"](r,e);case 13:return t.t3=t.sent,t.next=16,t.t0._pendingPayment.call(t.t0,t.t1,t.t2,t.t3);case 16:return o=t.sent,t.next=19,wt(this.providerOrSigner,r,o);case 19:return t.abrupt("return",t.sent);case 20:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.withdraw=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("release(address)",[e]);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r._pendingPayment=function(){var t=k(F.mark((function t(e,r,n){var a,s;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=r,t.next=3,this.readOnlyContract.shares(e);case 3:return t.t1=t.sent,a=t.t0.mul.call(t.t0,t.t1),t.t2=a,t.next=8,this.readOnlyContract.totalShares();case 8:return t.t3=t.sent,s=t.t2.div.call(t.t2,t.t3),t.abrupt("return",s.sub(n));case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.withdrawToken=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("release(address,address)",[r,e]);case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.distribute=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("distribute()",[]);case 2:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.distributeToken=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sendTransaction("distribute(address)",[e]);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Qt);Ye.moduleType=exports.ModuleType.SPLITS;var Xe=function(t){function e(){return t.apply(this,arguments)||this}S(e,t);var r=e.prototype;return r.connectContract=function(){return s.VotingGovernor__factory.connect(this.address,this.providerOrSigner)},r.getModuleType=function(){return e.moduleType},r.settings=function(){var t=k(F.mark((function t(){var e,r,n,a,s,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([this.readOnlyContract.votingDelay(),this.readOnlyContract.votingPeriod(),this.readOnlyContract.token(),this.readOnlyContract.quorumNumerator(),this.readOnlyContract.proposalThreshold()]);case 2:return r=(e=t.sent)[0],n=e[1],a=e[2],s=e[3],i=e[4],t.next=10,gt(this.providerOrSigner,a);case 10:return o=t.sent,t.abrupt("return",{votingDelay:r.toString(),votingPeriod:n.toString(),votingTokenAddress:a,votingTokenMetadata:o,votingQuorumFraction:s.toString(),proposalTokenThreshold:i.toString()});case 12:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.get=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ensureExists(e);case 2:return t.next=4,this.getAll();case 4:if(0!==(r=t.sent.filter((function(t){return t.proposalId.toLowerCase()===e.toLowerCase()}))).length){t.next=8;break}throw new Error("proposal not found");case 8:return t.abrupt("return",r[0]);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAll=function(){var t=k(F.mark((function t(){var e,r,n,a,s,i,o,u,c,p,d=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.queryFilter(this.contract.filters.ProposalCreated());case 2:return e=t.sent,r=[],t.next=6,Promise.all(e.map((function(t){return d.readOnlyContract.state(t.args.proposalId)})));case 6:return n=t.sent,t.next=9,Promise.all(e.map((function(t){return d.readOnlyContract.proposalVotes(t.args.proposalId)})));case 9:for(a=t.sent,s=0;s<e.length;s++){for(i=e[s].args,o=n[s],u=[{type:exports.VoteType.Against,label:"Against",count:a[s].againstVotes},{type:exports.VoteType.For,label:"For",count:a[s].forVotes},{type:exports.VoteType.Abstain,label:"Abstain",count:a[s].abstainVotes}],c=[],p=0;p<i.targets.length;p++)c.push({to:i.targets[p],value:i[3][p]||0,data:i.calldatas[p]});r.push({proposalId:i.proposalId.toString(),proposer:i.proposer,description:i.description,startBlock:i.startBlock,endBlock:i.endBlock,state:o,votes:u,executions:c.map((function(t){return{toAddress:t.to,nativeTokenValue:t.value,transactionData:t.data}}))})}return t.abrupt("return",r);case 12:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.propose=function(){var t=k(F.mark((function t(e,r){var n,a,s,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r||(r=[{toAddress:this.address,nativeTokenValue:0,transactionData:"0x"}]),n=r.map((function(t){return t.toAddress})),a=r.map((function(t){return t.nativeTokenValue})),s=r.map((function(t){return t.transactionData})),t.next=6,this.sendTransaction("propose",[n,a,s,e]);case 6:return o=this.parseEventLogs("ProposalCreated",null==(i=t.sent)?void 0:i.logs),t.abrupt("return",o.proposalId);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.vote=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n=""),t.next=3,this.ensureExists(e);case 3:return t.next=5,this.sendTransaction("castVoteWithReason",[e,r,n]);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.hasVoted=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=4;break}return t.next=3,this.getSignerAddress();case 3:r=t.sent;case 4:return t.abrupt("return",this.readOnlyContract.hasVoted(e,r));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.execute=function(){var t=k(F.mark((function t(e){var r,n,a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ensureExists(e);case 2:return t.next=4,this.get(e);case 4:return n=(r=t.sent).executions.map((function(t){return t.toAddress})),a=r.executions.map((function(t){return t.nativeTokenValue})),s=r.executions.map((function(t){return t.transactionData})),i=u.ethers.utils.id(r.description),t.next=11,this.sendTransaction("execute",[n,a,s,i]);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.canExecute=function(){var t=k(F.mark((function t(e){var r,n,a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ensureExists(e);case 2:return t.next=4,this.get(e);case 4:return n=(r=t.sent).executions.map((function(t){return t.toAddress})),a=r.executions.map((function(t){return t.nativeTokenValue})),s=r.executions.map((function(t){return t.transactionData})),i=u.ethers.utils.id(r.description),t.prev=9,t.next=12,this.contract.callStatic.execute(n,a,s,i);case 12:return t.abrupt("return",!0);case 15:return t.prev=15,t.t0=t.catch(9),t.abrupt("return",!1);case 18:case"end":return t.stop()}}),t,this,[[9,15]])})));return function(e){return t.apply(this,arguments)}}(),r.balance=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.provider.getBalance(this.address);case 2:return t.abrupt("return",{name:"",symbol:"",decimals:18,value:(e=t.sent).toString(),displayValue:u.ethers.utils.formatUnits(e,18)});case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.balanceOfToken=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=s.ERC20__factory.connect(e,this.readOnlyContract.provider),t.t0=wt,t.t1=this.providerOrSigner,t.t2=e,t.next=6,r.balanceOf(this.address);case 6:return t.t3=t.sent,t.next=9,(0,t.t0)(t.t1,t.t2,t.t3);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.setModuleMetadata=function(){var t=k(F.mark((function t(e){var r;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.sdk.getStorage().uploadMetadata(e);case 2:return r=t.sent,t.next=5,this.sendTransaction("setContractURI",[r]);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.ensureExists=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.readOnlyContract.state(e);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Qt);Xe.moduleType=exports.ModuleType.VOTE,globalThis.FormData||(globalThis.FormData=require("form-data"));var $e=function(){function t(t){this.gatewayUrl=void 0,this.gatewayUrl=t.replace(/\/$/,"")+"/"}var e=t.prototype;return e.upload=function(){var t=k(F.mark((function t(e,r,n){var a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e){t.next=7;break}return t.next=3,this.uploadBatch([e],r,0);case 3:return t.abrupt("return",t.sent+"0");case 7:if(!(e instanceof Buffer)){t.next=12;break}return t.next=10,this.uploadBatch([e],r,0);case 10:return t.abrupt("return",t.sent+"0");case 12:return a={"X-App-Name":"CONSOLE-TS-SDK-"+r,"X-Public-Address":n||""},(s=new FormData).append("file",e),t.prev=15,t.next=18,fetch("https://upload.nftlabs.co/upload",{method:"POST",body:s,headers:a});case 18:if(200===(i=t.sent).status){t.next=21;break}throw new Error("Failed to upload to IPFS [status code = "+i.status+"]");case 21:return t.next=23,i.json();case 23:return t.abrupt("return",t.sent.IpfsUri);case 27:throw t.prev=27,t.t0=t.catch(15),new V("Failed to upload to IPFS: "+t.t0);case 30:case"end":return t.stop()}}),t,this,[[15,27]])})));return function(e,r,n){return t.apply(this,arguments)}}(),e.uploadBatch=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n=0),t.next=3,this.uploadBatchWithCid(e,r,n);case 3:return t.abrupt("return","ipfs://"+t.sent.cid+"/");case 6:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.uploadBatchWithCid=function(){var t=k(F.mark((function t(e,r,n){var a,s,i,o,u,c;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n=0),t.next=3,this.getUploadToken(r||"");case 3:return a=t.sent,s={name:"CONSOLE-TS-SDK-"+r},i=new FormData,o=[],e.forEach((function(t,e){var r="",a=t;if(t instanceof File){var s="";if(t.name){var u=t.name.lastIndexOf(".");u>-1&&(s=t.name.substring(u))}r=""+(e+n)+s}else t instanceof Buffer||"string"==typeof t?r=""+(e+n):t&&t.name&&null!=t&&t.data?(a=null==t?void 0:t.data,r=""+t.name):r=""+(e+n);var c="files/"+r;if(o.indexOf(r)>-1)throw new q(r);o.push(r),"undefined"==typeof window?i.append("file",a,{filepath:c}):i.append("file",new Blob([a]),c)})),i.append("pinataMetadata",JSON.stringify(s)),t.next=11,fetch("https://api.pinata.cloud/pinning/pinFileToIPFS",{method:"POST",headers:{Authorization:"Bearer "+a},body:i});case 11:return u=t.sent,t.next=14,u.json();case 14:if(c=t.sent,u.ok){t.next=18;break}throw console.log(c),new V("Failed to upload files to IPFS");case 18:return t.abrupt("return",{cid:c.IpfsHash,fileNames:o});case 19:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.getUploadToken=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={"X-App-Name":"CONSOLE-TS-SDK-"+e},t.next=3,fetch("https://upload.nftlabs.co/grant",{method:"GET",headers:r});case 3:if((n=t.sent).ok){t.next=6;break}throw new Z("Failed to get upload token");case 6:return t.next=8,n.text();case 8:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),e.get=function(){var t=k(F.mark((function t(e){var r,n;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e,e&&(r=this.resolveFullUrl(e)),t.next=4,fetch(r);case 4:if((n=t.sent).ok){t.next=7;break}throw new Error("Status code (!= 200) ="+n.status);case 7:return t.next=9,n.text();case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.buildFilePropertiesMap=function(t,e){var r=Object.keys(t).sort();for(var n in r){var a=t[r[n]];(a instanceof File||a instanceof Buffer)&&e.push(a),"object"==typeof a&&this.buildFilePropertiesMap(a,e)}return e},e.batchUploadProperties=function(){var t=k(F.mark((function t(e){var r,n,a,s,i,o;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e){t.next=2;break}return t.abrupt("return",e);case 2:if(0!==(r=this.buildFilePropertiesMap(e,[])).length){t.next=5;break}return t.abrupt("return",e);case 5:return t.next=7,this.uploadBatchWithCid(r,"",0);case 7:for(a=(n=t.sent).cid,s=[],i=E(n.fileNames);!(o=i()).done;)s.push(a+"/"+o.value);return t.next=14,this.replaceFilePropertiesWithHashes(e,s);case 14:return t.abrupt("return",t.sent);case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.replaceFilePropertiesWithHashes=function(){var t=k(F.mark((function t(e,r){var n,a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Object.keys(e).sort(),t.t0=F.keys(n);case 2:if((t.t1=t.t0()).done){t.next=15;break}if(i=(s=e[n[a=t.t1.value]])instanceof File||s instanceof Buffer,"object"!=typeof s||i){t.next=10;break}return t.next=9,this.replaceFilePropertiesWithHashes(s,r);case 9:return t.abrupt("continue",2);case 10:if(i){t.next=12;break}return t.abrupt("continue",2);case 12:e[n[a]]="ipfs://"+r.splice(0,1)[0],t.next=2;break;case 15:return t.abrupt("return",e);case 16:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.uploadMetadata=function(){var t=k(F.mark((function t(e,r,n){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e){t.next=2;break}return t.abrupt("return",e);case 2:return t.next=4,this.uploadMetadataBatch([e],r,0);case 4:return t.abrupt("return",t.sent.metadataUris[0]);case 7:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.uploadMetadataBatch=function(){var t=k(F.mark((function t(e,r,n){var a,s,i,o,u,c,p,d,l;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.filter((function(t){return"string"!=typeof t})),t.next=3,this.batchUploadProperties(a);case 3:if(0!==(s=t.sent.map((function(t){return JSON.stringify(t)}))).length){t.next=6;break}return t.abrupt("return",{baseUri:"",metadataUris:e.filter((function(t){return"string"==typeof t}))});case 6:return t.next=8,this.uploadBatchWithCid(s,r,n);case 8:for(o=(i=t.sent).fileNames,u="ipfs://"+i.cid+"/",c=[],p=E(e);!(d=p()).done;)c.push("string"==typeof(l=d.value)?l:""+u+o.splice(0,1)[0]);return t.abrupt("return",{baseUri:u,metadataUris:c});case 15:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.resolveFullUrl=function(t){return"string"!=typeof t?"":t&&t.toLowerCase().includes("ipfs://")?t.replace("ipfs://",this.gatewayUrl):t},e.canResolve=function(t){return this.resolveFullUrl(t).toLowerCase()!==t.toLowerCase()},t}(),tr=function(t){function e(){return t.apply(this,arguments)||this}S(e,t);var r=e.prototype;return r.connectContract=function(){return s.Registry__factory.connect(this.address,this.providerOrSigner)},r.getProtocolContracts=function(){var t=k(F.mark((function t(e){var r,n,a,s,i=this;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=e,t.t0){t.next=5;break}return t.next=4,this.getSignerAddress();case 4:t.t0=t.sent;case 5:return r=t.t0,t.next=8,this.readOnlyContract.getProtocolControlCount(r);case 8:return n=Array.from(Array(t.sent.toNumber()).keys()).reverse(),t.next=12,Promise.all(n.map((function(t){return i.readOnlyContract.getProtocolControl(r,(t+1).toString())})));case 12:return a=t.sent,t.next=15,Promise.all(a.map((function(t){return pt(i.providerOrSigner,t,i.sdk.getStorage()).catch((function(){}))})));case 15:return s=t.sent,t.abrupt("return",n.map((function(t,e){return{address:a[e],version:t,metadata:s[e]}})));case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e}(Qt),er=function(){function t(t,e){this.options=void 0,this.defaultOptions={ipfsGatewayUrl:"https://cloudflare-ipfs.com/ipfs/",registryContractAddress:"",maxGasPriceInGwei:300,gasSpeed:"fastest",transactionRelayerUrl:"",transactionRelayerSendFunction:this.defaultRelayerSendFunction.bind(this),transactionRelayerForwarderAddress:"0xc82BbE41f2cF04e3a8efA18F7032BDD7f6d98a81",readOnlyRpcUrl:"",gasless:{biconomy:{apiId:"",apiKey:"",deadlineSeconds:3600,gasTier:"RAPID"}},gaslessSendFunction:this.defaultGaslessSendFunction.bind(this)},this.modules=new Map,this.providerOrSigner=void 0,this._signer=null,this._jsonConvert=new m.JsonConvert,this.storage=void 0,this.event=new h.EventEmitter2,this._registry=null,this.providerOrSigner=this.setProviderOrSigner(t),this.options=M({},this.defaultOptions,e),this.storage=new $e(this.options.ipfsGatewayUrl)}var r=t.prototype;return r.updateModuleSigners=function(){for(var t,e=E(this.modules);!(t=e()).done;){var r=t.value[1];this.isReadOnly()&&r.clearSigner(),r.setProviderOrSigner(this.providerOrSigner)}},r.getProvider=function(){return f.Provider.isProvider(this.providerOrSigner)?this.providerOrSigner:this.providerOrSigner.provider},r.getSigner=function(){if(u.Signer.isSigner(this.providerOrSigner))return this.providerOrSigner},r.getChainID=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(e=this.getProvider())||Zt(!1),t.next=4,e.getNetwork();case 4:return t.abrupt("return",t.sent.chainId);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getRegistryAddress=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.options.registryContractAddress){t.next=2;break}return t.abrupt("return",this.options.registryContractAddress);case 2:return t.t0=ee,t.next=5,this.getChainID();case 5:return t.t1=t.sent,t.abrupt("return",(0,t.t0)(t.t1));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getRegistryModule=function(){var t=k(F.mark((function t(){var e;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getRegistryAddress();case 2:return(e=t.sent)||Zt(!1),t.abrupt("return",this.registry=this.getOrCreateModule(e,tr));case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getOrCreateModule=function(t,e){if(this.modules.has(t))return this.modules.get(t);var r=new e(this.providerOrSigner,t,this.options,this);return this.modules.set(t,r),r},r.getForwarderAddress=function(){var t=k(F.mark((function t(){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.registry,t.t0){t.next=5;break}return t.next=4,this.getRegistryModule();case 4:t.t0=t.sent;case 5:return t.next=7,t.t0.readOnlyContract.forwarder();case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getApps=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.registry,t.t0){t.next=5;break}return t.next=4,this.getRegistryModule();case 4:t.t0=t.sent;case 5:return t.abrupt("return",t.t0.getProtocolContracts(e));case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.createApp=function(){var t=k(F.mark((function t(e){var r,n,a,s,i,u;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.registry,t.t0){t.next=5;break}return t.next=4,this.getRegistryModule();case 4:t.t0=t.sent;case 5:return n=t.t0.contract,t.next=8,this.getGasPrice();case 8:return s={},"number"==typeof(a=t.sent)&&(s.gasPrice=o.parseUnits(a.toString(),"gwei")),t.t1=at,t.t2=e,t.t3=n.address,t.next=16,null==(r=this.signer)?void 0:r.getAddress();case 16:if(t.t4=t.sent,t.t4){t.next=19;break}t.t4=void 0;case 19:return t.t5=t.t4,t.next=22,(0,t.t1)(t.t2,t.t3,t.t5);case 22:return i=t.sent,t.next=25,n.deployProtocol(i,s);case 25:return u=t.sent,t.next=28,u.wait();case 28:return t.abrupt("return",t.sent);case 29:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getGasPrice=function(){var t=k(F.mark((function t(e,r){var n,a;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e||this.options.gasSpeed,a=r||this.options.maxGasPriceInGwei,t.t0=Wt,t.next=5,this.getChainID();case 5:return t.t1=t.sent,t.t2=n,t.t3=a,t.next=10,(0,t.t0)(t.t1,t.t2,t.t3);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setProviderOrSigner=function(t){return this.providerOrSigner=f.Provider.isProvider(t)||u.Signer.isSigner(t)?t:u.ethers.getDefaultProvider(t),this.signer=u.Signer.isSigner(t)?t:null,this.updateModuleSigners(),this.providerOrSigner},r.isReadOnly=function(){return!u.Signer.isSigner(this.signer)},r.getContractMetadata=function(){var t=k(F.mark((function t(e){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=M,t.t1={},t.next=4,pt(this.providerOrSigner,e,this.getStorage(),!0);case 4:return t.t2=t.sent,t.t3={address:e},t.abrupt("return",(0,t.t0)(t.t1,t.t2,t.t3));case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getAppModule=function(t){return this.getOrCreateModule(t,Oe)},r.getNFTModule=function(t){return this.getOrCreateModule(t,Ke)},r.getCollectionModule=function(t){return this.getBundleModule(t)},r.getBundleModule=function(t){return this.getOrCreateModule(t,Ne)},r.getPackModule=function(t){return this.getOrCreateModule(t,Qe)},r.getCurrencyModule=function(t){return this.getOrCreateModule(t,Ae)},r.getTokenModule=function(t){return this.getOrCreateModule(t,Se)},r.getDatastoreModule=function(t){return this.getOrCreateModule(t,Ve)},r.getMarketModule=function(t){return this.getOrCreateModule(t,Ge)},r.getDropModule=function(t){return this.getOrCreateModule(t,Je)},r.getBundleDropModule=function(t){return this.getOrCreateModule(t,Ue)},r.getMarketplaceModule=function(t){return this.getOrCreateModule(t,Ze)},r.getSplitsModule=function(t){return this.getOrCreateModule(t,Ye)},r.getVoteModule=function(t){return this.getOrCreateModule(t,Xe)},r.getBundleSignatureModule=function(t){return this.getOrCreateModule(t,$t)},r.invokeRoute=function(t,e){var r=t.split(".");if(r.length>0&&"thirdweb"===r[0]){if(4===r.length){var n,a=r[3];return(n=this.getModuleByName(r[1],r[2]))[a].apply(n,e.arguments||[])}if(3===r.length)throw new Error("reserved for thirdweb.bridge.function_name");if(2===r.length)return this[r[1]].apply(this,e.arguments||[])}throw new Error("uknown route")},r.getModuleByName=function(t,e){if("currency"===t)return this.getCurrencyModule(e);if("nft"===t)return this.getNFTModule(e);if("market"===t)return this.getMarketModule(e);if("bundle"===t||"collection"===t)return this.getCollectionModule(e);if("drop"===t)return this.getDropModule(e);if("splits"===t)return this.getSplitsModule(e);if("pack"===t)return this.getPackModule(e);if("datastore"===t)return this.getDatastoreModule(e);if("app"===t||"project"===t)return this.getAppModule(e);throw new Error("unsupported module")},r.defaultGaslessSendFunction=function(){var t=k(F.mark((function t(e,r){return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.options.gasless.biconomy.apiId||!this.options.gasless.biconomy.apiKey){t.next=2;break}return t.abrupt("return",this.biconomySendFunction(e,r));case 2:return t.abrupt("return",this.defenderSendFunction(e,r));case 3:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.biconomySendFunction=function(){var t=k(F.mark((function t(e,r){var n,a,s,i,o,c,p,d,l,f,h;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=this.getSigner(),s=this.getProvider(),a&&s||Zt(!1),i=new u.ethers.Contract(ee(r.chainId,"biconomyForwarder"),ne,s),o=0,t.next=7,ie(i,"getNonce",[r.from,o]);case 7:return c=t.sent,p={from:r.from,to:r.to,token:u.ethers.constants.AddressZero,txGas:r.gasLimit.toNumber(),tokenGasPrice:"0",batchId:o,batchNonce:c.toNumber(),deadline:Math.floor(Date.now()/1e3+(null!=(n=this.options.gasless.biconomy.deadlineSeconds)?n:3600)),data:r.data},d=u.ethers.utils.arrayify(u.ethers.utils.solidityKeccak256(["address","address","address","uint256","uint256","uint256","uint256","uint256","bytes32"],[p.from,p.to,p.token,p.txGas,p.tokenGasPrice,p.batchId,p.batchNonce,p.deadline,u.ethers.utils.keccak256(p.data)])),this.event.emit(Ut.Signature,{status:"submitted",message:d,signature:""}),t.next=13,a.signMessage(d);case 13:return this.event.emit(Ut.Signature,{status:"completed",message:d,signature:l=t.sent}),t.next=17,fetch(this.options.transactionRelayerUrl||"https://api.biconomy.io/api/v2/meta-tx/native",{method:"POST",body:JSON.stringify({from:r.from,apiId:this.options.gasless.biconomy.apiId,params:[p,l],to:r.to,gasLimit:r.gasLimit.toHexString(),gasType:this.options.gasless.biconomy.gasTier}),headers:{"x-api-key":this.options.gasless.biconomy.apiKey,"Content-Type":"application/json;charset=utf-8"}});case 17:if(!(f=t.sent).ok){t.next=25;break}return t.next=21,f.json();case 21:if((h=t.sent).txHash){t.next=24;break}throw new Error("relay transaction failed: "+(h.log||h.message));case 24:return t.abrupt("return",h.txHash);case 25:throw new Error("relay transaction failed");case 26:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.defenderSendFunction=function(){var t=k(F.mark((function t(e,r){var n,a,i,o,c,p,d,l,f,h,m,y,x,v,g,b,w,k;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.getSigner(),a=this.getProvider(),n||Zt(!1),a||Zt(!1),o=s.Forwarder__factory.connect(i=this.options.transactionRelayerForwarderAddress,a),t.next=8,ie(o,"getNonce",[r.from]);case 8:if(c=t.sent,p={name:"GSNv2 Forwarder",version:"0.0.1",chainId:r.chainId,verifyingContract:i},d={ForwardRequest:re},l={from:r.from,to:r.to,value:u.BigNumber.from(0).toString(),gas:u.BigNumber.from(r.gasLimit).toString(),nonce:u.BigNumber.from(c).toString(),data:r.data},this.event.emit(Ut.Signature,{status:"submitted",message:l,signature:""}),"approve"!==r.functionName||2!==r.functionArgs.length){t.next=26;break}return h=r.functionArgs[0],m=r.functionArgs[1],t.next=18,ge(n,e.address,r.from,h,m);case 18:x=(y=t.sent).message,g=u.ethers.utils.splitSignature(v=y.signature),b=g.r,w=g.s,k=g.v,l={to:e.address,owner:x.owner,spender:x.spender,value:u.BigNumber.from(x.value).toString(),nonce:u.BigNumber.from(x.nonce).toString(),deadline:u.BigNumber.from(x.deadline).toString(),r:b,s:w,v:k},f=v,t.next=31;break;case 26:return t.next=28,zt(n,p,d,l);case 28:f=t.sent.signature;case 31:return this.event.emit(Ut.Signature,{status:"completed",message:l,signature:f}),t.next=34,this.options.transactionRelayerSendFunction(l,f);case 34:return t.abrupt("return",t.sent);case 36:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.defaultRelayerSendFunction=function(){var t=k(F.mark((function t(e,r){var n,a,s,i;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n="forward",null!=e&&e.owner&&(n="permit"),a=JSON.stringify({request:e,signature:r,type:n}),t.next=5,fetch(this.options.transactionRelayerUrl,{method:"POST",body:a});case 5:if(!(s=t.sent).ok){t.next=12;break}return t.next=9,s.json();case 9:return i=JSON.parse(t.sent.result),t.abrupt("return",i.txHash);case 12:throw new Error("relay transaction failed");case 13:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.createSnapshot=function(){var t=k(F.mark((function t(r){var n,a,s,i,o,u;return F.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(new Set(r).size<r.length)){t.next=3;break}throw new z;case 3:return t.next=5,new Promise((function(t){t(e(require("keccak256")))}));case 5:return n=t.sent.default,a=r.map((function(t){return n(t)})),s=new x(a,n,{sort:!0}),i={merkleRoot:s.getHexRoot(),claims:r.map((function(t){return{address:t,proof:s.getHexProof(n(t))}}))},o=JSON.stringify(this._jsonConvert.serializeObject(i,exports.Snapshot)),t.next=13,this.storage.upload(o);case 13:return u=t.sent,t.abrupt("return",{merkleRoot:s.getHexRoot(),snapshotUri:u,snapshot:i});case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getStorage=function(){return this.storage},r.overrideStorage=function(t){this.storage=t},T(t,[{key:"signer",get:function(){return this._signer},set:function(t){this._signer=t}},{key:"registry",get:function(){return this._registry},set:function(t){this._registry=t}}]),t}(),rr=er;globalThis.fetch||(globalThis.fetch=r),exports.AdminRoleMissingError=$,exports.AppModule=Oe,exports.AssetNotFoundError=U,exports.AuctionAlreadyStartedError=H,exports.AuctionHasNotEndedError=tt,exports.BundleDropModule=Ue,exports.BundleModule=Ne,exports.ChainlinkVrf=Rt,exports.ClaimConditionFactory=Ie,exports.ClaimConditionPhase=Le,exports.CurrencyModule=Ae,exports.DEFAULT_BLOCK_TIMES_FALLBACK=Te,exports.DatastoreModule=Ve,exports.DropModule=Je,exports.DuplicateFileNameError=q,exports.DuplicateLeafsError=z,exports.FetchError=Z,exports.FileNameMissingError=j,exports.FunctionDeprecatedError=K,exports.InterfaceId_IERC1155=ut,exports.InterfaceId_IERC721=ot,exports.InvalidAddressError=I,exports.IpfsStorage=$e,exports.ListingNotFoundError=Q,exports.MarketModule=Ge,exports.MarketplaceModule=Ze,exports.MissingOwnerRoleError=W,exports.MissingRoleError=D,exports.NATIVE_TOKEN_ADDRESS=xt,exports.NFTLabsSDK=rr,exports.NFTModule=Ke,exports.NotEnoughTokensError=J,exports.NotFoundError=L,exports.PackModule=Qe,exports.QuantityAboveLimitError=G,exports.RestrictedTransferError=X,exports.RolesMap=Vt,exports.SplitsModule=Ye,exports.ThirdwebSDK=er,exports.TokenModule=Se,exports.UploadError=V,exports.VoteModule=Xe,exports.WrongListingTypeError=Y,exports.convertModuleTypeToName=function(t){return c.$enum(exports.ModuleType).getKeyOrDefault(t,void 0)},exports.convertNameToModuleType=function(t){return c.$enum(exports.ModuleType).getValueOrDefault(null==t?void 0:t.toUpperCase(),void 0)},exports.estimateBlockAtTime=function(t,e){return Me.apply(this,arguments)},exports.generateRoot=function(t){return new y.MerkleTree(t,b.SHA256,{hashLeaves:!0,sortLeaves:!0}).getRoot().toString("hex")},exports.getContractMetadata=pt,exports.getCurrencyBalance=Tt,exports.getCurrencyMetadata=gt,exports.getCurrencyValue=wt,exports.getGasPriceForChain=Wt,exports.getMetadataWithoutContract=_t,exports.getNativeTokenByChainId=At,exports.getRoleHash=qt,exports.getTokenMetadata=Et,exports.getTokenMetadataUsingStorage=Ft,exports.getTokenUri=It,exports.isContract=lt,exports.isNativeToken=Ct,exports.recursiveResolveGatewayUrl=et,exports.replaceIpfsWithGateway=function(t,e){return t&&"string"==typeof t?(e.endsWith("/")||(e+="/"),t.replace("ipfs://",e)):""},exports.uploadMetadata=at,exports.uploadToIPFS=rt;
//# sourceMappingURL=sdk.cjs.production.min.js.map