Coinbase Logo

A Coinbase Wallet SDK primer

May 24, 2022

Unpacking the Coinbase Wallet Software Development Kit

For those developers who are new to Coinbase Wallet SDK, here’s a short primer on how to get started.

What is Coinbase Wallet SDK?

Coinbase Wallet SDK – formerly WalletLink, which was first introduced in 2019 – is an open source SDK that empowers developers to connect their dapps to millions of Coinbase Wallet users, including their assets and NFTs. 

How do I get started with Coinbase Wallet SDK?

You first need to install Coinbase Wallet SDK using yarn or npm. 

Yarn

  • First, check for available versions: yarn info @coinbase/wallet-sdk versions.

  • Then install a specific version (yarn add @coinbase/wallet-sdk@3.0.0) or install the latest version (yarn add @coinbase/wallet-sdk).

  • Finally, to check your latest version: yarn list @coinbase/wallet-sdk.

Npm

  • First, check for available versions: npm view @coinbase/wallet-sdk versions.

  • Then install a specific version (npm install @coinbase/wallet-sdk@3.0.0) or install the latest version (npm install @coinbase/wallet-sdk).

  • Finally, to check your installed version: npm list @coinbase/wallet-sdk.

You can also compare your installed version of Coinbase SDK with the latest available version for yarn (yarn outdated @coinbase/wallet-sdk) or npm (npm outdated @coinbase/wallet-sdk) and choose to upgrade your Wallet SDK. Learn more about upgrading here.

How do I initialize Coinbase Wallet SDK and a Wallet SDK-powered Web3 object?

This page will provide you with an explainer on how to integrate Coinbase Wallet SDK as the default provider for your dapp using web3.jps. The pattern is similar if you’re using ethers.js.

As a quick reference, here are some things to keep in mind:

  • An Infura API key is used as a fallback rpcUrl. You can check out the Infura documentation on how to get an Infura API Key.

  • Instructions are in TypeScript. The usage is the same in JavaScript, except for the occasional TypeScript type annotation such as string[] or as any.

  • The prerequisites for initializing include having a Typescript project set up locally, created with yarn create react-app my-app --template typescript or similar, and having web3.js installed using npm install web3 or similar.

  • Coinbase Wallet SDK uses an rpcUrl provided by Coinbase Wallet clients regardless of the rpcUrl passed into makeWeb3Provider for whitelisted networks. Wallet SDK needs an rpcUrl to be provided by the dapp as a fallback.

For the coding needed to initialize Coinbase Wallet SDK and a Web3 object, please refer to our article Three Ways to Integrate Coinbase Wallet

Coinbase Wallet is a self-custody wallet providing software services subject to Coinbase Wallet Terms of Service and Privacy Policy. Coinbase Wallet is distinct from Coinbase.com, and private keys for Coinbase Wallet are stored directly by the user and not by Coinbase. Fees may apply. You do not need a Coinbase.com account to use Coinbase Wallet.