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

@ethernauta/utils

v0.0.48

Published

Pure dependency-free helpers for Ethernauta — hex, bytes, BigInt, type guards.

Downloads

1,594

Readme

bundlejs

Philosophy

This module is a set of small, dependency-free utilities used across the other packages. It is intentionally generic — nothing here knows about Ethereum, chains, or transactions. Pure, side-effect-free, no third-party runtime dependencies. No new dependencies in @ethernauta/utils is a hard rule of the monorepo.

Modules

API

Hex ↔ bytes

import { bytes_to_hex, hex_to_bytes, strip_hex_prefix } from "@ethernauta/utils"

const hex = bytes_to_hex(new Uint8Array([0xde, 0xad, 0xbe, 0xef])) // "0xdeadbeef"
const bytes = hex_to_bytes("0xdeadbeef")                            // Uint8Array
const stripped = strip_hex_prefix("0xdeadbeef")                     // "deadbeef"

Hex ↔ number

import { hex_to_number, number_to_hex } from "@ethernauta/utils"

const hex = number_to_hex(255)  // "0xff"
const value = hex_to_number("0xff") // 255

Bytes ↔ unsigned integer

import { bytes_to_uint } from "@ethernauta/utils"

const n = bytes_to_uint(new Uint8Array([0x01, 0x00])) // 256n

RLP encoding

import { rlp_encode, type RlpInput } from "@ethernauta/utils"

const encoded = rlp_encode([
  new Uint8Array([0x01]),
  new Uint8Array([0x02, 0x03]),
])

Wei ↔ string formatting

import {
  format_ether, format_gwei, format_unit,
  parse_ether, parse_gwei, parse_unit,
} from "@ethernauta/utils"

format_ether(1_000_000_000_000_000_000n)  // "1"
format_gwei(2_000_000_000n)               // "2"
format_unit(123_456n, 4)                  // "12.3456"

parse_ether("1.5")                         // 1500000000000000000n
parse_gwei("2")                            // 2000000000n
parse_unit("12.34", 4)                     // 123400n

Time helpers

import { seconds_to_big, now_to_big, deadline_in } from "@ethernauta/utils"

const now = now_to_big()                        // BigInt seconds since epoch
const in_one_minute = deadline_in(60)           // now + 60
const ms_as_bigint = seconds_to_big(30)         // 30n

Case conversion

import { camel_to_kebab } from "@ethernauta/utils"

camel_to_kebab("transferFrom") // "transfer-from"

Type narrowing — invariant

import { invariant } from "@ethernauta/utils"

const input: string | null = "helloWorld"
invariant(typeof input === "string", "input must be a string")
// input is narrowed to `string` from here on