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

merx-sdk

v2.1.2

Published

Official JavaScript/TypeScript SDK for the Merx TRON resource exchange

Readme

@merx/sdk

JavaScript/TypeScript SDK for the Merx TRON energy exchange.

Installation

npm install @merx/sdk

Requires Node.js 18+ (uses native fetch). Zero dependencies.

Quickstart

import { MerxClient } from '@merx/sdk';

const merx = new MerxClient({ apiKey: 'sk_live_...' });

// Check prices
const prices = await merx.prices.list();
const best = await merx.prices.best('ENERGY');

// Preview cost before ordering
const preview = await merx.prices.preview({
  resource: 'ENERGY',
  amount: 65000,
  duration: 3600,
});

// Create order
const order = await merx.orders.create({
  resource_type: 'ENERGY',
  amount: 65000,
  duration_sec: 3600,
  target_address: 'TYourAddress...',
});

API Reference

Constructor

const merx = new MerxClient({
  apiKey: string;       // Required. API key from merx.exchange
  baseUrl?: string;     // Optional. Default: "https://merx.exchange"
});

merx.prices

| Method | Returns | Description | |--------|---------|-------------| | list() | Promise<ProviderPrice[]> | All current prices from all providers | | best(resource, amount?) | Promise<PriceHistoryEntry> | Cheapest available provider (server-side) | | history(params?) | Promise<PriceHistoryEntry[]> | Historical price snapshots | | stats() | Promise<PriceStats> | Market statistics (best/avg price, provider count) | | preview(params) | Promise<OrderPreview> | Preview order cost with best and fallback options |

merx.orders

| Method | Returns | Description | |--------|---------|-------------| | create(params) | Promise<Order> | Place a new order | | list(limit?, offset?, status?) | Promise<{ orders, total }> | List your orders with pagination | | get(id) | Promise<OrderWithFills> | Order details with fill history |

CreateOrderParams:

{
  resource_type: 'ENERGY' | 'BANDWIDTH';
  order_type?: 'MARKET' | 'LIMIT' | 'PERIODIC' | 'BROADCAST'; // Default: MARKET
  amount: number;              // Min 65000 for ENERGY, 300 for BANDWIDTH
  duration_sec: number;        // Duration in seconds (3600 = 1h, 86400 = 1d)
  target_address: string;      // TRON address to receive resources
  max_price_sun?: number;      // Maximum price per unit in SUN
  idempotency_key?: string;    // Prevent duplicate orders
}

merx.balance

| Method | Returns | Description | |--------|---------|-------------| | get() | Promise<Balance> | TRX balance, USDT balance, locked amount | | depositInfo() | Promise<DepositInfo> | Deposit address and memo | | withdraw(params) | Promise<Withdrawal> | Withdraw TRX or USDT | | history(period?) | Promise<HistoryEntry[]> | Transaction history (7D/30D/90D) | | summary() | Promise<HistorySummary> | Aggregated stats |

merx.webhooks

| Method | Returns | Description | |--------|---------|-------------| | create(params) | Promise<Webhook> | Register a webhook (secret shown once) | | list() | Promise<Webhook[]> | List all webhooks | | delete(id) | Promise<{ deleted }> | Delete a webhook |

Error Handling

All API errors throw MerxError:

import { MerxClient, MerxError } from '@merx/sdk';

try {
  await merx.orders.create({ ... });
} catch (err) {
  if (err instanceof MerxError) {
    console.error(err.code, err.message);
  }
}

Types

All TypeScript types are exported:

ProviderPrice, PricePoint, PriceHistoryEntry, PriceStats, OrderPreview, PreviewMatch, Balance, DepositInfo, Order, OrderWithFills, Fill, CreateOrderParams, HistoryEntry, HistorySummary, Withdrawal, WithdrawParams, Webhook, WebhookParams, MerxClientOptions, MerxError

License

MIT