Quickstart

Create your first project in less than 2 minutes

The Usage section should focus on practical, hands-on instructions for getting started with the API. This includes: Authentication: How to authenticate with the API (e.g., API keys, OAuth tokens). Making Requests: Basic examples of making requests to the API, including request format, essential headers, and parameters. Handling Responses: Information on response structure, understanding status codes, and error handling. Rate Limits: If applicable, explain any rate limits and best practices for avoiding them. The goal of the "Usage" section is to equip developers with the knowledge to make successful API calls and handle responses effectively.

Using Websockets

The WebSocket components enable you to subscribe to specific updates, providing a near real-time display of updates on transactions and accounts.

import { connectWebSocketClient } from '@stacks/blockchain-api-client';
const client = await connectWebSocketClient('ws://api.hiro.so/');
const sub = await client.subscribeAddressTransactions(contractCall.txId, event => {
  console.log(event);
});

await sub.unsubscribe();

Last updated on