Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@stacks/rx

Package Overview
Dependencies
Maintainers
8
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stacks/rx

Reactive client library for the Stacks blockchain

latest
npmnpm
Version
0.0.7
Version published
Weekly downloads
7
-56.25%
Maintainers
8
Weekly downloads
 
Created
Source

@stacks/rx

Build and test status

Reactive Extensions client for the Stacks Blockchain 🚀

Getting Started

yarn add @stacks/rx rxjs
import { RxStacks, HIRO_API_URL } from '@stacks/rx';

const client = new RxStacks({ url: HIRO_API_URL });

client.blocks$.subscribe(block => console.log('New block: ', block.height));

Demo App

git clone https://github.com/blockstack/rx
cd demo/demo-app
yarn && yarn start

Open http://localhost:3000 to view it in your browser.

Tutorial

Broadcasting a transaction

Tutorial

Using @stacks/rx to follow a transaction's lifecycle

const { broadcastTx } = new RxStacks({ url });

broadcastTx(transaction)
  .pipe(
    concatMap(txid => {
      notifyBroadcastSuccess(tx);
      return mempoolTxs$.pipe(filterByTxid(txid));
    }),
    concatMap(memTx => {
      notifyTxInMempool(mempoolTx);
      return txs$.pipe(filterByTxid(txid));
    })
  )
  .subscribe(tx => notifyTransactionConfirm(tx));
const txid = await broadcastTx(transaction)({
  onBroadcastSuccess(),
  onBroadcastError(),
  onMempoolInclusion(),
  onTransactionConfirmedInBlock(),
})

Resources

Keywords

typescript

FAQs

Package last updated on 09 May 2021

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