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

@totemsdk/omnia

v0.1.5

Published

Omnia eltoo payment channel state machine — transport-agnostic, WOTS-safe, HTLC-ready

Readme

@totemsdk/omnia

Eltoo payment channels — the heart of Totem's payment network.

An eltoo-based (not Lightning's punishment model) payment channel state machine. Eltoo uses sequential update numbers so you never need to store revocation secrets, making channels dramatically simpler and safer.

Install

npm install @totemsdk/omnia

What's inside

Core types (all exported as TypeScript type)

| Type | Description | |------|-------------| | OmniaChannel | The channel state object | | SignedChannelState | A channel state with attached WOTS signatures | | HTLCRecord | A Hash Time-Locked Contract attached to a channel update | | ChannelParticipant | A party in the channel with their key material | | CreateChannelParams | Parameters for opening a channel | | ChannelProposal | An incoming channel open proposal | | SettlementPayload | Data for a cooperative close | | DisputePayload | Data for a unilateral close / dispute | | ChannelSigner | Interface — plug in any signing backend | | KissvmEvaluator | Interface — plug in custom channel conditions | | UpdateStateResult | Result of updateState() |

Channel lifecycle functions

createChannel → acceptChannel → activateChannel
updateState (repeat) → attachCounterpartySignature
proposeSettlement → markChannelClosing → markChannelClosed
buildDisputePayload (unilateral close)

HTLC functions

| Function | What it does | |----------|-------------| | addHTLC(channel, params) | Add a Hash Time-Locked Contract to a state update | | fulfillHTLC(channel, htlcId, preimage) | Fulfill an HTLC by revealing the preimage | | timeoutHTLC(channel, htlcId) | Reclaim funds from an expired HTLC |

Transaction builders

| Function | What it does | |----------|-------------| | buildFundingTx(params) | Build the on-chain funding transaction | | buildUpdateTx(state, params) | Build an eltoo update transaction | | buildSettlementTx(state, params) | Build the cooperative settlement transaction |

Error types

ChannelCapacityError · DoubleSignError · BalanceConservationError · SequenceError · SigningIndexMonotonicityError · ChannelStatusError

Usage

Open a channel

import { createChannel, acceptChannel, activateChannel } from '@totemsdk/omnia';
import type { CreateChannelParams } from '@totemsdk/omnia';

const params: CreateChannelParams = {
  localParty:   { partyId: 'alice', publicKeyDigest: '0x...' },
  remoteParty:  { partyId: 'bob',   publicKeyDigest: '0x...' },
  localAmount:  100n,
  remoteAmount: 0n,
  tokenId:      '0x00',
};

// Local side creates the proposal
const { channel: localChannel, proposal } = await createChannel(params, provider);

// Remote side accepts the proposal
const remoteChannel = acceptChannel(proposal, provider);

// After the funding transaction confirms on-chain, both sides activate
const activeChannel = activateChannel(localChannel);

Update channel state (make a payment)

import { updateState, attachCounterpartySignature } from '@totemsdk/omnia';
import type { UpdateDelta } from '@totemsdk/omnia';

// Local side proposes a state update
const delta: UpdateDelta = {
  newBalances: {
    'alice': 90n,
    'bob':   10n,
  },
};
const result = await updateState(channel, delta, leaseProvider, signer);

// Exchange the signed state with the remote peer, then attach their signature
const updated = attachCounterpartySignature(channel, result.state, remoteSignature);

Add an HTLC (for routing / atomic swaps)

import { addHTLC, fulfillHTLC } from '@totemsdk/omnia';
import type { AddHTLCParams } from '@totemsdk/omnia';

const htlcParams: AddHTLCParams = {
  amount: 10n,
  hashlock: sha3_256(preimage),   // hex string of the hash
  expiryBlock: currentBlock + 144,
  recipientPublicKeyDigest: '0x...',
};

const { channel: withHtlc, htlcId } = await addHTLC(channel, htlcParams, leaseProvider, signer);

// Fulfill on receipt of the preimage
const { channel: settled } = await fulfillHTLC(withHtlc, htlcId, preimage, leaseProvider, signer);

Cooperative close

import { proposeSettlement, markChannelClosing, markChannelClosed } from '@totemsdk/omnia';

// Propose settlement — both sides call this and exchange partialState
const { settlementPayload, partialState } = await proposeSettlement(
  channel,
  leaseProvider,
  { signer, partyAddresses: { alice: 'MxAAA...', bob: 'MxBBB...' } },
);

// Once both signatures are collected and the settlement tx is broadcast:
const closing = markChannelClosing(channel);
const closed  = markChannelClosed(closing);

Channel lifecycle statuses

opening → active → closing_mutual | closing_unilateral | disputing → closed | spliced

See also