Skip to main content

Capabilities

Use the Capability resource to discover which settlement tokens and payable routes the platform exposes (rates, limits, cross-chain flags, and related fields). all() calls the public base URL (publicBaseUrl) and does not send an Authorization header for that request. You still construct GStableClient with apiKey so other private resources work as usual.

Accessing capabilities​

Call client.capability.all() on your GStableClient instance. There are no parameters on the method itself.

Error handling​

Public capability calls still throw GStableError (or subclasses) on HTTP failures, invalid envelopes, or API error code values.

import { GStableClient, GStableError } from 'gstable-js';

const client = new GStableClient({ apiKey: process.env.GSTABLE_API_KEY! });

try {
const caps = await client.capability.all();
console.log(caps.supportedTokens.length);
} catch (error) {
if (error instanceof GStableError) {
console.error(`GStable error [${error.code}]: ${error.message}`);
}
}

TypeScript support​

Types describe the public capabilities matrix returned by all(). Import them from the package root.

Core types

  • PaymentCapabilities — Top-level response: supportedTokens plus nested paymentCapabilities maps.
  • SupportedToken — Token metadata (tokenId, symbol, chainId, decimals, etc., per API).
  • PaymentCapabilitiesMatrix — Settlement token id → route bucket → route rows.
  • PaymentCapabilityRoute — A single payable route (feeRatePPM, minPaymentValue, maxPaymentValue, crosschain, and related fields per API).
import type {
PaymentCapabilities,
SupportedToken,
PaymentCapabilitiesMatrix,
PaymentCapabilityRoute,
} from 'gstable-js';

all​

Returns the matrix of supported settlement tokens and payable routes (rates, limits, cross-chain flags).

client.capability.all()

Parameters​

NameTypeRequiredDescription
———No method arguments. GStableClient still requires apiKey in the constructor for other resources.

Returns​

Promise<PaymentCapabilities> — Response shape:

  • supportedTokens: SupportedToken[] (tokenId, symbol, chainId, decimals).
  • paymentCapabilities: PaymentCapabilitiesMatrix — nested map settlement token id → route group → PaymentCapabilityRoute[] (feeRatePPM, minPaymentValue, maxPaymentValue, crosschain, etc.).

Example​

import { GStableClient } from 'gstable-js';

const client = new GStableClient({ apiKey: process.env.GSTABLE_API_KEY! });

const caps = await client.capability.all();
console.log(caps.supportedTokens.length);

const settlementTokenId = 'polygon::usdc';
const routesByGroup = caps.paymentCapabilities[settlementTokenId];
if (routesByGroup) {
console.log(Object.keys(routesByGroup));
}