Advanced Configuration
Connection Options
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.
Network Restrictions
You have the ability limit the networks a user can connect to with the Connect Widget.
Single Network
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:
Multiple Networks
Requires Connect Widget 3.0.0 or above.
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 Manifold Studio.
The following example requires the user to connect on Ethereum Mainnet and Optimism Mainnet:
Starting with Connect Widget version 3.1.0, you can indicate support for optional networks in your application using the data-optional-network
attribute.
Optional networks enhance your application's compatibility by enabling connections with wallets that do not inherently support these networks, while also enabling network switching functionality in wallets that do.
No Network Restrictions
You should ONLY use this configuration if your app supports the ability to connect to multiple blockchains AND you DO NOT use Wallet Connect.
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 Data Client and Wallet Connect will not work.
To do this, simply remove the data-network
prop.
Wallet Connect
Requires Connect Widget 3.0.0 or above.
To enable Wallet Connect, you MUST specify the following props:
data-network: See Network Restrictions
data-wallet-connect-project-id: Follow instructions here 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 Fallback Provider.
Automatic Wallet Reconnection
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.
Fallback Provider
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.
NOTE: Only websocket providers are currently supported.
If you do not have a provider already, you can get one from one of the following sites:
Single Network
Configure a fallback provider by adding the data-fallback-provider
and data-network
props with your provider websocket uri and network.
Multiple Networks
Requires Connect Widget 3.0.0 or above.
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 data-network prop.
The following example shows how you would add support for Ethereum Mainnet and Optimism
Starting with Connect Widget version 3.1.0, if you specify data-optional-network
, then data-fallback-provider
must correspond and match both data-network
and data-optional-network
in the same order.
Limitations
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 Data Client).
Delaying Authentication
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.
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 Marketplace). If you would like to avoid automatically triggering the authentication message signing request, you can use the data-delay-auth
prop.
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 immediatelytrue
- Delay authentication until your website explicitly asks for authentication via the Manifold Ethereum Provider and the calling getOAuth 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 Manifold Ethereum Provider and the calling getOAuth 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.
Using the Data Client APIs with delayed authentication
If you are delaying authentication by setting data-delay-auth
to true
or always
, and still want to use the Data Client APIs, you will need to emit an m-reauthenticate
event after getOAuth returns.
This will result in a window object being populated with the data client, as well as an m-authenticated
event being emitted with the data client.
Example code:
CodePen
This CodePen provides a sandbox for testing out the various configuration options in real time for Connect Widget v3.
Last updated