Zum Inhalt
HALOWERK

X402werk

route / optimize

Takes what the caller holds and what the seller accepts and works out which combinations can settle the amount. All costs are brought into USD, otherwise no comparison is possible: gas on the source chain plus, where needed, the cost of a swap or a bridge. Routes that require a swap or a bridge are marked explicitly - they often look cheaper on paper and are slower and riskier in practice. Every assumption is named in assumptions; nothing is folded in silently.

POST https://x402.halowerk.com/route/optimize

Eingaben

Felder des veröffentlichten Eingabeschemas
FeldTypPflichtBeschreibung
amount_usdnumberJaAmount to be paid, in USD.
availablearrayJaWhat the caller holds.
accepted_by_sellerarrayJaWhat the seller accepts.
prioritystringNeinWhich ranking to put first. All three are always returned.
Vollständiges Eingabeschema anzeigen
{
  "type": "object",
  "required": [
    "amount_usd",
    "available",
    "accepted_by_seller"
  ],
  "additionalProperties": false,
  "properties": {
    "amount_usd": {
      "type": "number",
      "minimum": 1e-06,
      "description": "Amount to be paid, in USD."
    },
    "available": {
      "type": "array",
      "minItems": 1,
      "maxItems": 30,
      "description": "What the caller holds.",
      "items": {
        "type": "object",
        "required": [
          "chain",
          "asset",
          "balance"
        ],
        "additionalProperties": false,
        "properties": {
          "chain": {
            "type": "string",
            "description": "CAIP-2 chain, for example eip155:8453."
          },
          "asset": {
            "type": "string",
            "description": "Asset address or symbol."
          },
          "balance": {
            "type": "number",
            "minimum": 0,
            "description": "Balance in USD equivalent."
          }
        }
      }
    },
    "accepted_by_seller": {
      "type": "array",
      "minItems": 1,
      "maxItems": 30,
      "description": "What the seller accepts.",
      "items": {
        "type": "object",
        "required": [
          "chain",
          "asset"
        ],
        "additionalProperties": false,
        "properties": {
          "chain": {
            "type": "string"
          },
          "asset": {
            "type": "string"
          },
          "scheme": {
            "type": "string",
            "description": "Payment scheme, usually exact."
          }
        }
      }
    },
    "priority": {
      "type": "string",
      "enum": [
        "guenstig",
        "schnell",
        "sicher"
      ],
      "default": "guenstig",
      "description": "Which ranking to put first. All three are always returned."
    }
  }
}

Originalschema öffnen

Veröffentlichtes Eingabebeispiel

{
  "amount_usd": 1e-06,
  "available": [
    {
      "chain": "beispiel",
      "asset": "beispiel",
      "balance": 0
    }
  ],
  "accepted_by_seller": [
    {
      "chain": "beispiel",
      "asset": "beispiel"
    }
  ],
  "priority": "guenstig"
}

Ergebnis & Dokumentation

Maschinenlesbare Dokumentation dieses Hubs

Quelle dieser Seite: der veröffentlichte HALOWERK-Katalog. Stand: 2026-11-01, 15:19 UTC.

Weitere Endpunkte dieses Hubs

Alle Endpunkte dieses Hubs →