Skip to main content

Request Cancellation

All service functions accept an optional options parameter with an AbortSignal for cancelling in-flight requests:
const controller = new AbortController();

// Cancel after 5 seconds
setTimeout(() => controller.abort(), 5000);

const { markets } = await getMarkets(client, {
  dex: 'hyperliquid',
}, { signal: controller.signal });
When the signal fires, the underlying fetch is aborted and the promise rejects with an AbortError.