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

@pingpay/onramp-sdk

v0.1.2

Published

<img width="565" alt="Screenshot 2025-05-29 at 1 52 36 PM" src="https://github.com/user-attachments/assets/c8a9caf3-2e20-4057-a2a1-b22c8e84473e" />

Downloads

8

Readme

Enable users to purchase NEAR Intents supported currencies with fiat, directly within your application.

Usage

Installation

npm install @pingpay/onramp-sdk

Basic Usage

import { PingpayOnramp } from "@pingpay/onramp-sdk";
import type { TargetAsset, OnrampResult } from "@pingpay/onramp-sdk";

const onramp = new PingpayOnramp();

const targetAsset: TargetAsset = {
  chain: "NEAR",
  asset: "USDC",
};

async function handleOnramp() {
  try {
    const result: OnrampResult = await onramp.initiateOnramp(targetAsset);
    console.log("Onramp successful:", result);
  } catch (error) {
    console.error("Onramp failed:", error);
  }
}

return <button onClick={handleOnramp}>Pingpay Onramp</button>;

Advanced Usage

The SDK provides helper methods to hook into the onramp lifecycle.

import { PingpayOnramp } from "@pingpay/onramp-sdk";
import type {
  TargetAsset,
  OnrampResult,
  PingpayOnrampConfig,
  OnrampFlowPayload,
  OnrampStep,
  OnrampStepDetails,
  FormDataSubmittedPayload,
  WalletConnectedPayload,
  TransactionSignedPayload,
  OnrampInitiatedPayload,
  ProcessFailedPayload,
  PingpayOnrampError,
} from "@pingpay/onramp-sdk";

const config: PingpayOnrampConfig = {
  onPopupReady: () => {
    console.log("SDK: Popup is ready.");
  },
  onFlowStarted: (payload: OnrampFlowPayload) => {
    console.log("SDK: Onramp flow started:", payload);
  },
  onStepChange: (step: OnrampStep, details?: OnrampStepDetails) => {
    console.log("SDK: Onramp step changed:", step, details);
  },
  onFormDataSubmitted: (payload: FormDataSubmittedPayload) => {
    console.log("SDK: Form data submitted:", payload);
  },
  onWalletConnected: (payload: WalletConnectedPayload) => {
    console.log("SDK: Wallet connected:", payload);
  },
  onTransactionSigned: (payload: TransactionSignedPayload) => {
    console.log("SDK: Transaction signed:", payload);
  },
  onOnrampInitiated: (payload: OnrampInitiatedPayload) => {
    console.log("SDK: Onramp initiated with service:", payload);
  },
  onProcessComplete: (result: OnrampResult) => {
    console.log("SDK: Onramp process complete:", result);
  },
  onProcessFailed: (payload: ProcessFailedPayload) => {
    console.error(
      "SDK: Onramp process failed:",
      payload.error,
      payload.details,
      payload.step,
    );
  },
  onPopupClose: () => {
    console.log("SDK: Popup was closed.");
  },
};

const onramp = new PingpayOnramp(config);

const targetAsset: TargetAsset = {
  chain: "NEAR",
  asset: "USDC",
};

async function handleOnramp() {
  try {
    const result: OnrampResult = await onramp.initiateOnramp(targetAsset);
    console.log("Onramp successful:", result);
  } catch (error) {
    if (error instanceof PingpayOnrampError) {
      // Use PingpayOnrampError for specific error handling
      console.error(
        "Onramp failed specifically:",
        error.message,
        error.details,
        error.step,
      );
    } else {
      console.error("Onramp failed generally:", error);
    }
  }
}

return <button onClick={handleOnramp}>Pingpay Onramp</button>;

Configuration

  • Event Handlers (all optional):
    • onPopupReady(): Called when the popup window signals it's ready. (SDK logs this internally too)
    • onFlowStarted(payload: OnrampFlowPayload): Called when the onramp flow begins in the popup.
    • onStepChange(step: OnrampStep, details?: OnrampStepDetails): Called when the current step in the onramp process changes.
    • onFormDataSubmitted(payload: FormDataSubmittedPayload): Called when user submits form data.
    • onWalletConnected(payload: WalletConnectedPayload): Called when a wallet is successfully connected.
    • onTransactionSigned(payload: TransactionSignedPayload): Called when a transaction is signed by the user.
    • onOnrampInitiated(payload: OnrampInitiatedPayload): Called when the onramp process is initiated with the backend service.
    • onProcessComplete(result: OnrampResult): Called when the entire onramp process is successfully completed.
    • onProcessFailed(payload: ProcessFailedPayload): Called if the onramp process fails at any point.
    • onPopupClose(): Called when the popup is closed, either by the user, an error, or programmatically.

Closing the Onramp

You can programmatically close the onramp popup and clean up resources by calling the close() method:

onramp.close();

This is useful if your application needs to interrupt the onramp flow. The onPopupClose callback will also be triggered.

Development

To install dependencies:

bun install

To run the dev server:

bun run dev

// "dev": "concurrently \"bun run watch:sdk\" \"bun run dev:popup\" \"bun run dev:examples\"",

This will watch for changes to the onramp SDK (./src), start the Vite dev server for the popup app (./popup), and run the example app (./examples) with a button that uses the SDK to open the popup.

  • localhost:5173: dev server for the popup
  • localhost:3000: example app to open popup

NOTE: always access the popup through clicking via the example app (localhost:3000)