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

@mixerx/oracles

v3.0.0

Published

Fail-closed Sepolia gas, token-price and withdrawal-fee policies for MixerX

Readme

MixerX Oracles

Fail-closed Sepolia pricing and gas policy for MixerX. Version 3.0.0 rejects a withdrawal quote when its gas or token price is missing, stale or economically unsafe.

Security contract

  • Sepolia (11155111) is the only accepted chain.
  • RPC endpoints must use HTTPS, are time-bounded and are checked against the real eth_chainId response.
  • Token calls use Multicall3 atomically at one block. Any failed token rejects the batch; no historical constant is substituted.
  • Non-native withdrawal fees require a repository price plus its observation timestamp. The default maximum age is two minutes.
  • Gas data, service fee, refund, token decimals and total fee are bounded before a result is returned. The default total-fee ceiling matches the contracts at 10% of the withdrawal amount.
  • Configurable token-price sanity bands can reject corrupted but fresh cache values.
  • The exact withdrawal gas limit is mandatory input and must come from simulation or eth_estimateGas; the package contains no token-specific limits inherited from another protocol.
  • Logging is disabled by default. Inject an ILogger that follows the host service's privacy policy if operational events are required.

The Sepolia OffchainOracle deployment must contain valid rates and must be protected by the protocol's TWAP/deviation policy. The library cannot create or initialize that on-chain state. Call assertReady() during application startup; do not accept traffic if it fails.

Installation

yarn add @mixerx/[email protected]

Node.js 24.12.0 or newer is required.

Usage

import {
  createMixerxOraclesModule,
  type ITokenPriceRepository,
} from '@mixerx/oracles';

const priceRepository: ITokenPriceRepository = {
  getQuote: async (symbol) => readCachedQuote(symbol),
};

const oracles = createMixerxOraclesModule({
  chainId: 11155111,
  rpcUrl: process.env.SEPOLIA_RPC_URL!,
  relayerFeePercent: 0.004,
  priceRepository,
  maxGasPriceGwei: 100,
  maxPriceAgeMs: 120_000,
  maxTotalFeeBps: 1_000,
  priceBounds: {
    fds: {
      minimumWeiPerToken: minimumAcceptedFdsPrice,
      maximumWeiPerToken: maximumAcceptedFdsPrice,
    },
  },
});

await oracles.assertReady();

const fee = await oracles.mixerXFeeOracle.calculateWithdrawalFee({
  currency: 'fds',
  amount: 1_000_000_000_000_000_000n,
  decimals: 18,
  gasLimit: estimatedWithdrawalGas,
  refund: '0',
  purpose: 'fee',
});

console.log({
  totalFee: fee.totalFee,
  tokenPriceInEth: fee.tokenPriceInEth,
  priceSource: fee.priceSource,
  priceObservedAtMs: fee.priceObservedAtMs,
  baseFeePerGas: fee.baseFeePerGas,
  effectiveGasPriceWei: fee.gasPriceWei,
  gasSource: fee.gasSource,
});

fee_quote and fee_validation remain accepted as input aliases for migration, but both normalize to the single fee policy in returned data.

Price-feed operation

fetchPrices() reads all configured Sepolia tokens through Multicall3 at one explicit block. It returns the complete price map together with blockNumber and observedAtMs, and only succeeds when every token succeeds. The host price feed must persist each price and its observation metadata atomically. Fee calculation never falls back from that repository to a spot value.

The default Multicall3 address is 0xcA11bde05977b3631167028862bE2a173976CA11; an explicit verified address can be supplied with multicallAddress.

Development

yarn install --immutable
yarn validate
yarn npm audit --all --recursive --severity high

CI executes those gates for every pull request. Published packages pin the protocol configuration dependency exactly.

License

GPL-3.0-only. See LICENSE.