@appliedblockchain/simple-block-explorer

0.1.5 • Public • Published

Summary

Small, simple library to get non-empty blocks/transactions.

It simply takes an instance of web3, an array of contract jsons for ABI injection and an optional middleware to modify TXs before being added.

Taken from Ed's blocks library in KLM.

Usage

Example Route:

Note: In my example, web3 and contract json's are injected via eth

const { BlockExplorer } = require('@appliedblockchain/simple-block-explorer')
const web3 = new Web3()
const componentJson = require('contracts/Components.json')
const contracts = [ componentJson ]

const txMiddleware = async (tx) => {
  tx.value = Number(tx.value)
  tx.extraProperty = 'testing'
  return tx
}

const handler = async (ctx) => {
  const blockExplorer = new BlockExplorer({
    web3,
    contracts,
    txMiddleware
  })

  ctx.body = await blockExplorer.getTransactions()
}

Readme

Keywords

none

Package Sidebar

Install

npm i @appliedblockchain/simple-block-explorer

Weekly Downloads

1

Version

0.1.5

License

ISC

Unpacked Size

16.2 kB

Total Files

8

Last publish

Collaborators

  • ewan-sims-applied-blockchain
  • lanreayobamidele
  • andyharr15
  • aditya.gupta.appliedblockchain
  • geoffreychalk
  • brunoneves-devops
  • samfcmc
  • tiagorvmartins
  • kjack83
  • losceicco
  • ruisereno
  • telmof
  • andremfaria
  • lbltavaresab
  • ztadic91
  • pedrolino
  • alisson-diniz-ab
  • juniorerico
  • diogopalhais
  • gabspeck
  • ab-ci
  • andycampbell92
  • mirek
  • danchmelo
  • seromenho
  • kennypt
  • zeluisping
  • pmcleite-ab
  • filipepedro
  • mnikolaus
  • bertola
  • lpalmeida
  • lslima91