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

wdk-protocol-fiat-peer

v0.1.1

Published

Peer Cash fiat off-ramp protocol for Tether WDK

Downloads

70

Readme

wdk-protocol-fiat-peer

Peer Cash for Tether WDK. The module implements WDK's IFiatProtocol for cashing out Base USDC to supported fiat payment platforms at the live oracle rate.

Peer Cash is off-ramp only. quoteBuy() and buy() reject with a typed unsupported_operation error.

Install

npm install wdk-protocol-fiat-peer

Quote a cash-out

import PeerFiatProtocol from 'wdk-protocol-fiat-peer';

const fiat = new PeerFiatProtocol(account);

const quote = await fiat.quoteSell({
  cryptoAsset: 'usdc',
  fiatCurrency: 'EUR',
  cryptoAmount: 25_000_000n,
  config: { platform: 'revolut', includeEta: true },
});

quote.cryptoAmount;
quote.fiatAmount;
quote.rate;
quote.metadata;

Amounts follow the WDK contract: cryptoAmount is in Base USDC base units and fiatAmount is in the fiat currency's minor unit. A quote is an oracle estimate, not a locked rate. The binding rate is the live oracle rate when a buyer fills the order.

Prepare a cash-out

Supply a payout platform and payee to have sell() return unsigned transactions:

const result = await fiat.sell({
  cryptoAsset: 'usdc',
  fiatCurrency: 'EUR',
  cryptoAmount: 25_000_000n,
  config: {
    platform: 'revolut',
    payee: '@alice',
  },
});

for (const [index, transaction] of result.prepared?.txs.entries() ?? []) {
  console.log(result.prepared?.steps[index], transaction);
}

The WDK host must inspect, sign, and submit prepared.txs in order. The module never accepts a private key or broadcasts a transaction. If prepared.accessPolicyRequired is true, finalize the confirmed create-deposit receipt with @zkp2p/cash, then prepare and submit its access-policy transaction.

Some payout platforms require a pre-existing verified payee. For those platforms, a new bare handle returns the SDK's PAYEE_VERIFICATION_REQUIRED error; pass prepared curator payee data or complete verification in the Peer app.

If config.platform and config.payee are both omitted, sell() returns https://app.peer.xyz/cash as the standard WDK sellUrl and does not register a payee or prepare transactions.

Resume an order

Use the composite Peer deposit ID as WDK's transaction ID:

const transaction = await fiat.getTransactionDetail(depositId);

transaction.status;
transaction.metadata.order;

Peer states map to WDK as follows:

  • deliveredcompleted
  • returnedfailed
  • all active states → in_progress

Supported surface

  • Asset: USDC on Base, 6 decimals
  • Fiat currencies and payout platforms: read live from @zkp2p/cash
  • Pricing: 0% protocol spread, live oracle rate at fill time
  • Countries: Peer exposes availability by payout platform and currency rather than by country, so getSupportedCountries() returns an empty list instead of inventing a country gate
  • Runtime: browser and Node.js 20.19+

Configuration

const fiat = new PeerFiatProtocol(account, {
  environment: 'production',
  referralCode: 'ABC123',
  appUrl: 'https://app.peer.xyz/cash',
});

refundAddress is rejected. Peer Cash returns any withdrawal to the depositing wallet, so the module never silently promises a different refund destination.

Development

npm install
npm run validate