UNPKG

@daimo/pay

Version:

Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.

37 lines (34 loc) 884 B
import { jsx } from 'react/jsx-runtime'; import React from 'react'; import { useAccount } from 'wagmi'; import { useChainIsSupported } from '../hooks/useChainIsSupported.js'; import { useChains } from '../hooks/useChains.js'; const Web3Context = React.createContext({ connect: { getUri: () => "" }, dapp: { chains: [] }, account: void 0 }); const Web3ContextProvider = ({ children }) => { const { address: currentAddress, chain } = useAccount(); const chainIsSupported = useChainIsSupported(chain?.id); const chains = useChains(); const value = { dapp: { chains }, account: currentAddress ? { chain, chainIsSupported, address: currentAddress } : void 0 }; return /* @__PURE__ */ jsx(Web3Context.Provider, { value, children }); }; export { Web3ContextProvider }; //# sourceMappingURL=Web3ContextProvider.js.map