yarn add @web3-react/magic-connector
apiKey: string
chainId: number
email: string
import { MagicConnector } from '@web3-react/magic-connector'
const magic = new MagicConnector({ apiKey: '…', chainId: 4, email: '…' })
Note: Once the connector has been activated, the Magic SDK instance can be accessed under the .magic
property.
Happens when the user closes the connection window.
import { UserRejectedRequestError } from '@web3-react/magic-connector'
function Component() {
const { error } = useWeb3React()
const isNoEthereumProviderError = error instanceof UserRejectedRequestError
// ...
}
Happens when the Magic link verification fails.
import { FailedVerificationError } from '@web3-react/magic-connector'
function Component() {
const { error } = useWeb3React()
const isNoEthereumProviderError = error instanceof FailedVerificationError
// ...
}
Happens when the Magic rate limit has been reached.
import { MagicLinkRateLimitError } from '@web3-react/magic-connector'
function Component() {
const { error } = useWeb3React()
const isNoEthereumProviderError = error instanceof MagicLinkRateLimitError
// ...
}
Happens when the Magic link has expired.
import { MagicLinkExpiredError } from '@web3-react/magic-connector'
function Component() {
const { error } = useWeb3React()
const isNoEthereumProviderError = error instanceof MagicLinkExpiredError
// ...
}