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

@suimpp/mpp

v0.7.0

Published

Sui USDC payment method for the Machine Payments Protocol (MPP)

Readme

@suimpp/mpp

Sui USDC payment method for the Machine Payments Protocol (MPP). Accept and make payments on any API — the first MPP implementation on Sui.

npm License: MIT

Website · GitHub · SDK · CLI

Migrated from @mppsui/mpp. If you were using the old package, switch your imports to @suimpp/mpp.

What is MPP?

The Machine Payments Protocol is an open standard by Stripe and Tempo Labs for agent-to-service payments. When a server returns HTTP 402 Payment Required, the client pays automatically and retries — no API keys, no subscriptions, no human approval.

@suimpp/mpp adds Sui USDC as a payment method. It works with any MPP-compatible client or server via the mppx SDK.

Installation

npm install @suimpp/mpp mppx

Accept Payments (Server)

Add payments to any API in 5 lines:

import { InMemoryDigestStore, USDC, sui } from '@suimpp/mpp/server';
import { Mppx } from 'mppx';

const mppx = Mppx.create({
  methods: [
    sui({
      currency: USDC,
      recipient: '0xYOUR_ADDRESS',
      store: new InMemoryDigestStore(), // Use Redis/DB in production.
    }),
  ],
});

export const GET = mppx.charge({ amount: '0.01' })(
  () => Response.json({ data: 'paid content' })
);

No webhooks. No Stripe dashboard. No KYC. USDC arrives directly in your wallet.

Make Payments (Client)

import { USDC, sui } from '@suimpp/mpp/client';
import { Mppx } from 'mppx/client';
import { SuiGrpcClient } from '@mysten/sui/grpc';
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';

const client = new SuiGrpcClient({
  baseUrl: 'https://fullnode.mainnet.sui.io:443',
  network: 'mainnet',
});
const signer = Ed25519Keypair.deriveKeypair('your mnemonic');

const mppx = Mppx.create({
  methods: [sui({ client, signer, currency: USDC })],
});

const response = await mppx.fetch('https://api.example.com/resource');
// If the API returns 402, mppx pays automatically via Sui USDC.

With t2000 SDK

If you're using the t2000 SDK, payments are even simpler:

import { T2000 } from '@t2000/sdk';

const agent = await T2000.create({ pin: 'my-secret' });

const result = await agent.pay({
  url: 'https://api.example.com/generate',
  body: { prompt: 'a sunset' },
  maxPrice: 0.05,
});
// Handles 402 → pay → retry automatically.
// Safeguards enforced (max per tx, daily limits).

CLI

t2000 pay https://api.example.com/data --max-price 0.10

t2000 pay https://api.example.com/analyze \
  --method POST \
  --data '{"text":"hello"}' \
  --max-price 0.05

How It Works

Agent                    API Server
  │                          │
  │── GET /resource ────────>│
  │<── 402 Payment Required ─│
  │    {amount, currency,    │
  │     recipient}           │
  │                          │
  │── USDC transfer on Sui ──│  (~400ms finality)
  │                          │
  │── GET /resource ────────>│
  │   + payment credential   │── verify TX on-chain via gRPC
  │   (digest + signature)   │
  │<── 200 OK + data ────────│

No facilitator. No intermediary. The server verifies the Sui transaction directly via gRPC.

Server API

sui(options)

Creates a Sui payment method for the server.

import { InMemoryDigestStore, USDC, sui } from '@suimpp/mpp/server';

const method = sui({
  currency: USDC,             // Sui coin type + decimals
  recipient: '0xYOUR_ADDR',   // Where payments are sent
  store: new InMemoryDigestStore(), // Required. Use Redis/DB in production.
  rpcUrl: '...',              // Optional: custom gRPC endpoint
  network: 'mainnet',         // Optional: 'mainnet' | 'testnet' | 'devnet'
  registryUrl: 'https://suimpp.dev/api/report', // Optional: report payments to suimpp.dev
});

Verification checks:

  • Transaction succeeded on-chain
  • Payment sent to correct recipient (address-normalized comparison)
  • Amount >= requested (BigInt precision, no floating-point)
  • Payment proof signature matches the transaction sender
  • Digest has not been used before according to the required store

Client API

sui(options)

Creates a Sui payment method for the client.

import { USDC, sui } from '@suimpp/mpp/client';

const method = sui({
  client: grpcClient,            // Any Sui client (SuiGrpcClient, etc.)
  signer: ed25519Keypair,        // Signer from @mysten/sui/cryptography
  currency: USDC,                // Coin type + decimals
  execute: async (tx) => {       // Optional: custom execution (gas sponsor, etc.)
    return myGasManager.execute(tx);
  },
});

| Option | Type | Required | Description | |--------|------|----------|-------------| | client | ClientWithCoreApi | Yes | Any Sui client implementing the core API | | signer | Signer | Yes | Any Signer from @mysten/sui/cryptographyEd25519Keypair works | | currency | Currency | Yes | Single-currency metadata including coin type and decimals | | execute | (tx: Transaction) => Promise<{ digest: string }> | No | Override transaction execution (e.g. gas sponsor/manager) |

The client builds a 0x2::coin::send_funds transaction for the exact payment amount, then signs and broadcasts it (or delegates to execute if provided).

Constants

Known currencies

The package exports common Currency presets and their raw coin type strings.

import { SUI_DOLLAR, USDC, USDC_TESTNET } from '@suimpp/mpp';

USDC;         // { type: SUI_USDC_TYPE, decimals: 6 }
USDC_TESTNET; // { type: SUI_USDC_TESTNET_TYPE, decimals: 6 }
SUI_DOLLAR;   // { type: SUI_DOLLAR_TYPE, decimals: 6 }

Utilities

parseAmountToRaw(amount, decimals)

Converts a string amount to BigInt raw units without floating-point math.

parseAmountToRaw('0.01', 6);  // 10000n
parseAmountToRaw('1.50', 6);  // 1500000n

Why Sui?

MPP is chain-agnostic. We chose Sui because agent payments need:

| | Sui | |---|---| | Finality | ~400ms | | Gas | <$0.001 per payment | | USDC | Circle-issued, native | | Verification | Direct gRPC — no facilitator |

Testing

pnpm --filter @suimpp/mpp test    # 29 tests
pnpm --filter @suimpp/mpp typecheck

License

MIT — see LICENSE