Reactive Extensions client for the Stacks Blockchain 🚀
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));
git clone https://github.com/blockstack/rx
cd demo/demo-app
yarn && yarn start
Open http://localhost:3000 to view it in your browser.
from(broadcastTransaction(transaction)).pipe(
tap(tx => notifyBroadcastSuccess(tx)),
concatMap(txid => mempoolTxs$.pipe(filterByTxid(txid))),
tap(mempoolTx => notifyTxInMempool(mempoolTx)),
concatMap(memTx => txs$.pipe(filterByTxid(txid))),
)
.subscribe(tx => notifyTransactionConfirm());