Repository navigation
v0.1.0
First public release of the TypeScript SDK for the Pegaroute cross-chain swap API.
npm install @pegaroute/sdkWhat's included
- Typed client for every API-key endpoint:
quotes.get,swaps.create/get/events/submitTxHash,transactions.list(paginated),chains,tokens,providers,healthandping. - Status polling:
swaps.waitForCompletionwaits until a swap reaches a final status. - Webhook verification:
verifyWebhookchecks theX-Pegasus-SignatureHMAC and returns a typed event. - Typed errors: a
PegarouteErrorsubclass per HTTP status, includingProviderChangedError, which carries the refreshed quote. GET requests are retried on network failures and retryable errors. - Browser-safe types:
@pegaroute/sdk/typesexports the types and type guards your frontend needs to readexecutionand sign, without the client or the API key.
Requirements
- Node.js 22.12+, Bun or Deno. ESM only:
importit, orrequire()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.