Skip to main content
The @surchi/sdk package is the official JavaScript and TypeScript client for the SURCHI API. It supports all modern runtimes — Node.js 18+, Bun, Deno, and browser environments — and ships with bundled TypeScript declarations so you get full type safety and autocompletion without any additional setup.

Installation

TypeScript Setup

The SDK bundles its own type definitions — you do not need to install a separate @types package. If your project uses TypeScript, make sure your tsconfig.json targets at least ES2017 and has moduleResolution set to node16 or bundler to correctly resolve the package exports.
Use TypeScript for the best developer experience. Every method return value, option object, and error class is fully typed, which means your editor will flag incorrect network names, missing required fields, and invalid option combinations at edit time rather than at runtime.

Initialization

Create a single Surchi instance and reuse it across your application. The constructor accepts your API key along with optional defaults that are applied to every subsequent request.

Tokens Module

The surchi.tokens namespace lets you fetch token metadata, search by name or ticker, and inspect holder distributions in real time.

Wallets Module

Use surchi.wallets to analyze any on-chain wallet — whether it belongs to a known trader, a smart money address, or a wallet you’re monitoring for your users.

Contracts Module

The surchi.contracts namespace runs SURCHI’s AI-powered audit engine against any smart contract address and returns a structured risk report.

Liquidity Module

surchi.liquidity finds the most efficient swap path across all supported DEXes for a given input and output token pair.

Error Handling

The SDK exports distinct error classes for the most common failure modes. Catching them individually lets you apply the right retry or fallback strategy for each case.

Pagination

Methods that return lists — such as tokens.holders — support automatic pagination through an async iterator. The iterator fetches the next page on demand, so you only make as many requests as you actually need.