Skip to content

Commit

Permalink
feat: native support for emails
Browse files Browse the repository at this point in the history
  • Loading branch information
softwarecurator committed Apr 12, 2024
1 parent 6554d5b commit 312a2e4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lib/stores/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type Config
} from '@wagmi/core';
import { mainnet, polygon, optimism, arbitrum, type Chain } from '@wagmi/core/chains';
import { createWeb3Modal, type Web3Modal } from '@web3modal/wagmi';
import { createWeb3Modal, emailConnector, type Web3Modal } from '@web3modal/wagmi';

export const connected = writable<boolean>(false);
export const wagmiLoaded = writable<boolean>(false);
Expand Down Expand Up @@ -45,6 +45,16 @@ export const defaultConfig = ({
}: DefaultConfigProps) => {
if (connectors) configuredConnectors.set(connectors);

//add email connector
configuredConnectors.update((connectors) => [
...connectors,
emailConnector({
options: {
projectId: walletConnectProjectId
}
})
]);

const chainsToUse = chains ? chains.map((chain) => chain) : [];
const transports = chains
? chains.reduce(
Expand All @@ -59,7 +69,7 @@ export const defaultConfig = ({
const config = createConfig({
chains: chainsToUse as [Chain, ...Chain[]],
transports,
connectors
connectors: get(configuredConnectors)
});

wagmiConfig.set(config);
Expand Down

0 comments on commit 312a2e4

Please sign in to comment.