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

lunartools-sdk

v1.0.4

Published

Official SDK for Lunar Tools API

Readme

Lunar Tools SDK

Official TypeScript/JavaScript SDK for the Lunar Tools API.

Installation

npm install lunartools-sdk

Getting Started

1. Obtain Your API Key

Visit the Lunar Tools Developer Portal to generate your API key.

2. Get User Access Tokens

Each API call requires a user's access token. Users can find their access token in the Lunar Tools application under Settings > Developer.

Usage

Initialize the Client

import { Client } from 'lunartools-sdk';

const client = new Client({
    apiKey: 'your-api-key-here'
});

Add Product to Inventory

await client.addProduct({
    token: 'user-access-token',
    name: 'Charizard VMAX',
    sku: 'SWSH-074',
    qty: 5,
    value: 150.00,
    spent: 120.00,
    size: 'Standard',
    store: 'TCGPlayer'
});

Add Order

await client.addOrder({
    token: 'user-access-token',
    name: 'Pokemon Booster Box',
    status: 'shipped',
    orderNumber: 'ORD-12345',
    price: '120.00',
    orderTotal: '132.00',
    retailer: 'Amazon',
    tracking: '1Z999AA10123456784',
    qty: '1'
});

Add Profile Analytics

await client.addProfile({
    token: 'user-access-token',
    success: true,
    billing: {
        name: 'John Doe',
        phone: '5551234567',
        line1: '123 Main St',
        line2: 'Apt 4B',
        postCode: '10001',
        city: 'New York',
        state: 'NY',
        country: 'United States'
    },
    shipping: {
        name: 'John Doe',
        phone: '5551234567',
        line1: '123 Main St',
        line2: 'Apt 4B',
        postCode: '10001',
        city: 'New York',
        state: 'NY',
        country: 'United States'
    },
    payment: {
        name: 'John Doe',
        type: 'Visa',
        lastFour: '4242',
        expMonth: '12',
        expYear: '2025',
        cvv: '123'
    }
});

Add Task Analytics

await client.addTask({
    token: 'user-access-token',
    bot: 'LunarAIO',
    site: 'Nike',
    mode: 'Fast',
    input: 'DM0121-001',
    profile: {
        billing: {
            name: 'John Doe',
            phone: '5551234567',
            line1: '123 Main St',
            line2: 'Apt 4B',
            postCode: '10001',
            city: 'New York',
            state: 'NY',
            country: 'United States'
        },
        shipping: {
            name: 'John Doe',
            phone: '5551234567',
            line1: '123 Main St',
            line2: 'Apt 4B',
            postCode: '10001',
            city: 'New York',
            state: 'NY',
            country: 'United States'
        },
        payment: {
            name: 'John Doe',
            type: 'Visa',
            lastFour: '4242',
            expMonth: '12',
            expYear: '2025'
        }
    },
    proxy: 'http://username:[email protected]:8080',
    account: '[email protected]',
    success: true
});

Forward Webhook to Discord

const response = await client.webhook(
    'https://www.lunartools.co/api/webhooks/YOUR_TOKEN_HERE',
    {
        content: 'New product in stock!',
        embeds: [{
            title: 'Product Alert',
            description: 'Charizard VMAX is now available',
            color: 0x5865F2,
            fields: [
                { name: 'Price', value: '$150.00', inline: true },
                { name: 'Quantity', value: '5', inline: true }
            ],
            timestamp: new Date().toISOString()
        }]
    }
);

console.log(response); // { status: 'queued', queueLength: 1 }

API Reference

Constructor

new Client(config: Config)

Config:

  • apiKey (string, required) - Your API key from the Lunar Tools Developer Portal
  • baseUrl (string, optional) - Custom API base URL (defaults to https://www.lunartools.co)

Methods

addProduct(product: AddProduct): Promise

Add a new product to a user's inventory.

Required fields:

  • token (string) - User's access token
  • name (string) - Product name
  • sku (string) - Product SKU
  • qty (number) - Quantity

Optional fields:

  • size (string) - Product size
  • store (string) - Store name
  • value (number) - Product value
  • spent (number) - Amount spent

Example:

await client.addProduct({
    token: 'user-access-token',
    name: 'Product Name',
    sku: 'SKU-123',
    qty: 10,
    value: 50.00
});

addOrder(order: AddOrder): Promise

Add a new order to a user's orders.

Required fields:

  • token (string) - User's access token
  • name (string) - Order name
  • status (string) - Order status
  • orderNumber (string) - Order number

Optional fields:

  • image (string) - Product image URL
  • tracking (string) - Tracking number
  • date (string) - Order date (format: MM/DD/YYYY, HH:MM:SS AM/PM)
  • qty (string) - Quantity
  • price (string) - Item price
  • orderTotal (string) - Total order amount
  • account (string) - Account name
  • retailer (string) - Retailer name
  • tags (string) - Order tags

Example:

await client.addOrder({
    token: 'user-access-token',
    name: 'Pokemon Cards',
    status: 'delivered',
    orderNumber: 'ORD-456',
    price: '99.99',
    retailer: 'eBay'
});

addProfile(profile: AddProfile): Promise

Add profile analytics data for tracking successful/declined checkouts.

Required fields:

  • token (string) - User's access token
  • success (boolean) - Whether the checkout was successful
  • billing (Address) - Billing address information
  • shipping (Address) - Shipping address information
  • payment (Payment) - Payment information

Address fields (all required):

  • name (string) - Full name
  • phone (string) - Phone number
  • line1 (string) - Address line 1
  • line2 (string, optional) - Address line 2
  • postCode (string) - Postal/ZIP code
  • city (string) - City
  • state (string) - State/province
  • country (string) - Country

Payment fields (all required):

  • name (string) - Name on card
  • type (string) - Card type (e.g., Visa, Mastercard)
  • lastFour (string) - Last 4 digits of card
  • expMonth (string) - Expiration month (MM)
  • expYear (string) - Expiration year (YYYY)
  • cvv (string, optional) - CVV code

Example:

await client.addProfile({
    token: 'user-access-token',
    success: true,
    billing: {
        name: 'John Doe',
        phone: '5551234567',
        line1: '123 Main St',
        postCode: '10001',
        city: 'New York',
        state: 'NY',
        country: 'United States'
    },
    shipping: {
        name: 'John Doe',
        phone: '5551234567',
        line1: '456 Oak Ave',
        postCode: '10002',
        city: 'Brooklyn',
        state: 'NY',
        country: 'United States'
    },
    payment: {
        name: 'John Doe',
        type: 'Visa',
        lastFour: '4242',
        expMonth: '12',
        expYear: '2025'
    }
});

addTask(task: AddTask): Promise

Add task analytics data for tracking checkout attempts and generating AI-powered setup suggestions.

Required fields:

  • token (string) - User's access token
  • bot (string) - Bot name (e.g., "LunarAIO", "Stellar", "Valor")
  • site (string) - Site/retailer name (e.g., "Nike", "Walmart", "Target")
  • mode (string) - Checkout mode (e.g., "Fast", "Safe", "Guest")
  • input (string) - Product input (SKU, URL, keywords, etc.)
  • profile (object) - Profile information used for checkout
    • billing (Address) - Billing address
    • shipping (Address) - Shipping address
    • payment (Payment) - Payment method
  • proxy (string) - Proxy used for the task
  • account (string) - Account email/username (empty string if guest checkout)
  • success (boolean) - Whether the checkout was successful

Address fields (all required):

  • name (string) - Full name
  • phone (string) - Phone number
  • line1 (string) - Address line 1
  • line2 (string, optional) - Address line 2
  • postCode (string) - Postal/ZIP code
  • city (string) - City
  • state (string) - State/province
  • country (string) - Country

Payment fields (all required):

  • name (string) - Name on card
  • type (string) - Card type (e.g., Visa, Mastercard)
  • lastFour (string) - Last 4 digits of card
  • expMonth (string) - Expiration month (MM)
  • expYear (string) - Expiration year (YYYY)
  • cvv (string, optional) - CVV code

Example:

await client.addTask({
    token: 'user-access-token',
    bot: 'LunarAIO',
    site: 'Nike',
    mode: 'Fast',
    input: 'DM0121-001',
    profile: {
        billing: {
            name: 'John Doe',
            phone: '5551234567',
            line1: '123 Main St',
            postCode: '10001',
            city: 'New York',
            state: 'NY',
            country: 'United States'
        },
        shipping: {
            name: 'John Doe',
            phone: '5551234567',
            line1: '456 Oak Ave',
            postCode: '10002',
            city: 'Brooklyn',
            state: 'NY',
            country: 'United States'
        },
        payment: {
            name: 'John Doe',
            type: 'Visa',
            lastFour: '4242',
            expMonth: '12',
            expYear: '2025'
        }
    },
    proxy: 'http://user:[email protected]:8080',
    account: '[email protected]',
    success: true
});

Use Case:

The addTask method powers Lunar Tools' AI-driven setup suggestion system. By reporting checkout attempts, the platform:

  • Analyzes success/failure patterns across addresses, payment methods, proxies, and accounts
  • Identifies burned profiles with high failure rates
  • Recommends optimal configurations based on historical performance
  • Provides actionable insights to improve checkout success rates

Users can view personalized setup suggestions in the Lunar Tools app under Profiles > Setups.

webhook(webhookUrl: string, payload: Webhook): Promise

Forward a webhook payload to Discord via Lunar Tools.

Parameters:

  • webhookUrl (string) - Full Lunar Tools webhook URL
  • payload (Webhook) - Discord webhook payload

Payload structure:

  • content (string, optional) - Message content
  • username (string, optional) - Override webhook username
  • avatarUrl (string, optional) - Override webhook avatar
  • embeds (Embed[], optional) - Array of embeds (max 10)

Example:

const response = await client.webhook(
    'https://www.lunartools.co/api/webhooks/TOKEN',
    {
        content: 'Hello!',
        embeds: [{
            title: 'Alert',
            description: 'Something happened',
            color: 0xFF0000,
            fields: [
                { name: 'Field 1', value: 'Value 1', inline: true }
            ]
        }]
    }
);

Authentication

The SDK uses two-level authentication:

  1. API Key: Your developer API key (passed in constructor)

  2. User Access Token: Individual user's access token (passed per request)

    • Users find this in: Lunar Tools App > Settings > Developer
    • Identifies which user's data to modify

Error Handling

The SDK validates all inputs and throws descriptive errors:

try {
    await client.addProduct({
        token: 'user-access-token',
        name: '',
        sku: 'SKU-123',
        qty: 5
    });
} catch (error) {
    console.error(error.message); // "Product name is required"
}

Common Use Cases

E-commerce Bot Integration

// After checkout attempt
await client.addTask({
    token: userAccessToken,
    bot: 'MyBot',
    site: 'Nike',
    mode: 'Fast',
    input: productSku,
    profile: {
        billing: billingInfo,
        shipping: shippingInfo,
        payment: paymentInfo
    },
    proxy: proxyUsed,
    account: accountEmail,
    success: checkoutSuccessful
});

// Track order (if successful)
if (checkoutSuccessful) {
    await client.addOrder({
        token: userAccessToken,
        name: productName,
        status: 'confirmed',
        orderNumber: orderNumber,
        price: price,
        orderTotal: total,
        retailer: 'Nike',
        tracking: trackingNumber
    });
}

// Track legacy profile analytics
await client.addProfile({
    token: userAccessToken,
    success: checkoutSuccessful,
    billing: billingInfo,
    shipping: shippingInfo,
    payment: paymentInfo
});

Inventory Management

// Add new inventory
await client.addProduct({
    token: userAccessToken,
    name: 'Limited Edition Sneakers',
    sku: 'SNKR-001',
    qty: 10,
    value: 200.00,
    spent: 150.00,
    store: 'Footlocker'
});

Discord Notifications

// Send success notification
await client.webhook(webhookUrl, {
    embeds: [{
        title: '✅ Checkout Success',
        description: `Successfully checked out ${productName}`,
        color: 0x00FF00,
        fields: [
            { name: 'Order Number', value: orderNumber, inline: true },
            { name: 'Total', value: `$${total}`, inline: true }
        ],
        timestamp: new Date().toISOString()
    }]
});

Support

For issues, questions, or feature requests:

License

MIT