Setup
Prerequisites
To get started with Embedded Wallets, you need the following:
- Node 18+
- A CDP API key.
- A webapp, targeting modern browsers (either mobile or desktop).
Installation
Our SDK is distributed via NPM. If you're using React, we provide additional bindings to make it easier to manage wallets.
Frontend
- React
- Pure JS
npm install @coinbase/waas-sdk-web @coinbase-waas-sdk-web-react @coinbase/waas-sdk-viem
npm install @coinbase/waas-sdk-web @coinbase-waas-sdk-viem
Configuration
Get your project ID from the Coinbase Developer Platform, or the projectId
field of the API key you previously created.
- React
- Pure JS
info
The SDK does not support React strict mode. Disable strict mode in your application before beginning.
Wrap your application's root component in the WalletProvider
.
// 1. Wrap your application with the WalletProvider component.
import {WalletProvider} from '@coinbase/waas-sdk-web-react';
// ...
return (
<WalletProvider
collectAndReportMetrics
enableHostedBackups
projectId={"<TODO: Insert `projectID` for this project>"}
prod={false}
>
<App /> {/* Your app component */}
</WalletProvider>
);
Use InitializeWaas
to start and configure the SDK.
import { InitializeWaas } from "@coinbase/waas-sdk-web";
const waas = await InitializeWaas({
collectAndReportMetrics: true,
enableHostedBackups: true,
prod: false,
projectId: "<TODO: Insert `projectID` for this project>",
});