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

irium-js

v1.1.0

Published

JavaScript/TypeScript SDK for the Irium settlement blockchain

Readme

irium-js

JavaScript/TypeScript SDK for the Irium settlement blockchain.

Covers the complete settlement lifecycle: offers, agreements, proofs, and real-time events.

Install

npm install irium-js

Quick start

import { IriumClient, formatIrm } from "irium-js";

const client = new IriumClient({
  nodeUrl: "http://your-node:38300",
  token: "your-rpc-token", // optional; required if IRIUM_RPC_TOKEN is set on the node
});

const status = await client.getStatus();
console.log(`Height: ${status.height}, Peers: ${status.peer_count}`);

const balance = await client.getBalance("Q...");
console.log(`Balance: ${formatIrm(balance.balance)} IRM`);

API reference

IriumClient

Constructor: new IriumClient({ nodeUrl, token? })

| Method | Description | |---|---| | getStatus() | Node status — height, peers, genesis hash, network era | | getHeight() | Current block height | | getBalance(address) | Balance and UTXO count for an address | | getOffers(filters?) | Offer feed with optional status/paymentMethod/amount filters | | computeAgreementHash(agreement) | Compute the deterministic hash for an agreement object | | getAgreementStatus(agreement) | Full lifecycle status for an agreement | | getReleaseEligibility(agreement) | Check if a funded agreement is release-eligible | | getRefundEligibility(agreement) | Check if a funded agreement is refund-eligible | | buildOtcTemplate(params) | Build an OTC escrow policy template | | submitProof(proof) | Submit a proof against an agreement | | listProofs(params) | List all proofs for an agreement hash | | getProof(proofId) | Retrieve a specific proof by ID | | checkPolicy(params) | Check a policy against current proof state | | storePolicy(policy, replace?) | Store a policy in the node's policy store | | getPolicy(agreementHash) | Retrieve a stored policy | | evaluatePolicy(params) | Evaluate a policy and return the result | | getAgreementTimeline(agreement) | Full event timeline for an agreement | | getAgreementAudit(agreement) | Audit log for an agreement | | submitTx(txHex) | Broadcast a signed raw transaction | | getBlock(height) | Block by height | | getBlockByHash(hash) | Block by hash | | getTx(txid) | Transaction by txid | | getNetworkHashrate() | Current network hashrate | | getFeeEstimate() | Recommended fee rate | | subscribeEvents(eventTypes, handler, filter?) | Subscribe to real-time WebSocket events | | closeEvents() | Close the WebSocket connection |

Offer filters

await client.getOffers({
  status: "open",          // "open" | "taken" | "filled" | "expired"
  paymentMethod: "bank-transfer",
  minAmount: 50_000_000,   // satoshis
  maxAmount: 500_000_000,
});

Real-time events

const ws = client.subscribeEvents(
  ["agreement.satisfied", "block.new"],
  (event) => console.log(event),
  { agreement_hash: "abc123..." }, // optional filter
);

// Later:
client.closeEvents();

Supported event types:

  • agreement.funded
  • agreement.proof_submitted
  • agreement.satisfied
  • agreement.timeout
  • agreement.disputed
  • agreement.proof_reorged
  • proof.gossip_received
  • offer.created
  • offer.taken
  • block.new
  • peer.connected
  • peer.disconnected

Utilities

import { formatIrm, parseIrm, isValidAddress, satoshisToIrm, irmToSatoshis } from "irium-js";

formatIrm(100_000_000)     // "1.00000000"
parseIrm("1.0")            // 100_000_000
isValidAddress("Qabc...")  // true/false

Settlement lifecycle example

// 1. Browse offers
const offers = await client.getOffers({ status: "open" });

// 2. Compute agreement hash (both parties must agree on the same object)
const { agreement_hash } = await client.computeAgreementHash({
  seller: { pubkey: "03..." },
  buyer:  { pubkey: "02..." },
  amount_irm: 100_000_000,
});

// 3. Build policy template (seller creates the escrow policy)
const template = await client.buildOtcTemplate({
  policy_id: "my-trade-001",
  agreement_hash,
  attestors: [{ pubkey: "03..." }],
  release_proof_type: "service_completion",
  refund_deadline_height: await client.getHeight() + 1000,
});

// 4. Check agreement status
const status = await client.getAgreementStatus({ seller: {...}, buyer: {...}, amount_irm: 100_000_000 });

// 5. Submit proof (when service is delivered)
await client.submitProof({
  agreement_hash,
  proof_type: "service_completion",
  payload: { /* proof payload */ },
  attestor_pubkey: "03...",
  attestor_signature: "...",
});

// 6. Check release eligibility
const eligible = await client.getReleaseEligibility({ ... });
if (eligible.eligible) {
  // Submit release_tx_hex via submitTx
  await client.submitTx(eligible.release_tx_hex);
}

Building

npm install
npm run build

Output goes to dist/.

Notes

  • Offer creation and transaction signing require the irium-wallet CLI — the SDK does not hold private keys.
  • Reputation data is wallet-local; use irium-wallet reputation-show to query it.
  • WebSocket connections auto-reconnect with exponential backoff.
  • All amounts are in satoshis (1 IRM = 100,000,000 satoshis).

Licence

MIT