export const createWagmiConfig = () =>
createConfig({
chains,
connectors: [
Web3Auth({
clientId: env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID,
web3AuthNetwork: 'sapphire_devnet',
}),
],
transports: {
[polygon.id]: http(env.NEXT_PUBLIC_POLYGON_ALCHEMY_API_URL),
[polygonAmoy.id]: http(env.NEXT_PUBLIC_POLYGONAMOY_ALCHEMY_API_URL),
},
})
import { Options } from '@/interfaces/web3auth.options'
import { CHAIN_NAMESPACES } from '@web3auth/base'
import { EthereumPrivateKeyProvider } from '@web3auth/ethereum-provider'
import {
Web3AuthOptions,
Web3Auth as Web3AuthSfa,
} from '@web3auth/single-factor-auth'
import { createConnector } from 'wagmi'
import { web3Auth } from '@/config/connectors'
export interface Web3AuthParameters
extends Omit<Options, 'adapter' | 'web3authSfa'> {
web3AuthNetwork: Web3AuthOptions['web3AuthNetwork']
clientId: string
enableLogging?: boolean
}
const Web3Auth = (options: Web3AuthParameters) => {
return createConnector((config) => {
const chainConfig = {
chainId: '0x' + config.chains[0].id.toString(16),
displayName: config.chains[0].name,
chainNamespace: CHAIN_NAMESPACES.EIP155,
tickerName: config.chains[0].nativeCurrency.name,
ticker: config.chains[0].nativeCurrency?.symbol,
decimals: 18,
rpcTarget: config.chains[0].rpcUrls.default.http[0]!,
blockExplorer: config.chains[0].blockExplorers?.default.url[0] as string,
}
return web3Auth({
...options,
web3authSfa: new Web3AuthSfa({
clientId: options.clientId,
privateKeyProvider: new EthereumPrivateKeyProvider({
config: { chainConfig },
}),
web3AuthNetwork: options.web3AuthNetwork,
usePnPKey: false,
}),
})(config)
})
}
export default Web3Auth
and web3Auth is the connector with overriden functions .
connect function takes chainId and loginParams {verifier, verifierId, idToken}
but whenever i try to use
await connectAsync({
connector: connectors.find((c) => c.id === 'web3Auth')!,
chainId: 137,
verifierId,
idToken: accessToken,
verifier,
})
i get the error
Object literal may only specify known properties, and ‘verifierId’ does not exist in type ‘{ chainId?: number | undefined; connector: CreateConnectorFn | Connector; }’.