1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6171],{30322:(e,r,t)=>{t.d(r,{Q:()=>i});var a=t(65453),n=t(65192),o=t(4377);let i=(0,a.v)(e=>({targetNetwork:{...n.A.targetNetworks[0],...o.Mr[n.A.targetNetworks[0].id]},setTargetNetwork:r=>e(()=>({targetNetwork:r}))}))},43448:(e,r,t)=>{t.d(r,{x:()=>l});var a=t(12115),n=t(2145),o=t(65192),i=t(30322),c=t(4377);function l(){let{chain:e}=(0,n.F)(),r=(0,i.Q)(e=>{let{targetNetwork:r}=e;return r}),t=(0,i.Q)(e=>{let{setTargetNetwork:r}=e;return r});return(0,a.useEffect)(()=>{let a=o.A.targetNetworks.find(r=>r.id===(null==e?void 0:e.id));a&&a.id!==r.id&&t({...a,...c.Mr[a.id]})},[null==e?void 0:e.id,t,r.id]),(0,a.useMemo)(()=>({targetNetwork:r}),[r])}},68227:(e,r,t)=>{t.d(r,{C:()=>n});var a=t(12115);let n=()=>{let[e,r]=(0,a.useState)(!1);return{copyToClipboard:async e=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>{r(!1)},800)}catch(e){console.error("Failed to copy text:",e)}},isCopiedToClipboard:e}}},71520:(e,r,t)=>{t.d(r,{Mb:()=>f,Mh:()=>u,AX:()=>h,O$:()=>w});var a=t(7441),n=t(35109);let o=e=>{var r,t,o,i,c;let l=(null==e?void 0:e.walk)?e.walk():e;if(l instanceof a.C){if(l.details)return l.details;if(l.shortMessage){if(l instanceof n.M&&l.data&&"Error"!==l.data.errorName){let e=null!==(t=null===(r=l.data.args)||void 0===r?void 0:r.toString())&&void 0!==t?t:"";return"".concat(l.shortMessage.replace(/reverted\.$/,"reverted with the following reason:"),"\n").concat(l.data.errorName,"(").concat(e,")")}return l.shortMessage}return null!==(i=null!==(o=l.message)&&void 0!==o?o:l.name)&&void 0!==i?i:"An unknown error occurred"}return null!==(c=null==l?void 0:l.message)&&void 0!==c?c:"An unknown error occurred"};var i=t(69372),c=t(24578),l=t(67622),s=t(2962),d=t(17475);let u=((e,r)=>{let t={};for(let a of Array.from(new Set([...Object.keys(r),...Object.keys(e)]))){if(!r[a]){t[a]=e[a];continue}let n=Object.fromEntries(Object.entries(r[a]).map(e=>{let[r,t]=e;return[r,{...t,external:!0}]}));t[a]={...e[a],...n}}return t})(d.A,{84532:{DarkToken:{address:"0x0000000000000000000000000000000000000000",abi:[]}}});var f=function(e){return e[e.LOADING=0]="LOADING",e[e.DEPLOYED=1]="DEPLOYED",e[e.NOT_FOUND=2]="NOT_FOUND",e}({});let h=(e,r)=>{let t=o(e);if(/Encoded error signature.*not found on ABI/i.test(t)){let e=t.match(/0x[a-fA-F0-9]{8}/),a=e?e[0]:"";if(!a)return t;try{let e=d.A[r];if(!e)return t;let n={};Object.entries(e).forEach(e=>{let[r,t]=e;t.abi&&t.abi.forEach(e=>{if("error"===e.type){let t=e.name,a=(e.inputs||[]).map(e=>e.type).join(","),o="".concat(t,"(").concat(a,")");n[(0,c.S)((0,l.nj)(o)).slice(0,10)]={name:t,contract:r,signature:o}}})});let o=n[a];if(o)return"Contract function execution reverted with the following reason:\n".concat(o.signature," from ").concat(o.contract," contract");return"".concat(t,"\n\nThis error occurred when calling a function that internally calls another contract. Check the contract that your function calls internally for more details.")}catch(e){console.log("Failed to create error lookup table:",e)}}return t},w=async e=>{let{wagmiConfig:r,writeContractParams:t,chainId:a}=e;try{await (0,s.v)(r,t)}catch(r){let e=h(r,a);throw i.E.error(e),r}}},76171:(e,r,t)=>{t.d(r,{Rk:()=>i,Yb:()=>s,Eu:()=>v,CA:()=>b,HW:()=>C,Z2:()=>B,x:()=>n.x,$C:()=>D});var a=t(12115),n=t(43448),o=t(65996);let i=e=>{let[r,t]=(0,a.useState)([]),{targetNetwork:i}=(0,n.x)(),c=(0,o.e)({chainId:i.id});return(0,a.useEffect)(()=>((async()=>{if(!c)return console.error("Client not found");try{let r=await c.getLogs({address:e,fromBlock:0n,toBlock:"latest"});t(r)}catch(e){console.error("Failed to fetch logs:",e)}})(),null==c?void 0:c.watchBlockNumber({onBlockNumber:async(r,a)=>{let n=await c.getLogs({address:e,fromBlock:a,toBlock:"latest"});t(e=>[...e,...n])}})),[e,c]),r};t(68227);var c=t(74692),l=t(71520);function s(e){var r;let t=(0,c.aq)(),n="string"==typeof e?{contractName:e}:e;(0,a.useEffect)(()=>{"string"==typeof e&&console.warn("Using `useDeployedContractInfo` with a string parameter is deprecated. Please use the object parameter version instead.")},[e]);
1let{contractName:i,chainId:s}=n,d=B(s),u=null===l.Mh||void 0===l.Mh?void 0:null===(r=l.Mh[d.id])||void 0===r?void 0:r[i],[f,h]=(0,a.useState)(l.Mb.LOADING),w=(0,o.e)({chainId:d.id});return(0,a.useEffect)(()=>{(async()=>{try{if(!t()||!w)return;if(!u){h(l.Mb.NOT_FOUND);return}let e=await w.getBytecode({address:u.address});if("0x"===e){h(l.Mb.NOT_FOUND);return}h(l.Mb.DEPLOYED)}catch(e){console.error(e),h(l.Mb.NOT_FOUND)}})()},[t,i,u,w]),{data:f===l.Mb.DEPLOYED?u:void 0,isLoading:f===l.Mb.LOADING}}var d=t(31973),u=t(23968),f=t(71381),h=t(12443),w=t(11266),g=t(4377);let m=(0,d.C)({chain:w.H,mode:"hardhat",transport:(0,u.K)("ws://127.0.0.1:8545")}).extend(f.$).extend(h.D),v=()=>{let[e,r]=(0,a.useState)([]),[t,n]=(0,a.useState)({}),[o,i]=(0,a.useState)(0),[c,l]=(0,a.useState)(0n),[s,d]=(0,a.useState)(null),u=(0,a.useCallback)(async()=>{d(null);try{let e=await m.getBlockNumber();l(e);let t=e-BigInt(20*o),a=Array.from({length:Number(20<t+1n?20:t+1n)},(e,r)=>t-BigInt(r)).map(async e=>{try{return m.getBlock({blockNumber:e,includeTransactions:!0})}catch(e){throw d(e instanceof Error?e:Error("An error occurred.")),e}}),i=await Promise.all(a);i.forEach(e=>{e.transactions.forEach(e=>(0,g.nb)(e))});let c=await Promise.all(i.flatMap(e=>e.transactions.map(async e=>{try{let r=await m.getTransactionReceipt({hash:e.hash});return{[e.hash]:r}}catch(e){throw d(e instanceof Error?e:Error("An error occurred.")),e}})));r(i),n(e=>({...e,...Object.assign({},...c)}))}catch(e){d(e instanceof Error?e:Error("An error occurred."))}},[o]);return(0,a.useEffect)(()=>{u()},[u]),(0,a.useEffect)(()=>{let e=async e=>{try{if(0===o){if(e.transactions.length>0){let r=await Promise.all(e.transactions.map(e=>m.getTransaction({hash:e})));e.transactions=r}e.transactions.forEach(e=>(0,g.nb)(e));let t=await Promise.all(e.transactions.map(async e=>{try{let r=await m.getTransactionReceipt({hash:e.hash});return{[e.hash]:r}}catch(e){throw d(e instanceof Error?e:Error("An error occurred fetching receipt.")),e}}));r(r=>[e,...r.slice(0,19)]),n(e=>({...e,...Object.assign({},...t)}))}e.number&&l(e.number)}catch(e){d(e instanceof Error?e:Error("An error occurred."))}};return m.watchBlocks({onBlock:e,includeTransactions:!0})},[o]),{blocks:e,transactionReceipts:t,currentPage:o,totalBlocks:c,setCurrentPage:i,error:s}};t(51362);var y=t(26715),p=t(13244),E=t(52260);let b=e=>{let{contractName:r,functionName:t,args:n,chainId:o,...i}=e,c=B(o),{data:l}=s({contractName:r,chainId:c.id}),{query:d,watch:u,...f}=i,h=null==u||u,w=(0,p.Q)({chainId:c.id,functionName:t,address:null==l?void 0:l.address,abi:null==l?void 0:l.abi,args:n,...f,query:{enabled:!Array.isArray(n)||!n.some(e=>void 0===e),...d}}),g=(0,y.jE)(),{data:m}=(0,E.y)({watch:h,chainId:c.id,query:{enabled:h}});return(0,a.useEffect)(()=>{h&&g.invalidateQueries({queryKey:w.queryKey})},[m]),w};var k=t(53031),N=t(2145),A=t(68183);function C(e,r){let t="string"==typeof e?{contractName:e,writeContractParams:r,chainId:void 0}:e,{contractName:n,chainId:o,writeContractParams:i}=t,c=(0,k.U)();(0,a.useEffect)(()=>{"string"==typeof e&&console.warn("Using `useScaffoldWriteContract` with a string parameter is deprecated. Please use the object parameter version instead.")},[e]);let{chain:d}=(0,N.F)(),u=D(),[f,h]=(0,a.useState)(!1),w=(0,A.x)(i),m=B(o),{data:v}=s({contractName:n,chainId:m.id}),y=async(e,r)=>{if(!v){g.Ew.error("Target Contract is not deployed, did you forget to run `yarn deploy`?");return}if(!(null==d?void 0:d.id)){g.Ew.error("Please connect your wallet");return}if((null==d?void 0:d.id)!==m.id){g.Ew.error("Wallet is connected to the wrong network. Please switch to ".concat(m.name));return}try{h(!0);let{blockConfirmations:a,onBlockConfirmation:n,...o}=r||{},i={abi:v.abi,address:v.address,...e};return(null==t?void 0:t.disableSimulate)||await (0,l.O$)({wagmiConfig:c,writeContractParams:i,chainId:m.id}),await u(()=>w.writeContractAsync(i,o),{blockConfirmations:a,onBlockConfirmation:n})}catch(e){throw e}finally{h(!1)}};return{...w,isMining:f,writeContractAsync:y,writeContract:(e,r)=>{if(!v){g.Ew.error("Target Contract is not deployed, did you forget to run `yarn deploy`?");return}if(!(null==d?void 0:d.id)){g.Ew.error("Please connect your wallet");return}if((null==d?void 0:d.id)!==m.id){g.Ew.error("Wallet is connected to the wrong network. Please switch to ".concat(m.name));return}w.writeContract({abi:v.abi,address:v.address,...e},r)}}}var O=t(95155),x=t(7569),T=t(7052),I=t(65192),j=t(99621);let M=e=>{let{message:r,blockExplorerLink:t}=e;return(0,O.jsxs)("div",{className:"flex flex-col ml-1 cursor-default",children:[(0,O.jsx)("p",{className:"my-0",children:r}),t&&t.length>0?(0,O.jsx)("a",{href:t,target:"_blank",rel:"noreferrer",className:"block link",children:"check out transaction"}):null]})},D=e=>{let r=e,{data:t}=(0,x.G)();return void 0===r&&t&&(r=t),async(e,t)=>{let a,n;if(!r){g.Ew.error("Cannot access account"),console.error("â¡ï¸ ~ file: useTransactor.tsx ~ error");return}let o=null,i="",c=I.A.targetNetworks[0].id;try{c=await r.getChainId();let l=(0,T.B)(j.G);if(o=g.Ew.loading((0,O.jsx)(M,{message:"Awaiting for user confirmation"})),"function"==typeof e)n=await e();else if(null!=e)n=await r.sendTransaction(e);else throw Error("Incorrect transaction passed to transactor");if(g.Ew.remove(o),i=c?(0,g.NP)(c,n):"",o=g.Ew.loading((0,O.jsx)(M,{message:"Waiting for transaction to complete.",blockExplorerLink:i})),a=await l.waitForTransactionReceipt({hash:n,confirmations:null==t?void 0:t.blockConfirmations}),g.Ew.remove(o),"reverted"===a.status)throw Error("Transaction reverted");g.Ew.success((0,O.jsx)(M,{message:"Transaction completed successfully!",blockExplorerLink:i}),{icon:"\uD83C\uDF89"}),(null==t?void 0:t.onBlockConfirmation)&&t.onBlockConfirmation(a)}catch(r){o&&g.Ew.remove(o),console.error("â¡ï¸ ~ file: useTransactor.ts ~ error",r);let e=(0,l.AX)(r,c);if((null==a?void 0:a.status)==="reverted")throw g.Ew.error((0,O.jsx)(M,{message:e,blockExplorerLink:i})),r;throw g.Ew.error(e),r}return n}};var L=t(30322),P=t(30666);function B(e){let r=(0,L.Q)(e=>{let{targetNetwork:r}=e;return r}),t=I.A.targetNetworks.find(r=>r.id===e);return t?{...t,...P.Mr[t.id]}:r}},99621:(e,r,t)=>{t.d(r,{G:()=>C});
1var a=t(63439),n=t(408),o=t(7764),i=t(95494),c=t(73705),l=t(48532),s=t(31665),d=t(40090),u=t(11266),f=t(65192);let{burnerWalletMode:h,targetNetworks:w}=f.A,g=w.every(e=>e.id===u.H.id),m=[n.d,o.Z,i.J,c.$,l.G,s.H,..."disabled"!==h&&("allNetworks"===h||g)?[d.w]:[]];var v=t(32064),y=t(98078),p=t(61498),E=t(37200),b=t(23953),k=t(4377);let{targetNetworks:N}=f.A,A=N.find(e=>1===e.id)?N:[...N,E.r],C=(0,b.Z)({chains:A,connectors:(0,a.Qq)([{groupName:"Supported Wallets",wallets:m}],{appName:"scaffold-eth-2",projectId:f.A.walletConnectProjectId}),ssr:!0,client:e=>{var r;let{chain:t}=e,a=[(0,v.L)("https://mainnet.rpc.buidlguidl.com")],n=[...t.id===E.r.id?a:[],(0,v.L)()],o=null===(r=f.A.rpcOverrides)||void 0===r?void 0:r[t.id];if(o)n=[(0,v.L)(o),...n];else{let e=(0,k.l7)(t.id);e&&(n=f.A.alchemyApiKey===f.v?[...n,(0,v.L)(e)]:[(0,v.L)(e),...n])}return(0,y.U)({chain:t,transport:(0,p.Np)(n),...t.id!==u.H.id?{pollingInterval:f.A.pollingInterval}:{}})}})}}]);
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.