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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eth-address-observer

v0.7.2

Published

Ethereum addresses observer for poonkt.io

Readme

Ethereum Address Observer

GitHub Workflow Status npm GitHub npm

Ethereum addresses observer is part of poonkt.io cryptocurrency exchange. The library is used with combination of web3.js. You need to run a local or remote Ethereum node to use this library.

Installation

npm install eth-address-observer

Usage

const Web3 = require("web3");
const { EthAddressObserver } = require("eth-address-observer");
import { EthAddressObserver } from "eth-address-observer"; // or

/** Requires websocket or ipc provider */
const web3 = new Web3("ws://localhost:8546");

/** Optional config */
const config = {
	confirmationsRequired: 12, // default
	erc20: {
		confirmationsRequired: 12 // default
	}
};
const observer = new EthAddressObserver(web3, config);

Adding, removing and listing:

/** Adding ethereum address to observer */
observer.add("0x0000000000000000000000000000000000000000");
observer.add(["0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000001"]);

/** Removing ethereum address from observer */
observer.remove("0x0000000000000000000000000000000000000000");
observer.remove(["0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000001"]);

/** Show observable addresses */
console.log(observer.list);

Listening for incoming transactions:

/** Subscribing to changes */
/** Emits ever transaction in pending state */
observer.subscribe("pending", (transactionHash) => {
	const transaction = await web3.eth.getTransaction(transactionHash);

	console.log(
		`${transaction.to}: Transaction: ${transaction.hash} in PENDING state`
	);
});
/** Emits at every confirmation */
observer.subscribe("confirmation", (confirmationNumber, transactionHash) => {
	const transaction = await web3.eth.getTransaction(transactionHash);

	console.log(
		`${transaction.to}: Transaction: ${transaction.hash} new CONFIRMATION: ${confirmationNumber}, in block ${transaction.blockHash}`
	);
});
/** When transaction reach required amount of confirmations */
observer.subscribe("success", async (transactionHash) => {
	const transaction = await web3.eth.getTransaction(transactionHash);

	console.log(
		`${transaction.to}: Transaction: ${transaction.hash} is CONFIRMED!`
	);
});

Listening for incoming token transfers:

const tokens = new Map();
tokens.set("0x022E292b44B5a146F2e8ee36Ff44D3dd863C915c".toLowerCase(), {
	name: "XEENUS",
	decimals: 18
});
tokens.set("0x1f9061B953bBa0E36BF50F21876132DcF276fC6e".toLowerCase(), {
	name: "ZEENUS",
	decimals: 0
});

function getTokenInfo(address) {
	return tokens.get(address.toLowerCase()) || { name: "unknown token", decimals: "unknown" };
}

/** For any valid erc20 tokens with Transfer(address,address,uint256) event interface */
observer.subscribe("transfer-pending", (transactionHash, erc20Transfer) => {
	const { hash, address, from, to, value, log } = erc20Transfer;

	const tokenInfo = getTokenInfo(address);
	console.log(`${to}: ${tokenInfo.name} Transaction: ${transactionHash} in PENDING state`);
});

observer.subscribe("transfer-confirmation", (confirmationNumber, transactionHash, erc20Transfer) => {
	const { hash, address, from, to, value, log } = erc20Transfer;

	const tokenInfo = getTokenInfo(address);
	console.log(
		`${to}: ${tokenInfo.name} Transaction: ${transactionHash} new CONFIRMATION: ${confirmationNumber}, in block ${log.blockHash}`
	);
});

observer.subscribe("transfer-success", (transactionHash, erc20Transfer) => {
	const { hash, address, from, to, value, log } = erc20Transfer;

	const tokenInfo = getTokenInfo(address);
	console.log(`${to}: ${tokenInfo.name} Transaction: ${transactionHash} is CONFIRMED!`);
});

Sponsorship

If you like the product please donate:

  • BTC: bc1q9l3h6fkg4pznglaeupl7j94vk3fs8k4ssvg6zz
  • ETH: 0x4a90366BE03B1b0bAd024e833a18C8602a4291A0
  • XRP: rwUmFRpwX69eTkMMGmity1TgC4FSvday7z
  • BCH qrcyfuyr33lxvzjceuqq4sxnwwd3fxty0cg5fhpatm
  • ERC-20 TOKENS: 0x4a90366BE03B1b0bAd024e833a18C8602a4291A0