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

brewit

v0.1.11

Published

JavaScript SDK for Humans and Agents - Accounts, Delegations and Automations

Readme

brewit-js

JavaScript SDK for Humans and Agents - Accounts, Delegations and Automations

Installation

# npm
npm install brewit

# pnpm
pnpm install brewit

# yarn
yarn add brewit

# bun
bun install brewit

Usage

Create a main account

import { toAccount } from 'brewit';

const mainAccount = await toAccount({
  chainId: 8453,
  rpcEndpoint: 'https://mainnet.base.org',
  signer: privateKeyToAccount('0x...'),
  type: 'main',
  config: { validator: 'ownable' },
});

Create a delegated account

import { toAccount } from 'brewit';
import { createDelegatedAccount } from 'brewit/delegation';


// Define the validator and policy for the delegated account
const validator = {
  address: '0xValidatorAddress', // Validator contract address
  initData: '0x...',             // Validator initialization data
  salt: '0x...',                 // Unique salt for the delegated account
};

const policyParams = {
  policy: 'spendlimit', // or 'sudo'
  tokenLimits: [{ token: '0xTokenAddress', amount: 1000000000000000000n }],
};

const txs = await createDelegatedAccount(mainAccount, validator, policyParams);
// Send these transactions using the main account and client

Get delegated account details

import { getDelegatedAccount } from 'brewit/delegation';

// Fetch delegated account info
const delegatedInfo = await getDelegatedAccount(
  publicClient, // viem PublicClient instance
  tokens,       // Array of tokens to check
  mainAccount.address,
  validator,
  'spendlimit'  // or 'sudo'
);

Use a delegated account

import { toAccount } from 'brewit/account';

const account = await toAccount({
  chainId: 8453,
  rpcEndpoint: 'https://mainnet.base.org',
  signer: privateKeyToAccount('0x...'),
  type: 'delegated',
  config: { validator: 'ownable', validatorInitData: '0x...', salt: '0x...' },
});

Update a delegated account

import { updateDelegatedAccount } from 'brewit/delegation';

// Update the policy or validator for the delegated account
const updatedPolicyParams = {
  policy: 'spendlimit',
  tokenLimits: [{ token: '0xTokenAddress', amount: 2000000000000000000n }],
};

const updateTxs = await updateDelegatedAccount(mainAccount, updatedPolicyParams, validator);
// Send these transactions using the main account and client

Remove a delegated account

import { removeDelegatedAccount } from 'brewit/delegation';

const removeTxs = await removeDelegatedAccount(mainAccount, validator);
// Send these transactions using the main account and client

Send a transaction

import { createAccountClient } from 'brewit';

const client = createAccountClient(account, bundlerUrl);

const tx = await client.sendTransaction(calls: {
  to: '0x...00',
  value: 0,   
  data: '0x'
});