TzKT API
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:
- AccountsService
- BigMapsService
- BlocksService
- CommitmentsService
- ContractsService
- CyclesService
- DelegatesService
- HeadService
- OperationsService
- ProtocolsService
- QuotesService
- RewardsService
- RightsService
- SoftwareService
- StatisticsService
- VotingService
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: