(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7869],{45376:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/bridge",function(){return s(17270)}])},68655:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(31134).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},89346:function(e,t,s){"use strict";s.d(t,{Ol:function(){return c},SZ:function(){return o},Zb:function(){return i},aY:function(){return d},eW:function(){return u},ll:function(){return l}});var r=s(85893),a=s(67294),n=s(94777);let i=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...a})});i.displayName="Card";let c=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",s),...a})});c.displayName="CardHeader";let l=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("h3",{ref:t,className:(0,n.cn)("text-2xl font-semibold leading-none tracking-tight",s),...a})});l.displayName="CardTitle";let o=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("p",{ref:t,className:(0,n.cn)("text-sm text-muted-foreground",s),...a})});o.displayName="CardDescription";let d=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("p-6 pt-0",s),...a})});d.displayName="CardContent";let u=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("flex items-center p-6 pt-0",s),...a})});u.displayName="CardFooter"},88860:function(e,t,s){"use strict";s.d(t,{I:function(){return i}});var r=s(85893),a=s(67294),n=s(94777);let i=a.forwardRef((e,t)=>{let{className:s,type:a,...i}=e;return(0,r.jsx)("input",{type:a,className:(0,n.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),ref:t,...i})});i.displayName="Input"},93517:function(e,t,s){"use strict";s.d(t,{SP:function(){return o},dr:function(){return l},mQ:function(){return c},nU:function(){return d}});var r=s(85893),a=s(67294),n=s(82968),i=s(94777);let c=n.fC,l=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(n.aV,{ref:t,className:(0,i.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...a})});l.displayName=n.aV.displayName;let o=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(n.xz,{ref:t,className:(0,i.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",s),...a})});o.displayName=n.xz.displayName;let d=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(n.VY,{ref:t,className:(0,i.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...a})});d.displayName=n.VY.displayName},17270:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return k}});var r=s(85893),a=s(67294),n=s(34240),i=s(89346),c=s(98778),l=s(88860),o=s(68655);let d=(0,s(31134).Z)("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var u=s(74598),m=s(44976),h=s(55678),f=s(25675),x=s.n(f),p=s(93517),b=s(3112),g=s(82020),v=s(54124),y=s(82002),N=s(89810),j=s(78033),w=s(16693),A=s(39625),C=s(50676),S=s(33305),B=s(56334);function k(){let{address:e,isConnected:t}=(0,g.Tj)(),[s,f]=(0,a.useState)("bsc-to-avax"),[k,F]=(0,a.useState)("BSC"),[Y,V]=(0,a.useState)("AVAX"),[O,R]=(0,a.useState)(""),[I,M]=(0,a.useState)("0.004 BNB"),[L,X]=(0,a.useState)("0"),{writeContract:E}=(0,v.S)(),{writeContract:Z}=(0,v.S)(),{writeContract:q}=(0,v.S)(),T=(0,y.x)(),{data:_}=(0,N.u)({address:b.hR,abi:w.Wo,functionName:"balanceOf",args:[e],chainId:56,query:{enabled:t,refetchInterval:3e3,select:e=>e?(0,A.d)(e):"0"}}),{data:K}=(0,N.u)({address:b.ai,abi:w.Wo,functionName:"balanceOf",args:[e],chainId:B.p.id,query:{enabled:t,refetchInterval:3e3,select:e=>e?(0,A.d)(e):"0"}}),{data:P}=(0,N.u)({address:b.hR,abi:w.Wo,functionName:"allowance",args:[e,b.ku],chainId:56,query:{enabled:t,refetchInterval:3e3,select:e=>e?parseFloat((0,A.d)(e)):0}}),{data:W}=(0,j.K)({address:e,chainId:56,query:{refetchInterval:3e3,enabled:t,select:e=>e?(0,A.d)(e.value):"0"}}),{data:z}=(0,j.K)({address:e,chainId:B.p.id,query:{refetchInterval:3e3,enabled:t,select:e=>e?(0,A.d)(e.value):"0"}}),U=()=>"bsc-to-avax"===s?_||"0":K||"0",D=()=>"bsc-to-avax"===s?parseFloat(W||"0"):parseFloat(z||"0"),G=()=>"bsc-to-avax"===s?.004:.05,H=e=>{"bsc-to-avax"===e?(X("0.25"),M("0.004 BNB")):(X("0.1"),M("0.05 AVAX"))};return(0,r.jsx)(n.Z,{children:(0,r.jsxs)("div",{className:"w-full flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("h1",{className:"text-3xl font-bold text-white",children:"Bridge LFY"}),(0,r.jsx)("p",{className:"text-gray-400",children:"Move your LFY tokens between BSC and Avalanche chains"})]}),t?(0,r.jsxs)(i.Zb,{className:"bg-green-900/30 border-green-800/50 backdrop-blur-sm max-w-xl mx-auto w-full",children:[(0,r.jsxs)(i.Ol,{children:[(0,r.jsx)(i.ll,{className:"text-white",children:"Bridge LFY Tokens"}),(0,r.jsx)(i.SZ,{className:"text-gray-400",children:"Transfer your LFY tokens between Binance Smart Chain and Avalanche"})]}),(0,r.jsxs)(i.aY,{className:"space-y-6",children:[(0,r.jsx)(p.mQ,{defaultValue:"bsc-to-avax",value:s,onValueChange:e=>{f(e),"bsc-to-avax"===e?(F("BSC"),V("AVAX")):(F("AVAX"),V("BSC")),H(e),R("")},className:"w-full",children:(0,r.jsxs)(p.dr,{className:"grid w-full grid-cols-2 bg-green-950/50",children:[(0,r.jsx)(p.SP,{value:"bsc-to-avax",className:"data-[state=active]:bg-primary data-[state=active]:text-black",children:"BSC to AVAX"}),(0,r.jsx)(p.SP,{value:"avax-to-bsc",className:"data-[state=active]:bg-primary data-[state=active]:text-black",children:"AVAX to BSC"})]})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(x(),{src:"BSC"===k?"/icons/tokens/bnb.png":"/icons/tokens/avax.png",alt:k,width:20,height:20,className:"rounded-full"}),(0,r.jsxs)("span",{className:"text-sm text-gray-400",children:["From ",k]})]}),(0,r.jsxs)("span",{className:"text-sm text-white",children:["Balance: ",U()," LFY"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(l.I,{type:"number",placeholder:"0.0",value:O,onChange:e=>{R(e.target.value)},className:"bg-green-950/50 border-green-800 text-white"}),(0,r.jsx)(c.z,{variant:"outline",size:"sm",className:"border-green-500 bg-green-900/50 text-white hover:bg-green-800/70",onClick:()=>{R(U())},children:"MAX"})]})]}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)("div",{className:"w-10 h-10 rounded-full bg-green-900/50 flex items-center justify-center",children:(0,r.jsx)(d,{className:"h-6 w-6 text-primary"})})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(x(),{src:"BSC"===Y?"/icons/tokens/bnb.png":"/icons/tokens/avax.png",alt:Y,width:20,height:20,className:"rounded-full"}),(0,r.jsxs)("span",{className:"text-sm text-gray-400",children:["To ",Y]})]}),(0,r.jsxs)("span",{className:"text-sm text-white",children:["Balance: ","bsc-to-avax"===s?K||"0":_||"0"," LFY"]})]}),(0,r.jsx)(l.I,{type:"text",readOnly:!0,value:O||"0.0",className:"bg-green-950/50 border-green-800 text-white"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-2 bg-green-950/50 border border-green-800 rounded-md p-3",children:[(0,r.jsx)(u.Z,{className:"h-4 w-4 text-primary flex-shrink-0 mt-0.5"}),(0,r.jsxs)("div",{className:"text-sm text-gray-300 space-y-1",children:[(0,r.jsxs)("p",{children:["Gas cost: ",(0,r.jsx)("span",{className:"text-white font-medium",children:I})]}),(0,r.jsxs)("p",{children:["Your ","BSC"===k?"BNB":"AVAX"," balance:"," ",(0,r.jsxs)("span",{className:"text-white font-medium",children:[D().toFixed(5)," ","BSC"===k?"BNB":"AVAX"]})]}),D(){if(!O||0>=Number.parseFloat(O)){h.Am.error("Please enter a valid amount");return}if("BSC"===k&&(P||0)=Number.parseFloat(O)||D(){if(this.#r&&this.hasListeners()){let t=this.#t.variables,s=this.#t.context;e?.type==="success"?(this.#r.onSuccess?.(e.data,t,s),this.#r.onSettled?.(e.data,null,t,s)):e?.type==="error"&&(this.#r.onError?.(e.error,t,s),this.#r.onSettled?.(void 0,e.error,t,s))}this.listeners.forEach(e=>{e(this.#t)})})}},o=s(30202),d=s(86290),u=s(82693),m=s(37122);function h(e={}){var t;let{mutation:s}=e,a=(t=(0,m.Z)(e),{mutationFn:e=>(0,u.n)(t,e),mutationKey:["writeContract"]}),{mutate:i,mutateAsync:c,...h}=function(e,t){let s=(0,o.NL)(void 0),[a]=r.useState(()=>new l(s,e));r.useEffect(()=>{a.setOptions(e)},[a,e]);let i=r.useSyncExternalStore(r.useCallback(e=>a.subscribe(n.Vr.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),c=r.useCallback((e,t)=>{a.mutate(e,t).catch(d.Z)},[a]);if(i.error&&(0,d.L)(a.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:c,mutateAsync:i.mutate}}({...s,...a});return{...h,writeContract:i,writeContractAsync:c}}}},function(e){e.O(0,[9221,5666,3043,6525,2888,9774,179],function(){return e(e.s=45376)}),_N_E=e.O()}]);