PageSourceSearch

https://farcaster.xyz/assets/SettingsConnectedAddressesPage-kZ3KdaqZ.js

js farcaster.xyz collected 2026-10-01 08:56:26 UTC 7,723 bytes, 6 lines download raw bytes

1import{f as w,m as I,r,j as s}from"./vendor-wagmi-CRHMQcRy.js";import{$ as C,eX as k,e0 as U,ad as O,G as A,eY as W,J as B,r as y,bh as v,eZ as K,ak as T,dd as _,Z as b,c3 as $,e_ as q,e$ as Q}from"./index-CjDX1y09.js";import{B as z}from"./BorderedMainContent-B9qGeuWd.js";import{P as L}from"./Page-C2J4bqep.js";import{P as D}from"./PageHeader-CFhDbjgp.js";import{P as H}from"./PageTitle-Cat8u_GY.js";import{S as Y}from"./SettingsPageContent-DAJF-rDi.js";import{u as Z}from"./useComposeVerificationUrl-DJJxkJ_n.js";import{S as G}from"./SettingsNav-BW3qTIgh.js";import{u as J}from"./useInvalidateUser-2aWuWlEQ.js";import{b as j}from"./buildPrimaryAddressKey-BNu3sP-Q.js";import{T as g}from"./trash-2-vKg08iNX.js";import"./vendor-viem-ArXx0jqs.js";import"./vendor-draftjs-CyxKTt2q.js";import"./vendor-charts-BcRAxB9K.js";import"./vendor-privy-DhIdpdpm.js";import"./vendor-solana-CJKAWoEz.js";import"./vendor-emoji-C9KqHmBf.js";import"./ScrollToTop-DxjDDV6u.js";import"./SelectInput-B97m2Zfu.js";const X=({fid:e})=>{const{apiClient:t}=C(),a=w();return I({mutationFn:async l=>{const n=await t.putPrimaryVerification(l);if(n.status!==200)throw new Error("Failed to set primary address");if(n.data.result.success!==!0)throw new Error("Failed to set primary address");return n.data.result},onSuccess:(l,n)=>{a.invalidateQueries({queryKey:k({fid:e})}),a.invalidateQueries({queryKey:U({fid:e})}),n.protocol==="ethereum"&&a.setQueryData(j({fid:e}),{address:n.address}),a.invalidateQueries({queryKey:j({fid:e})})}})},S=()=>{const e=w();return r.useCallback(({fid:t})=>{e.invalidateQueries({queryKey:k({fid:t})})},[e])},ee=()=>{const{apiClient:e}=C(),t=J(),a=S();return r.useCallback(async({fid:l,signerAddress:n,protocol:i})=>{await e.deleteVerification({signerAddress:n,protocol:i}),t({fid:l}),a({fid:l})},[e,t,a])};/**
2 * @license lucide-react v0.487.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const se=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],te=O("ellipsis",se),re=e=>`https://solana.fm/address/${e}`,ae=(e,t=6)=>e.slice(0,t)+"..."+e.slice(-t),ne=(e,t,a=6)=>{switch(t){case"solana":return ae(e,a);case"ethereum":return Q(e,a)}},P={ethereum:"Ethereum",solana:"Solana"},le=(e,t)=>
6{switch(t){case"solana":return re(e);case"ethereum":return q(e)}};function ie({item:e,hasMore:t}){const{fid:a}=A(),[l,n]=r.useState(!1),[i,c]=r.useState(!1),d=r.useRef(null),m=r.useRef(null),f=ee(),x=X({fid:a});r.useEffect(()=>{const o=h=>{d.current&&m.current&&!d.current.contains(h.target)&&!m.current.contains(h.target)&&n(!1)};return l&&document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[l]);const u=r.useCallback(()=>{n(!1),c(!0)},[]),M=r.useCallback(async()=>{await f({fid:a,signerAddress:e.address,protocol:e.protocol}),c(!1),v({message:"Address removed",type:"info"})},[f,a,e]),V=r.useMemo(()=>e.isPrimary?s.jsx("div",{className:"flex items-center rounded-xl bg-pill-active text-pill-active",style:{fontSize:"11px",lineHeight:"16px"},children:s.jsx("p",{className:"mx-2 my-[2px]",children:"Primary"})}):null,[e.isPrimary]),p=r.useCallback(async()=>{n(!1),await x.mutateAsync(e),v({message:"Primary address updated",type:"info"})},[x,e]),E=r.useMemo(()=>{if(!l)return null;const o=!e.isPrimary&&s.jsxs("button",{onClick:p,className:"flex w-full items-center justify-between border-b px-4 py-3 border-default text-default hover:bg-overlay-faint",children:[s.jsx("span",{className:"text-default",children:"Set as Primary"}),s.jsx(K,{width:20,height:20,className:"text-default"})]});return s.jsx("div",{ref:d,className:"absolute right-0 top-8 z-10 min-w-[192px] rounded-lg border shadow-md bg-app border-default",children:s.jsxs("div",{className:"flex flex-col",children:[o,s.jsxs(T,{href:le(e.address,e.protocol),title:"View in Explorer",className:"flex w-full items-center justify-between border-b px-4 py-3 border-default hover:bg-overlay-faint",onClick:()=>n(!1),children:[s.jsx("span",{className:"text-default",children:"View in Explorer"}),s.jsx(_,{size:20,className:"text-default"})]}),s.jsxs("button",{className:"flex w-full items-center justify-between px-4 py-3 hover:bg-overlay-faint",onClick:u,children:[s.jsx("span",{className:"text-danger text-default",children:"Remove address"}),s.jsx(g,{width:20,height:20,className:"text-danger"})]})]})})},[l,u,p,e]),R=r.useMemo(()=>e.label?e.label==="Warpcast Wallet"?"Farcaster Wallet":e.label:ne(e.address,e.protocol,4),[e]),F=e.label==="Farcaster Wallet"||e.label==="Warpcast Wallet";return s.jsxs("div",{className:`flex p-4 ${t?"border-b border-default":""}`,children:[s.jsxs("div",{className:"flex w-full items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-x-2 text-default",children:[s.jsxs("div",{className:"relative",children:[s.jsx(b,{src:`/~/images/protocols-${e.protocol}.png`,alt:P[e.protocol],style:{height:28,width:28}}),F&&s.jsx("div",{className:"absolute bottom-[-4px] right-[-4px]",style:{height:20,width:20},children:s.jsx(b,{src:"/favicon-v3.png",alt:"Farcaster Wallet",className:"object-contain",style:{height:20,width:20}})})]}),s.jsx("p",{className:"text-base",children:R}),V]}),s.jsxs("div",{className:"relative flex",children:[s.jsx("button",{ref:m,className:"cursor-pointer",onClick:()=>n(!l),children:s.jsx(te,{className:"text-muted"})}),E]})]}),i&&s.jsx($,{onCancel:()=>{c(!1)},onConfirm:M,title:"Remove Address",icon:({size:o})=>s.jsx(g,{width:o,height:o,className:"text-danger"}),body:s.jsx("p",{children:"Removes the verified address from your Farcaster profile. You can add it back later by connecting to this wallet again."}),hideAreYouSure:!0,confirmText:"Remove",destructive:!0})]})}function N({protocol:e,items:t}){const a=r.useMemo(()=>t.filter(l=>l.protocol===e),[t,e]);return s.jsxs("div",{className:"mb-3",children:[s.jsx("div",{className:"mb-2 font-medium text-muted",children:P[e]}),s.jsx("div",{className:"w-full rounded-xl border border-default",children:a.map((l,n)=>s.jsx(ie,{item:l,hasMore:n!==a.length-1},l.address))})]})}const oe=r.memo(()=>{const{fid:e}=A(),{data:t}=W({fid:e}),[a,l]=r.useState(!1),n=B(),i=r.useMemo(()=>t?.pages.flatMap(u=>u.result.verifications)||[],[t]),c=Z(),d=S(),m=r.useCallback(async()=>{l(!0);const u=await c();n({to:u,openInNewTab:!0})},[c,n]),f=r.useCallback(()=>{d({fid:e})},[e,d]),x=r.useMemo(()=>a&&i.length===0,[a,i.length]);return s.jsx(L,{meta:{title:"Verified addresses / Farcaster"},children:s.jsxs(r.Suspense,{children:[s.jsx("div",{className:"border-default sm:border-x",children:s.jsx(D,{hideCastButton:!0,children:s.jsx(H,{children:"Settings"})})}),s.jsxs(z,{className:"flex flex-row",children:[s.jsx(G,{}),s.jsxs(Y,{children:[s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"mb-2 text-xl font-semibold",children:"Verified addresses"}),s.jsx("div",{className:"text-muted",children:s.jsx("p",{className:"pb-3 font-normal tracking-[-0.25px]",style:{fontSize:"14px"},children:"Addresses you've proven ownership of on Farcaster. Set one as primary to receive rewards, tips, and tokens."})})]}),s.jsxs("div",{className:"flex flex-col space-y-2",children:[s.jsx(N,{protocol:"ethereum",items:i}),s.jsx(N,{protocol:"solana",items:i}),x&&s.jsx("div",{className:"self-center",children:s.jsx(y,{className:"mt-4 w-min",variant:"muted",onClick:f,children:"Refresh"})})]}),s.jsx("div",{className:"mt-3 w-full",children:s.jsx(y,{size:"md",variant:"normal",className:"w-full",onClick:m,children:"Verify Address"})})]})]})]})})});oe.displayName="SettingsConnectedAddressesPage";export{oe as SettingsConnectedAddressesPage};

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.