JavaScript/TypeScript wrapper for DeFi SDK
Last updated Dec 7, 2025
48
Stars
17
Forks
9
Issues
0
Stars/day
Attention Score
31
Language breakdown
TypeScript 98.4%
JavaScript 1.2%
HTML 0.3%
Shell 0.1%
▸ Files
click to expand
README
defi-sdk
A JS client for interacting with Zerion API
Install
npm install defi-sdk
Getting Started
import { client } from "defi-sdk";
client.configure({ url: endpoint, apiToken: API_TOKEN });
API
General usage
client.subscribe(options)
import { client } from "defi-sdk";
client.subscribe({ namespace: "assets", body: { scope: ["prices"], payload: { asset_codes: ["eth"], currency: "usd" } }, onMessage: (event: Event, data: Response) => { / handle data / } });
namespace: aNamespacestringevent: one ofreceived | changed | appended | removed, see Zerion Docsbody: aRequestobjectdata: aResponseobject
Domain Helpers
Instead of calling client.subscribe and passing type information manually, the SDK provides helpers for most of the existing request scopes
addressAssets
import { client } from "defi-sdk";
client.addressAssets({ payload: { asset_codes: ["eth"], currency: "usd" }, onData: data => { / handle data / } });
Types
Request
interface Request<T, ScopeName extends string> {
scope: ScopeName[];
payload: T;
}
Response
interface Response<T> {
meta: any;
payload: T;
}
See Response in Zerion Docs
License
MIT License, see the included LICENSE file.
🔗 More in this category