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

ox

v0.3.0

Published

Ethereum Standard Library

Downloads

289,735

Readme

Overview

Ox (⦻) is the foundation of robust Ethereum software written in TypeScript. It is an Ethereum Standard Library that provides a set of lightweight, performant, and type-safe TypeScript modules for Ethereum.

It offers core utilities & types for primitives such as: ABIs, Addresses, Blocks, Bytes, ECDSA, Hex, JSON-RPC, RLP, Signing & Signatures, Transaction Envelopes, and more.

As an unopinionated Standard Library, it is designed to be used by higher-level consumers (such as Viem, Tevm, or their alternatives) to provide their own opinionated interfaces, and/or when reaching for low-level primitives may be needed without buying into a Client Abstraction stack (Viem, Ethers, Web3.js, etc).

Documentation

Head to the documentation to read and learn more about Ox.

Example Usage

The example below demonstrates how to construct, sign, and broadcast a transaction envelope using Ox:

import { Provider, Secp256k1, TransactionEnvelopeEip1559, Value } from 'ox'
 
// 1. Construct a transaction envelope.
const envelope = TransactionEnvelopeEip1559.from({
  chainId: 1,
  gas: 21000n,
  nonce: 0n,
  maxFeePerGas: Value.fromGwei('10'),
  maxPriorityFeePerGas: Value.fromGwei('1'),
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: Value.fromEther('1'),
})
 
// 2. Get the signing payload for the envelope.
const payload = TransactionEnvelopeEip1559.getSignPayload(envelope) 
 
// 3. Sign the payload with your private key using secp256k1.
const signature = Secp256k1.sign({ payload, privateKey: '0x...' })

// 4. Serialize the envelope with the signature.
const serialized = TransactionEnvelopeEip1559.serialize(envelope, { signature })

// 5. Broadcast the envelope to the network.
const provider = Provider.from(window.ethereum)
const hash = await provider.request({
  method: 'eth_sendRawTransaction',
  params: [serialized],
})

[!NOTE]
Ox's APIs are purposely stateless, unopinionated, and verbose. The example above can definitely be achieved in a few lines of code in a more concise manner, however, the goal is for higher-level abstractions (Viem, etc) built on top of Ox to handle this for you.

Community

Check out the following places for more Ox-related content:

Support