This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@dipdup/tzkt-events
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

TzKT API

npm version Made With License: MIT

Fully typed cliend for working with TzKT subscriptions API.
A thin wrapper on top of SignalR converting subscriptions to observables.

Installation

yarn add @dipdup/tzkt-events

Usage

Create an instance of events service specifying TzKT events endpoint.

import { EventsService } from "@dipdup/tzkt-events";

const events = new EventsService({ url: "https://api.tzkt.io/v1/events" });

Connection is not initiated until the first request (lazy connection):

const sub = events.operations({ types: [ 'origination' ] })
    .subscribe({ next: console.log });

Events service implements subscription router internally (on TzKT your subscriptions are aggregated) hence you can always "unsubscribe" from new updates (however it does not change anything on the TzKT side, just stops firing your observer):

sub.unsubscribe();

By default events service will infinitely try to reconnect in case of drop, you can monitor current state by subscribing to status updates:

events.status()
    .subscribe({ next: console.log });

In case you need to terminate the connection you can do that (note that event service will start again in case you send a subscription request afterwards):

await events.stop();

Examples

Check out demo apps using TzKT events:

Readme

Keywords

none

Package Sidebar

Install

npm i @dipdup/tzkt-events

Homepage

dipdup.net

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

43.7 kB

Total Files

13

Last publish

Collaborators

  • dmirg
  • m_kus