UNPKG

@lifi/widget

Version:

LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.

20 lines 1.06 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { ChainType } from '@lifi/sdk'; import { useContext } from 'react'; import { WagmiContext } from 'wagmi'; import { useInternalWalletProvider } from '../../hooks/useInternalWalletProvider.js'; import { isItemAllowed } from '../../utils/item.js'; import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'; import { EVMBaseProvider } from './EVMBaseProvider.js'; import { EVMExternalContext } from './EVMExternalContext.js'; function useInWagmiContext() { const { chains } = useWidgetConfig(); const context = useContext(WagmiContext); return Boolean(context) && isItemAllowed(ChainType.EVM, chains?.types); } export const EVMProvider = ({ children }) => { const inWagmiContext = useInWagmiContext(); const useInternalWallet = useInternalWalletProvider(inWagmiContext); return useInternalWallet ? (_jsx(EVMBaseProvider, { children: children })) : (_jsx(EVMExternalContext.Provider, { value: inWagmiContext, children: children })); }; //# sourceMappingURL=EVMProvider.js.map