nucleic

0.5.1 • Public • Published

Nucleic

For building Bitcoin-powered applications in Node.js Typescript.

Usage

import { PlanariaCrawler } from 'nucleic'

class Crawler extends PlanariaCrawler {

  query: {
    // see https://bitquery.planaria.network for query syntax
  }

  async getBlockIndex() {
    // optional override 
  }

  async setBlockIndex() {
    // optional override 
  }

  async onTransaction(transaction) {
    // override to receive transactions
  }

  async persistTransction(transaction) {
    // optional override to persist transaction if not persisted
  }

}

(aysnc () => {

  let crawler = new Crawler(process.env.PLANARIA_TOKEN)

  // optional event emitter in addition to onTransaction callback
  crawler.on('transaction', (transaction) => {

  })

  // crawler will catch all errors silently and it an error event
  crawler.on('error', (error) => {

  })

  // awaiting crawler will crawl forever until stopped
  crawler.on('transaction', crawler.stop)

  await crawler.start()

}()

Readme

Keywords

none

Package Sidebar

Install

npm i nucleic

Weekly Downloads

2

Version

0.5.1

License

ISC

Unpacked Size

81.7 kB

Total Files

28

Last publish

Collaborators

  • stevenzeiler