FundModal
component.
Fund
and FundModal
components will cost real money unless you enable mock buys and sends.create-cdp-app
package!
npm
, pnpm
, or yarn
)Access CDP Portal
Add your domain
http://localhost:3000
(the port your demo app will run locally).Save your changes
Create a Secret API Key
Copy your Project ID
Create a new demo app
create-cdp-app
to create a new demo app using your package manager:Configure your app
Run your app
Sign in
Enter your email
Verify
View your new wallet
What is Base?
Enter deposit details
Complete your purchase
View your confirmation
https://basescan.org/address/YOUR-WALLET-ADDRESS
.What is a transaction?
npm
, pnpm
, or yarn
)@coinbase/cdp-core
and @coinbase/cdp-hooks
installedCreate key
Update .env
.env
file with the API Key ID and API Key Secret.@coinbase/cdp-sdk
@coinbase/cdp-sdk
to generate one.
lib/cdp-auth.ts
lib/cdp-auth.ts
in your project root. This file exports helper functions to generate JWTs for authorizing Onramp API calls and provides the base URL for API requests.
getCDPCredentials()
: Reads your API credentials from environment variablesgenerateCDPJWT()
: Creates authenticated JWT tokens for API callsONRAMP_API_BASE_URL
: The base URL for all Onramp API requestsTransform response data helper
FundModal
component expects functions that return data in camel-case, so for now the data from the Onramp API needs to be transformed.Get buy options
FundModal
and Fund
components.Create buy quote
Fund
and FundModal
components.FundModal
componentFundModal
component to your app.
Create fetchBuyOptions and fetchBuyQuote
FundModal
component requires fetchBuyOptions
and fetchBuyQuote
props, which are functions that handle calling the Onramp API via your new server-side endpoints.Render FundModal
Resource | Description |
---|---|
Buy options API | Coinbase Onramp Buy Options API reference |
Buy quote API | Coinbase Onramp Buy Quote API reference |
Fund README | Component overview and usage |