Options
The following options can be passed to the createWeb3Modal
function:
createWeb3Modal({ projectId, chains, ...options })
defaultChain
You can set a desired chain for the initial connection:
- Wagmi v1
- Ethers
- Ethers v5
import { mainnet } from 'viem/chains'
createWeb3Modal({
//...
defaultChain: mainnet
})
const mainnet = {
chainId: 1,
name: 'Ethereum',
currency: 'ETH',
explorerUrl: 'https://etherscan.io',
rpcUrl: 'https://cloudflare-eth.com',
};
createWeb3Modal({
//...
defaultChain: mainnet
})
const mainnet = {
chainId: 1,
name: 'Ethereum',
currency: 'ETH',
explorerUrl: 'https://etherscan.io',
rpcUrl: 'https://cloudflare-eth.com',
};
createWeb3Modal({
//...
defaultChain: mainnet
})
clipboardClient
Use your preferred clipboard library to allow Web3Modal use the clipboard to copy addresses & URIs
import * as Clipboard from 'expo-clipboard' // or `@react-native-clipboard/clipboard`
createWeb3Modal({
//...
clipboardClient: {
setString: async (value: string) => {
await Clipboard.setStringAsync(value)
}
}
})
tokens
You can select tokens for Web3Modal to show the user's balance of. Each key represents the chain id of the token's blockchain.
createWeb3Modal({
//...
tokens: {
1: {
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
},
137: {
address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619'
}
}
})
customWallets
Add custom wallets to the modal's main view. customWallets
is an array of objects, where each object contains specific information of a custom wallet.
createWeb3Modal({
//...
customWallets: [
{
id: 'myCustomWallet',
name: 'My Custom Wallet',
homepage: 'www.mycustomwallet.com', // Optional
image_url: 'my_custom_wallet_image', // Optional
mobile_link: 'mobile_link', // Optional - Deeplink or universal
desktop_link: 'desktop_link', // Optional - Deeplink
webapp_link: 'webapp_link', // Optional
app_store: 'app_store', // Optional
play_store: 'play_store' // Optional
}
]
})
featuredWalletIds
Select wallets that are going to be shown on the modal's main view. Default wallets are MetaMask and Trust Wallet.
Array of wallet ids defined will be prioritized (order is respected).
These wallets will also show up first in All Wallets
view.
You can find the wallets ids in WalletConnect Explorer
createWeb3Modal({
//...
featuredWalletIds: [
'1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369', // Rainbow
'4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0' // Trust
]
})
includeWalletIds
Override default recommended wallets that are fetched from WalletConnect explorer.
Array of wallet ids defined will be shown (order is respected).
Unlike featuredWalletIds
, these wallets will be the only ones shown in All Wallets
view and as recommended wallets.
You can get these ids from the explorer link mentioned before by clicking on a copy icon of desired wallet card.
createWeb3Modal({
//...
includeWalletIds: [
'1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369', // Rainbow
'4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0' // Trust
]
})
excludeWalletIds
Exclude wallets that are fetched from WalletConnect explorer. Array of wallet ids defined will be excluded. All other wallets will be shown in respective places. You can get these ids from the explorer link mentioned before by clicking on a copy icon of desired wallet card.
createWeb3Modal({
//...
excludeWalletIds: [
'4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0', // Trust
'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa' // Coinbase
]
})
enableAnalytics
Analytics is currently in alpha.
Enable analytics to get more insights on your users activity within your WalletConnect Cloud's dashboard
createWeb3Modal({
//...
enableAnalytics: true
})
chainImages
Add or override the modal's network images.
createWeb3Modal({
// ...
chainImages: {
1: 'https://my.images.com/eth.png'
}
})
Was this helpful?