1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[16288],{65642:function(e,t,n){n.d(t,{Y:function(){return F},b:function(){return v},bE:function(){return q},bJ:function(){return E},bL:function(){return B},bz:function(){return K},c:function(){return y},d:function(){return C},e:function(){return m},l:function(){return p}}),n(93969);var i=n(44194),r=n(32018),a=n(40911),o=n(60118),c=n(48225),l=n(31549),u=n(88626),s=n(48767),d=n(88425),h=n(57100),g=n(51801);n(80568);let f=(0,i.createContext)(void 0);function p(){let e=(0,i.useContext)(f);if(!e)throw Error("useWalletContext() can only be used inside <ThirdwebProvider />");return e}function v(){let e=p();return(0,c.Z)(e,"useConnect() hook must be used within a <ThirdwebProvider/>"),e.connect}function m(){let e=p();return(0,c.Z)(e,"useDisconnect() hook must be used within a <ThirdwebProvider/>"),e.disconnect}function y(){let e=p();return(0,c.Z)(e,"useConnectionStatus() must be used within a <ThirdwebProvider/>"),e.connectionStatus}function C(){let e=p();return(0,c.Z)(e,"useCreateWalletInstance() must be used within a <ThirdwebProvider/>"),e.createWalletInstance}let A="tw-cache";function b(e){return[A,...e.filter(e=>"string"!=typeof e||e!==A)]}function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g.d,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return b(["contract",e,...t])}function I(e,t){return b(T.network.active(t).concat(e))}let T={network:{active:e=>b(["chainId",e])},contract:{read:(e,t)=>w(e,["read",t]),type:e=>w(e,["contract-type"]),compilerMetadata:e=>w(e,["publish-metadata"]),typeAndCompilerMetadata:e=>w(e,["contract-type-and-metadata"]),metadata:e=>w(e,["metadata"]),extractFunctions:e=>w(e,["extractFunctions"]),call:(e,t,n,i)=>w(e,["call",t,n,i]),accountFactory:{getAll:e=>w(e,["accountFactory"]),isAccountDeployed:(e,t)=>w(e,["isAccountDeployed",t]),getAllForAddress:(e,t)=>w(e,["getAllForAddress",t])},account:{signers:e=>w(e,["account","signers"])},app:{get:e=>w(e,["appURI"])},events:{getEvents:(e,t)=>w(e,["events","getEvents",{eventName:t}]),getAllEvents:e=>w(e,["events","getAllEvents"])},nft:{get:(e,t)=>w(e,["get",{tokenId:t}]),balanceOf:(e,t,n)=>w(e,["balanceOf",{owner:t,tokenId:n}]),query:{all:(e,t)=>w(e,t?["query","all",t]:["query","all"]),totalCirculatingSupply:(e,t)=>w(e,["query","totalCirculatingSupply",t??"0"]),totalCount:e=>w(e,["query","totalCount"]),owned:{all:(e,t)=>w(e,["query","owned","all",t])}},sharedMetadata:{get:e=>w(e)},drop:{getAllUnclaimed:(e,t)=>w(e,t?["getAllUnclaimed",t]:["getAllUnclaimed"]),getAllClaimed:(e,t)=>w(e,t?["getAllClaimed",t]:["getAllClaimed"]),totalUnclaimedSupply:e=>w(e,["totalUnclaimedSupply"]),totalClaimedSupply:e=>w(e,["totalClaimedSupply"]),revealer:{getBatchesToReveal:(e,t)=>w(e,t?["getBatchesToReveal",t]:["getBatchesToReveal"])}}},token:{totalSupply:e=>w(e,["totalSupply"]),decimals:e=>w(e,["decimals"]),balanceOf:(e,t)=>w(e,["balanceOf",{walletAddress:t}])},marketplace:{getListing:(e,t)=>w(e,["getListing",{listingId:t}]),getAllListings:(e,t)=>w(e,t?["getAllListings",t]:["getAllListings"]),getTotalCount:e=>w(e,["getTotalCount"]),getActiveListings:(e,t)=>w(e,t?["getActiveListings",t]:["getActiveListings"]),auction:{getBidBufferBps:(e,t)=>w(e,["auction","getBidBufferBps",{listingId:t}]),getWinningBid:(e,t)=>w(e,["auction","getWinningBid",{listingId:t}]),getMinimumNextBid:(e,t)=>w(e,["auction","getMinimumNextBid",{listingId:t}]),getWinner:(e,t)=>w(e,["auction","getWinner",{listingId:t}])},directListings:{getAll:(e,t)=>w(e,t?["directListings","getAll",t]:["directListings","getAll"]),getAllValid:(e,t)=>w(e,t?["directListings","getAllValid",t]:["directListings","getAllValid"]),getListing:(e,t)=>w(e,["directListings","getListing",{listingId:t}]),getTotalCount:e=>w(e,["directListings","getTotalCount"])},englishAuctions:{getAll:(e,t)=>w(e,t?["englishAuctions","getAll",t]:["englishAuctions","getAll"]),getAllValid:(e,t)=>w(e,t?["englishAuctions","getAllValid",t]:["englishAuctions","getAllValid"]),getAuction:(e,t)=>w(e,["englishAuctions","getAuction",{auctionId:t}]),getWinningBid:(e,t)=>w(e,["englishAuctions","getWinningBid",{auctionId:t}]),getTotalCount:e=>w(e,["englishAuctions","getTotalCount"])}}}},x=e=>{let{queryClient:t,children:n}=e,o=(0,i.useMemo)(()=>t||new r.S,[t]);return(0,l.jsx)(a.aH,{client:o,children:n})},P=(0,i.createContext)(void 0),k=e=>{let{value:t,children:n}=e;return(0,l.jsx)(P.Provider,{value:t,children:n})},L=(0,i.createContext)({});function S(){let{sdk:e}=function(){let e=(0,i.useContext)(L);return(0,c.Z)(e._inProvider,"useSDK must be called from within a ThirdwebProvider, did you forget to wrap your app in a <ThirdwebProvider />?"),e}();return e}function B(){let e=S();return e?._chainId}let M={wallet:void 0,address:void 0,chainId:void 0,signer:void 0},Z=(0,i.createContext)(void 0),_=e=>{let{signer:t,children:n}=e,{chains:r,clientId:a}=function(){let e=(0,i.useContext)(P);return(0,c.Z)(e,"useThirdwebConfigContext() hook must be used within a <ThirdwebProvider/>"),e}(),o=S()?.storage,[s,h]=(0,i.useState)({...M,signer:t||void 0});return(0,i.useEffect)(()=>{h(e=>({...e,signer:t||void 0}))},[t]),(0,i.useEffect)(()=>
1{if(!o)return;let e=t;return t?Promise.all([t.getAddress(),t.getChainId()]).then(n=>{let i,[c,l]=n,s=r.find(e=>e.chainId===l);if(s)try{i=(0,u.OZ$)(s,a)[0]}catch(e){console.error(e)}t===e&&h({wallet:new d.U(t,{readonlySettings:i?{rpcUrl:i,chainId:l}:void 0},o),address:c,chainId:l,signer:t})}).catch(e=>{}):h(M),()=>{e=void 0}},[t,a]),(0,l.jsx)(Z.Provider,{value:s,children:n})},j=e=>{let{sdkOptions:t={},storageInterface:n,supportedChains:r,activeChain:a,signer:o,children:c,clientId:d,secretKey:h}=e,g=(0,i.useMemo)(()=>a?"number"==typeof a?a:"string"==typeof a?r.find(e=>e.slug===a)?.chainId:a.chainId:r[0]?.chainId,[a,r]),f=(0,i.useMemo)(()=>{let e,i,a=g,o=r.find(e=>e.chainId===a);if(o||void 0===a||(console.warn(`The chainId ${a} is not in the configured chains, please add it to the ThirdwebProvider`),a=void 0),o&&o.rpc.length>0)try{let t=(0,u.OZ$)(o,d)[0];e={chainId:o.chainId,rpcUrl:t}}catch(e){}let c={readonlySettings:e,...t,supportedChains:r};if(a&&(i=new s.x9T(a,{...c,clientId:d,secretKey:h},n)),!i){if(r.length>0)a=r[0].chainId,i=new s.x9T(a,c,n);else{console.error("No chains configured, please pass a chain or chains to the ThirdwebProvider");return}}return i._chainId=a,i},[g,r,t,n,d,h]);(0,i.useEffect)(()=>{f&&f._chainId===g&&(o?f.updateSignerOrProvider(o):g&&f.updateSignerOrProvider(g))},[f,f?._chainId,o,g]);let p=(0,i.useMemo)(()=>({sdk:f&&f._chainId===g?f:void 0,_inProvider:!0}),[g,f]);return(0,l.jsx)(L.Provider,{value:p,children:c})},E=e=>{var t;let{signer:n,children:r,queryClient:a,supportedChains:o,activeChain:c,clientId:s,...h}=e;s||(0,d.c)("No API key. Please provide a clientId. It is required to access thirdweb's services. You can create a key at https://thirdweb.com/create-api-key",s,void 0);let g=o||u.gL9,f=(0,i.useMemo)(()=>"object"==typeof c&&null!==c?g.find(e=>e.chainId===c.chainId)?g.map(e=>e.chainId===c.chainId?c:e):[...g,c]:g,[g,c]),[p,v]=(t=c||f[0],[(0,i.useMemo)(()=>f.map(e=>(0,u.nRj)(e,s)),[f,s]),(0,i.useMemo)(()=>t&&"string"!=typeof t&&"number"!=typeof t?(0,u.nRj)(t,s):t,[t,s])]),m=(0,i.useMemo)(()=>v&&"string"!=typeof v&&"number"!=typeof v?[...p.filter(e=>e.chainId!==v.chainId),v].filter((e,t,n)=>t===n.findIndex(t=>t.chainId===e.chainId)):p,[p,v]);return(0,l.jsx)(k,{value:{chains:m,clientId:s},children:(0,l.jsx)(x,{queryClient:a,children:(0,l.jsx)(j,{signer:n,supportedChains:m,clientId:s,activeChain:v,...h,children:(0,l.jsx)(_,{signer:n,children:r})})})})};function q(){let e=(0,i.useContext)(P);return(0,c.Z)(e,"useSupportedChains() hook must be used within a <ThirdwebProvider/>"),e.chains}let W={persist:!1},O={cacheKey:(e,t)=>I(T.contract.type(e),t),fetchQuery:async function(e,t){if(!e||!t)return null;try{return await t.resolveContractType(e)}catch(e){return console.error("failed to resolve contract type",e),"custom"}}},D={cacheKey:(e,t)=>I(T.contract.compilerMetadata(e),t),fetchQuery:function(e,t){if(!e||!t)return null;try{return t.getPublisher().fetchCompilerMetadataFromAddress(e)}catch(e){return null}}};function F(e,t){let n=S(),r=(0,a.NL)(),l=B(),u=function(e,t,n){let i=B(),r={...n,enabled:!!(i&&n?.enabled)};return(0,o.a)(I(e,i),t,r)}(["contract-instance",e,{wallet:function(){let e=(0,i.useContext)(Z),t=(0,i.useContext)(f);return t?t.address:((0,c.Z)(e,"useAddress() hook must be used within a <ThirdwebProvider/>"),e.address)}(),walletChainId:function(){let e=(0,i.useContext)(Z),t=(0,i.useContext)(f);return t?t.chainId:((0,c.Z)(e,"useChainId() hook must be used within a <ThirdwebProvider/> or <ThirdwebSDKProvider/> component"),e.chainId)}(),sdkTimestamp:n?._constructedAt,contractTypeOrABI:t},W],async()=>{var i;if(i="contract address is required",(0,c.Z)(null!==e||void 0!==e,i),(0,c.Z)(n,"SDK not initialized"),(0,c.Z)(l,"active chain id is required"),!t||"custom"===t){let t;let i=(0,h.g)(e);if(i)return n.getContract(e,i);let a=await r.fetchQuery(O.cacheKey(e,l),()=>O.fetchQuery(e,n),{cacheTime:1/0,staleTime:1/0});return"custom"===a&&(t=(await r.fetchQuery(D.cacheKey(e,l),()=>D.fetchQuery(e,n),{cacheTime:1/0,staleTime:1/0,retry:0}))?.abi),(0,c.Z)(a,"failed to resolve contract type"),n.getContract(e,t||a)}return n.getContract(e,t)},{keepPreviousData:!0,cacheTime:1/0,staleTime:1/0,enabled:!!e&&!!n&&!!l,retry:0});return{...u,data:u.data,contract:u.data}}function K(){let e=S();return e?.storage}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.