Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions docs/get-started/how-to/connect-wallet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ Create a file named `wagmi.ts` in your in your project directory, and add this c
```ts
import { http, createConfig } from 'wagmi'
import { linea, lineaSepolia, mainnet } from 'wagmi/chains'
import { injected } from 'wagmi/connectors'
import { injected, metaMask } from 'wagmi/connectors'

const projectId = '<WALLETCONNECT_PROJECT_ID>'

export const config = createConfig({
chains: [lineaSepolia, linea, mainnet],
connectors: [injected()],
connectors: [
injected(),
metaMask({
infuraAPIKey: process.env.NEXT_PUBLIC_INFURA_API_KEY!,
})],
transports: {
[lineaSepolia.id]: http(),
[linea.id]: http(),
Expand All @@ -48,6 +52,8 @@ This configuration file ensures Wagmi works with Linea, Linea Sepolia, and Ether
also defines that we should use the `injected` wallet connector, which works with any wallet that
uses the common EIP-1193 standard. There are a few wallets that also have [separate connectors](https://wagmi.sh/react/api/connectors).

You can also use the `metaMask` connector, which works with MetaMask Wallet.

### Add Wagmi and query providers

Next, head to your app file.
Expand Down Expand Up @@ -115,7 +121,7 @@ whatever filename you like:

```js
import { useConnect } from 'wagmi'
import { injected } from 'wagmi/connectors'
import { injected, metaMask } from 'wagmi/connectors'

export function ConnectButton() {
const { connect } = useConnect()
Expand All @@ -124,6 +130,9 @@ export function ConnectButton() {
<button onClick={() => connect({ connector: injected() })}>
Connect wallet
</button>
<button onClick={() => connect({ connector: metaMask() })}>
Connect MetaMask wallet
</button>
)
}
```
Expand Down