dedust_api_client 0.7.3

API client for Dedust
Documentation
# dedust_api_client

Thin typed wrapper for the [DeDust](https://dedust.io/) asset registry, API v4
pool discovery endpoints, and legacy API v2.

Use this crate when an application needs raw typed access to DeDust asset
metadata, pool discovery/configuration, pool trades, or routing plans. The crate
does not join asset metadata into pools, load on-chain pool state, choose routes,
calculate slippage, execute swaps, or normalize DeDust data into a shared DEX
domain model.

## Usage

```toml
[dependencies]
dedust_api_client = "0.7"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```

The minimum supported Rust version (MSRV) is 1.88.

Run requests inside an async Tokio runtime. Match response enums with a wildcard
arm because they are non-exhaustive.

```rust,no_run
use dedust_api_client::api_client::DedustApiClient;
use dedust_api_client::assets::{AssetsRequest, AssetsResponse};
use dedust_api_client::v4::{PoolsParams, V4Request, V4Response};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let client = DedustApiClient::builder().build()?;

let assets_response = client.assets.exec(AssetsRequest::List).await?;
match assets_response {
    AssetsResponse::List(assets) => println!("assets: {}", assets.len()),
    _ => println!("unexpected DeDust asset response variant"),
}

let pools_response = client.v4.exec(V4Request::AllCpmmPools).await?;
match pools_response {
    V4Response::AllCpmmPools(pools) => println!("CPMM v2 pools: {}", pools.len()),
    _ => println!("unexpected DeDust v4 response variant"),
}

let params = PoolsParams::new().with_limit(100);
let screened_page = client.v4.all_pools(&params).await?;
println!("screened pool rows: {}", screened_page.total_count);
# Ok(())
# }
```

The asset registry returns friendly TON addresses and absolute image URLs. The
v4 endpoints return raw `workchain:hex_hash` addresses and asset strings such as
`native` and `jetton:0:<hash>`. Applications own any address conversion and
domain normalization.

## Asset Registry

| Method | Endpoint   | Request               | Response              |
|--------|------------|-----------------------|-----------------------|
| GET    | /list.json | `AssetsRequest::List` | `AssetsResponse::List` |

The default asset-registry origin is `https://assets.dedust.io`.

## API v4 Pool Discovery

| Method | Endpoint                  | Request                                | Response                      |
|--------|---------------------------|----------------------------------------|-------------------------------|
| POST   | /get_pools                | `V4ApiClient::pools(&PoolsParams)`     | One `PoolsResponse` page      |
| POST   | /get_pools, all pages     | `V4ApiClient::all_pools(&PoolsParams)` | Aggregated `PoolsResponse`    |
| GET    | /get_pools_allclassic     | `V4Request::AllClassicPools`           | `V4Response::AllClassicPools` |
| GET    | /get_pools_allstable      | `V4Request::AllStablePools`            | `V4Response::AllStablePools`  |
| GET    | /get_pools_allcpmm        | `V4Request::AllCpmmPools`              | `V4Response::AllCpmmPools`    |
| GET    | /get_pools_alluranus      | `V4Request::AllUranusPools`            | `V4Response::AllUranusPools`  |

The default v4 origin is `https://mainnet.api.dedust.io/v4/api`.
`POST /get_pools` is the enriched screener used by the DeDust web application.
It returns asset-pair rows with nested pools, TVL, volume, APR, reserves, fees,
rewards, and embedded asset metadata. `total_count` counts grouped rows rather
than nested pools, and the current upstream page limit is 100. Decimal and raw
integer amounts remain strings to preserve the wire representation.
`PoolsParams::new()` uses that 100-row limit. `all_pools` resets the offset to
zero, loads pages sequentially using the configured limit, merges embedded asset
metadata, and returns no partial response if a page fails or pagination is
inconsistent.

The four `get_pools_all*` endpoints return much larger discovery and
configuration registries without the screener's dynamic enrichment. Uranus
records identify launchpad tokens and fundraising configuration rather than
ordinary two-asset pools.

`POST /get_pools` and the other UI operations below are observed web-application
interfaces, not endpoints documented in DeDust's public developer reference.
They may change without a public API compatibility notice.

### Observed but unsupported web-application operations

The current DeDust frontend also calls these v4 endpoint groups, which this
crate does not yet expose:

| Area | Endpoints |
|------|-----------|
| Pool lookup | `POST /v4/api/get_pair_pools`, `POST /v4/api/pools/summary`, `GET /v4/api/pools/{address}` |
| Pool analytics | `GET /v4/api/chart`, `GET /v4/api/coin_transactions` |
| Assets | `GET /v4/api/coins/{asset}/resolver` |
| Positions | `GET /v4/api/pools/{pool}/providers`, `GET /v4/api/pools/{pool}/liquidity_position/{wallet}` |
| Portfolio | `GET /v4/api/portfolio/{wallet}`, `GET /v4/api/portfolio/{wallet}/earnings` |
| Router | `GET /v4/router/assets`, `GET /v4/router/memepads-assets`, `POST /v4/router/quote`, `POST /v4/router/swap` |

## Legacy API v2

The following operations remain available through `client.v2` for backward
compatibility. The v2 asset and pool-list endpoints are considered legacy and
should not be selected for new registry integrations.

| Method                                   | Supported |
|------------------------------------------|-----------|
| /v2/accounts/{address}/assets            |           |
| /v2/accounts/{address}/trades            |           |
| /v2/assets                               ||
| /v2/assets/{symbol}                      |           |
| /v2/coinmarketcap/markets                |           |
| /v2/dns/{domain}                         |           |
| /v2/gcko/pairs                           |           |
| /v2/gcko/tickers                         |           |
| /v2/gcko/trades                          |           |
| /v2/jettons/{address}/circulating-supply |           |
| /v2/jettons/{address}/metadata           |           |
| /v2/jettons/{address}/top-buys           |           |
| /v2/jettons/{address}/top-traders        |           |
| /v2/jettons/{address}/total-supply       |           |
| /v2/pools                                ||
| /v2/pools-lite                           ||
| /v2/pools/{address}/metadata             |           |
| /v2/pools/{address}/trades               ||
| /v2/prices                               |           |
| /v2/routing/plan                         ||

`RoutingPlanParams::new` maps the zero TON address to `native` and all other
addresses to `jetton:<address>`.

Public request and response types are marked `#[non_exhaustive]` for SemVer
headroom. Build public POD structs with `Default::default().with_<field>(...)`
or request parameter constructors, pass request parameters directly where
`Into<Request>` is implemented, and include a wildcard arm when matching public
enums.

The existing `with_api_url` and `with_executor` builder setters configure v2.
Use `with_assets_url`/`with_assets_executor` and
`with_v4_url`/`with_v4_executor` to override the other origins independently.

Live API tests hit DeDust directly. Asset and pool counts, metadata, routing
amounts, and ordering can drift with upstream state.