@daimo/pay
Version:
Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.
37 lines (34 loc) • 1.01 kB
JavaScript
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: undefined,
});
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,
}
: undefined,
};
return jsx(Web3Context.Provider, { value: value, children: children });
};
export { Web3ContextProvider };
//# sourceMappingURL=Web3ContextProvider.js.map