Advanced Configuration
Last updated
Was this helpful?
Last updated
Was this helpful?
You can provide users with different connect options by adding the data-multi
prop and setting it to true.
The wallets we currently support are:
For Wallet Connect, we are limiting connection options to Rainbow Wallet, Ledger Live and Trust Wallet. The list of wallets may increase in the future.
Make sure you are on the latest version of your mobile wallet, to ensure they properly handle Wallet Connect 2.0.
You have the ability limit the networks a user can connect to with the Connect Widget.
You can force a user to connect to a specific network by setting the data-network
prop to the chain id of the network. If the user is not connected to the appropriate network, the Connect Widget will not be clickable and will show "Wrong Network".
The following example requires the user to connect on Ethereum Mainnet:
The following example requires the user to connect on Ethereum Mainnet and Optimism Mainnet:
You should ONLY use this configuration if your app supports the ability to connect to multiple blockchains AND you DO NOT use Wallet Connect.
To do this, simply remove the data-network
prop.
To enable Wallet Connect, you MUST specify the following props:
By default, the Connect Widget will automatically reconnect a wallet if a person was previously connected. To disable this, add the data-auto-reconnect="false"
prop.
By default, the Connect Widget will reference the user's default browser provider (e.g. MetaMask, Coinbase Wallet, Brave). However, there are situations where a browser does not have a built in provider (e.g. mobile devices or those that have not installed a wallet). In this case, you may wish to supply a fallback provider so your website or application can still access the blockchain.
If you do not have a provider already, you can get one from one of the following sites:
Configure a fallback provider by adding the data-fallback-provider
and data-network
props with your provider websocket uri and network.
The following example shows how you would add support for Ethereum Mainnet and Optimism
By default, when a user clicks the 'Connect' button, they will be asked to grant your website access to their wallet, as well as authenticate their wallet address by signing a message.
The data-delay-auth
prop can take one of 3 values:
false (default)
- Do NOT delay authentication. The user is asked to authenticate with your website by signing a message immediately after they click connect. You will get access to the Data Client immediately
Example code:
This CodePen provides a sandbox for testing out the various configuration options in real time for Connect Widget v3.
You can specify the data-network
as a comma-separated list of chain IDs for the networks you wish to allow the user to connect to. An example of an app that does this is .
You can use the connect widget with websites that are intended to interact with multiple blockchains. However, you will not be able to use the and Wallet Connect will not work.
data-network: See
data-wallet-connect-project-id: Follow instructions to register for one
If you wish to allow a user to use Wallet Connect to read blockchain data when they do not have an integrated browser provider (e.g. mobile devices without a wallet installed), please specify a .
NOTE: Only websocket providers are currently supported.
To configure a fallback provider for multiple networks, add a data-fallback-provider prop that contains a comma separated list of websocket providers that correspond to your .
Accessing the blockchain via the fallback provider will only occur if the user does not have an installed wallet. This means that you will only be able to read smart contract information if the fallback provider is in use, and you will not be able to perform any authenticated actions (e.g. signing a message, or using the ).
In some cases, you may not need the user to be authenticated to access some parts of your website (e.g. if you are building a ). If you would like to avoid automatically triggering the authentication message signing request, you can use the data-delay-auth
prop.
true
- Delay authentication until your website explicitly asks for authentication via the and the calling method.
Note: if the end-user is authenticated and switches their wallet, they will immediately be asked to re-authenticate.
always (available in v2.2.1 or later)
- Delay authentication until your website explicitly asks for authentication via the and the calling method.
Note: unlike 'true', end-users will NOT be asked to re-authenticate if they switch their wallet, and will simply be disconnected if they have not previously authenticated with the new wallet.
If you are delaying authentication by setting data-delay-auth
to true
or always
, and still want to use the, you will need to emit an m-reauthenticate
event after returns.
This will result in a being populated with the data client, as well as an event being emitted with the data client.