@asbjornenge/tzkt-api

1.0.4 • Public • Published

TzKTAPI

TzKTApi is a Node.js module to communicate with a tzkt API.

Heavily inspired by the dipdup-sdk.

It uses the openapi-typescript-codegen to generate the api code from the spec. It transpiles and modified this code to produce a module for Node.js in Javascript. It uses the module pattern.

It also exposes a wrapper around SignalR to ease consumption of the available websocket methods.

Install

npm i @asbjornenge/tzkt-api

Use

TzKTAPI

import { TzKTAPI } from '@asbjornenge/tzkt-api'

const api = new TzKTAPI({ BASE: 'https://api.tzkt.io' })

const contracts = await api.accounts.accountsGet({
  type: 'contract',
  limit: 10
})

console.log(contracts)

TzKTEvents

import { TzKTEvents } from '@asbjornenge/tzkt-api'

const events = new TzKTEvents({ BASE: 'https://api.tzkt.io/v1/events' })
await events.start()
events.on('head', async (head) => console.log(head))
await events.listen('head')

Test

npm test

enjoy.

Readme

Keywords

none

Package Sidebar

Install

npm i @asbjornenge/tzkt-api

Weekly Downloads

20

Version

1.0.4

License

ISC

Unpacked Size

1.19 MB

Total Files

420

Last publish

Collaborators

  • asbjornenge