Options
This documentation is for Web3Modal v2. You can find Web3Modal v3 docs here
Following options can be passed as arguments to Web3Modal
constructor i.e.
const web3Modal = new Web3Modal({
projectId: '...',
mobileWallets: [{ id: '...' }]
})
projectId (required)β
Your project's unique identifier that can be obtained at cloud.walletconnect.com. Enables following functionalities within Web3Modal: wallet and chain logos, optional WalletConnect RPC, support for all wallets from WalletConnect explorer and WalletConnect v2 support. Defaults to undefined
.
projectId: string
mobileWallets (optional)β
You can define an array of custom mobile wallets. Note: you will also need to add appropriate wallet images in walletImages
. Native link represents deeplinking URL like rainbow://
and Universal link represent webpage link that can redirect to the app or fallback page. Defaults to undefined
.
mobileWallets: [
{
id: string,
name: string,
links: {
native: string
universal: string,
},
},
];
desktopWallets (optional)β
You can define an array of custom desktop or web based wallets. Note: you will also need to add appropriate wallet images in walletImages
. Native link represents deeplinking URL like ledgerlive://
and Universal link represents webpage link that can redirect to the app or fallback page. Defaults to undefined
.
desktopWallets: [
{
id: string,
name: string,
links: {
native: string
universal: string,
},
},
];
walletImages (optional)β
Array of wallet id's and their logo mappings. This will override default logos. Id's in this case can be: WalletConnect explorer id's, wallet id's you provided in mobileWallets
or desktopWallets
and wagmi connector id's. Defaults to undefined
.
walletImages: {
rainbow: "/images/rainbow.webp",
metaMask: "/images/metamask.webp",
};
chainImages (optional)β
Array of chain id's and their logo mappings. This will override default logos. You can find detailed chain data at chainlist.org Defaults to undefined
.
chainImages: {
1: "/images/ethereum.webp",
137: "/images/polygon.webp",
};
tokenImages (optional)β
Array of token symbols and their logo mappings. Defaults to undefined
.
tokenImages: {
ETH: "/images/eth.webp",
AVAX: "/images/avax.webp",
};
defaultChain (optional)β
Before the user establishes a connection, the default wagmi chain can be set prompting user to switch in their wallet if they were on a different one. Defaults to undefined
.
defaultChain: polygon
tokenContracts (optional)β
Allows to override default token(s) address for each chain to show custom balances in account view. Defaults to undefined
.
tokenContracts: {
1: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
137: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'
}
explorerRecommendedWalletIds (optional)β
Allows to override default recommended wallets that are fetched from WalletConnect explorer. You can define an array of wallet ids you'd like to prioritise (order is respected). You can get these ids from the explorer link mentioned before by clicking on a copy icon of desired wallet card. If you want to completely disable recommended wallets, you can set this option to NONE
. Defaults to undefined
.
explorerRecommendedWalletIds: [
'1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369',
'4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0'
]
// -- or -- //
explorerRecommendedWalletIds: 'NONE'
explorerExcludedWalletIds (optional)β
Allows to exclude wallets that are fetched from WalletConnect explorer. You can define an array of wallet ids you'd like to exclude. You can get these ids from the explorer link mentioned before by clicking on a copy icon of desired wallet card. If you want to exclude all wallets, you can set this option to ALL
, however if explorerRecommendedWalletIds
were defined, they will still be fetched. Defaults to undefined
.
explorerExcludedWalletIds: [
'1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369',
'4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0'
]
// -- or -- //
explorerExcludedWalletIds: 'ALL'
termsOfServiceUrl (optional)β
String URL to your terms of service page, if specified will append special "legal info" footer to the modal. Defaults to undefined
.
termsOfServiceUrl: 'https://example.com/terms-and-conditions'
privacyPolicyUrl (optional)β
String URL to your privacy policy page, if specified will append special "legal info" footer to the modal. Defaults to undefined
.
privacyPolicyUrl: 'https://example.com/privacy-policy'
enableNetworkView (optional)β
If more than 1 chain was provided in modal or wagmi configuration, users will be show network selection view before selecting a wallet. This option can enable or disable this behavior. Defaults to false
.
enableNetworkView: true
enableAccountView (optional)β
Option to enable or disable the modal's account view. The default setting is set to true
.
enableAccountView: false
enableExplorer (optional)β
Option to enable or disable wallet fetching from WalletConnect explorer. Defaults to true
.
enableExplorer: false
themeMode (optional)β
Puts Web3Modal into dark or light mode. Defaults to user's system preference.
themeMode: 'dark' | 'light'
themeVariables (optional)β
Allows to override Web3Modal's css styles. See theming section for all available options.
themeVariables: {
"--w3m-font-family": "Roboto, sans-serif",
"--w3m-accent-color": "#F5841F",
// ...
};
Was this helpful?