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

paj-utility-example

v1.0.0

Published

Example demonstrating PAJ Ramp utility functions for value conversion

Readme

PAJ Ramp - Utility Functions Example

This example demonstrates how to use the PAJ Ramp SDK's utility functions for fetching banks, converting between token amounts and fiat values, and more.

Features

  • getBanks: Fetch the list of supported banks
  • getTokenValue: Convert a fiat amount to its token equivalent
  • getFiatValue: Convert a token amount to its fiat equivalent
  • Authentication flow (initiate & verify)

Prerequisites

  • Node.js (v16 or higher)
  • A valid PAJ Ramp business API key
  • A registered email address

Setup

  1. Install dependencies:

    npm install
  2. Configure environment variables:

    cp .env.example .env
  3. Edit .env file with your credentials:

    [email protected]
    BUSINESS_API_KEY=your-business-api-key
    TOKEN_MINT=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
    CURRENCY=NGN

Running the Example

  1. Start the example:

    npm start
  2. Follow the prompts:

    • An OTP will be sent to your email
    • Add the OTP to your .env file: OTP=123456
    • Run the script again
  3. View the results:

    • The script will display available banks
    • Token-to-fiat conversions
    • Fiat-to-token conversions

What This Example Does

  1. Initializes the PAJ Ramp SDK
  2. Authenticates using email and OTP verification
  3. Fetches banks - lists the first 3 available banks with name, code, country, and logo
  4. Fetches token value - converts a fiat amount to its token equivalent
  5. Fetches fiat value - converts a token amount to its fiat equivalent
  6. Displays all conversion results

Functions Used

getBanks

import { getBanks } from 'paj_ramp';

const banks = await getBanks(sessionToken);
// Response: [ { id: string, code: string, name: string, logo: string, country: string } ]

getTokenValue

import { getTokenValue, Currency } from 'paj_ramp';

const tokenValueResult = await getTokenValue(
  {
    amount: 50000,              // fiat amount
    mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
    currency: Currency.NGN,
  },
  sessionToken
);
// Response: { amount: number, mint: string, currency: string }

getFiatValue

import { getFiatValue, Currency } from 'paj_ramp';

const fiatValueResult = await getFiatValue(
  {
    amount: 100,                // token amount
    mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
    currency: Currency.NGN,
  },
  sessionToken
);
// Response: { amount: number, mint: string, currency: string, fiatAmount: number }

Expected Output

🚀 Initializing PAJ Ramp SDK...

📧 Initiating session...
Email: [email protected]
✅ OTP sent to: [email protected]

🔐 Verifying session with OTP...
✅ Session verified successfully!

🏦 Fetching available banks...
✅ Found 25 banks
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 First 3 Banks:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. GTBank (058) - NG
   Logo: https://...
2. Access Bank (044) - NG
   Logo: https://...
3. First Bank (011) - NG
   Logo: https://...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

💰 Getting onramp value...

✅ Onramp value fetched successfully!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Onramp Details:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Token Amount: 6.55
Mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Currency: NGN
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

💵 Getting offramp value...

✅ Offramp value fetched successfully!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Offramp Details:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Token Amount: 100
Mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Currency: NGN
Fiat Value: 152500 NGN
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✨ Summary:
• 1010 NGN = 6.55 USDC
• 1000 USDC = 152500 NGN

Troubleshooting

  • OTP not received: Check your spam folder or contact support
  • Invalid API key: Verify your business API key is correct
  • Connection errors: Ensure you have internet connectivity
  • Token mint issues: Verify the token mint address is valid on Solana

Next Steps

  • Integrate these utility functions into your application
  • Use them for price quotes before creating orders
  • Display real-time conversion rates to your users