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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@seimoney/sdk

v1.5.6

Published

A comprehensive TypeScript SDK for interacting with the Payment Gateway API, built with modern web3 capabilities and blockchain integration.

Readme

Payment Gateway SDK

A comprehensive TypeScript SDK for interacting with the Payment Gateway API, built with modern web3 capabilities and blockchain integration.

Features

  • Modular Architecture: Clean separation of concerns with dedicated modules for each feature area
  • Type Safety: Full TypeScript support with comprehensive type definitions
  • Wallet Integration: Seamless integration with Web3 wallets using Viem
  • Error Handling: Robust error handling with detailed error information
  • Payment Processing: Support for ERC20 tokens and blockchain transactions
  • File Management: Upload and manage gated content with payment requirements
  • Contract Management: Create and manage smart contracts with automated payroll
  • Analytics: Comprehensive analytics and activity tracking
  • Product Management: E-commerce functionality with product and checkout management

Installation

npm install @seimoney/sdk

Quick Start

Basic Setup

import { createSeiMoneySDK } from "@seimoney/sdk";

const sdk = createSeiMoneySDK({
  apiUrl: import.meta.env.VITE_API_URL,
  token: "your-auth-token", // Optional
});

With Wallet Integration

import { createSeiMoneySDK } from "@seimoney/sdk";
import { createWalletClient } from "viem";

const sdk = createSeiMoneySDK({
  apiUrl: import.meta.env.VITE_API_URL,
});

// Connect your wallet
const walletClient = createWalletClient({
  // wallet configuration
});

sdk.updateWalletClient(walletClient);

Usage Examples

Authentication

// Authorize with wallet signature
const authResult = await sdk.auth.authorize({
  owner: "0x...",
  signature: "0x...",
  expiresAt: Math.floor(Date.now() / 1000) + 3600,
});

sdk.setToken(authResult.token);

Account Management

// Create an account
const account = await sdk.accounts.createAccount({
  owner: "0x...",
  name: "John Doe",
  emailAddress: "[email protected]",
});

// Get account info
const accountInfo = await sdk.accounts.getAccount();

Payment Links

// Create a payment link
const paymentLink = await sdk.paymentLinks.createPaymentLink({
  description: "Service payment",
  amount: {
    amount: "100.00",
    token: {
      name: "USDC",
      symbol: "USDC",
      address: "0x...",
      decimals: 6,
      // ... other token properties
    },
  },
  attributes: { service: "consultation" },
  oneTime: true,
  network: "sei-testnet",
});

// Get all payment links
const links = await sdk.paymentLinks.getPaymentLinks();

// Fulfill a payment
const result = await sdk.paymentLinks.fulfillPaymentLink({
  paymentId: "payment-id",
});

File Management

// Upload a gated file
const file = new File(["content"], "document.pdf");

const gatedFile = await sdk.files.uploadFile(
  {
    name: "Premium Content",
    description: "Exclusive content",
    previewURL: null,
    metadata: { category: "premium" },
    amount: {
      amount: "10.00",
      token: {
        /* token details */
      },
    },
    network: "sei-testnet",
  },
  file
);

// Download a file
const downloadUrl = await sdk.files.downloadFile({
  fileId: "file-id",
  signature: "0x...",
  expiresAt: Math.floor(Date.now() / 1000) + 3600,
});

Contract Management

// Create a contract
const contract = await sdk.contracts.createContract({
  name: "Employment Contract",
  role: {
    title: "Developer",
    description: "Full-stack developer role",
  },
  recipientAddress: "0x...",
  payroll: {
    frequency: "monthly",
    amount: {
      amount: "5000.00",
      token: {
        /* token details */
      },
    },
  },
  metadata: { department: "engineering" },
  company: "Tech Corp",
  network: "sei-testnet",
});

// Sign a contract
const signedContract = await sdk.contracts.signContract({
  contractId: "contract-id",
  signature: "0x...",
  expiresAt: Math.floor(Date.now() / 1000) + 3600,
});

Analytics

// Get analytics dashboard
const analytics = await sdk.analytics.getAnalytics();

// Get activities
const activities = await sdk.analytics.getActivities();

// Get activities for specific item
const itemActivities = await sdk.analytics.getActivitiesFor("item-id");

Product Management

// Create a product
const images = [
  { file: new File(["..."], "product1.jpg"), caption: "Main view" },
  { file: new File(["..."], "product2.jpg"), caption: "Side view" },
];

const product = await sdk.products.createProduct(
  {
    name: "Digital Asset",
    description: "Premium digital content",
    availableInStock: 100,
    isFeatured: true,
    isOnSale: false,
    amount: {
      amount: "25.00",
      token: {
        /* token details */
      },
    },
    network: "sei-testnet",
  },
  images
);

// Get products
const products = await sdk.products.getProducts();

Error Handling

The SDK provides comprehensive error handling:

try {
  const result = await sdk.paymentLinks.createPaymentLink(params);
} catch (error) {
  if (error.code === "HTTP_400") {
    console.log("Bad request:", error.message);
  } else if (error.code === "NETWORK_ERROR") {
    console.log("Network issue:", error.message);
  } else {
    console.log("Unknown error:", error.message);
  }
}

API Reference

SDK Configuration

interface SDKConfig {
  apiUrl: string; // Required: API base URL
  token?: string; // Optional: Authentication token
}

Modules

  • auth: Authentication and authorization
  • accounts: Account management
  • paymentLinks: Payment link operations
  • files: File upload and management
  • contracts: Smart contract operations
  • analytics: Analytics and reporting
  • products: Product and checkout management

Development

# Install dependencies
npm install

# Run development server
npm run dev

# Build the project
npm run build

# Run tests
npm test

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see the LICENSE file for details.