UNPKG

cdp-docs-cli

Version:

CLI tool to set up CDP (Coinbase Developer Platform) documentation and integration in your project

222 lines (165 loc) • 5.86 kB
# šŸš€ CDP Docs CLI A CLI tool to quickly set up Coinbase Developer Platform (CDP) documentation and integration in your Node.js projects. ## šŸ“¦ Installation ### Global Installation (Recommended) ```bash npm install -g cdp-docs-cli ``` ### Using npx (No Installation Required) ```bash # Install globally first, then use commands npm install -g cdp-docs-cli cdp-setup ``` ## šŸŽÆ What This Package Does When you install and run this CLI tool, it will: 1. **šŸ“ Create Documentation Structure**: Sets up a `/doc/cdp/` directory in your project 2. **šŸ“– Copy Documentation**: Adds comprehensive CDP wallet API documentation 3. **šŸ”§ Integration Guides**: Provides step-by-step setup and integration guides 4. **šŸ“¦ Install Dependencies**: Optionally installs required CDP packages 5. **šŸ” Environment Setup**: Creates environment file templates with CDP credentials ## šŸš€ Quick Start ### Interactive Setup (Recommended) ```bash # Install globally first npm install -g cdp-docs-cli # Then run interactive setup cdp-setup ``` This will guide you through: - Setting up documentation - Installing CDP dependencies - Creating environment templates - Configuring your project ### Manual Setup ```bash # Install globally first npm install -g cdp-docs-cli # Setup documentation only cdp-docs setup # List available documentation cdp-docs list # Setup with custom path cdp-docs setup --path ./docs/coinbase # Force overwrite existing files cdp-docs setup --force ``` ## šŸ“ Generated Directory Structure After running the setup, your project will have: ``` your-project/ ā”œā”€ā”€ doc/ │ └── cdp/ │ ā”œā”€ā”€ wallet/ # Wallet API documentation │ │ ā”œā”€ā”€ wallet-start.md │ │ ā”œā”€ā”€ fund.md │ │ ā”œā”€ā”€ transfer.md │ │ ā”œā”€ā”€ managing-accounts.md │ │ ā”œā”€ā”€ policies.md │ │ ā”œā”€ā”€ importing.md │ │ ā”œā”€ā”€ exporting.md │ │ └── wallet-accounts.md │ ā”œā”€ā”€ integration/ # Integration guides │ │ ā”œā”€ā”€ SETUP-CDP-WALLET.md │ │ ā”œā”€ā”€ INTEGRATION-SUMMARY.md │ │ ā”œā”€ā”€ cdp-wallet.md │ │ ā”œā”€ā”€ context.md │ │ └── directory.md │ └── examples/ # Code examples (future) ā”œā”€ā”€ .env.local.example # Environment template └── package.json # Updated with CDP dependencies ``` ## šŸ”§ Dependencies Installed The CLI will optionally install these packages: ### Runtime Dependencies - `@coinbase/cdp-sdk` - Official Coinbase Developer Platform SDK - `dotenv` - Environment variable management - `viem` - Ethereum interaction library ### Dev Dependencies - `@types/node` - Node.js TypeScript definitions ## šŸ” Environment Setup The tool creates a `.env.local.example` file with the required CDP configuration: ```bash # CDP (Coinbase Developer Platform) Configuration # Get these values from https://portal.cdp.coinbase.com/ # Your CDP API credentials CDP_API_KEY_ID=your_actual_key_id_here CDP_API_KEY_SECRET=your_actual_key_secret_here CDP_WALLET_SECRET=your_actual_wallet_secret_here # Network configuration (optional) # CDP_NETWORK_ID=base-sepolia # Use base-sepolia for testing, base-mainnet for production ``` ## šŸ“š Available Commands ### `cdp-docs` Main documentation management command: ```bash cdp-docs setup [options] # Setup CDP documentation cdp-docs list # List available documentation cdp-docs --help # Show help ``` #### Options: - `-f, --force` - Overwrite existing files - `-p, --path <path>` - Custom documentation path (default: ./doc/cdp) ### `cdp-setup` Interactive setup wizard: ```bash cdp-setup # Run interactive setup ``` ## šŸ—ļø Integration Guide After running the setup: 1. **Get CDP Credentials**: - Visit [https://portal.cdp.coinbase.com/](https://portal.cdp.coinbase.com/) - Create API keys and wallet secret 2. **Configure Environment**: ```bash cp .env.local.example .env.local # Edit .env.local with your actual credentials ``` 3. **Review Documentation**: - Read `./doc/cdp/integration/SETUP-CDP-WALLET.md` - Follow `./doc/cdp/integration/INTEGRATION-SUMMARY.md` 4. **Start Building**: - Use the wallet API documentation in `./doc/cdp/wallet/` - Implement CDP features in your application ## 🌟 Features ### šŸ“– Comprehensive Documentation - Complete wallet API v2 documentation - Step-by-step integration guides - Security best practices - Troubleshooting guides ### šŸ› ļø Developer Experience - Interactive CLI setup - Automatic dependency management - Environment template generation - Force overwrite options ### šŸ”’ Security First - Environment variable management - Private key handling best practices - Testnet-first development approach ### 🌐 Multi-Network Support Documentation covers: - **Base** (Layer 2 Ethereum) - **Ethereum** (Mainnet & Testnets) - **Solana** (Mainnet & Devnet) ## šŸ“‹ Requirements - **Node.js**: 16.0.0 or higher - **npm**: 7.0.0 or higher - **Operating System**: macOS, Linux, Windows ## šŸ¤ Contributing This package is maintained by [must-be-ash](https://github.com/must-be-ash). ## šŸ“„ License MIT ## šŸ†˜ Support - **NPM Package**: [https://www.npmjs.com/package/cdp-docs-cli](https://www.npmjs.com/package/cdp-docs-cli) - **CDP Documentation**: [https://docs.cdp.coinbase.com/](https://docs.cdp.coinbase.com/) - **Base Network**: [https://base.org/](https://base.org/) - **Issues**: [GitHub Issues](https://github.com/must-be-ash/cdp-docs-cli/issues) ## šŸ”„ Version History ### 1.0.0 - Initial release - CDP documentation setup - Interactive CLI - Dependency management - Environment templates --- **Built with ā¤ļø for the CDP developer community**