Skip to main content

SDK Configuration

SDKConfig

Pass a config object to the ArgyrosSDK constructor:
import { ArgyrosSDK } from "@argyros/sdk";

const sdk = new ArgyrosSDK({
  apiKey: "argy_your_api_key",
  chain: "solana",
  baseUrl: "https://api.argyros.xyz",
  timeout: 30000,
  retries: 2,
});

Options

OptionTypeDefaultRequiredDescription
apiKeystringyesYour Argyros API key. Sent as Authorization: Bearer <apiKey>.
chain"solana" | "fogo""solana"noTarget chain. Appended as ?chain=<value> to every request.
baseUrlstring"https://api.argyros.xyz"noAPI base URL. Trailing slashes are stripped automatically.
timeoutnumber30000noPer-request timeout in milliseconds. Uses AbortController.
retriesnumber2noNumber of retry attempts for retryable errors (429, 5xx, network failures). Total attempts = retries + 1.

Chains

ChainDescriptionToken Standard
"solana"Solana mainnetSPL Token / Token-2022
"fogo"Fogo chainSPL Token
The chain parameter is sent as a query parameter on every API call. It determines which set of DEX markets the aggregator searches.

Retry Behavior

The SDK retries automatically on transient failures:
ConditionRetriedBackoff
HTTP 429 (rate limit)yesExponential: 1s, 2s, 4s, … (max 8s)
HTTP 5xx (server error)yesExponential: 1s, 2s, 4s, … (max 8s)
Network error / timeoutyesExponential: 1s, 2s, 4s, … (max 8s)
HTTP 400 (bad request)no
HTTP 401/403 (auth)no
HTTP 404 (no route)no
With the default retries: 2, the SDK makes up to 3 attempts before throwing.

Self-Hosted API

If you run your own route-engine instance, point the SDK at it:
const sdk = new ArgyrosSDK({
  apiKey: "any-value",
  baseUrl: "http://localhost:8080",
});