0.0.1 • Published 3 years ago

@dipdup/tzkt-api v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

TzKT API

npm version Made With License: MIT

Fully typed cliend for working with TzKT blockchain API.
Automatically generated from the OpenAPI specification.

Installation

yarn add @dipdup/tzkt-api

Usage

TzKT endpoints are split by groups called services to facilitate treeshaking:

You need to create an instance of a service pointing to a particular TzKT API host:

import { AccountsService } from '@dipdup/tzkt-api'

const accounts = new AccountsService({ baseUrl: 'https://api.tzkt.io' });

After that you can start making requests:

const smartContracts = await accounts.get({
    kind: { eq: 'smart_contract' },
    balance: { gt: 0 },
    staked: { eq: true },
    select: { fields: [ 'address', 'balance', 'delegate' ] },
    sort: { desc: 'lastActivity' },
    limit: 10
});

VSCode will provide autocompletion and tooltips for the request body, but generally you can build queries by just using the docs.

Examples

Check out demo apps using TzKT API: