# 幣種與鏈

提供平台支援的鏈與幣種（token）資訊。這幾支屬中繼資料查詢，**不扣 credit（免費）**，但仍需 API key。

所有回應皆為 `{ data, meta }` 信封，請在 header 帶 `X-API-Key`。

## 列出支援的鏈與幣種

```bash
curl https://api.atlantis.example/v1/chains \
  -H "X-API-Key: ak_live_YOUR_KEY"
```

```json
{
  "data": [
    {
      "name": "ethereum",
      "token_addresses": [
        { "name": "ETH",  "symbol": "ETH",  "address": "0x0", "decimals": 18, "verified": true },
        { "name": "USDT", "symbol": "USDT", "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "decimals": 6, "verified": true }
      ]
    }
  ],
  "meta": { "request_id": "9b1c2d3e-..." }
}
```

## 完整 token registry

```bash
curl https://api.atlantis.example/v1/registry \
  -H "X-API-Key: ak_live_YOUR_KEY"
```

```json
{
  "data": {
    "tokens": [
      { "chain": "ethereum", "symbol": "usdt", "contract": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
        "decimals": 6, "usd_mode": "stable", "rate_symbol": null, "verified": true, "display_name": "USDT" }
    ]
  },
  "meta": { "request_id": "..." }
}
```

## 某條鏈的代幣

```bash
curl "https://api.atlantis.example/v1/assets?chain=ethereum" \
  -H "X-API-Key: ak_live_YOUR_KEY"
```

```json
{
  "data": {
    "chain": "ethereum",
    "assets": [
      { "symbol": "usdt", "contract": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "decimals": 6, "usd_mode": "stable", "rate_symbol": null }
    ]
  },
  "meta": { "request_id": "..." }
}
```

## 解析 symbol / 合約 → 資產規格

把 `symbols` 或 `contracts` 解析成完整資產規格（含 `decimals`）。`contracts` 中以 `null` 代表原生幣。

```bash
# 用 symbol
curl -X POST https://api.atlantis.example/v1/resolve \
  -H "X-API-Key: ak_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"blockchain":"ethereum","symbols":["usdt","weth"]}'

# contract-first（含原生幣 null）
curl -X POST https://api.atlantis.example/v1/resolve \
  -H "X-API-Key: ak_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"blockchain":"tron","contracts":["TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",null]}'
```

```json
{
  "data": {
    "blockchain": "tron",
    "assets": [
      { "symbol": "trx",  "contract": null, "decimals": 6, "usd_mode": "rate", "rate_symbol": "TRX" },
      { "symbol": "usdt", "contract": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "decimals": 6, "usd_mode": "stable", "rate_symbol": null }
    ]
  },
  "meta": { "request_id": "..." }
}
```

## 端點與計費

| Method | 路徑                  | 說明                | Credit |
| ------ | ------------------- | ----------------- | ------ |
| `GET`  | `/v1/chains`        | 支援的鏈與幣種           | 0      |
| `GET`  | `/v1/registry`      | 完整 token registry | 0      |
| `GET`  | `/v1/assets?chain=` | 某鏈的代幣             | 0      |
| `POST` | `/v1/resolve`       | symbol／合約 → 資產規格  | 0      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blockchainsecurity.asia/documentation/zi-liao-api/assets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
