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

@toon-protocol/connector

v4.0.0

Published

TypeScript client for the ILP connector's client edge

Readme

@toon-protocol/connector

npm License: MIT

TypeScript client for the ILP connector's client edge. POST /ilp, OER-encoded PREPARE in, OER-encoded FULFILL/REJECT out — see docs/protocol/client-edge-spec.md §1.1.

See the root README for conceptual overview and network architecture. The connector itself now runs as a Rust binary (crates/connector-bin, deploy/connector-rust/) — this package is a client only, with no native dependencies and no prebuilt binaries.

Install

npm install @toon-protocol/connector

Quick Start

import { ConnectorHttpClient } from '@toon-protocol/connector';

const client = new ConnectorHttpClient({ baseUrl: 'http://localhost:3000' });

const result = await client.sendPacket({
  destination: 'g.connector-b.agent',
  amount: 1000n,
  expiresAt: new Date(Date.now() + 30000),
  data: Buffer.from('Hello'),
});

sendPacket() returns the decoded ILP Fulfill or Reject packet — a Reject is a normal return value, not a thrown error. A non-200 response from POST /ilp (a transport-level failure) throws ConnectorHttpTransportError, carrying status and the raw response body.

Identity and payment claim headers

sendPacket() takes an optional headers escape hatch for identity (client-edge-spec.md §1.2, ILP-Peer-Id/Authorization) and payment claim (§1.3, ILP-Payment-Channel-Claim) headers. This client does not construct or validate either — it passes whatever the caller already built straight through:

await client.sendPacket({
  destination: 'g.connector-b.agent',
  amount: 1000n,
  expiresAt: new Date(Date.now() + 30000),
  headers: {
    'ILP-Peer-Id': 'my-agent',
    'ILP-Payment-Channel-Claim': claim,
  },
});

Custom fetch

Pass any fetch-compatible function via options.fetch (defaults to the global fetch) — works in Node 18+, the browser, and test harnesses with no native dependencies.

Migrating from the embedded ConnectorNode

Issue #457 removed the embedded, in-process ConnectorNode and every in-process local-delivery handler (per ADR 0013, once the Rust fleet's parallel-devnet cutover — issue #431 — completed). This package is now a client only.

swap, town, and mill each migrate individually, at their own pace, from importing ConnectorNode in-process to talking to a Rust connector over HTTP. Each repo's own migration is tracked in its own repository; the notes below are what they migrate to.

| Embedded (ConnectorNode) | HTTP client (ConnectorHttpClient) | | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | new ConnectorNode(config, logger) + node.start() | new ConnectorHttpClient({ baseUrl }) — no process to start/stop; point baseUrl at a running Rust connector | | node.setPacketHandler(handler) | Not applicable — local delivery is the app's own handler_url (per toon.json), reached directly by the connector, not by a callback into this package | | node.sendPacket(params) | client.sendPacket(params) — same shape (destination/amount/expiresAt/data/executionCondition); add identity/claim headers via the new headers field | | node.registerPeer(...) / listPeers() / addRoute(...) | No equivalent yet — peer/route administration is the Rust connector's operator surface (crates/connector-operator), configured via connector.toml or its authenticated write endpoints, not via this package | | In-process settlement (chainProviders, openChannel, getBalance) | Settlement runs inside the Rust connector; see crates/connector-settlement* |

Nothing in this package constructs a connector process anymore — point baseUrl at wherever the Rust connector's client edge is reachable (see deploy/connector-rust/README.md for running one).

Exported API

Classes: ConnectorHttpClient, ConnectorHttpTransportError

Types: ConnectorHttpClientOptions, SendIlpPacketParams, ILPPreparePacket, ILPFulfillPacket, ILPRejectPacket

Package Structure

src/
├── client/     # ConnectorHttpClient — the client edge HTTP shim
├── lib.ts      # Public API barrel
└── index.ts    # Package entry point

Testing

npm test

test/integration/connector-http-client-rust-e2e.test.ts drives the client against a real compiled connector-bin (skipped when target/debug/connector doesn't exist).

License

MIT — see LICENSE.