cdp-docs-cli
Version:
CLI tool to set up CDP (Coinbase Developer Platform) documentation and integration in your project
98 lines (75 loc) • 3.88 kB
Markdown
# CDP Wallet Documentation Directory
Use this file as a roadmap for extracting the **exact snippets** needed to implement wallet functionality according to `wallet.md`.
## 1. Quick Overview First
• **File**: `context.md`
• **Lines**: *entire file*
• **Why**: Gives a compact summary of SDK auth, account types, operations, policies.
> Read this first to orient yourself—no code yet.
## 2. Project Setup
| Task | Doc & Section | Lines |
|------|---------------|-------|
| Node/Env prerequisites | `/wallet/wallet-start.md` – *Prerequisites* | 20-60 |
| API Key & Wallet Secret creation | same file – *Create keys* | 65-95 |
| npm / pip install commands | same file – *Project setup* (TypeScript tab) | 100-150 |
Copy the install commands into your project as described in `wallet.md` → *Installation*.
## 3. Instantiate SDK
| Task | Doc | Lines |
|------|-----|-------|
| Sample instantiation (TS) | `/wallet/wallet-start.md` – first TS code block under *1. Create an account* | 160-180 |
| Python version (optional) | same file – Python block | 185-205 |
Use the TS snippet to populate `src/lib/cdp.ts` boilerplate.
## 4. Account Workflows
| Feature | Doc | Lines |
|---------|-----|-------|
| Create or fetch EOA | `cdp/wallet/managing-accounts.md` – *EVM Accounts* | 20-55 |
| Create Smart Account | same file – *Smart Accounts* | 70-115 |
| Create Solana Account | same file – *Solana Accounts* | 120-160 |
| List / Update accounts | same file – *Managing Existing Accounts* | 165-260 |
Merge these patterns into helper functions (`createEvmAccount`, `createSmartAccount`, etc.).
## 5. Import / Export Keys
• **File**: `/wallet/importing.md`
– Use the TS examples under *EVM Accounts* (lines 25-55) and *Solana Accounts* (lines 65-115) to build an `importAccount` utility.
## 6. Funding Accounts
| Method | Doc | Lines |
|--------|-----|-------|
| Testnet Faucet (ETH & SOL) | `/wallet/wallet-start.md` – *2. Fund account with test funds* | 210-315 |
| Fiat → Crypto (beta) | `/wallet/fund.md` – *Get a quote* & *Execute a quote* | 30-110 |
Implement faucet call in demo; leave fiat-funding optional behind a feature flag.
## 7. Sending Transactions
| Chain | Doc | Lines |
|-------|-----|-------|
| EVM example (viem) | `/wallet/wallet-start.md` – *3. Send a transaction → EVM → TypeScript* | 320-400 |
| Solana example | same file – *Solana TypeScript* | 405-560 |
Wrap these in `sendEvmTx` and `sendSolTx` helpers.
## 8. Policies (Optional Governance)
• **File**: `/wallet/policies.md`
– Read *Overview* (lines 1-60) for concept.
– For code, copy TS snippet under *Programmatically* (lines 260-350) to see how to `createPolicy` and `updateAccount`.
Attach policies only if required by product spec.
## 9. Smart Account Gas Sponsorship (Advanced)
• **File**: `/wallet/wallet-accounts.md`
– Table under *EOA vs Smart Accounts* (lines 40-110) explains benefits.
Use when enabling paymaster / bundler.
## 10. Putting It All Together
Follow the sequence below aligning with sections in `wallet.md`:
1. **Install & Env** → Section *Installation* ↔ Docs in step 2.
2. **Boilerplate Helper** → Section *Boilerplate Code* ↔ Docs in step 3.
3. **Demo Flow (`demoWallet`)** → Section *Example Usage* ↔ Docs 4-7.
4. **Questions & Policies** → Use step 8 if needed.
Complete the checklist at the end of `wallet.md`. When each box is satisfied, you've integrated wallets successfully.
### Tips for Efficient Navigation
1. Use search (`⌘⇧F`) with keywords: `createAccount(`, `requestFaucet(`, `sendTransaction(` to jump quickly.
2. When copying code, remove `dotenv.config()` if already handled globally.
3. Keep server-side functions inside the **app router** or `src/lib` to avoid leaking secrets.
Happy building! :rocket: