🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

chain-ops-mgo

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chain-ops-mgo

Multi-chain Gas Optimizer — Compare real-time gas prices across 9 EVM chains via x402 pay-per-call on Base. Powered by @chain-ops/agent-sdk.

latest
Source
npmnpm
Version
1.1.2
Version published
Weekly downloads
28
-40.43%
Maintainers
1
Weekly downloads
 
Created
Source

chain-ops-mgo

Multi-chain Gas Optimizer — Compare real-time gas prices across 9 EVM chains and get the cheapest-chain recommendation. Pay-per-call via x402 on Base. No API key, no signup.

When to use: call it before any EVM transaction (bridge, deploy, swap) to route to the lowest-fee chain — e.g. "Use Base — saves 99.8% vs Ethereum". Built for AI agents: one USDC microtransaction per call, ERC-8004 identity handled automatically.

npm version Powered by @chain-ops/agent-sdk ClawHub

Install

Free endpoints only:

npm install chain-ops-mgo

Auto-payment (recommended for paid endpoints):

npm install chain-ops-mgo @chain-ops/agent-sdk viem

Quick Start

Free — no payment

const { getCheapestChain } = require('chain-ops-mgo');

const result = await getCheapestChain();
console.log(result);
// {
//   chain: 'Base',
//   gasPriceGwei: '0.0100',
//   dexSwapCostUsdc: 0.001,
//   savingsVs: 'Ethereum',
//   savingsPercent: '99.8%'
// }
const { getGasBasicWithPayment } = require('chain-ops-mgo');

const data = await getGasBasicWithPayment({
  account: process.env.PRIVATE_KEY, // 0x...
  network: 'base',
});

console.log(data.recommendation.action);
// "Use Base — saves 99.8% vs Ethereum"

The SDK handles ERC-8004 identity, EIP-712 signing, and the x402 402-handshake automatically. One USDC microtransaction per call ($0.001 basic, $0.002 premium).

Endpoints

FunctionPriceChainsNotes
getGasDemo()Free4Raw gas prices, rate limited 10/hr
getCheapestChain()Free4Simple cheapest chain helper
getGasBasicWithPayment({ account })$0.001 USDC4Auto-pay via SDK + recommendation
getGasPremiumWithPayment({ account })$0.002 USDC9Auto-pay via SDK + 9 chains incl. BNB, Polygon, Avalanche, zkSync, Hyperliquid
getGasBasic({ paymentHeader })$0.001 USDC4Manual mode — bring your own x402 header
getGasPremium({ paymentHeader })$0.002 USDC9Manual mode — bring your own x402 header

Auto-pay options

await getGasPremiumWithPayment({
  account: '0x...',         // private key OR a viem Account object
  network: 'base',          // currently only 'base'
  maxPrice: 5_000n,         // optional cap in micro-USDC ($0.005)
});

If @chain-ops/agent-sdk is not installed, the auto-pay functions throw a clear error pointing to the install command. Free functions work without it.

Manual mode (advanced)

If you build your own x402 client, you can supply a pre-built header:

const { getGasBasic } = require('chain-ops-mgo');

const data = await getGasBasic({
  paymentHeader: { 'X-PAYMENT': '<your encoded payment>' },
});

Without a payment header, paid functions throw Error: Payment required with err.status === 402 and err.paymentInfo for inspection.

Payment

Uses x402 protocol on Base (eip155:8453) with USDC. No API key, no subscription, no account required.

License

MIT

Keywords

gas

FAQs

Package last updated on 15 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts