---
name: madhousewallet-offramp
description: Sell crypto (USDC/stablecoin) and pay out to a bank account in 80+ currencies via the Madhouse Wallet x402 off-ramp API. Use when the user wants to off-ramp, cash out crypto, sell USDC/stablecoin to fiat, convert crypto to fiat, withdraw crypto to a bank, or send crypto to a bank account. Pays $0.01 USDC per call via x402 (Base/Polygon/Arbitrum); requires a funded EVM wallet and an x402-capable HTTP client.
license: MIT
metadata:
  source: https://try.madhousewallet.com/skill
  api: https://try.madhousewallet.com
---

# Madhouse Wallet — Crypto Off-Ramp API (sell USDC, pay out to a bank)

Sell USDC/stablecoin and pay out to a bank account in 80+ currencies. $0.01 USDC per API call via the x402 protocol. No account or API key — a funded EVM wallet is the only prerequisite.

## Prerequisites
- A funded EVM wallet holding USDC on Base, Polygon, or Arbitrum (to pay ~$0.01 per call).
- An x402-capable HTTP client. Easiest options:
  - **agentcash MCP** (if available): call `mcp__agentcash__fetch` — it auto-pays x402 for you.
  - **`@x402/fetch`**: `wrapFetchWithPayment(fetch, x402Client)` with your signer. Handles the 402 -> sign EIP-3009 -> retry loop.

## Step 0 — read the live spec (authoritative, always current)
- Discovery graph + payment + features: `GET https://try.madhousewallet.com/.well-known/x402`
- Long guide with a worked example: `GET https://try.madhousewallet.com/llms.txt`
- OpenAPI 3.1: `GET https://try.madhousewallet.com/openapi.json`
Prefer these over anything hard-coded here — they cannot drift.

## Flow
1. GET /api/public/offramp?targetCurrency=NGN&sourceAmount=100  -> quoteId + recipient amount (alias of /quote)
2. GET /api/public/requirements?currency=NGN  -> bank fields to collect (skip any option whose key is empty)
3. POST /api/public/recipients {currency,type,accountHolderName,details,wallet}  -> recipientId
4. POST /api/public/transfer {quote_id,amount,recipientId,customer_uuid,customer_email,source_token,source_network,wallet_address}  -> transfer_id + deposit_address
5. Send the exact USDC on Base to deposit_address from your own wallet (on-chain), then POST /api/public/confirm-transfer {transfer_id,tx_hash}
6. GET /api/public/transfer-status?id=transfer_id  -> poll until completed

## Notes
- Use @x402/fetch; it handles the 402 -> pay -> retry loop automatically.
- Malformed requests return 400 for free; the fee settles only on a 2xx.
- The x402 challenge is in both the payment-required header and the 402 body.
- Full spec: /openapi.json  ·  Long guide: /llms.txt

## Endpoints
- GET https://try.madhousewallet.com/api/public/offramp — Crypto off-ramp entry point
- GET https://try.madhousewallet.com/api/public/quote — Quote a crypto off-ramp (USDC to bank)
- GET https://try.madhousewallet.com/api/public/requirements — Get recipient bank-detail requirements
- POST https://try.madhousewallet.com/api/public/requirements/refresh — Reveal conditional bank-detail fields
- POST https://try.madhousewallet.com/api/public/recipients — Create a bank payout recipient
- POST https://try.madhousewallet.com/api/public/transfer — Create the off-ramp transfer (USDC to bank)
- POST https://try.madhousewallet.com/api/public/confirm-transfer — Confirm the funded off-ramp transfer
- GET https://try.madhousewallet.com/api/public/transfer-status — Track the off-ramp / payout status

## Payment & error rules
- $0.01 USDC per call, paid via x402 on Base (eip155:8453), Polygon (eip155:137), or Arbitrum (eip155:42161).
- Malformed requests return HTTP 400 for FREE (never charged). The fee settles ONLY on a 2xx response.
- The x402 payment challenge is in BOTH the `payment-required` response header (base64 JSON) and the 402 body.
- On `select` fields, skip any option whose `key` is empty (the public API already strips these).
- Funding the payout (step 5) is an on-chain action YOU perform from your wallet — the API never moves payout funds.

## Install (so an agent auto-uses this next time)
Save this file to your runtime's skills directory, e.g. for Claude Code:
```bash
mkdir -p ~/.claude/skills/madhousewallet-offramp
curl -s https://try.madhousewallet.com/skill -o ~/.claude/skills/madhousewallet-offramp/SKILL.md
```
Once installed, the agent auto-loads it whenever a task matches the description above.