@daimo/pay
Version:
Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.
27 lines (24 loc) • 1.68 kB
JavaScript
import { jsx, jsxs } from 'react/jsx-runtime';
import { useConnect, useDisconnect, useAccount } from 'wagmi';
import ChainSelectList from '../../Common/ChainSelectList/index.js';
import { PageContent, ModalContent, ModalBody } from '../../Common/Modal/styles.js';
import useLocales from '../../../hooks/useLocales.js';
import { DisconnectIcon } from '../../../assets/icons.js';
import { useChainIsSupported } from '../../../hooks/useChainIsSupported.js';
import { isSafeConnector } from '../../../utils/index.js';
import Button from '../../Common/Button/index.js';
import { OrDivider } from '../../Common/Modal/index.js';
const SwitchNetworks = () => {
const { reset } = useConnect();
const { disconnect } = useDisconnect();
const { connector, chain } = useAccount();
const isChainSupported = useChainIsSupported(chain?.id);
const locales = useLocales({});
const onDisconnect = () => {
disconnect();
reset();
};
return (jsx(PageContent, { style: { width: 278 }, children: jsxs(ModalContent, { style: { padding: 0, marginTop: -10 }, children: [!isChainSupported && (jsxs(ModalBody, { children: [locales.warnings_chainUnsupported, " ", locales.warnings_chainUnsupportedResolve] })), jsx("div", { style: { padding: "6px 8px" }, children: jsx(ChainSelectList, { variant: "secondary" }) }), !isChainSupported && !isSafeConnector(connector?.id) && (jsxs("div", { style: { paddingTop: 12 }, children: [jsx(OrDivider, {}), jsx(Button, { icon: jsx(DisconnectIcon, {}), variant: "secondary", onClick: onDisconnect, children: locales.disconnect })] }))] }) }));
};
export { SwitchNetworks as default };
//# sourceMappingURL=index.js.map