import { observer } from "mobx-react-lite"; import { HotConnector } from "../../HotConnector"; import { ConnectorType, OmniConnector } from "../../OmniConnector"; import { formatter } from "../../omni/utils"; import { ImageView } from "../payment/TokenCard"; import { PopupOption, PopupOptionInfo } from "../styles"; import { openWalletPicker } from "../router"; import { LogoutIcon } from "../icons/logout"; import Popup from "../Popup"; interface MultichainPopupProps { hot: HotConnector; onClose: () => void; } export const Connector = observer(({ hot, onClose }: MultichainPopupProps) => { const onechain = hot.connectors.filter((t) => t.type === ConnectorType.WALLET); const social = hot.connectors.filter((t) => t.type === ConnectorType.SOCIAL); const selectConnector = async (t: OmniConnector) => { if (t.wallets[0]) return t.disconnect(); if (t.options.length > 0) return [openWalletPicker(t), onClose()]; await t.connect().finally(() => onClose()); }; return ( Select network

} onClose={onClose}> {onechain.map((t) => ( selectConnector(t)}>

{t.name}

{t.wallets[0]?.address && {formatter.truncateAddress(t.wallets[0].address, 24)}}
{t.wallets[0]?.address && }
))} {social.length > 0 && ( <>
or
{social.map((t) => ( selectConnector(t)}>

{t.name}

{t.wallets[0]?.address && Multichain connected}
{t.wallets[0]?.address && }
))} )}
); });