Socket
Socket
Sign inDemoInstall

@zilliqa-js/subscriptions

Package Overview
Dependencies
24
Maintainers
6
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @zilliqa-js/subscriptions

Class(es) for interactiong with websocket API of Zilliqa node


Version published
Maintainers
6
Install size
2.13 MB
Created

Readme

Source

@zilliqa-js/subscriptions

JavaScript library for managing and handling subscription-based events with the Zilliqa blockchain.

Table of Contents

  • Installation
  • Usage
  • Examples
  • Supported Events
  • Documentation
  • License

Installation

npm install @zilliqa-js/subscriptions --save

or

yarn add @zilliqa-js/subscriptions

Usage

To start using the subscriptions package, first import the necessary components:

const { SubscriptionBuilder, Zilliqa } = require("@zilliqa-js/subscriptions");

or using ES6 imports:

import { SubscriptionBuilder, Zilliqa } from "@zilliqa-js/subscriptions";

Examples

Subscribe to New Blocks

const zilliqa = new Zilliqa("https://api.zilliqa.com");
const subscription = zilliqa.subscriptionBuilder.buildNewBlockSubscriptions();

subscription.subscribe();
subscription.emitter.on(StatusType.SUBSCRIBE_NEW_BLOCK, (event) => {
  console.log("New block:", event.value);
});

Unsubscribing

After subscribing, you can also unsubscribe from events:

subscription.unsubscribe();

Supported Events

  • New Block Subscriptions (SUBSCRIBE_NEW_BLOCK)
  • Transaction Subscriptions (SUBSCRIBE_TX)
  • [Add more supported events as per the library]

Documentation

For comprehensive documentation, please refer to Zilliqa Official Documentation.

License

This project is licensed under the GPL License. View LICENSE for more information.

FAQs

Last updated on 06 Dec 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc