1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4349],{35695:(e,t,a)=>{"use strict";a.r(t);var l=a(18999),n={};for(let e in l)"default"!==e&&(n[e]=()=>l[e]);a.d(t,n)},66285:(e,t,a)=>{Promise.resolve().then(a.bind(a,82600))},82600:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>d});var l=a(95155),n=a(12115),r=a(35695),s=a(94524),o=a(2145),c=a(76171),i=a(4377);let d=()=>{let e=(0,r.useRouter)(),{address:t,isConnected:a}=(0,o.F)(),[d,x]=(0,n.useState)("0x5dfbd7e43d207f3c1c67e5d81a28593bec0981e7"),[p,b]=(0,n.useState)(""),[u,h]=(0,n.useState)(""),[m,f]=(0,n.useState)("10"),[g,w]=(0,n.useState)("10"),[k,N]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),{data:_}=(0,c.Yb)({contractName:"PenumbraAuction"}),F=null==_?void 0:_.address,[y,E]=(0,n.useState)("form"),[C,A]=(0,n.useState)(null),{data:B}=(0,c.CA)({contractName:"PenumbraToken",functionName:"balanceOf",args:[t]}),{data:P}=(0,c.CA)({contractName:"PenumbraToken",functionName:"allowance",args:[t,F]}),{writeContractAsync:S,isPending:$}=(0,c.HW)({contractName:"PenumbraToken"}),{writeContractAsync:I,isPending:T}=(0,c.HW)({contractName:"PenumbraAuction"}),{data:H}=(0,c.CA)({contractName:"PenumbraAuction",functionName:"nextAuctionId"}),M=p?(0,s.g)(p):0n,D=void 0!==P&&M>0n&&P<M,L=void 0!==B&&M>0n&&B>=M,O=async()=>{if(p&&F){E("approving");try{await S({functionName:"approve",args:[F,M]}),i.Ew.success("Token approval successful!"),E("form")}catch(e){console.error("Approve error:",e),i.Ew.error("Approval failed"),E("form")}}},W=async()=>{if(!p||!u||!m||!g){i.Ew.error("Please fill all required fields");return}let e=BigInt(60*Number(m)),a=BigInt(60*Number(g)),l=(0,s.g)(u),n=void 0!==H?Number(H):null;E("creating");try{if(await I({functionName:"createAuction",args:[d,M,l,e,a]}),i.Ew.success("Auction created on-chain!"),null!==n){E("registering");try{let e=await fetch("/api/auction/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({auctionId:n,sellerAddress:null==t?void 0:t.toLowerCase(),ensName:k||void 0,docCid:v||void 0})});if(e.ok)i.Ew.success("Auction registered with BitGo wallet!");else{let t=await e.json();console.error("Backend registration failed:",t),i.Ew.warning("On-chain auction created but backend registration failed. Auction still works.")}}catch(e){console.error("Backend error:",e),i.Ew.warning("On-chain auction created but backend registration failed.")}A(n),E("done")}else E("done")}catch(e){console.error("Create auction error:",e),i.Ew.error("Auction creation failed"),E("form")}};if(!a)return(0,l.jsx)("div",{className:"flex flex-col items-center justify-center flex-1 py-20 px-4 bg-[#E5E5E5] min-h-screen",children:(0,l.jsxs)("div",{className:"bg-white border-4 border-black shadow-[8px_8px_0px_#0066FF] p-12 flex flex-col items-center max-w-md text-center",children:[(0,l.jsx)("div",{className:"text-6xl mb-6 text-black",children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-24 h-24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a2.25 2.25 0 0 0-2.25-2.25H15a3 3 0 1 1-6 0H5.25A2.25 2.25 0 0 0 3 12m18 0v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6m18 0V9M3 12V9m18 0a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 9m18 0V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v3"})})}),(0,l.jsx)("h2",{className:"text-3xl font-winky font-normal tracking-wide mb-4 text-black uppercase",children:"Connect Wallet"}),(0,l.jsx)("p",{className:"text-base font-bold text-black border-2 border-black px-4 py-2 bg-[#E5E5E5] shadow-[2px_2px_0px_#000]",children:"You need to connect a wallet to create an auction."})]})});if("done"===y&&null!==C)return(0,l.jsx)("div",{className:"flex flex-col items-center justify-center flex-1 py-20 px-4 bg-[#E5E5E5] min-h-screen",children:(0,l.jsxs)("div",{className:"bg-white border-4 border-black shadow-[8px_8px_0px_#0066FF] p-12 flex flex-col items-center max-w-lg text-center",children:[(0,l.jsx)("div",{className:"text-6xl mb-6 text-[#0066FF]",children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:3,stroke:"currentColor",className:"w-24 h-24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),(0,l.jsx)("h2",{className:"text-4xl font-winky font-normal tracking-wide mb-4 text-black uppercase",children:"Auction Created!"}),(0,l.jsxs)("p",{className:"text-xl font-bold mb-8 text-black bg-[#E5E5E5] border-2 border-black px-6 py-2 shadow-[2px_2px_0px_#000]",children:["Auction #",C," is now live."]}),(0,l.jsxs)("div",{className:"flex flex-wrap justify-center gap-4",children:[(0,l.jsx)("button",{onClick:()=>e.push("/auction/".concat(C)),className:"btn bg-[#0066FF] text-white border-2 border-black hover:bg-[#0055DD] rounded-none px-8 text-lg font-black shadow-[4px_4px_0px_#000000] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-[2px_2px_0px_#000000] transition-all",children:"View Auction"}),(0,l.jsx)("button",{onClick:()=>{E("form"),A(null),b(""),h("")},className:"btn bg-white text-black border-2 border-black hover:bg-[#
1E5E5E5] rounded-none px-8 text-lg font-black shadow-[4px_4px_0px_#000000] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-[2px_2px_0px_#000000] transition-all",children:"Create Another"})]})]})});let R=e=>"Configure"===e&&"form"===y||"Approve"===e&&"approving"===y||"Create"===e&&("creating"===y||"registering"===y)||"Done"===e&&"done"===y?"bg-[#0066FF] text-white shadow-[2px_2px_0px_#000] border-black":"bg-white text-black border-black opacity-50";return(0,l.jsx)("div",{className:"flex-1 py-12 px-4 sm:px-6 bg-[#E5E5E5] min-h-screen",children:(0,l.jsxs)("div",{className:"max-w-3xl mx-auto",children:[(0,l.jsxs)("div",{className:"mb-10 text-center",children:[(0,l.jsx)("h1",{className:"font-winky text-5xl md:text-6xl font-normal tracking-wide mb-4 text-black uppercase",children:"Create Auction"}),(0,l.jsx)("p",{className:"text-lg font-bold text-black bg-white border-2 border-black px-6 py-2 inline-block shadow-[4px_4px_0px_#0066FF]",children:"List your ERC-20 tokens for a sealed-bid auction."})]}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2 mb-8",children:["Configure","Approve","Create","Done"].map((e,t)=>(0,l.jsxs)("div",{className:"flex-1 text-center font-black py-2 border-2 transition-all text-sm md:text-base ".concat(R(e)),children:[t+1,". ",e]},e))}),(0,l.jsxs)("div",{className:"bg-white border-4 border-black shadow-[8px_8px_0px_#0066FF] p-6 md:p-10 relative",children:[(0,l.jsx)("div",{className:"absolute -top-4 -right-4 w-8 h-8 bg-[#E60000] border-2 border-black shadow-[2px_2px_0px_#000] z-10 transform rotate-12"}),(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsxs)("div",{className:"form-control",children:[(0,l.jsx)("label",{className:"label px-0 pt-0",children:(0,l.jsx)("span",{className:"label-text font-fira font-bold text-lg text-black uppercase",children:"Token Address"})}),(0,l.jsx)("input",{type:"text",value:d,onChange:e=>x(e.target.value),placeholder:"0x...",className:"input bg-white border-2 border-black rounded-none focus:outline-none focus:ring-0 focus:border-[#0066FF] focus:shadow-[4px_4px_0px_#0066FF] text-black font-fira text-sm w-full transition-all"}),(0,l.jsx)("label",{className:"label px-0 pb-0",children:(0,l.jsx)("span",{className:"label-text-alt font-bold text-black/60",children:"Default: PenumbraToken (PNBR)"})})]}),(0,l.jsxs)("div",{className:"form-control",children:[(0,l.jsxs)("label",{className:"label px-0 pt-0",children:[(0,l.jsx)("span",{className:"label-text font-fira font-bold text-lg text-black uppercase",children:"Token Amount"}),void 0!==B&&(0,l.jsxs)("span",{className:"label-text-alt font-bold bg-[#E5E5E5] border border-black px-2 py-1 text-black",children:["Balance: ",(Number(B)/1e18).toFixed(2)," PNBR"]})]}),(0,l.jsx)("input",{type:"number",value:p,onChange:e=>b(e.target.value),placeholder:"100",min:"0",step:"any",className:"input bg-white border-2 border-black rounded-none focus:outline-none focus:ring-0 focus:border-[#0066FF] focus:shadow-[4px_4px_0px_#0066FF] text-black font-bold text-lg w-full transition-all"}),p&&!L&&(0,l.jsx)("label",{className:"label px-0 pb-0",children:(0,l.jsx)("span",{className:"label-text-alt font-bold text-[#E60000]",children:"Insufficient token balance"})})]}),(0,l.jsxs)("div",{className:"form-control",children:[(0,l.jsx)("label",{className:"label px-0 pt-0",children:(0,l.jsx)("span",{className:"label-text font-fira font-bold text-lg text-black uppercase",children:"Minimum Bid (ETH)"})}),(0,l.jsx)("input",{type:"number",value:u,onChange:e=>h(e.target.value),placeholder:"0.01",min:"0",step:"any",className:"input bg-white border-2 border-black rounded-none focus:outline-none focus:ring-0 focus:border-[#0066FF] focus:shadow-[4px_4px_0px_#0066FF] text-black font-bold text-lg w-full transition-all"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,l.jsxs)("div",{className:"form-control",children:[(0,l.jsx)("label",{className:"label px-0 pt-0",children:(0,l.jsx)("span",{className:"label-text font-black text-lg text-black uppercase",children:"Commit (min)"})}),(0,l.jsx)("input",{type:"number",value:m,onChange:e=>f(e.target.value),placeholder:"10",min:"1",className:"input bg-white border-2 border-black rounded-none focus:outline-none focus:ring-0 focus:border-[#0066FF] focus:shadow-[4px_4px_0px_#0066FF] text-black font-bold text-lg w-full transition-all"})]}),(0,l.jsxs)("div",{className:"form-control",children:[(0,l.jsx)("label",{className:"label px-0 pt-0",children:(0,l.jsx)("span",{className:"label-text font-black text-lg text-black uppercase",children:"Settle (min)"})}),(0,l.jsx)("input",{type:"number",value:g,onChange:e=>w(e.target.value),placeholder:"10",min:"1",className:"input bg-white border-2 border-black rounded-none focus:outline-none focus:ring-0 focus:border-[#0066FF] focus:shadow-[4px_4px_0px_#0066FF] text-black font-bold text-lg w-full transition-all"})]})]}),(0,l.jsx)("div",{className:"mt-4 border-2 border-black bg-[#E5E5E5]",children:(0,l.jsxs)("details",{className:"group",children:[(0,l.jsxs)("summary",{className:"font-black text-lg text-black p-4 cursor-pointer list-none flex justify-between items-center uppercase hover:bg-[#d5d5d5] transition-colors",children:["Optional Fields",(0,l.jsx)("span",{className:"group-open:rotate-180 transition-transform",children:"â¼"})]}),(0,l.jsxs)("div",{className:"p-4 border-t-2 border-black bg-white flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"form-control",children:[(0,l.jsx)("label",{className:"label px-0 pt-0",children:(0,l.jsx)("span",{className:"label-text font-black text-black",children:"ENS NAME"})}),(0,l.jsx)("input",{type:"text",value:k,onChange:e=>N(e.target.value),placeholder:"yourname.eth",className:"input bg-white border-2 border-black rounded-none focus:outline-none focus:ring-0 focus:border-[#0066FF] focus:shadow-[4px_4px_0px_#0066FF] text-black font-bold w-full transition-all"})]}),(0,l.jsxs)("div",{className:"form-control",children:[(0,l.jsx)("label",{className:"label px-0 pt-0",children:(0,l.jsx)("span",{className:"label-text font-black text-black",children:"DOCUMENT CID (IPFS)"})}
1),(0,l.jsx)("input",{type:"text",value:v,onChange:e=>j(e.target.value),placeholder:"bafy...",className:"input bg-white border-2 border-black rounded-none focus:outline-none focus:ring-0 focus:border-[#0066FF] focus:shadow-[4px_4px_0px_#0066FF] text-black font-fira text-sm w-full transition-all"})]})]})]})}),(0,l.jsx)("div",{className:"mt-4",children:D?(0,l.jsx)("button",{onClick:O,disabled:$||!p||!L,className:"w-full py-4 bg-[#FFD700] text-black border-4 border-black font-black text-xl uppercase tracking-wider shadow-[6px_6px_0px_#000000] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-[4px_4px_0px_#000000] disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:$?(0,l.jsx)("span",{className:"loading loading-spinner loading-md"}):"Approve ".concat(p||"0"," PNBR")}):(0,l.jsx)("button",{onClick:W,disabled:T||!p||!u||!m||!g||!L||"form"!==y,className:"w-full py-4 bg-[#0066FF] text-white border-4 border-black font-black text-xl uppercase tracking-wider shadow-[6px_6px_0px_#000000] hover:translate-y-[2px] hover:translate-x-[2px] hover:shadow-[4px_4px_0px_#000000] disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:"creating"===y||"registering"===y?(0,l.jsxs)("span",{className:"flex items-center justify-center gap-3",children:[(0,l.jsx)("span",{className:"loading loading-spinner loading-md"}),"creating"===y?"Creating on-chain...":"Registering backend..."]}):"Create Auction"})}),(0,l.jsxs)("div",{className:"mt-4 border-4 border-black bg-white p-4 shadow-[4px_4px_0px_#000000] relative overflow-hidden",children:[(0,l.jsx)("div",{className:"absolute top-0 right-0 w-16 h-16 bg-[#0066FF] opacity-10 rounded-bl-full"}),(0,l.jsxs)("h3",{className:"font-winky font-normal tracking-wide text-black uppercase mb-2 flex items-center gap-2",children:[(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:3,stroke:"currentColor",className:"w-5 h-5 text-[#0066FF]",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})}),"How it works"]}),(0,l.jsxs)("ul",{className:"text-sm font-bold text-black/80 space-y-1 ml-1",children:[(0,l.jsx)("li",{children:"1. Approve token transfer to the auction contract"}),(0,l.jsx)("li",{children:"2. Create the auction (tokens are locked in the contract)"}),(0,l.jsx)("li",{children:"3. Bidders submit sealed bids privately during the commit phase"}),(0,l.jsx)("li",{children:"4. Backend settles the auction off-chain â bid amounts are never revealed on-chain"}),(0,l.jsx)("li",{children:"5. Winner claims tokens with a ZK proof to a stealth address"})]})]})]})]})]})})}},94524:(e,t,a)=>{"use strict";a.d(t,{g:()=>s});var l=a(77136),n=a(7441);class r extends n.C{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function s(e,t="wei"){return function(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new r({value:e});let[a,l="0"]=e.split("."),n=a.startsWith("-");if(n&&(a=a.slice(1)),l=l.replace(/(0+)$/,""),0===t)1===Math.round(Number(`.${l}`))&&(a=`${BigInt(a)+1n}`),l="";else if(l.length>t){let[e,n,r]=[l.slice(0,t-1),l.slice(t-1,t),l.slice(t)],s=Math.round(Number(`${n}.${r}`));(l=s>9?`${BigInt(e)+BigInt(1)}0`.padStart(e.length+1,"0"):`${e}${s}`).length>t&&(l=l.slice(1),a=`${BigInt(a)+1n}`),l=l.slice(0,t)}else l=l.padEnd(t,"0");return BigInt(`${n?"-":""}${a}${l}`)}(e,l.eL[t])}}},e=>{var t=t=>e(e.s=t);e.O(0,[8451,9288,4730,5616,8378,6135,4377,6171,8441,1684,7358],()=>t(66285)),_N_E=e.O()}]);
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.