import{W as i,c as d,g as p,a as m,p as g,M as u,B as h,b as l,s as n,d as f,e as c,T as y,f as C}from"./index-BgvJrIu2.js";const S=({solanaWallet:a,walletDetailsParams:o,connection:r})=>d(t=>({...o,isSolanaConnector:!0,id:a.adapter.name,name:a.adapter.name,type:a.adapter.name,showQrModal:!1,sendTransaction:async e=>{const s=y.from(C.from(e,"hex"));return await a.adapter.sendTransaction(s,r)},connect:async()=>(t.emitter.emit("message",{type:"connecting"}),c("sk-widget@1//shimDisconnect/solana",!0),await a.adapter.connect(),{accounts:[a.adapter.publicKey?.toBase58()],chainId:n.id}),disconnect:()=>(c("sk-widget@1//shimDisconnect/solana",!1),a.adapter.disconnect()),getAccounts:async()=>f.fromNullable(a.adapter.publicKey?.toBase58()).map(e=>[e]).unsafeCoerce(),switchChain:async()=>n,getChainId:async()=>n.id,isAuthorized:async()=>l("sk-widget@1//shimDisconnect/solana").map(e=>!!(e&&a.adapter.connected&&a.adapter.publicKey?.toBase58())).orDefault(!1),onAccountsChanged:e=>{e.length===0?t.emitter.emit("disconnect"):t.emitter.emit("change",{accounts:e})},onChainChanged:e=>{t.emitter.emit("change",{chainId:e})},onDisconnect:()=>{t.emitter.emit("disconnect")},getProvider:async()=>({}),$filteredChains:new h([n]).asObservable()})),k=({wallets:a,forceWalletConnectOnly:o,connection:r,variant:t})=>({groupName:"Solana",wallets:o?[]:a.filter(e=>t==="porto"?e.adapter instanceof i:!0).map(e=>()=>({id:e.adapter.name,name:t==="porto"?"Porto":e.adapter.name,iconUrl:t==="porto"?g:e.adapter.icon,iconBackground:t==="porto"?"#000":"#fff",chainGroup:{iconUrl:m(u.Solana),title:"Solana",id:"solana"},installed:e.readyState==="Installed"||e.readyState==="Loadable",...p(e.adapter),createConnector:s=>S({solanaWallet:e,walletDetailsParams:s,connection:r})}))});export{k as getSolanaConnectors};
//# sourceMappingURL=solana-connector-pbZ8Xvpf.js.map
