npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

firm.web3

v0.1.1

Published

[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Join the chat at https://gitter.im/ethcore/parity][gitter-image]][gitter-url] [![GPLv3][license-image]][license-url]

Downloads

4

Readme

NPM version Build Status Join the chat at https://gitter.im/ethcore/parity GPLv3

Firm Web3

Subset of original Web3 API with additional certainty checks. I.e. wait for some confirmations (new blocks) before triggering the callback.

Usage

// Import the library
import {FirmWeb3, Certainty} from 'firm.web3';

// Create new `FirmWeb3` passing existing `web3` instance.
let firmWeb3 = new FirmWeb3(global.web3);

// Change certainty level (default MEDIUM=4 blocks)
firmWeb3 = firmWeb3.withCertainty(Certainty.HIGH); // wait for 12 blocks

// send transaction and wait for receipt
web3.eth.sendTransaction({...}, (err, txHash) => {
  console.log('Transaction sent.');

  // wait for receipt with sufficient confirmations count
  firmWeb3.getTransactionReceipt(txHash, (err, receipt) => {
    console.log('Transaction has 12 confirmations.');
  });  
});

or without ES2015:

// Import the library
var firmWeb3 = require('firm.web3');

// Create new `FirmWeb3` passing existing `web3` instance.
var firmWeb3 = new firmWeb3.FirmWeb3(global.web3);

// Change certainty level (default MEDIUM=4 blocks)
firmWeb3 = firmWeb3.withCertainty(firmWeb3.Certainty.HIGH); // wait for 12 blocks

// send transaction and wait for receipt
web3.eth.sendTransaction({...}, function (err, txHash) {
  console.log('Transaction sent.');

  // wait for receipt with sufficient confirmations count
  firmWeb3.getTransactionReceipt(txHash, function (err, receipt) {
    console.log('Transaction has 12 confirmations.');
  });
});

API

Web3

  • firmWeb3.withCertainty(level) - returns a new instance with given certainty level (Certainty.{LOW(2 blocks), MEDIUM(4), HIGH(12)} or just number of blocks),
  • firmWeb3.getTransactionReceipt(hash, callback) - gets a receipt for given hash (will retry up to 24 blocks),
  • firmWeb3.getCode(address, callback) - gets contract code under given address (will retry up to 24 blocks),
  • firmWeb3.filter(filterOptions) - returns a new logs (events) filter,
  • firmWeb3.contract(abiArray) - returns a new contract factory.

Filter

  • filter.withCertainty(level) - returns a new filter with changed certainty level,
  • filter.get(callback) - gets current "firm" logs (logs coming from block latest - confirmationLevel),
  • filter.watch(callback) - fires a callback for each new logs specified in filter and happening in block latest - confirmationLevel,
  • filter.stopWatching() - stops watching and uninstall filter.

Contract

  • contractF.at(address) - returns contract with current ABI bound to given address,

  • contractF.new([...args,] callback) - deploys contract with current ABI and calls back with FirmContract.

  • contract.withCertainty(level) - returns a new contract with different certainty level,

  • contract.allEvents([filterOptions] [, callback]) - returns a filter for all events hapening in contract

  • contract.[eventName]([filterValues] [, filterOptions] [, callback]) - returns a filter for specific event in contract

Parameters values are the same as specified here: JavaScript API

TODO

  • [] Better retries handling (each block instead of timeout)
  • [] Information about progress