npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@binance/types

v1.0.11

Published

Shared types for Binance connectors

Downloads

248

Readme

Binance TypeScript Types

Code Style: Prettier npm version npm Downloads Node.js Version Known Vulnerabilities License: MIT

@binance/types is a TypeScript type definition package for Binance modular connectors. It centralizes shared interfaces, types, and error classes, ensuring consistency across all Binance Connectors.

This package is designed to be used with the modular Binance connectors.

Table of Contents

Features

  • Centralized Type Definitions for Binance REST/WebSocket APIs
  • Error Classes for standardized exception handling
  • Shared Configuration Interfaces used across all Binance Connectors
  • Lightweight & Tree-Shakeable – excludes runtime values when possible
  • Fully Compatible with TypeScript for strong type safety

Installation

To use this package, install it via npm:

npm install @binance/types

Usage

This package provides types and error classes to be used within Binance Connectors.

Example: Importing Common Types

import type { ConfigurationRestAPI } from '@binance/types';

const config: ConfigurationRestAPI = {
    apiKey: 'your-api-key',
    apiSecret: 'your-api-secret',
};

Example: Handling Errors Consistently

import { ConnectorClientError, UnauthorizedError } from '@binance/types';

try {
    // Some API call
} catch (err) {
    if (err instanceof ConnectorClientError) {
        console.error('Client error occurred:', err);
    } else if (err instanceof UnauthorizedError) {
        console.error('Invalid API credentials:', err);
    } else {
        console.error('Unexpected error:', err);
    }
}

Available Types

API Response Types

  • RestApiResponse<T> – Standardized REST API response structure
  • WebsocketApiResponse<T> – WebSocket response format

Configuration Types

  • ConfigurationRestAPI – Configuration structure for REST API clients
  • ConfigurationWebsocketAPI – Configuration for WebSocket API clients
  • ConfigurationWebsocketStreams – Config for managing WebSocket streams

Rate Limit Types

  • RestApiRateLimit
  • WebsocketApiRateLimit

Error Handling

The package includes predefined error classes to simplify error handling across Binance SDKs.

| Error Class | Description | | ---------------------- | --------------------------------- | | ConnectorClientError | Generic client error | | RequiredError | Missing required parameter | | UnauthorizedError | Invalid or missing API key | | ForbiddenError | Access denied | | TooManyRequestsError | Rate limit exceeded | | RateLimitBanError | Banned due to excessive API calls | | ServerError | Internal Binance server error | | NetworkError | Network connectivity issue | | NotFoundError | Requested resource not found | | BadRequestError | Malformed request |

Example: Catching API Errors

import { RequiredError, NotFoundError } from '@binance/types';

try {
    // API call
} catch (err) {
    if (err instanceof RequiredError) {
        console.error('Missing required parameters:', err);
    } else if (err instanceof NotFoundError) {
        console.error('Requested resource does not exist:', err);
    }
}

Contributing

Contributions are welcome!

  1. Open a GitHub issue before making changes.
  2. Discuss proposed changes with maintainers.
  3. Follow the existing TypeScript structure.

License

This project is licensed under the MIT License - see the LICENSE file for details.