PageSourceSearch

https://www.meteora.ag/_next/static/chunks/pages/dev/create-auth-session-demo-aa9e57d5eb4b4e50.js

js meteora.ag collected 2026-09-25 01:04:09 UTC 7,465 bytes, 1 lines download raw bytes

1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f7413ff1-29fe-45f5-bf28-1421aedec581",e._sentryDebugIdIdentifier="sentry-dbid-f7413ff1-29fe-45f5-bf28-1421aedec581")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8808],{5843:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/dev/create-auth-session-demo",function(){return s(92289)}])},92289:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var a=s(94458),r=s(68658),n=s(78308),o=s(62548),i=s(19688),l=s(73128),c=s(72149),d=s(99608),u=s(92654);let g=[void 0,"referral","alerts"];function m(){let e=(0,o.useRouter)();return((0,r.useEffect)(()=>{u.LE||e.replace("/")},[e]),u.LE)?(0,a.jsx)(h,{"data-sentry-element":"CreateAuthSessionDemoContent","data-sentry-component":"CreateAuthSessionDemoPage","data-sentry-source-file":"create-auth-session-demo.tsx"}):null}function h(){var e;let{publicKey:t,signMessage:s,signTransaction:o,wallet:u}=(0,i.vT)(),[m,h]=(0,r.useState)(),[p,f]=(0,r.useState)(!1),[x,y]=(0,r.useState)(""),b=(0,n.n)((0,d.z)(m)),w=(e,t)=>y("> ".concat(e,"\n").concat(JSON.stringify(t,null,2),"\n")),v=async()=>{if(!t||!(null==u?void 0:u.adapter))return void w("error",{message:"connect a wallet first"});try{let e=await b.mutateAsync(p?{isLedger:!0,walletPubkey:t,signTransaction:o,walletAdapter:u.adapter}:{isLedger:!1,walletPubkey:t,signMessage:s,walletAdapter:u.adapter});w("createAuthSession success",e)}catch(e){w("createAuthSession error",e instanceof Error?{name:e.name,message:e.message}:e)}};return(0,a.jsx)("div",{className:"min-h-screen bg-v2-base--2 p-8","data-sentry-component":"CreateAuthSessionDemoContent","data-sentry-source-file":"create-auth-session-demo.tsx",children:(0,a.jsxs)("div",{className:"max-w-3xl mx-auto flex flex-col gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-3xl font-bold text-v2-text-primary mb-2",children:"createAuthSessionMutation — Demo"}),(0,a.jsxs)("p",{className:"text-v2-text-secondary",children:["Connected wallet:"," ",(0,a.jsx)("span",{className:"font-mono text-v2-text-primary",children:null!=(e=null==t?void 0:t.toBase58()
1)?e:"— not connected —"})]})]}),(0,a.jsxs)("div",{className:"p-4 bg-container-main rounded-lg border border-stroke flex flex-col gap-4",children:[(0,a.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-v2-text-secondary",children:[(0,a.jsx)("span",{children:"audience (changes token lifetime)"}),(0,a.jsx)("select",{className:"rounded-md bg-v2-base--1 border border-stroke px-3 py-2 text-sm text-v2-text-primary outline-none focus:border-v2-accent-400-base",value:m,onChange:e=>h(e.target.value),children:g.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm text-v2-text-primary",children:[(0,a.jsx)("input",{type:"checkbox",checked:p,onChange:e=>f(e.target.checked)}),"Using Ledger? (signs a transaction instead of a message)"]}),(0,a.jsxs)("div",{className:"rounded-md border border-stroke bg-v2-base--1 px-3 py-2 text-xs flex items-center justify-between",children:[(0,a.jsx)("span",{className:"font-mono text-v2-text-primary",children:"status"}),(0,a.jsx)("span",{className:"text-v2-text-secondary",children:b.status})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(l.$,{variant:"primary",size:"sm",disabled:!t||b.isLoading,onClick:v,"data-sentry-element":"Button","data-sentry-source-file":"create-auth-session-demo.tsx",children:b.isLoading?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.A,{spinnerColor:"#f76727",baseColor:"rgba(248, 130, 78, 0.25)",width:14,height:14}),"Signing..."]}):"Create Auth Session"}),(0,a.jsx)(l.$,{variant:"neutral-outline",size:"sm",onClick:()=>b.reset(),"data-sentry-element":"Button","data-sentry-source-file":"create-auth-session-demo.tsx",children:"reset"})]})]}),(0,a.jsxs)("div",{className:"p-4 bg-container-main rounded-lg border border-stroke",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-v2-text-primary mb-3",children:"Output"}),(0,a.jsx)("pre",{className:"text-xs text-v2-text-secondary overflow-auto max-h-[480px] p-4 bg-v2-base--1 rounded-lg whitespace-pre-wrap break-all",children:x||"— no output yet —"})]})]})})}},99608:(e,t,s)=>{"use strict";s.d(t,{z:()=>p});var a=s(71682),r=s(73368),n=s(83944),o=s.n(n),i=s(98889),l=s(27190),c=s(47278),d=s(16473),u=s(72076).Buffer;let g=new c.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");class m{buildAuthChallengeTransactionPayload(e){let{encodedMessage:t}=this.buildAuthChallengeMessagePayload(),s=new c.Transaction().add(new c.TransactionInstruction({programId:g,keys:[],data:u.from(t)}));return s.recentBlockhash="11111111111111111111111111111111",s.feePayer=e,s}buildAuthChallengeMessagePayload(){let e="Verify Ownership of Wallet\nIssued At: ".concat(new Date().toISOString());return{message:e,encodedMessage:new TextEncoder().encode(e)}}async createAuthSession(e){let{proof:t,audience:s}=e;return(await d.A.post("".concat("https://auth.meteora.ag","/api/v1/auth/verify"),{proof:t,audience:s})).data}}var h=s(88704);let p=e=>({mutationKey:["create-auth-session",e],mutationFn:async t=>{var s,n;let c,d=new i.F("rpc","Authentication"),u=new m;if(!0===t.isLedger){if(!t.signTransaction){let e=Error("Wallet does not support Sign Transaction");throw d.error({description:"Wallet does not support signing transation. Please try a different wallet.",errorInfo:{error:e,wallet:t.walletAdapter.name}}),e}d.signing({title:"Signing",description:"Confirm in ".concat(null!=(s=t.walletAdapter.name)?s:"your wallet"," to prove it's you. Nothing gets sent on-chain.")});let e=u.buildAuthChallengeTransactionPayload(t.walletPubkey);try{let s=await t.signTransaction(e);c={method:"signTransaction",publicKey:t.walletPubkey.toBase58(),transaction:s.serialize().toString("base64")}}catch(e){throw e instanceof r.m7?new l.z(e).isUserRejectionError()?d.walletRejectionError({description:e.message}):d.error({description:e.message,errorInfo:{error:e.name,errorMessage:e.message,stack:e.stack,cause:e.cause}}):d.error({description:"Unable to sign transaction.",errorInfo:{error:e}}),e}}else{if(!t.signMessage){let e=Error("Wallet does not support Sign Message");throw d.error({description:"Wallet does not support signing message. Please toggle on 'Using Ledger?' or try a different wallet.",errorInfo:{error:e,wallet:t.walletAdapter.name}}),e}d.signing({title:"Signing",description:"Connecting to ".concat(null!=(n=t.walletAdapter.name)?n:"wallet")});let{message:e,encodedMessage:s}=u.buildAuthChallengeMessagePayload();try{let a=await t.signMessage(s);c={method:"signMessage",publicKey:t.walletPubkey.toBase58(),message:e,signature:o().encode(a)}}catch(e){throw e instanceof r.m7?new l.z(e).isUserRejectionError()?d.walletRejectionError({description:e.message}):d.error({description:e.message,errorInfo:{error:e.name,errorMessage:e.message,stack:e.stack,cause:e.cause}}):d.error({description:"Unable to sign message.",errorInfo:{error:e}}),e}}try{let t=await u.createAuthSession({proof:c,audience:e});return a.Zs.set((0,h._8)(e),()=>
1t),d.success({title:"Signed",description:"Wallet verified",signatures:[]}),t}catch(e){throw d.error({description:"Failed to authenticate",errorInfo:{error:e}}),e}}})}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=5843)),_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.