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

@safeblock/blockchain-utils

v1.0.2

Published

Tools and utilities for managing blockchain networks, addresses, amounts, and providers

Downloads

55

Readme

@safeblock/blockchain-utils

The documentation is outdated and will be updated as soon as possible


Table of Contents


Introduction

@safeblock/blockchain-utils provides tools and utilities for managing blockchain networks, addresses, amounts, and providers with seamless integration and ease of use. Built for developers working in blockchain ecosystems, it includes functionalities to manage networks, validate and process addresses, handle amounts effectively, and utilize fallback providers.


Features

  • Network Management: Pre-configured support for blockchain networks.
  • Address Utilities: Includes type checks, actions, and support for special addresses.
  • Amount Utilities: Provides robust tools for amount calculations, formatting, and validation.
  • Provider Integration: Simplifies interactions with public nodes using a fallback mechanism.
  • Provider Reconfiguration: Dynamically update the provider list as needed.
  • Extensible: Modular design for easy customization and integration.

Installation

Install the package via npm:

npm install @safeblock/blockchain-utils

or via yarn:

yarn add @safeblock/blockchain-utils

Usage

Network Management

import { networks } from '@safeblock/blockchain-utils';

console.log(networks);

Address Utilities

import { isSpecialAddress, validateAddress } from '@safeblock/blockchain-utils/address';

const address = '0x...';

// Check if an address is special
console.log(isSpecialAddress(address));

// Validate the address format
console.log(validateAddress(address));

The Address Utilities module also supports:

  • Address Type Checks: Easily determine if an address is valid or matches specific criteria.
  • Address Actions: Includes functions for address formatting and manipulation.

Amount Utilities

import { parseAmount, formatAmount } from '@safeblock/blockchain-utils/amount';

// Parse an amount string to a standardized object
const parsedAmount = parseAmount('1.23');
console.log(parsedAmount);

// Format an amount object for display
const formattedAmount = formatAmount(parsedAmount);
console.log(formattedAmount);

The Amount Utilities module supports:

  • Parsing amounts from strings into objects.
  • Formatting amounts for user-friendly display.
  • Validating amounts to ensure accuracy.

Ethers Provider

import { createFallbackProvider, reconfigureProviders } from '@safeblock/blockchain-utils/ethers-provider';

// Create a fallback provider with a list of nodes
const provider = createFallbackProvider(['https://mainnet.infura.io', 'https://cloudflare-eth.com']);

// Dynamically update the provider list
reconfigureProviders(provider, ['https://new-node1.com', 'https://new-node2.com']);

The Ethers Provider module supports:

  • Fallback mechanisms for reliable provider access.
  • Reconfiguring provider lists dynamically without restarting the application.

API Reference

Core Modules

  • networks: Pre-defined blockchain network configurations.
  • index: Main entry point to the package.

Utilities

  • selectAddress: Helps select and validate blockchain addresses.
  • cast: Handles type conversions.

Address Management

  • specialAddresses: Defines special address types and checks.
  • addressActions: Perform actions such as validations and formatting.

Amount Utilities

  • parseAmount: Converts string representations of amounts into structured objects.
  • formatAmount: Formats structured amounts for user-friendly display.

Ethers Provider

  • publicNodesList: Lists pre-configured public nodes for network access.
  • createFallbackProvider: Ensures reliable provider access by using fallback mechanisms.
  • reconfigureProviders: Dynamically updates the provider list for runtime flexibility.

Contributing

We welcome contributions! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature-branch-name.
  3. Make your changes and commit them: git commit -m 'Add new feature'.
  4. Push the changes: git push origin feature-branch-name.
  5. Submit a pull request.

License

This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
For more information, visit: CC BY-NC-SA 4.0.