Skip to content

GET /tokens response doesn't match oif-specs GetAssetsResponse schema #295

@th0rOdinson

Description

@th0rOdinson

Summary

The solver's GET /api/v1/tokens endpoint returns a response that differs from the GetAssetsResponse type defined in oif-specs. The field holding the asset list is named tokens instead of assets, and each network object includes extra fields (input_settler, output_settler) not present in the spec.

oif-specs Reference

PR: Asset discovery types (#31)

File: schemas/typescript/types.ts#L936-L994

export interface NetworkAssets {
  chain_id: number;
  assets: AssetInfo[];    // ← "assets"
}

export interface AssetInfo {
  address: Address;       // EIP-7930 interoperable format
  symbol: string;
  decimals: number;
}

export interface GetAssetsResponse {
  networks: Record<string, NetworkAssets>;
}

oif-solver Implementation

Struct definitions: crates/solver-service/src/apis/tokens.rs#L29-L49

pub struct NetworkTokens {
    pub chain_id: u64,
    pub input_settler: String,    // ← not in spec
    pub output_settler: String,   // ← not in spec
    pub tokens: Vec<TokenInfo>,   // ← "tokens" instead of "assets"
}

Handler: crates/solver-service/src/apis/tokens.rs#L54-L81

OpenAPI spec: api-spec/tokens-api.yaml#L120-L148 — also defines tokens and settler fields.

Actual Response (verified 2026-02-11)

curl -s 'http://54.202.245.89:3000/api/v1/tokens'
{
  "networks": {
    "84532": {
      "chain_id": 84532,
      "input_settler": "0x6c0428cc521cc418a8842d46d413f5f96775c67b",
      "output_settler": "0xc450a11afb68731833be13225a88ecdad7d7ed52",
      "tokens": [
        { "address": "0x73c83dacc74bb8a704717ac09703b959e74b9705", "symbol": "USDC", "decimals": 6 }
      ]
    },
    "11155420": {
      "chain_id": 11155420,
      "input_settler": "0x1f0b9d6984f5f9187db70469085f7935453b815f",
      "output_settler": "0x923aa6cc898540092616f97ca770ffb8080354fc",
      "tokens": [
        { "address": "0x191688b2ff5be8f0a5bcab3e819c900a810faaf6", "symbol": "USDC", "decimals": 6 }
      ]
    }
  }
}

Request

Rename the tokens field to assets in NetworkTokens to match the oif-specs NetworkAssets type. The extra fields (input_settler, output_settler) are useful and could remain as optional additions, but they just aren't part of the spec contract.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions