Integrate social logins within Web3Modal through Particle Auth.
@web3modal/ethers
)@web3modal/ethers
. A complete demo repository for this example can be found here.
Starting with the first example, Particle Auth Core can be added as an option within Web3Modal by simply configuring and initializing the SDK through createWeb3Modal
, then placing the resulting instance within Particle Auth Core’s AuthCoreContextProvider
React component, which will then wrap your core application component containing wallet connection and handling logic (by using <w3m-button>
, for example).
This can be achieved through the following steps:
createWeb3Modal
, you’ll first need to configure one or multiple chains to be supported within your application. This can be done by simply defining objects containing the following values:
chainId
name
currency
explorerUrl
rpcUrl
name
, the name of your application.description
, a description of your application.url
, the expected origin URL of your application (which will be using Web3Modal).icons
, one or multiple icons representing your project.createWeb3Modal
from @web3modal/ethers/react
, an instance of Web3Modal can be created. createWeb3Modal
will take various parameters, including those we defined above. The three key required parameters are the following:
ethersConfig
, which in this example is defaultConfig
loaded with metadata
.chains
, an array of supported chains you intend to use.projectId
, your WalletConnect project ID (retrieved from the WalletConnect dashboard).enableOnramp
, enableAnalytics
, etc. See the example below for a standard implementation of createWeb3Modal
.web3Modal
(or the equivalent within your application) defined, you’ll need to place it within the web3Modal
property when configuring AuthCoreContextProvider
(the primary React component used for initializing Particle Auth Core). AuthCoreContextProvider
, with web3Modal
defined, should wrap your core application component containing your “Connect Wallet” button (through <w3m-button>
).
AuthCoreContextProvider
may look similar to the snippet shown below.