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

@mentaproject/transactions

v0.0.5

Published

Transaction builder and gas utilities for Menta - Build, batch, and execute EVM transactions with ERC-4337 support

Downloads

556

Readme

@mentaproject/transactions

Transaction builder and gas utilities for Menta. Build, batch, and execute EVM transactions with ERC-4337 Account Abstraction support.

Installation

npm install @mentaproject/transactions @mentaproject/core

Features

  • TransactionBuilder: Fluent API to build and batch multiple contract calls
  • GasTracker: EIP-1559 gas estimation with slow/medium/fast tiers
  • ERC-4337 Support: Built for Account Abstraction with UserOperation gas limits
  • Simulation: Dry-run transactions before execution

Usage

TransactionBuilder

Build and execute batched transactions:

import { TransactionBuilder } from "@mentaproject/transactions";

// Single call
const hash = await new TransactionBuilder(client)
  .addCall(erc20.transfer({ to: recipient, amount: 100n }))
  .execute();

// Batch multiple calls
const hash = await new TransactionBuilder(client)
  .addCalls([
    erc20.approve({ spender: router, amount: 1000n }),
    swap.exactIn({ tokenIn: USDC, tokenOut: ETH, amount: 1000n }),
  ])
  .execute();

With Gas Configuration

import { TransactionBuilder, GasTracker } from "@mentaproject/transactions";

const gasTracker = new GasTracker(client);
const { fast } = await gasTracker.getEstimates();

await new TransactionBuilder(client)
  .addCall(erc20.transfer({ to: recipient, amount: 100n }))
  .withGasConfig(fast)
  .execute();

Simulation

Test transactions before sending:

const builder = new TransactionBuilder(client)
  .addCall(erc20.transfer({ to: recipient, amount: 100n }));

const simulation = await builder.simulate();

// Check asset changes
for (const change of simulation.assetChanges) {
  console.log(`${change.token.symbol}: ${change.value.diff}`);
}

// Execute if simulation succeeded
await builder.execute();

Gas Estimation

import { GasTracker } from "@mentaproject/transactions";

const tracker = new GasTracker(client);
const { slow, medium, fast, baseFee } = await tracker.getEstimates();

console.log(`Base fee: ${baseFee}`);
console.log(`Fast: ${fast.maxFeePerGas} (priority: ${fast.maxPriorityFeePerGas})`);

Custom configuration for L2s:

const tracker = new GasTracker(client, {
  blockCount: 10,
  percentiles: [10, 50, 90],
  minPriorityFee: 1_000_000n, // 0.001 gwei
  baseFeeMultiplierPercent: 110n, // 1.1x for stable L2s
});

Transaction Metadata

Add metadata for UI display:

const builder = new TransactionBuilder(client)
  .addCall(swap.exactIn({ ... }))
  .withMetadata({
    title: "Swap 100 USDC to ETH",
    description: "Via Uniswap V3",
  })
  .addWarning("Slippage: 0.5%");

// Get summary for UI
const summary = builder.toJSON();
// { title, description, warnings, callCount, calls }

Estimate Gas Limits (ERC-4337)

const limits = await builder.estimateGasLimits();
// {
//   callGasLimit: 150000n,        // Execution cost
//   verificationGasLimit: 250000n, // Signature validation
//   preVerificationGas: 55000n,    // Calldata overhead
// }

const totalGas = limits.callGasLimit + 
                 limits.verificationGasLimit + 
                 limits.preVerificationGas;

API Reference

TransactionBuilder

| Method | Description | |--------|-------------| | addCall(call) | Add a single call | | addCalls(calls) | Add multiple calls | | withGasConfig(config) | Set gas configuration | | withMetadata(meta) | Set transaction metadata | | addWarning(warning) | Add a warning message | | simulate() | Dry-run the transaction | | estimateGasLimits() | Get ERC-4337 gas limits | | execute() | Send the transaction | | toJSON() | Get summary for UI |

GasTracker

| Method | Description | |--------|-------------| | getEstimates() | Get slow/medium/fast estimates | | slow() | Get slow estimate only | | medium() | Get medium estimate only | | fast() | Get fast estimate only |

Types

interface GasEstimate {
  maxFeePerGas: bigint;
  maxPriorityFeePerGas: bigint;
}

interface GasLimits {
  callGasLimit: bigint;
  verificationGasLimit: bigint;
  preVerificationGas: bigint;
}

interface TransactionMetadata {
  title?: string;
  description?: string;
  warnings?: string[];
}

License

MIT