Skip to content

v0.1.0

Choose a tag to compare

@dillu24 dillu24 released this 12 Oct 14:01

First public release of the TypeScript SDK for the Pegaroute cross-chain swap API.

npm install @pegaroute/sdk

What's included

  • Typed client for every API-key endpoint: quotes.get, swaps.create / get / events / submitTxHash, transactions.list (paginated), chains, tokens, providers, health and ping.
  • Status polling: swaps.waitForCompletion waits until a swap reaches a final status.
  • Webhook verification: verifyWebhook checks the X-Pegasus-Signature HMAC and returns a typed event.
  • Typed errors: a PegarouteError subclass per HTTP status, including ProviderChangedError, which carries the refreshed quote. GET requests are retried on network failures and retryable errors.
  • Browser-safe types: @pegaroute/sdk/types exports the types and type guards your frontend needs to read execution and sign, without the client or the API key.

Requirements

  • Node.js 22.12+, Bun or Deno. ESM only: import it, or require() it from CommonJS on Node 22.12+.
  • Use the client on your backend only: it holds your API key.

See the README for usage, and examples/ for a backend (Hono) and EVM signing (viem) example.

Before 1.0, a minor release may include breaking changes.