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

@usdctofiat/offramp

v3.0.3

Published

USDC-to-fiat offramp SDK — create delegated deposits in one function call

Readme

@usdctofiat/offramp

npm version License: MIT

USDC-to-fiat offramp SDK for Base. 6 functions + 2 const objects.

Agent bundle

If you are integrating through an agent (Claude Code, Cursor, etc.), start here:

Install

bun add @usdctofiat/offramp

Quick Start

import { offramp, PLATFORMS, CURRENCIES } from "@usdctofiat/offramp";

const result = await offramp(walletClient, {
  amount: "100",
  platform: PLATFORMS.REVOLUT,
  currency: CURRENCIES.EUR,
  identifier: "alice",
});
// { depositId: "362", txHash: "0x...", resumed: false }

Deposit Management

import { deposits, close } from "@usdctofiat/offramp";

const list = await deposits("0xYourAddress");
await close(walletClient, "361");

React

import { useOfframp } from "@usdctofiat/offramp/react";
import { PLATFORMS, CURRENCIES } from "@usdctofiat/offramp";

function SellButton({ walletClient }: { walletClient: WalletClient }) {
  const { offramp, step, isLoading } = useOfframp();

  return (
    <button
      disabled={isLoading}
      onClick={() => offramp(walletClient, {
        amount: "100",
        platform: PLATFORMS.REVOLUT,
        currency: CURRENCIES.EUR,
        identifier: "alice",
      })}
    >
      {step ?? "Sell USDC"}
    </button>
  );
}

Platform & Currency Data

import { PLATFORMS, CURRENCIES } from "@usdctofiat/offramp";

PLATFORMS.REVOLUT.name; // "Revolut"
PLATFORMS.REVOLUT.currencies; // ["USD", "EUR", "GBP", ...]
PLATFORMS.REVOLUT.identifier.label; // "Revtag"
PLATFORMS.REVOLUT.identifier.placeholder; // "revtag (no @)"
PLATFORMS.REVOLUT.identifier.help; // "Revtag without @ (must be public)"
PLATFORMS.REVOLUT.validate("@alice"); // { valid: true, normalized: "alice" }

CURRENCIES.EUR.symbol; // "€"
CURRENCIES.EUR.name; // "Euro"
CURRENCIES.EUR.countryCode; // "eu"

OTC Private Orders

Restrict a deposit to a single taker wallet. Pass otcTaker and the deposit is created, delegated, and restricted in one call:

import { offramp, PLATFORMS, CURRENCIES } from "@usdctofiat/offramp";

const { depositId, otcLink } = await offramp(walletClient, {
  amount: "100",
  platform: PLATFORMS.REVOLUT,
  currency: CURRENCIES.EUR,
  identifier: "alice",
  otcTaker: "0xBuyerAddress",
});
// otcLink = "https://otc.usdctofiat.xyz/d/0x.../362"
// Share otcLink with the buyer — they open it, connect their wallet, and fill the order.

Toggle OTC on existing deposits:

import { enableOtc, disableOtc, getOtcLink } from "@usdctofiat/offramp";

await enableOtc(walletClient, "362", "0xBuyerAddress");
await disableOtc(walletClient, "362"); // make public again
getOtcLink("362"); // just the URL, no tx

Resumable

offramp() is idempotent. If an undelegated deposit exists for the wallet, it skips straight to delegation. Handles browser crashes, failed delegation, and retries automatically. Just call offramp() again.

Error Handling

import { OfframpError, OFFRAMP_ERROR_CODES } from "@usdctofiat/offramp";

try {
  await offramp(walletClient, params);
} catch (err) {
  if (err instanceof OfframpError) {
    if (err.code === "USER_CANCELLED") return;
    if (err.code === OFFRAMP_ERROR_CODES.EXTENSION_REGISTRATION_REQUIRED) {
      // User needs to register in the Peer extension first — see below.
      return;
    }
    // For any other failure: call offramp() again to resume
  }
}

Peer Extension Registration (PayPal, Wise)

PayPal and Wise makers must register their handle inside the Peer (PeerAuth) browser extension before the first deposit. The SDK throws OfframpError with code EXTENSION_REGISTRATION_REQUIRED when curator rejects a maker for this reason. Drive the three-step handshake via the React hook:

import { PLATFORMS, CURRENCIES, OFFRAMP_ERROR_CODES } from "@usdctofiat/offramp";
import { useOfframp, usePeerExtensionRegistration } from "@usdctofiat/offramp/react";

function PayPalSellButton({ walletClient }) {
  const { offramp, lastError } = useOfframp();
  const peer = usePeerExtensionRegistration(PLATFORMS.PAYPAL);

  const needsExtension = lastError?.code === OFFRAMP_ERROR_CODES.EXTENSION_REGISTRATION_REQUIRED;

  return (
    <>
      <button
        onClick={() =>
          offramp(walletClient, {
            amount: "100",
            platform: PLATFORMS.PAYPAL,
            currency: CURRENCIES.USD,
            identifier: "alicepay", // PayPal.me username, NOT email
          })
        }
      >
        Sell USDC
      </button>

      {needsExtension && (
        <div>
          <p>{peer.info?.requiredPrompt}</p>
          {peer.phase === "needs_install" && (
            <button onClick={peer.installExtension}>Install Peer Extension</button>
          )}
          {peer.phase === "needs_connection" && (
            <button onClick={peer.connectExtension} disabled={peer.busy}>
              Connect Peer Extension
            </button>
          )}
          {peer.phase === "ready" && (
            <button onClick={peer.openVerifySidebar}>Verify in Peer</button>
          )}
          {peer.info?.ctaSubtext && <small>{peer.info.ctaSubtext}</small>}
        </div>
      )}
    </>
  );
}

Or drive the handshake manually via peerExtensionSdk:

import { peerExtensionSdk } from "@usdctofiat/offramp";

const state = await peerExtensionSdk.getState();
if (state === "needs_install") {
  peerExtensionSdk.openInstallPage();
} else if (state === "needs_connection") {
  const approved = await peerExtensionSdk.requestConnection();
  if (approved) peerExtensionSdk.openSidebar("/verify/paypal");
} else {
  peerExtensionSdk.openSidebar("/verify/paypal");
}

After the user completes the flow in the extension, call offramp() again.

How It Works

Every deposit is automatically delegated to the Delegate vault for oracle-based rate management, auto-closes when filled, and is attributed to Galleon Labs via ERC-8021.

Webhooks

Subscribe to live deposit.created, deposit.filled, deposit.partially_filled, deposit.closed, and otc.taken events for your attributed deposits. otc.enabled and otc.disabled are reserved event names. Register endpoints at usdctofiat.xyz/developers with your Peerlytics API key. HMAC-SHA256 signed deliveries use the X-Usdctofiat-Signature: t=<unix>,v1=<hex> header. Reference HMAC receiver in the starters repo.

Links

usdctofiat.xyz · delegate.usdctofiat.xyz · peerlytics.xyz · orderbook.peerlytics.xyz

Examples & agent skills · @usdctofiat · @andrewwilkinson