### Install and Run CDP SDK Quickstart (Bash) Source: https://docs.cdp.coinbase.com/get-started/quickstart These commands install the necessary dependencies for the CDP SDK quickstart project and then build and run the application. This is typically executed after cloning the repository to start interacting with Coinbase services. ```bash npm install && npm run build && npm start ``` -------------------------------- ### Example React Component for Node Playground Quickstart Source: https://docs.cdp.coinbase.com/data/node/quickstart A React functional component that renders introductory text, a list of CDP Node capabilities, and instructions for using the Node Playground. It includes placeholders for step-by-step guidance and visual aids. ```jsx export const NodePlaygroundQuickstart = () => { return <>

CDP Node provides RPC endpoints for Base. With Node, you can:

Let's make your first blockchain call using the Node Playground in CDP Portal.

Navigate to Node in Portal. The playground has a prefilled eth_blockNumber call. Click Run to get the current block number on Base. See results in milliseconds! ⚡ Node Playground RPC call results showing current block number ; }; ``` -------------------------------- ### Install Solana Web3.js Source: https://docs.cdp.coinbase.com/coinbase-wallet/solana-developers/solana-wallet-adapter/getting-started-guide Command to install the Solana JavaScript API, which is essential for interacting with the Solana blockchain. ```bash yarn add @solana/web3.js ``` -------------------------------- ### Clone Onchain App Template Repository Source: https://docs.cdp.coinbase.com/paymaster/introduction/quickstart Clones the Onchain App Template repository to start building your application. This command requires Git to be installed. ```bash git clone https://github.com/coinbase/onchain-app-template.git cd onchain-app-template ``` -------------------------------- ### Install Project Dependencies with Bun Source: https://docs.cdp.coinbase.com/paymaster/introduction/quickstart Installs project dependencies using Bun. It first ensures Bun is installed and then proceeds to install the necessary packages. This is an alternative to npm or yarn. ```bash # Install bun in case you don't have it bun curl -fsSL | bash # Install packages bun i ``` -------------------------------- ### Install Solana Wallet Adapter Dependencies Source: https://docs.cdp.coinbase.com/coinbase-wallet/solana-developers/solana-wallet-adapter/getting-started-guide Command to install core Solana wallet adapter packages for React applications, including base, react, react-ui, wallets, and mobile support. ```bash yarn add @solana/wallet-adapter-base \ @solana/wallet-adapter-react \ @solana/wallet-adapter-react-ui \ @solana/wallet-adapter-wallets \ @solana_mobile/wallet-adapter-mobile ``` -------------------------------- ### Start Local Development Server with Bun Source: https://docs.cdp.coinbase.com/paymaster/introduction/quickstart Starts the local development server for your application using Bun. This command allows you to test your application locally before deployment. ```bash bun run dev ``` -------------------------------- ### Install eth-account (Python) Source: https://docs.cdp.coinbase.com/x402/quickstart-for-buyers Installs the eth_account Python package. This library provides utilities for managing Ethereum accounts, including deriving accounts from private keys. ```bash pip install eth_account ``` -------------------------------- ### Initialize Wallet Adapter Component (React) Source: https://docs.cdp.coinbase.com/coinbase-wallet/solana-developers/solana-wallet-adapter/getting-started-guide Basic React component setup for the WalletAdapter, importing necessary hooks and the main App component. This serves as a placeholder before further configuration. ```javascript import { useMemo } from "react"; import App from "./App"; export default function WalletAdapter() { return ; } ``` -------------------------------- ### Install x402 package (Python) Source: https://docs.cdp.coinbase.com/x402/quickstart-for-buyers Installs the x402 Python package using pip. This package provides functionality to interact with x402 services for payment processing. ```bash pip install x402 ``` -------------------------------- ### Install x402-axios or x402-fetch (Node.js) Source: https://docs.cdp.coinbase.com/x402/quickstart-for-buyers Installs the x402-axios or x402-fetch npm packages for Node.js. These packages simplify integration with x402 for handling payments. ```bash npm install x402-axios # or npm install x402-fetch ``` -------------------------------- ### Install CDP and python-dotenv (Python) Source: https://docs.cdp.coinbase.com/x402/quickstart-for-buyers Installs the cdp and python-dotenv Python packages. These are necessary for utilizing the CDP client and managing environment variables for wallet integration. ```bash pip install cdp python-dotenv ``` -------------------------------- ### Install and Run Demo App Source: https://docs.cdp.coinbase.com/embedded-wallets/demo-app-tutorial Commands to navigate to the newly created demo app directory, install its dependencies, and start the development server. Compatible with npm, pnpm, and yarn. ```bash cd cdp-app-react npm install npm run dev ``` ```bash cd cdp-app-react pnpm install pnpn dev ``` ```bash cd cdp-app-react yarn install yarn dev ``` -------------------------------- ### Clone Coinbase CDP SDK Examples (Bash) Source: https://docs.cdp.coinbase.com/get-started/quickstart This command clones the Coinbase CDP SDK quickstart repository for TypeScript and navigates into the example directory. It's the first step to setting up a local development environment for onchain requests. ```bash git clone --depth=1 https://github.com/coinbase/cdp-sdk && cd cdp-sdk/examples/typescript/quickstart ``` -------------------------------- ### Install cdpcurl using Homebrew or Go Source: https://docs.cdp.coinbase.com/data/webhooks/quickstart Instructions for installing the cdpcurl command-line tool, which is used to make authenticated requests to CDP APIs. It can be installed via Homebrew or Go. ```bash # With Homebrew brew tap coinbase/cdpcurl && brew install cdpcurl # Or with Go go install github.com/coinbase/cdpcurl@latest ``` -------------------------------- ### Local Development Commands using Bun Source: https://docs.cdp.coinbase.com/get-started/demo-apps/app-examples/onchain-commerce-shop Shell commands for setting up and running the Next.js application locally using Bun. Includes installing Bun, installing project dependencies, and starting the development server. ```sh # Install bun in case you don't have it bun curl -fsSL | bash # Install packages bun i # Run Next app bun run dev ``` -------------------------------- ### Run React Native App and Install Dependencies Source: https://docs.cdp.coinbase.com/embedded-wallets/react-native These commands are used to navigate into the project directory, install all necessary dependencies, and then start the development server for either iOS or Android platforms. This step is crucial for running and testing the newly created React Native application. ```bash cd my-react-native-app npm install npm run ios # or npm run android ``` -------------------------------- ### Project Startup Command (Bash) Source: https://docs.cdp.coinbase.com/server-wallets/v1/introduction/quickstart This command initiates the CDP Coinbase project, allowing you to create a wallet, fund it with testnet tokens, and perform your first transfer. It assumes you have Node.js installed. ```bash npm start ``` -------------------------------- ### Install Wagmi and CDP Packages (npm) Source: https://docs.cdp.coinbase.com/embedded-wallets/wagmi Installs the necessary packages for integrating Coinbase CDP Wallets with Wagmi, including core CDP libraries, React Query, viem, and wagmi. Use this command with npm as your package manager. ```bash npm install @coinbase/cdp-wagmi @coinbase/cdp-core @tanstack/react-query viem wagmi ``` -------------------------------- ### Clone and Run x402 Miniapp Template Source: https://docs.cdp.coinbase.com/x402/miniapps Clones the x402 repository, installs dependencies, builds packages, copies environment variables, and starts the development server for the Farcaster miniapp example. Requires Node.js 18+ and pnpm v10. ```bash # Clone the x402 repository git clone https://github.com/coinbase/x402.git cd x402/examples/typescript/fullstack/farcaster-miniapp # Install dependencies pnpm install # Build all packages (required for monorepo) cd ../../ pnpm build cd fullstack/farcaster-miniapp # Copy environment variables cp env.example .env.local # Configure your environment (see below) # Then start the development server pnpm dev ``` -------------------------------- ### Instantiate CDP Client (Python) Source: https://docs.cdp.coinbase.com/x402/quickstart-for-buyers Initializes the CdpClient and creates an EVM account using the CDP SDK in Python. It loads environment variables using python-dotenv for necessary configurations. ```python import asyncio from cdp import CdpClient from dotenv import load_dotenv load_dotenv() cdp = CdpClient() account = await cdp.evm.create_account() ``` -------------------------------- ### Simple GET Request Example Source: https://docs.cdp.coinbase.com/coinbase-app/api-architecture/cors An example of a simple GET request to fetch Bitcoin price data using JavaScript's `fetch` API, which does not require a preflight request. ```APIDOC ## Simple GET Request Example ### Description This example demonstrates a simple `GET` request to the Coinbase API v2 to retrieve the spot price of BTC-USD. Simple requests like this, using safe methods and headers, do not trigger a preflight `OPTIONS` request. ### Method `GET` ### Endpoint `https://api.coinbase.com/v2/prices/BTC-USD/spot` ### Request Example (JavaScript) ```javascript fetch("https://api.coinbase.com/v2/prices/BTC-USD/spot") .then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => console.log(data)) .catch(error => console.error('Error fetching data:', error)); ``` ### Response Example (Success) ```json { "data": { "base": "BTC", "currency": "USD", "amount": "34567.89" } } ``` ``` -------------------------------- ### Get Wrapped Asset Details JSON Example Source: https://docs.cdp.coinbase.com/exchange/changes/changelog An example JSON response from the Get Wrapped Asset Details endpoint (`/wrapped-assets/{wrapped_asset_id}/`). It includes details such as `circulating_supply`, `total_supply`, and `conversion_rate` for wrapped assets like CBETH. ```json { "wrapped_assets":[ { "id":"CBETH", "circulating_supply":"314666.9334401934801646", "total_supply":"1067354.0841178434801646", "conversion_rate":"1.0241755005866786" } ] } ``` -------------------------------- ### Example API Request: Get Asset by ID (cURL) Source: https://docs.cdp.coinbase.com/get-started/authentication/cdp-api-keys An example cURL command to get an asset by ID, specifically for BTC on the base-mainnet. It includes the Authorization header with the JWT and specifies JSON content and accept types. ```shell curl -L -X POST "https://api.cdp.coinbase.com/platform/v1/networks/base-mainnet/assets/BTC" \ -H "Authorization: Bearer ${JWT}" \ -H "Content-Type: application/json" \ -H "Accept: application/json" ``` -------------------------------- ### Python Signature Examples Source: https://docs.cdp.coinbase.com/prime/rest-api/authentication Examples of generating request signatures in Python for both GET and POST requests. ```APIDOC ### Signature Examples (Python) ##### Python GET Request ```python import hmac import hashlib import base64 import time from urllib.parse import urlparse SECRET_KEY = 'YOUR_SECRET_KEY' uri = 'https://api.prime.coinbase.com/v1/portfolios' url_path = urlparse(uri).path timestamp = str(int(time.time())) message = timestamp + 'GET' + url_path hmac_message = hmac.new(SECRET_KEY.encode(), message.encode(), hashlib.sha256).digest() signature_b64 = base64.b64encode(hmac_message).decode() print(f'Timestamp: {timestamp}') print(f'Message: {message}') print(f'Signature: {signature_b64}') ``` ##### Python POST Request ```python import hmac import hashlib import base64 import time import json from urllib.parse import urlparse SECRET_KEY = 'YOUR_SECRET_KEY' PORTFOLIO_ID = 'YOUR_PORTFOLIO_ID' payload = { "symbol": "BTC-USD", "amount": "0.001", "side": "buy" } # Example payload uri = f'https://api.prime.coinbase.com/v1/portfolios/{PORTFOLIO_ID}/order' url_path = urlparse(uri).path timestamp = str(int(time.time())) message = timestamp + 'POST' + url_path + json.dumps(payload) hmac_message = hmac.new(SECRET_KEY.encode(), message.encode(), hashlib.sha256).digest() signature_b64 = base64.b64encode(hmac_message).decode() print(f'Timestamp: {timestamp}') print(f'Message: {message}') print(f'Signature: {signature_b64}') ``` ``` -------------------------------- ### CDP App CLI Examples (Bash) Source: https://docs.cdp.coinbase.com/sdks/cdp-sdks-v2/frontend/%40coinbase/create-cdp-app/index Demonstrates how to use the CDP App CLI with various command-line arguments to create different types of projects. Includes examples for Next.js with Onramp, React with Solana, and React Native with EVM accounts. ```bash # Create a Next.js app with EVM Smart Accounts and Onramp enabled npm create @coinbase/cdp-app@latest my-next-app --template nextjs --project-id YOUR_PROJECT_ID --account-type evm-smart --onramp # Create a React app with Solana support npm create @coinbase/cdp-app@latest my-solana-app --template react --project-id YOUR_PROJECT_ID --account-type solana # Create a React Native app with regular EVM accounts (default) npm create @coinbase/cdp-app@latest my-mobile-app --template react-native --project-id YOUR_PROJECT_ID --account-type evm-eoa ``` -------------------------------- ### Get Current Block Number on Base using RPC Source: https://docs.cdp.coinbase.com/data/get-started/quickstart This example demonstrates a basic RPC call to the CDP Node, specifically the 'eth_blockNumber' method. It retrieves the current block number on the Base blockchain, showcasing the ability to read blockchain state. The playground pre-fills this call, requiring only a click to execute. ```javascript // This is a conceptual example, actual RPC call is made via the Node Playground UI. // The playground has a prefilled eth_blockNumber call. // Example of what the call might look like in a client: // const blockNumber = await provider.send('eth_blockNumber', []); ``` -------------------------------- ### Query Block Number with Node.js Source: https://docs.cdp.coinbase.com/data/node/quickstart This Node.js example fetches the current block number on Base using the built-in `https` module. It defines the API endpoint, constructs the JSON-RPC payload, and sets up request options for a POST request. The response data is collected, parsed, and the hexadecimal block number is converted to decimal. ```javascript const https = require("https"); const rpcUrl = "https://api.developer.coinbase.com/rpc/v1/base/YOUR_CLIENT_API_KEY"; const payload = JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_blockNumber", }); const options = { method: "POST", headers: { "Content-Type": "application/json", }, }; const req = https.request(rpcUrl, options, (res) => { let data = ""; res.on("data", (chunk) => (data += chunk)); res.on("end", () => { const result = JSON.parse(data); console.log("Current block:", parseInt(result.result, 16)); }); }); req.write(payload); req.end(); ``` -------------------------------- ### Initialize Project with npm Source: https://docs.cdp.coinbase.com/paymaster/guides/quickstart Initializes a new Node.js project and navigates into its directory using npm commands. This sets up the basic structure for the project. ```bash mkdir paymaster-tutorial cd paymaster-tutorial npm init es6 ``` -------------------------------- ### Create React App Source: https://docs.cdp.coinbase.com/coinbase-wallet/solana-developers/solana-wallet-adapter/getting-started-guide Command to create a new React application using npx. This is a prerequisite for setting up the Solana wallet adapter. ```bash npx create-react-app ``` -------------------------------- ### CDP Coinbase GET Request Example Source: https://docs.cdp.coinbase.com/api-reference/international-exchange-api/rest-api/authentication Demonstrates how to generate an HMAC signature and make an authenticated GET request to the CDP Coinbase API using Python, Ruby, and JavaScript. ```APIDOC ## GET /websites/cdp_coinbase ### Description This endpoint is used to retrieve data from the CDP Coinbase API. It requires specific headers to be set for authentication, including a timestamp, signature, passphrase, and access key. The signature is generated using an HMAC-SHA256 hash of the request details. ### Method GET ### Endpoint /websites/cdp_coinbase ### Parameters #### Query Parameters None #### Headers - **CB-ACCESS-TIMESTAMP** (string) - Required - The current Unix epoch timestamp. - **CB-ACCESS-SIGN** (string) - Required - The HMAC-SHA256 signature of the request. - **CB-ACCESS-PASSPHRASE** (string) - Required - Your API passphrase. - **CB-ACCESS-KEY** (string) - Required - Your API access key. ### Request Example ```python import json import hmac import hashlib import time import base64 import requests import urllib.parse method = 'GET' url = 'https://api.coinbase.com/v2/...' # Example URL, replace with actual endpoint secret_key = 'YOUR_SECRET_KEY' timestamp = str(int(time.time())) passphrase = 'YOUR_PASSPHRASE' access_key = 'YOUR_ACCESS_KEY' body = '' message = timestamp + method + urllib.parse.urlparse(url).path + str(body or '') hmac_key = base64.b64decode(secret_key) signature = hmac.new(hmac_key, message.encode('utf-8'), digestmod=hashlib.sha256).digest() signature_b64 = base64.b64encode(signature).decode() headers = { "CB-ACCESS-TIMESTAMP": timestamp, "CB-ACCESS-SIGN": signature_b64, "CB-ACCESS-PASSPHRASE": passphrase, "CB-ACCESS-KEY": access_key } response = requests.get(url, headers=headers) print(response.json()) ``` ### Response #### Success Response (200) - **data** (object) - The response payload from the API. #### Response Example ```json { "data": { "some_field": "some_value" } } ``` ``` -------------------------------- ### Create New Onchain Agent Project (Python) Source: https://docs.cdp.coinbase.com/agent-kit/getting-started/quickstart Initializes a new AgentKit project using the Python CLI. This command starts an interactive setup process for selecting AI frameworks, blockchain networks, and wallet providers, creating a local chatbot integration. ```bash pipx run create-onchain-agent ``` -------------------------------- ### Coinbase OAuth Redirect Example Source: https://docs.cdp.coinbase.com/coinbase-app/authentication-authorization/oauth2/integrations This is an example of a GET request redirect from Coinbase after a user approves an application. It includes a temporary 'code' and 'state' parameter. ```http GET https://example.com/oauth/callback?code=4c666b5c0c0d9d3140f2e0776cbe245f3143011d82b7a2c2a590cc7e20b79ae8&state=134ef5504a94 ``` -------------------------------- ### CDP SDK Quickstart Success Output (Bash) Source: https://docs.cdp.coinbase.com/get-started/quickstart This output demonstrates a successful execution of the CDP SDK quickstart project. It indicates that API keys were loaded, an EVM account was created, testnet funds were received, and a transaction was confirmed on the Sepolia testnet. ```bash 🔐 Loaded API key from cdp_api_key.json 🔐 Loaded wallet secret from cdp_wallet_secret.txt ✅ Created EVM account: 0x1234567890123456789012345678901234567890 🚰 Received testnet ETH: 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890 📦 TX confirmed: https://sepolia.basescan.org/tx/0x1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890 ``` -------------------------------- ### Get Coinbase Product Details using Go Source: https://docs.cdp.coinbase.com/exchange/introduction/rest-quickstart Initializes the products service to retrieve details for a specific product (e.g., BTC-USD). It requires exchange credentials and a default HTTP client. The output is a JSON string of the product details. ```go func main() { credentials, err := credentials.ReadEnvCredentials("EXCHANGE_CREDENTIALS") if err != nil { panic(fmt.Sprintf("unable to read exchange credentials: %v", err)) } httpClient, err := core.DefaultHttpClient() if err != nil { panic(fmt.Sprintf("unable to load default http client: %v", err)) } client := client.NewRestClient(credentials, httpClient) productsSvc := products.NewProductsService(client) request := &products.GetProductRequest{ ProductId: "BTC-USD", } response, err := productsSvc.GetProduct(context.Background(), request) if err != nil { panic(fmt.Sprintf("unable to get product: %v", err)) } jsonResponse, err := json.MarshalIndent(response, "", " ") if err != nil { panic(fmt.Sprintf("error marshaling response to JSON: %v", err)) } fmt.Println(string(jsonResponse)) } ``` -------------------------------- ### Instantiate CDP Client (Node.js) Source: https://docs.cdp.coinbase.com/x402/quickstart-for-buyers Creates an instance of the CdpClient and an EVM account using the CDP SDK in Node.js. It utilizes dotenv to load environment variables for authentication. ```typescript import { CdpClient } from "@coinbase/cdp-sdk"; import { toAccount } from "viem/accounts"; import dotenv from "dotenv"; dotenv.config() const cdp = new CdpClient(); const cdpAccount = await cdp.evm.createAccount(); const account = toAccount(cdpAccount); ``` -------------------------------- ### Node.js Hono Payment Middleware Setup Source: https://docs.cdp.coinbase.com/x402/quickstart-for-sellers Sets up the x402 payment middleware within a Hono application. This involves initializing Hono, applying the payment middleware with the necessary payment details, and defining protected routes. The example includes basic route implementation. ```javascript import { Hono } from "hono"; import { serve } from "@hono/node-server"; import { paymentMiddleware, Network } from "x402-hono"; // import { facilitator } from "@coinbase/x402"; // For mainnet const app = new Hono(); // Configure the payment middleware app.use(paymentMiddleware( "0xYourAddress", // your receiving wallet address { "/protected-route": { price: "$0.10", network: "base-sepolia", // for mainnet, see Running on Mainnet section config: { description: "Access to premium content", } } }, { url: "https://x402.org/facilitator", // for testnet } )); // Implement your route ``` -------------------------------- ### Install .NET NuGet Package for Coinbase Prime SDK Source: https://docs.cdp.coinbase.com/prime/introduction/quickstart Instructions for installing the Coinbase Prime .NET SDK using the `dotnet` CLI or `paket`. Requires .NET 8.0 or later. ```bash dotnet add package CoinbaseSdk.Prime --version x.y.z ``` ```bash paket add CoinbaseSdk.Prime --version x.y.z ``` -------------------------------- ### Render Quickstart Item Component (React) Source: https://docs.cdp.coinbase.com/get-started/demo-apps/learn Represents an item in a quickstart guide, featuring an icon, title, and description. It provides a clickable link to a specific resource. ```javascript export const QuickstartItem = ({title, description, icon, href}) => { return
{icon}
{title}
{description}
; }; ``` -------------------------------- ### Setup CDP Client and Create Account Source: https://docs.cdp.coinbase.com/faucets/introduction/quickstart Initializes the CDP client and creates an EVM account on Base Sepolia by default. Requires CDP API key, wallet secret, and the @coinbase/cdp-sdk or cdp package. Outputs the newly created account address. ```bash CDP_API_KEY_ID=your-api-key-id CDP_API_KEY_SECRET=your-api-key-secret CDP_WALLET_SECRET=your-wallet-secret ``` ```typescript import { CdpClient } from "@coinbase/cdp-sdk"; import dotenv from "dotenv"; dotenv.config(); const cdp = new CdpClient(); // Create an EVM account on Base Sepolia (default) const account = await cdp.evm.createAccount(); console.log(`Created account: ${account.address}`); ``` ```python import asyncio from cdp import CdpClient from dotenv import load_dotenv load_dotenv() async def main(): cdp = CdpClient() # Create an EVM account on Base Sepolia (default) account = await cdp.evm.create_account() print(f"Created account: {account.address}") await cdp.close() asyncio.run(main()) ``` -------------------------------- ### Get Portfolio Buying Power OpenAPI Specification Source: https://docs.cdp.coinbase.com/api-reference/prime-api/rest-api/financing/get-portfolio-buying-power This OpenAPI specification defines the GET /v1/portfolios/{portfolio_id}/buying_power endpoint. It outlines the request parameters (portfolio_id, base_currency, quote_currency) and the structure of the successful JSON response, including schema definitions and examples. ```yaml paths: path: /v1/portfolios/{portfolio_id}/buying_power method: get servers: - url: https://api.prime.coinbase.com/ request: security: [] parameters: path: portfolio_id: schema: - type: string required: true description: The unique ID of the portfolio query: base_currency: schema: - type: string required: true description: The symbol for the base currency quote_currency: schema: - type: string required: true description: The symbol for the quote currency header: {} cookie: {} body: {} response: '200': application/json: schemaArray: - type: object properties: buying_power: allOf: - $ref: '#/components/schemas/coinbase.public_rest_api.BuyingPower' refIdentifier: >- #/components/schemas/coinbase.public_rest_api.GetBuyingPowerResponse examples: example: value: buying_power: portfolio_id: e8bbed13-fa33-41de-86d5-4335d8f08166 base_currency: BTC quote_currency: USD base_buying_power: '3.8533347963443316' quote_buying_power: '2051207.48454132' description: A successful response. deprecated: false type: path components: schemas: coinbase.public_rest_api.BuyingPower: type: object properties: portfolio_id: type: string description: The unique ID of the portfolio example: e8bbed13-fa33-41de-86d5-4335d8f08166 base_currency: type: string description: The symbol for the base currency example: BTC quote_currency: type: string description: The symbol for the quote currency example: USD base_buying_power: type: string description: The buying power for the base currency example: '3.8533347963443316' quote_buying_power: type: string description: The buying power for the quote currency example: '2051207.48454132' ``` -------------------------------- ### Wrapped Assets API Endpoints (REST) Source: https://docs.cdp.coinbase.com/exchange/changes/changelog Examples of REST API endpoints for retrieving wrapped asset information. Includes an endpoint to get all wrapped assets and another to get conversion rates. ```bash /wrapped-assets ``` ```bash /wrapped-assets/{wrapped_asset_id}/conversion-rate ``` -------------------------------- ### Configure Environment Variables for OnchainKit Source: https://docs.cdp.coinbase.com/paymaster/introduction/quickstart Sets up essential environment variables for your application, including Paymaster endpoint, CDP API key, and Wallet Connect Project ID. Ensure these values are obtained from their respective services. ```env NEXT_PUBLIC_PAYMASTER_AND_BUNDLER_ENDPOINT=ADD_YOUR_PAYMASTER_URL_HERE NEXT_PUBLIC_CDP_API_KEY=ADD_YOUR_ONCHAINKIT_KEY_HERE NEXT_PUBLIC_WC_PROJECT_ID=ADD_YOUR_PROJECT_ID_HERE ``` -------------------------------- ### Get Ethereum Block Number (curl) Source: https://docs.cdp.coinbase.com/data/node/api-reference/core-evm-methods Example of how to get the current block number on an Ethereum-compatible network using the JSON-RPC API and curl. This method returns the number of the most recent block. ```curl # eth_blockNumber: https://ethereum.org/en/developers/docs/apis/json-rpc#eth_blocknumber curl -s {Your_Endpoint_URL} -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber"}' ``` -------------------------------- ### Create New Onchain Agent Project (TypeScript) Source: https://docs.cdp.coinbase.com/agent-kit/getting-started/quickstart Initializes a new AgentKit project using the TypeScript CLI. This command triggers an interactive setup process for choosing AI frameworks, project templates, blockchain networks, and wallet providers. ```bash npm create onchain-agent@latest ``` -------------------------------- ### Clone Repository and Navigate to Example Directory (Bash) Source: https://docs.cdp.coinbase.com/agent-kit/core-concepts/frameworks This Bash snippet demonstrates how to clone the AgentKit repository and navigate into the specific example directory for the OpenAI Agents SDK integration. ```bash # Clone the repository git clone https://github.com/coinbase/agentkit.git # Navigate to the chatbot-python example cd agentkit/python/examples/openai-agents-sdk-cdp-chatbot ```