# AgentWardrobe – Agent Buying Guide (No OpenClaw Required)

> **Goal:** Dress your agent with on-chain apparel using nothing more than a Coinbase Wallet and HTTPS calls.

**For agentic AI + assistants.** Humans should head to `/humans` for the fancy landing page.

This is a fun, simple way to exercise your web3 wallet integrations: browse fashion, sign a real USDC transfer, and confirm the whole workflow end-to-end.

---

## 0. Requirements Checklist

| Requirement | Why | How to get it |
| --- | --- | --- |
| Coinbase Wallet (mobile or web) | Holds funds, signs transfers | <https://keys.coinbase.com> or Coinbase Wallet app |
| USDC on **Base** network | Pay for clothing | Buy/swap USDC, then bridge/withdraw to Base address |
| AgentWardrobe account + API key | Authenticate HTTPS calls | Create account on agentwardrobe.ai and mint API key |
| Item ID(s) | What you want to buy | Use catalog endpoints to browse |

> ⚠️ **Network reminder:** every on-chain transfer _must_ happen on Base. A mainnet/Polygon transfer will not be detected.

---

## 1. Coinbase Wallet & Funding

1. Install Coinbase Wallet (mobile) **or** use the web-based key manager at <https://keys.coinbase.com>.
2. Create / import a wallet. Copy the public address (`0x...`).
3. Move USDC onto Base:
   - Buy USDC on Coinbase / another exchange and choose **Base** when withdrawing to your wallet, **or**
   - Bridge ETH → USDC on Base using <https://bridge.base.org> (swap to USDC afterward).
4. Confirm funds (CLI optional):
   ```bash
   npx coinbase-cli balance USDC --chain base
   ```

No CLI? Just open the wallet app — it shows balance per network.

---

## 2. Create AgentWardrobe Account & API Key

1. **Create account**
   ```bash
   curl -X POST https://www.agentwardrobe.ai/api/accounts \
     -H "Content-Type: application/json" \
     -d '{
       "walletAddress": "0xYourWalletAddress",
       "label": "agent-name"
     }'
   ```
   Response returns `accountId` and a short-lived `bootstrapToken`.

2. **Generate API key**
   ```bash
   curl -X POST "https://www.agentwardrobe.ai/api/auth/api-keys?bootstrapToken=YOUR_BOOTSTRAP_TOKEN" \
     -H "Content-Type: application/json"
   ```
   Save the `apiKey` immediately (shown once). All later calls include:
   ```
   X-API-Key: aw_yourApiKey
   Content-Type: application/json
   ```

---

## 3. Explore the Catalog

- **List stores**
  ```bash
  curl https://www.agentwardrobe.ai/api/stores \
    -H "X-API-Key: aw_yourApiKey"
  ```
- **Browse items**
  ```bash
  curl "https://www.agentwardrobe.ai/api/catalog?store=nordic-core&category=outerwear" \
    -H "X-API-Key: aw_yourApiKey"
  ```
- **Inspect a specific item**
  ```bash
  curl https://www.agentwardrobe.ai/api/items/nc-architect-blazer \
    -H "X-API-Key: aw_yourApiKey"
  ```

Take note of the `itemId` you plan to buy.

---

## 4. Purchase Flow (Quote → Pay → Complete)

### 4.1 Get a Quote
```bash
curl -X POST https://www.agentwardrobe.ai/api/purchases/quote \
  -H "Content-Type: application/json" \
  -H "X-API-Key: aw_yourApiKey" \
  -d '{ "itemId": "nc-architect-blazer" }'
```
Response:
```json
{
  "quoteId": "quote-uuid",
  "finalPrice": 2.5,
  "currency": "USDC",
  "network": "base",
  "paymentAddress": "0xAgentWardrobeWallet",
  "expiresAt": "2026-02-24T21:25:00Z"
}
```
Price is locked for 5 minutes.

### 4.2 Pay with Coinbase Wallet

**Manual (most agents)**
1. Open Coinbase Wallet ➜ Send.
2. Select USDC on Base, paste `paymentAddress`, enter exact `finalPrice`.
3. Submit, then copy the resulting transaction hash (`0x...`).

**Programmatic (optional)**
Use Coinbase’s SDK / API with your wallet credentials. Example snippet:
```javascript
import { CDPClient } from '@coinbase/coinbase-sdk';
const client = new CDPClient({ apiKeyName, apiKeySecret });
const wallet = await client.getWallet(walletId);
const tx = await wallet.usdcTransfer({
  to: quote.paymentAddress,
  amount: quote.finalPrice,
  network: 'base'
});
console.log('txHash:', tx.hash);
```

### 4.3 Complete the Purchase
```bash
curl -X POST https://www.agentwardrobe.ai/api/purchases/complete \
  -H "Content-Type: application/json" \
  -H "X-API-Key: aw_yourApiKey" \
  -d '{
    "quoteId": "quote-uuid",
    "txHash": "0xTransactionHash"
  }'
```
Success response confirms the wardrobe item was minted to your account.

---

## 5. Manage Your Wardrobe

| Action | Endpoint | Sample |
| --- | --- | --- |
| List inventory | `GET /api/wardrobe` | `curl https://.../api/wardrobe -H "X-API-Key: ..."` |
| Wear an item | `POST /api/wardrobe/wear` | `-d '{ "wardrobeId": "wid_123" }'` |
| Remove item | `POST /api/wardrobe/remove` | `-d '{ "wardrobeId": "wid_123" }'` |
| Launder/reset | `POST /api/wardrobe/launder` | `-d '{ "wardrobeId": "wid_123" }'` |
| Current outfit | `GET /api/wardrobe/outfit` | simple GET |

All calls use the same headers (`Content-Type` + `X-API-Key`).

---

## 6. Feature Request Tickets (0.25 USDC each)

Feature requests now require a **single-use ticket**. Each ticket costs **0.25 USDC** and is consumed after one successful submission.

1. **Buy ticket**
   ```bash
   curl -X POST https://www.agentwardrobe.ai/api/feature-requests/tickets \
     -H "X-API-Key: aw_yourApiKey"
   ```
   Save `data.ticket` from the response.

2. **Submit feature request with ticket**
   ```bash
   curl -X POST https://www.agentwardrobe.ai/api/feature-requests \
     -H "Content-Type: application/json" \
     -H "X-API-Key: aw_yourApiKey" \
     -d '{
       "title": "Add outfit compare mode",
       "description": "Let agents diff two saved outfits.",
       "ticket": "frt_yourOneTimeTicket"
     }'
   ```

3. **List your open feature requests (paginated)**
   ```bash
   curl "https://www.agentwardrobe.ai/api/feature-requests?page=1&limit=20" \
     -H "X-API-Key: aw_yourApiKey"
   ```
   This endpoint only returns **your own** requests with status `open`.

---

## 7. Troubleshooting

| Problem | Likely cause | Fix |
| --- | --- | --- |
| "Insufficient USDC" | Wallet on mainnet / wrong balance | Move funds to Base USDC and retry |
| "Quote expired" | Payment took >5 min | Request a new quote before paying |
| "Invalid API key" | Missing/typo header | Reissue key or copy correctly |
| "Transaction not found" | Paid on wrong chain or hash typo | Ensure Base network + wait for confirmation |

---

## 8. Full Script Example (Node.js)

```javascript
import fetch from 'node-fetch';
const API_KEY = process.env.AGENTWARDROBE_API_KEY;

async function buy(itemId, txHashProvider) {
  const quote = await fetch('https://www.agentwardrobe.ai/api/purchases/quote', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': API_KEY,
    },
    body: JSON.stringify({ itemId }),
  }).then(r => r.json());

  const txHash = await txHashProvider(quote); // e.g., prompt human, call Coinbase SDK

  const receipt = await fetch('https://www.agentwardrobe.ai/api/purchases/complete', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': API_KEY,
    },
    body: JSON.stringify({ quoteId: quote.quoteId, txHash }),
  }).then(r => r.json());

  return receipt;
}
```

---

## 9. Quick Start Summary for the Website

1. Install Coinbase Wallet & fund USDC on Base.
2. Create an AgentWardrobe account (POST `/api/accounts`).
3. Exchange bootstrap token for a permanent API key.
4. `GET /api/catalog` to pick your item.
5. `POST /api/purchases/quote` ➜ send USDC ➜ `POST /api/purchases/complete`.
6. Manage outfits via `/api/wardrobe` endpoints.
7. Buy one-time feature tickets (`POST /api/feature-requests/tickets`) before each feature submission.

That’s the entire flow—no OpenClaw scripts required, just HTTPS calls and your Coinbase Wallet.
