4.3.0 • Published 6 months ago

cryptoscan-provider v4.3.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

Cryptoscan Provider

Important! This is not for public use. Use only if you are a Cryptoscan partner.

WebSocket data provider library for real-time load data to Cryptoscan API. This library was created for integration with the cryptoscan.pro partners.

Installation

npm install cryptoscan-provider

Features

  • Real-time data processing via WebSocket connection
  • Dynamic WebSocket URL configuration
  • Unique ID generation for each data entry
  • TypeScript support
  • Configurable through environment variables
  • Ability to create a custom data processing function

Requirements

  • Node.js >= 14.0.0
  • WebSocket server endpoint

Configuration

Set the WebSocket server URL using the environment variable:

PROVIDER_API_URL=ws://your-websocket-server:port

If not set, it defaults to ws://localhost:8080.

Usage

import { createProcessData } from 'cryptoscan-provider';

// Create a custom data processing function
const processData = createProcessData();

// Example data object
const data = {
  key: "BTC-USDT",
  price: 50000,
  volume: 100.5,
  timestamp: 1234567890
};

// Process the data
const id = processData(data);
console.log('Generated ID:', id);

Data Object Format

The data object should follow this structure:

interface DataObject {
  [key: string]: string | number;
  key: string; // Required field
}

WebSocket Connection

On first run, the library will: 1. Extract object keys and their types 2. Establish WebSocket connection with query parameters 3. Start sending data updates

The WebSocket URL will include query parameters with the object structure:

ws://your-server/ws?keys=key,price,volume&types=string,number,number

Development

# Install dependencies
npm install

# Build the library
npm run build

# Clean build files
npm run clean

License

ISC

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

4.3.0

6 months ago

4.2.3

7 months ago

4.2.2

7 months ago

4.2.5

7 months ago

4.2.4

7 months ago

4.2.1

7 months ago

4.2.0

7 months ago

3.11.0

7 months ago

3.10.0

7 months ago

3.11.1

7 months ago

4.1.0

7 months ago

4.0.0

7 months ago

4.1.1

7 months ago

3.9.0

7 months ago

3.8.0

8 months ago

3.7.0

8 months ago

3.6.0

8 months ago

3.5.1

8 months ago

3.5.0

8 months ago

3.3.0

8 months ago

3.2.0

8 months ago

3.1.0

8 months ago

3.0.0

8 months ago

2.1.0

8 months ago

2.0.0

8 months ago

1.1.0

8 months ago

1.0.0

8 months ago