Integrating with Plaid Link
Plaid Link lets you integrate multiple wallets such as Coinbase Wallet, Metamask, and more into your dApp.
A complete guide on setting up and integrating Plaid Link can be found in the docs. To explore a running version of Plaid Link, you can try out the demo where Product = "Investments".
Prerequisites
Plaid Link can be used in any JavaScript web dApp, but there is a React library for React applications as well.
You can read about the setup and installation process in the Plaid Link docs
Example integration
Plaid Link returns a provider that your dApp can use to request the user’s addresses as well as signatures and transactions.
Here’s a simple example of the code used to integrate Plaid Link in a vanilla JavaScript dApp:
<script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>
<script>
const plaidWeb3 = await Plaid.web3();
const handler = plaidWeb3.createEthereumOnboarding({
// retrieve from Plaid Dashboard
token: 'token-abc',
chain: {
rpcUrl: 'https://cloudflare-eth.com/v1/mainnet',
chainId: '0x1',
},
onSuccess: async (provider) => {
const accounts = await provider.request({ method: 'eth_accounts' });
}
});
handler.open();
</script>
For a complete overview of the configuration options and capabilities of Plaid Link, refer to its docs.