PageSourceSearch

https://seer-pm.netlify.app/assets/entries/src_pages_claim_-code.CE5uRPHP.js

js seer-pm.netlify.app collected 2026-10-03 11:23:38 UTC 17,360 bytes, 1 lines download raw bytes

1import{K as H,h as l,j as e,a0 as x,W as E,k as S,u as Y,_ as B,ab as L,T as J,a1 as X,aM as Z,aN as P,aO as z,e as ee,aP as se,o as te,a as V,aQ as ae,X as ne,Y as ie,Z as re}from"../chunks/chunk-Cc_hGA4j.js";import{I as oe}from"../chunks/chunk-ofJF75QI.js";import{u as le}from"../chunks/chunk-CzhTCTn9.js";import"../chunks/chunk-B2Os9g2n.js";/* empty css                      *//* empty css                      */globalThis.process=globalThis.process||{env:{}};var $,I,O;const de=((O=(I=($=X[se.id])==null?void 0:$.blockExplorers)==null?void 0:I.default)==null?void 0:O.url)??"https://gnosisscan.io",D=s=>["useCreditCard",s],M="cubic-bezier(0.16, 1, 0.3, 1)";function ce(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ue(s){return Y({queryKey:D(s),enabled:!!s,retry:!1,queryFn:async()=>{const t=await fetch(`${V()}/.netlify/functions/credit-card?code=${encodeURIComponent(s)}`),a=await t.json();if(!t.ok&&t.status!==404)throw new Error(a.error??"Failed to load card");return a},refetchInterval:t=>{const a=t.state.data;if((a==null?void 0:a.state)!=="claimed")return!1;const n=i=>i==="pending"||i==="sent";return n(a.data.status)||n(a.data.dripStatus)?4e3:!1}})}function me(s,t){const a=te();return le({mutationFn:async n=>{const i=await fetch(`${V()}/.netlify/functions/claim-credit-card`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:s,address:n})}),r=await i.json();if(!i.ok&&!r.state)throw new Error(r.error??"Failed to claim card");return r},onSuccess:n=>{n.state==="claimed"&&!n.error?(t(),a.setQueryData(D(s),n)):a.invalidateQueries({queryKey:D(s)})}})}function he(s,t){const[a,n]=l.useState(t?0:s);return l.useEffect(()=>{if(!t||ce()){n(s);return}let i=0;const r=performance.now(),m=1100,u=h=>{const c=Math.min(1,(h-r)/m);n(Math.round(s*(1-2**(-10*c)))),c<1?i=requestAnimationFrame(u):n(s)};return i=requestAnimationFrame(u),()=>cancelAnimationFrame(i)},[s,t]),a}function j(s){return`$${s.toLocaleString("en-US",{maximumFractionDigits:0})}`}function xe(s){return ae(s).slice(2).match(/.{1,4}/g).join(" ")}function b({children:s,busy:t}){return e.jsx("div",{className:"container-fluid py-[24px] lg:py-[65px]",children:e.jsx("div",{className:"max-w-[480px] mx-auto card shadow-sm border border-separator-100 bg-base-100 p-5 lg:p-8 space-y-6","aria-busy":t||void 0,children:s})})}function C({serial:s,campaignName:t,amount:a,revealing:n=!1,pending:i=!1}){const[r,m]=l.useState(!n);l.useEffect(()=>{if(!n)return;const h=requestAnimationFrame(()=>m(!0));return()=>cancelAnimationFrame(h)},[n]);const u=he(a??0,n);return e.jsxs("div",{className:"relative overflow-hidden rounded-xl bg-purple-dark text-white shadow-[0_12px_32px_-12px_rgba(89,9,126,0.55)] aspect-[2] sm:aspect-[1.7] p-5 flex flex-col justify-between",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx(z,{width:"76px",height:"35px",className:"-ml-1 -mt-1 shrink-0"}),e.jsxs("div",{className:"text-right min-w-0",children:[s&&e.jsx("p",{className:"font-mono text-[13px] tracking-wide tabular-nums text-white/85",children:s}),t&&e.jsx("p",{className:"text-[13px] text-white/75 truncate",children:t})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] text-white/75",children:"Trading credits"}),a===void 0?e.jsxs("p",{className:"text-[44px] leading-none font-semibold tracking-tight",children:[e.jsx("span",{className:"sr-only",children:"Amount hidden until you claim"}),e.jsx("span",{"aria-hidden":!0,className:ee("inline-block select-none blur-[10px] opacity-70",i&&"animate-pulse"),children:"$88"})]}):e.jsxs("p",{className:"text-[44px] leading-none font-semibold tracking-tight tabular-nums",children:[e.jsx("span",{className:"sr-only",children:j(a)}),e.jsx("span",{"aria-hidden":!0,className:"inline-block motion-reduce:!transition-none motion-reduce:!blur-none",style:{filter:r?"blur(0)":"blur(10px)",opacity:r?1:.6,transition:`filter 700ms ${M}, opacity 700ms ${M}`},children:j(u)})]})]}),e.jsx(z,{width:"300px",height:"139px",fill:"rgba(255,255,255,0.06)",className:"pointer-events-none absolute -right-[176px] -bottom-8"})]})}function U({title:s,children:t,action:a,card:n}
1){return e.jsxs(b,{children:[n&&e.jsx(C,{serial:n.serial,campaignName:n.campaignName}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-semibold text-balance",children:s}),e.jsx("div",{className:"text-base-content/80 space-y-2",children:t})]}),a]})}function g({href:s,children:t}){return e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"font-semibold text-purple-primary dark:text-purple-secondary underline underline-offset-2 decoration-1 hover:decoration-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-primary rounded-sm",children:t})}function pe(s){return s.message==="Invalid address"?"That address is not valid. Check it and try again.":"We could not reach Seer to claim your card. Check your connection and try again; the card is still yours to claim."}function fe({code:s,card:t,onClaimed:a}){var F;const{address:n}=B(),{open:i}=Z(),[r,m]=l.useState(""),[u,h]=l.useState(!1),[c,f]=l.useState(!1),[v,y]=l.useState(!1),k=l.useRef(null),R=l.useRef(null),o=me(s,a),_=u||!n,T=r.trim(),N=_?T:n??"",p=P(N),q=o.data&&o.data.state!=="claimed"?o.data.error:void 0,w=o.error?pe(o.error):q;l.useEffect(()=>{var d;c&&((d=R.current)==null||d.focus())},[c]);const Q=()=>{var d;if(!p){y(!0),(d=k.current)==null||d.focus();return}f(!0)},W=async()=>{var d;try{const A=(await navigator.clipboard.readText()).trim();m(A),y(!!A&&!P(A))}catch{(d=k.current)==null||d.focus()}},G=typeof navigator<"u"&&!!((F=navigator.clipboard)!=null&&F.readText),K=(t==null?void 0:t.minUsd)!=null&&(t==null?void 0:t.maxUsd)!=null?`between ${j(t.minUsd)} and ${j(t.maxUsd)}`:"a surprise amount";return e.jsxs(b,{children:[e.jsx(C,{serial:t==null?void 0:t.serial,campaignName:t==null?void 0:t.campaignName,pending:o.isPending}),c&&p?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{ref:R,tabIndex:-1,className:"text-2xl font-semibold outline-none",children:"Send your credits here?"}),e.jsx("p",{className:"text-base-content/80",children:"Credits go out on Gnosis Chain and cannot be sent back."})]}),e.jsxs("div",{className:"rounded-lg bg-base-200 p-4 space-y-1",children:[e.jsx("p",{className:"text-sm text-base-content/70",children:"Recipient on Gnosis Chain"}),e.jsxs("p",{className:"font-mono text-[15px] leading-relaxed tracking-wide break-words",children:[e.jsx("span",{className:"text-base-content/70",children:"0x"})," ",xe(N)]})]}),e.jsx("p",{className:"text-sm text-base-content/80",children:"Use a wallet you control. An exchange deposit address may never credit these tokens, and the card cannot be claimed again."}),w&&e.jsx("p",{role:"alert",className:"text-sm text-error-primary",children:w}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{text:o.isPending?"Revealing…":"Reveal my credits",type:"button",className:"w-full",isLoading:o.isPending,onClick:()=>o.mutate(N)}),e.jsx(x,{text:"Change address",type:"button",variant:"secondary",className:"w-full",disabled:o.isPending,onClick:()=>{o.reset(),f(!1)}})]})]}):e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-semibold text-balance",children:"Reveal your Seer credits"}),e.jsxs("p",{className:"text-base-content/80",children:["This card holds ",K," in credits for trading on Seer prediction markets. Choose where to send them, then reveal the amount."]})]}),_?e.jsxs("div",{className:"space-y-4",children:[!n&&e.jsxs(e.Fragment,{children:[e.jsx(x,{text:"Connect a wallet",type:"button",className:"w-full",onClick:()=>i()}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-base-content/70","aria-hidden":!0,children:[e.jsx("span",{className:"h-px flex-1 bg-separator-100"}),"or",e.jsx("span",{className:"h-px flex-1 bg-separator-100"})]})]}),e.jsxs("form",{className:"space-y-3",noValidate:!0,onSubmit:d=>{d.preventDefault(),Q()},children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:"claim-address",className:"text-sm font-semibold block",children:"Paste a Gnosis Chain address"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(oe,{ref:k,id:"claim-address",className:"w-full font-mono",placeholder:"0x…",value:r,autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,"aria-invalid":v&&!p,"aria-describedby":v&&!p?"claim-address-error":void 0,onChange:d=>{m(d.target.value),v&&P(d.target.value.trim())&&y(!1)},onBlur:()=>y(!!T&&!p)})}),G&&e.jsx(x,{text:"Paste",type:"button",variant:"secondary",className:"!min-w-0",onClick:W})]}),v&&!p&&e.jsx("p",{id:"claim-address-error",className:"text-sm text-error-primary",children:T?"This is not a valid address. It should start with 0x and have 42 characters.":"Paste an address first."})]}),e.jsx(x,{text:"Continue",type:"submit",variant:n?"primary":"secondary",className:"w-full"})]}),n&&e.jsx(x,{text:"Use my connected wallet",type:"button",variant:"secondary",className:"w-full",onClick:()=>{h(!1),y(!1)}})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-lg bg-base-200 p-4 space-y-1",children:[e.jsx("p",{className:"text-sm text-base-content/70",children:"Sending to your connected wallet"}),e.jsx("p",{className:"font-mono text-[15px] break-all",children:n})]}),w&&e.jsx("p",{role:"alert",className:"text-sm text-error-primary",children:w}),e.jsx(x,{text:o.isPending?"Revealing…":"Reveal my credits",type:"button",className:"w-full",isLoading:o.isPending,onClick:()=>o.mutate(N)}),e.jsx(x,{text:"Send to another address",type:"button",variant:"secondary",className:"w-full",disabled:o.isPending,onClick:()=>h(!0)})]}),e.jsxs("div",{className:"text-sm text-base-content/70 space-y-1 border-t border-separator-100 pt-4",children:[e.jsx("p",{children:"Free to claim: no signature and no gas fees. Each card can be claimed once."}),!n&&e.jsxs("p",{children:["New to wallets? ",e.jsx(g,{href:S.beginnerGuide(),children:"Find one to get started"})]})]})]})]})}
1function ye(s){return Number(s).toLocaleString("en-US",{maximumFractionDigits:2})}function ge(s){return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function je({card:s,justClaimed:t}){var c;const{address:a}=B(),n=l.useRef(null),i=s.status==="pending"||s.status==="sent",r=s.claimedBy?L(s.claimedBy):"your wallet",m=t||!!a&&a.toLowerCase()===((c=s.claimedBy)==null?void 0:c.toLowerCase());l.useEffect(()=>{var f;t&&((f=n.current)==null||f.focus())},[t]);const u=s.credits&&Number(s.credits)>0?s.amountUsd/Number(s.credits):null;if(!m)return e.jsxs(b,{children:[e.jsx(C,{serial:s.serial,campaignName:s.campaignName,amount:s.amountUsd}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"This card was already claimed"}),e.jsxs("p",{className:"text-base-content/80",children:[s.claimedAt?`Claimed on ${ge(s.claimedAt)}`:"Claimed",s.claimedBy&&e.jsxs(e.Fragment,{children:[" ","by ",e.jsx("span",{className:"font-mono",children:L(s.claimedBy)})]}),". If that was you, connect that wallet to see your delivery."]})]}),e.jsx(E,{text:"Explore Seer markets",to:"/",variant:"secondary",className:"w-full"})]});const h=s.status==="confirmed"?"Your credits are in your wallet":s.status==="failed"?"Your credits did not arrive":"Sending your credits";return e.jsxs(b,{children:[e.jsx(C,{serial:s.serial,campaignName:s.campaignName,amount:s.amountUsd,revealing:t}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{ref:n,tabIndex:-1,className:"text-2xl font-semibold outline-none",children:h}),s.credits&&e.jsxs("p",{className:"text-base-content/80",children:[j(s.amountUsd)," became ",e.jsxs("strong",{children:[ye(s.credits)," Seer credits"]}),".",u&&` Each credit is backed by 1 sDAI, worth about $${u.toFixed(2)} today.`]})]}),e.jsxs("output",{"aria-live":"polite",className:"block rounded-lg bg-base-200 p-4 space-y-2 text-[15px]",children:[i&&e.jsxs("p",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"loading loading-spinner loading-xs mt-1 shrink-0","aria-hidden":!0}),e.jsxs("span",{children:["Sending to ",r,". This usually takes less than a minute."]})]}),s.status==="confirmed"&&e.jsxs("p",{className:"flex items-start gap-2",children:[e.jsx(J,{width:16,height:16,className:"mt-1 shrink-0 text-success-primary","aria-hidden":!0}),e.jsxs("span",{children:["Delivered to ",r,"."," ",s.txHash&&e.jsx(g,{href:`${de}/tx/${s.txHash}`,children:"View transaction"})]})]}),s.status==="failed"&&e.jsxs("p",{children:["The transfer to ",r," did not go through, and the card stays reserved for that address. Message us on"," ",e.jsx(g,{href:S.discord(),children:"Discord"})," with card"," ",e.jsx("span",{className:"font-mono",children:s.serial})," and we will send it again."]}),(s.dripStatus==="pending"||s.dripStatus==="sent")&&e.jsx("p",{className:"text-base-content/80",children:"A little xDAI to pay gas fees is on its way too."}),s.dripStatus==="confirmed"&&e.jsx("p",{className:"text-base-content/80",children:"We also sent a little xDAI so you can pay gas fees."}),s.dripStatus==="failed"&&s.status!=="failed"&&e.jsxs("p",{className:"text-base-content/80",children:["The xDAI for gas fees did not go through. Message us on ",e.jsx(g,{href:S.discord(),children:"Discord"})," ","with card ",e.jsx("span",{className:"font-mono",children:s.serial})," if you need it."]})]}),s.status==="confirmed"&&e.jsx(E,{text:"Start trading",to:"/",className:"w-full"})]})}function be(){return e.jsxs(b,{busy:!0,children:[e.jsx("div",{className:"shimmer-container aspect-[2] sm:aspect-[1.7] rounded-xl","aria-hidden":!0}),e.jsxs("div",{className:"space-y-3","aria-hidden":!0,children:[e.jsx("div",{className:"shimmer-container h-8 w-3/4 rounded"}),e.jsx("div",{className:"shimmer-container h-5 w-full rounded"}),e.jsx("div",{className:"shimmer-container h-5 w-2/3 rounded"})]}),e.jsx("div",{className:"shimmer-container h-[45px] rounded","aria-hidden":!0}),e.jsx("output",{className:"sr-only",children:"Loading your card…"})]})}function ve(){var c;const{routeParams:s}=H(),t=s.code??"",{data:a,isLoading:n,error:i,refetch:r,isRefetching:m}=ue(t),[u,h]=l.useState(!1);return n?e.jsx(be,{}):i||!a?e.jsx(U,{title:"We could not load this card",action:e.jsx(x,{text:"Try again",type:"button",className:"w-full",isLoading:m,onClick:()=>r()}),children:e.jsx("p",{children:"Check your connection and try again. Nothing has been claimed yet."})}):a.state==="not_found"?e.jsx(U,{title:"This card link does not work",action:e.jsx(E,{text:"Explore Seer markets",to:"/",variant:"secondary",className:"w-full"}),children:e.jsx("p",{children:"The link does not match any Seer card. Scan the QR code again and make sure the whole link opened in your browser."})}):a.state==="inactive"?e.jsxs(U,{title:"This card is not active yet",card:a.card,children:[e.jsx("p",{children:"Cards are switched on when they are handed out, and n
1obody can claim this one until then. Open this link again later."}),e.jsxs("p",{children:["Still inactive after the event? Ask us on ",e.jsx(g,{href:S.discord(),children:"Discord"}),((c=a.card)==null?void 0:c.serial)&&e.jsxs(e.Fragment,{children:[" ","with card ",e.jsx("span",{className:"font-mono",children:a.card.serial})]}),"."]})]}):a.state==="claimed"?e.jsx(je,{card:a.data,justClaimed:u}):e.jsx(fe,{code:t,card:a.state==="valid"?a.card:void 0,onClaimed:()=>h(!0)})}const Ne=Object.freeze(Object.defineProperty({__proto__:null,default:ve},Symbol.toStringTag,{value:"Module"})),we="Claim your Seer credits | Seer",Se=Object.freeze(Object.defineProperty({__proto__:null,default:we},Symbol.toStringTag,{value:"Module"})),Ee={isClientRuntimeLoaded:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:!0}},onBeforeRenderEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:null}},dataEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:null}},onRenderClient:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/__internal/integration/onRenderClient",fileExportPathToShowToUser:[]},valueSerialized:{type:"pointer-import",value:re}},Page:{type:"standard",definedAtData:{filePathToShowToUser:"/src/pages/claim/@code/+Page.tsx",fileExportPathToShowToUser:[]},valueSerialized:{type:"plus-file",exportValues:Ne}},hydrationCanBeAborted:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/config",fileExportPathToShowToUser:["default","hydrationCanBeAborted"]},valueSerialized:{type:"js-serialized",value:!0}},Layout:{type:"cumulative",definedAtData:[{filePathToShowToUser:"/src/components/Layout/Layout.tsx",fileExportPathToShowToUser:[]}],valueSerialized:[{type:"pointer-import",value:ie}]},title:{type:"standard",definedAtData:{filePathToShowToUser:"/src/pages/claim/@code/+title.ts",fileExportPathToShowToUser:[]},valueSerialized:{type:"plus-file",exportValues:Se}},Loading:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/__internal/integration/Loading",fileExportPathToShowToUser:[]},valueSerialized:{type:"pointer-import",value:ne}}};export{Ee as configValuesSerialized};

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.