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

@anshu007/falcon-api-sdk

v1.0.3

Published

Falcon API SDK - Monetize your APIs with Stellar blockchain. Supports Pay-per-User and Escrow payment modes.

Readme

Falcon API SDK

🦅 Monetize your APIs with Stellar blockchain payments

Falcon API SDK enables developers to wrap their Express.js API endpoints with payment protection using the Stellar blockchain. Choose between Pay-per-User or Escrow payment modes.

Installation

npm install @anshu007/falcon-api-sdk

Quick Start

Run the interactive setup:

npx @anshu007/falcon-api-sdk init

This will ask you:

  1. Payment Mode: Pay-per-User or Escrow
  2. Wallet Address: Your Stellar wallet to receive payments
  3. API Details: Name and price per call

Payment Modes

💳 Mode 1: Pay-per-User

Direct payment for each API call. User pays → API responds.

const express = require('express');
const { protect } = require('@anshu007/falcon-api-sdk');

const app = express();

app.get('/api/premium', protect({
  price: { amount: '5', asset: 'XLM' },
  receiver: 'GXXXXX...'  // Your wallet
}), (req, res) => {
  res.json({ 
    data: 'Premium content!',
    payer: req.paymentInfo.payer
  });
});

app.listen(3000);

How it works:

  1. User calls your API
  2. API returns 402 Payment Required with payment details
  3. User pays via Stellar wallet (Freighter, etc.)
  4. User retries with x-payment-tx header containing transaction hash
  5. SDK verifies payment on Stellar blockchain
  6. API returns premium content

🏦 Mode 2: Escrow (Prepaid)

Users prepay to escrow wallet, then consume credits on API calls.

const express = require('express');
const { protectWithEscrow, ESCROW_PUBLIC_KEY } = require('@anshu007/falcon-api-sdk');

const app = express();

console.log('Escrow Wallet:', ESCROW_PUBLIC_KEY);

app.get('/api/premium', protectWithEscrow({
  apiId: 'my-api',
  apiOwnerId: 'GXXXXX...',  // Your wallet
  pricePerCall: 5,
}), (req, res) => {
  res.json({ 
    data: 'Premium content!',
    remainingBalance: res.locals.escrowBalance
  });
});

app.listen(3000);

Escrow Wallet:

Public Key: GALFFRMVCGOPUHSXER3ZZKYHR25F4ISJFTLPEGX3UI4B63MPKUC75BLJ

How it works:

  1. User funds escrow wallet with XLM
  2. User records prepayment via your backend
  3. User calls API with x-user-id or x-wallet-address header
  4. SDK deducts credits from user's escrow balance
  5. API returns content + remaining balance

API Reference

protect(config)

Pay-per-User middleware.

protect({
  price: {
    amount: '10',      // Price per call (XLM)
    asset: 'XLM'       // Payment asset
  },
  receiver: 'GXXX...', // Your Stellar wallet
  validateRequest: (req) => true  // Optional validator
})

protectWithEscrow(config)

Escrow middleware.

protectWithEscrow({
  apiId: 'my-api',           // Unique API ID
  apiOwnerId: 'GXXX...',     // Your Stellar wallet
  pricePerCall: 5,           // Price in XLM
  escrowServer: 'http://...' // Optional: custom escrow server
})

initEscrow(config)

Initialize escrow SDK for backend use.

const { initEscrow } = require('@anshu007/falcon-api-sdk');

const escrow = initEscrow();

// Record prepayment
await escrow.recordPrepayment({
  userId: 'GUSER...',
  txHash: 'abc123...',
  amount: 100
});

// Check balance
const { balance } = escrow.getUserBalance('GUSER...');

// Consume credits
escrow.consumeCredit({
  userId: 'GUSER...',
  apiId: 'my-api',
  apiOwnerId: 'GOWNER...',
  amount: 5
});

CLI Commands

# Interactive setup
npx @anshu007/falcon-api-sdk init

# Register API on marketplace
npx @anshu007/falcon-api-sdk register \
  --name "My API" \
  --description "Amazing API" \
  --endpoint "https://myapi.com/api/premium" \
  --price 5 \
  --wallet "GXXXXX..." \
  --mode escrow

# List registered APIs
npx @anshu007/falcon-api-sdk list

# Show escrow info
npx @anshu007/falcon-api-sdk escrow

# Help
npx @anshu007/falcon-api-sdk help

Environment Variables

| Variable | Description | Default | |----------|-------------|---------| | FALCON_REGISTRY | API registry URL | http://localhost:3001 | | FALCON_ESCROW_SERVER | Escrow server URL | http://localhost:3001 |


Escrow Wallet Info

For Escrow Mode:

Public Key:  GALFFRMVCGOPUHSXER3ZZKYHR25F4ISJFTLPEGX3UI4B63MPKUC75BLJ
Network:     Stellar Testnet

License

MIT © Falcon Labs