Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stacks/blockchain-api-client

Package Overview
Dependencies
Maintainers
5
Versions
360
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stacks/blockchain-api-client

Client for the Stacks Blockchain API

  • 0.26.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
684
decreased by-55.21%
Maintainers
5
Weekly downloads
 
Created
Source

@stacks/blockchain-api-client

NPM Package Build Status

A JS Client for the Stacks Blockchain API

Features

This package provides the ability to:

  • Execute REST API requests against the Stacks Blockchain API
  • Subscribe to WebSockets for real-time Stacks updates (for addresses or transactions)
  • Full type safety for WebSocket and API requests and responses

Installation

You can install this package using NPM:

npm install --save-dev @stacks/blockchain-api-client

Usage

Here is an example code that connects with the WebSocket server and subscribes to updates for a specific Stacks address:

import { connectWebSocketClient } from '@stacks/blockchain-api-client';

const client = await connectWebSocketClient('ws://stacks-node-api.blockstack.org/');

const sub = await client.subscribeAddressTransactions('ST3GQB6WGCWKDNFNPSQRV8DY93JN06XPZ2ZE9EVMA', event =>
  console.log(event);
  /*
    {
      address: 'ST3GQB6WGCWKDNFNPSQRV8DY93JN06XPZ2ZE9EVMA',
      tx_id: '0x8912000000000000000000000000000000000000000000000000000000000000',
      tx_status: 'success',
      tx_type: 'token_transfer',
    }
  */
);

await sub.unsubscribe();

Documentation

You can find full references here.

Known Issues

  • The TypeScript definitions for several objects involving type unions, including transactions, are incorrectly specified as only object.

FAQs

Package last updated on 12 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc