Components
- `SignInModal` - a button that triggers a modal with the sign-in flow
- `SignIn` - the forms for the sign in flow, a logo, heading, and description text
- `SignOutButton` - a sign out button
- `AuthButton` - the
SignOutButtonwhen logged in, and theSignInModalwhen logged out - `SendEvmTransactionButton` - a button that signs and sends an EVM transaction
- `SendSolanaTransactionButton` - a button that signs and sends a Solana transaction
- `Fund` - the fund flow
- `FundModal` - a button that triggers a modal with the fund flow
Quickstart
This guide will help you get started with@coinbase/cdp-react. You’ll learn how to install the package, set up the provider, and render your first component.
Installation
First, add the package to your project using your preferred package manager.Gather your CDP Project information
- Sign in or create an account on the CDP Portal
- On your dashboard, select a project from the dropdown at the at the top, and copy the Project ID
Allowlist your local app
- Navigate to the Embedded Wallet Configuration in CDP Portal, and click Add origin to include your local app
- Enter the origin of your locally running app - e.g.,
http://localhost:3000 - Click Add origin again to save your changes
Setup Provider
Next, you need to wrap your application with theCDPReactProvider.
CDPReactProvider provides the necessary context for hooks and components to work correctly. It also provides access to config data and theming.
Update your main application file (e.g., main.tsx or App.tsx) to include the provider:
Analytics Opt-Out
By default the SDK will emit usage analytics to help us improve the SDK. If you would like to opt-out, you can do so by setting thedisableAnalytics configuration option to true.
Render a Component
Now you can use the components from the library. Let’s add theAuthButton component to your application. This component handles both sign-in and sign-out functionality.
@coinbase/cdp-react, set up the provider, and rendered your first component.