@daimo/pay
Version:
Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.
56 lines (53 loc) • 1.92 kB
JavaScript
import { jsx, jsxs } from 'react/jsx-runtime';
import { usePayContext } from '../../../hooks/usePayContext.js';
import { PageContent, ModalContent } from '../../Common/Modal/styles.js';
import WalletPaymentSpinner from '../../Spinners/WalletPaymentSpinner/index.js';
import { Ethereum, Solana } from '../../../assets/chains.js';
import { ROUTES } from '../../../constants/routes.js';
import { OptionsList } from '../../Common/OptionsList/index.js';
const SelectWalletChain = () => {
const { paymentState, setPendingConnectorId, setRoute, setSolanaConnector } = usePayContext();
const { selectedWallet } = paymentState;
if (selectedWallet == null) {
return /* @__PURE__ */ jsx(PageContent, {});
}
const wallet = selectedWallet;
if (!wallet.solanaConnectorName) {
return /* @__PURE__ */ jsx(PageContent, {});
}
function handleSelect(chain) {
if (chain === "evm") {
setPendingConnectorId(wallet.id);
setRoute(ROUTES.CONNECT);
} else {
setSolanaConnector(wallet.solanaConnectorName);
setRoute(ROUTES.SOLANA_CONNECTOR);
}
}
const options = [
{
id: "ethereum",
title: "Ethereum",
icons: [/* @__PURE__ */ jsx(Ethereum, {}, "ethereum")],
onClick: () => handleSelect("evm")
},
{
id: "solana",
title: "Solana",
icons: [/* @__PURE__ */ jsx(Solana, {}, "solana")],
onClick: () => handleSelect("solana")
}
];
return /* @__PURE__ */ jsxs(PageContent, { children: [
/* @__PURE__ */ jsx(
WalletPaymentSpinner,
{
logo: selectedWallet.icon,
logoShape: selectedWallet.iconShape === "square" ? "squircle" : selectedWallet.iconShape || "squircle"
}
),
/* @__PURE__ */ jsx(ModalContent, { $preserveDisplay: true, children: /* @__PURE__ */ jsx(OptionsList, { options }) })
] });
};
export { SelectWalletChain as default };
//# sourceMappingURL=index.js.map