For the complete documentation index, see llms.txt. This page is also available as Markdown.

Installation and Configuration

Install and configure the Routing Engine SDK for Zert's routing API.

TypeScript/JavaScript client for Zert's routing API — tokens, chains, pairs, quotes, swaps, execution, and limit orders.

The Routing Engine SDK calls Zert's backend only. The base URL is fixed in the package as DEFAULT_API_BASE_URL (see routing-engine-sdk exports); you cannot override it via config.

All API requests require an API key. Pass api.apiKey when creating the SDK; it is sent as the x-api-key header on every request (header name is also available as API_KEY_HEADER).

How to integrate the SDK

Step 1 — Install the SDK

npm install routing-engine-sdk

Or with yarn, pnpm, or bun:

yarn add routing-engine-sdk
# or: pnpm add routing-engine-sdk
# or: bun add routing-engine-sdk

Step 2 — Create and configure the SDK

import { RoutingEngineSDK, DEFAULT_API_BASE_URL, API_KEY_HEADER } from 'routing-engine-sdk';

const sdk = new RoutingEngineSDK({
  api: {
    apiKey: 'your-api-key',
  },
});

Optional: timeout and headers:

Step 3 — Call the API

Use layers (e.g. sdk.tokens, sdk.quote) or flat methods (getTokens, requestQuote, createLimit):

Step 4 — Handle errors

See Error Handling. API failures throw RoutingEngineAPIError. Invalid or unsupported config (e.g. wrong types, or passing baseURL) can throw ConfigTypeError in development.

API surface

Layer / access
Doc

sdk.tokens

Token Management

sdk.chains

Chains

sdk.pairs

Pairs

sdk.quote

Quote

sdk.swap

Swap

sdk.limit

Limit orders

sdk.status

Status

sdk.health

Health

sdk.api exposes the same layers for backward compatibility.

Flat API

Flat method
Delegates to

getTokens(params?), getChains(), getPairs(params?)

tokens.get(params?), chains.get(), pairs.get(params?)

requestQuote(body)

quote.request(body)

buildSwap(body), getSwapSigning(swapId), submitSwapSigning(swapId, body)

matching swap.* methods

createLimit, getLimit, cancelLimit, replaceLimit, listLimits

matching limit.* methods

getTransactionStatus(txHash, params), getHealth()

status.getTransaction(...), health.get()

Configuration reference (api option)

Field
Description

apiKey

Required for authenticated Zert API calls; sent as x-api-key.

timeout

Request timeout in ms (default 10000).

baseHeaders

Optional { known?, headers?, only? } maps merged into default headers (after Content-Type).

onError

Optional callback invoked before throwing RoutingEngineAPIError.

Unsupported: baseURL — the SDK always uses DEFAULT_API_BASE_URL.

Last updated