Setting up Coinbase Wallet SDK
:::caution The code snippets have been updated to reflect the rebranding of Coinbase Wallet SDK from its previous name of WalletLink. ::: :::info Instructions are in TypeScript. The usage is the same in JavaScript, except for the occasional TypeScript type annotation such asstring[]
or as any
.
:::
Prerequisites
- A Typescript project set up locally, created with
yarn create react-app my-app --template typescript
or similar - web3.js installed using
npm install web3
or similar
Initializing
In your App.tsx file, add the following code to initialize Coinbase Wallet SDK and a Web3 object:makeWeb3Provider
for whitelisted networks. Wallet SDK needs an rpcUrl to be provided by the app as a fallback.
Next steps:
Troubleshooting
I run into the following error: <b>Module not found: Error: Can't resolve <'assert'/'url/'/...>
I run into the following error: <b>Module not found: Error: Can't resolve <'assert'/'url/'/...>
Due to the removal of default polyfills in webpack5, you must install the following utilities:Then, add the following code snippet to your webpack.config.js:If you are using an application built on
create-react-app
locally, you must run npm run eject
to be able to customize your webpack configuration.