@daimo/pay
Version:
Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.
46 lines (43 loc) • 1.92 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 /* @__PURE__ */ jsx(PageContent, { style: { width: 278 }, children: /* @__PURE__ */ jsxs(ModalContent, { style: { padding: 0, marginTop: -10 }, children: [
!isChainSupported && /* @__PURE__ */ jsxs(ModalBody, { children: [
locales.warnings_chainUnsupported,
" ",
locales.warnings_chainUnsupportedResolve
] }),
/* @__PURE__ */ jsx("div", { style: { padding: "6px 8px" }, children: /* @__PURE__ */ jsx(ChainSelectList, { variant: "secondary" }) }),
!isChainSupported && !isSafeConnector(connector?.id) && /* @__PURE__ */ jsxs("div", { style: { paddingTop: 12 }, children: [
/* @__PURE__ */ jsx(OrDivider, {}),
/* @__PURE__ */ jsx(
Button,
{
icon: /* @__PURE__ */ jsx(DisconnectIcon, {}),
variant: "secondary",
onClick: onDisconnect,
children: locales.disconnect
}
)
] })
] }) });
};
export { SwitchNetworks as default };
//# sourceMappingURL=index.js.map