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

@sip-protocol/api

v0.1.0

Published

REST API service for SIP Protocol SDK - Optional wrapper for non-JS backends

Downloads

9

Readme

@sip-protocol/api

REST API service for SIP Protocol SDK - Optional wrapper for non-JavaScript backends.

Overview

This package provides a REST API wrapper around the @sip-protocol/sdk, allowing non-JavaScript applications to interact with the SIP Protocol through HTTP requests.

Features

  • RESTful API endpoints for all core SDK functionality
  • Request validation with Zod schemas
  • Comprehensive error handling
  • OpenAPI documentation
  • Docker support for easy deployment
  • Production-ready security (Helmet, CORS, rate limiting)

Installation

pnpm install

Development

# Start development server with hot reload
pnpm dev

# Build for production
pnpm build

# Start production server
pnpm start

# Run tests
pnpm test

# Type check
pnpm typecheck

API Endpoints

Health Check

  • GET /api/v1/health - Service health check

Stealth Addresses

  • POST /api/v1/stealth/generate - Generate stealth address

Commitments

  • POST /api/v1/commitment/create - Create Pedersen commitment

Proofs

  • POST /api/v1/proof/funding - Generate funding proof

Swaps

  • POST /api/v1/quote - Get swap quote
  • POST /api/v1/swap - Execute swap
  • GET /api/v1/swap/:id/status - Get swap status

Usage Examples

Generate Stealth Address

curl -X POST http://localhost:3000/api/v1/stealth/generate \
  -H "Content-Type: application/json" \
  -d '{
    "chain": "ethereum",
    "recipientMetaAddress": {
      "spendingKey": "0x02...",
      "viewingKey": "0x03...",
      "chain": "ethereum"
    }
  }'

Create Commitment

curl -X POST http://localhost:3000/api/v1/commitment/create \
  -H "Content-Type: application/json" \
  -d '{
    "value": "1000000000"
  }'

Get Swap Quote

curl -X POST http://localhost:3000/api/v1/quote \
  -H "Content-Type: application/json" \
  -d '{
    "inputChain": "ethereum",
    "inputToken": "ETH",
    "inputAmount": "1000000000000000000",
    "outputChain": "solana",
    "outputToken": "SOL",
    "slippageTolerance": 1
  }'

Docker Deployment

# Build image
docker build -t sip-api .

# Run container
docker run -p 3000:3000 -e NODE_ENV=production sip-api

# With environment variables
docker run -p 3000:3000 \
  -e NODE_ENV=production \
  -e PORT=3000 \
  -e CORS_ORIGIN=https://example.com \
  sip-api

Environment Variables

  • PORT - Server port (default: 3000)
  • NODE_ENV - Environment (development/production)
  • CORS_ORIGIN - CORS allowed origins (default: *)

Response Format

All endpoints return responses in the following format:

Success Response

{
  "success": true,
  "data": { ... }
}

Error Response

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": { ... }
  }
}

Error Codes

  • VALIDATION_ERROR - Invalid request parameters
  • NOT_FOUND - Resource not found
  • INTERNAL_SERVER_ERROR - Unexpected server error
  • SDK-specific error codes from @sip-protocol/sdk

Architecture

src/
├── routes/          # API route handlers
│   ├── health.ts    # Health check
│   ├── stealth.ts   # Stealth address generation
│   ├── commitment.ts # Pedersen commitments
│   ├── proof.ts     # ZK proof generation
│   └── swap.ts      # Swap quotes and execution
├── middleware/      # Express middleware
│   ├── validation.ts    # Request validation
│   └── error-handler.ts # Error handling
├── types/          # TypeScript types
│   └── api.ts      # API request/response types
└── server.ts       # Main server setup

Production Considerations

  1. Database: The in-memory swap tracking should be replaced with a proper database (PostgreSQL, MongoDB, etc.)
  2. Authentication: Add API key or JWT authentication for production use
  3. Rate Limiting: Consider adding rate limiting middleware
  4. Logging: Use structured logging (e.g., Winston, Pino) for production
  5. Monitoring: Add APM tools (e.g., New Relic, Datadog)
  6. Load Balancing: Deploy behind a load balancer for high availability

License

MIT