@zilliqa-js/subscriptions
TypeScript icon, indicating that this package has built-in type declarations

3.5.0 • Public • Published

@zilliqa-js/subscriptions

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

Table of Contents

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @zilliqa-js/subscriptions

Weekly Downloads

1,163

Version

3.5.0

License

GPL-3.0

Unpacked Size

364 kB

Total Files

78

Last publish

Collaborators

  • lukozill
  • troelsfr
  • inamirandaz
  • zilliqateam
  • fluffypancake5436
  • zilliqaofficial