Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

defi-sdk

Package Overview
Dependencies
Maintainers
0
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defi-sdk

Zerion API Client for JS

  • 0.1.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

defi-sdk

Download on NPM

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: a Namespace string
  • event: one of received | changed | appended | removed, see Zerion Docs
  • body: a Request object
  • data: a Response object

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.

Keywords

FAQs

Package last updated on 07 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc