Skip to content

bitmacro/relay-connect

Repository files navigation

@bitmacro/relay-connect

CI npm version License: MIT TypeScript Node

→ Connect UI: relay-connect-web
→ BitMacro: bitmacro.io

BitMacro Connect is the product name; the npm package is @bitmacro/relay-connect. TypeScript SDK for NIP-46 (Nostr Connect) and NIP-07 used with BitMacro Relay Manager: relay-api /signer, optional relay-agent, and browser extensions.

Reference app (Next.js): relay-connect-web

Package Role
@bitmacro/relay-connect This repo — reusable client logic
relay-connect-web Minimal UI + Next.js proxy to relay-api
relay-api Central hub (private in production)

Status

Public API grows as logic is extracted from relay-connect-web and consumers like relay-panel.

Install

npm install @bitmacro/relay-connect

Usage

import {
  RELAY_CONNECT_PRODUCT_NAME,
  RELAY_CONNECT_VERSION,
  relayConnectLog,
  setRelayConnectLogSink,
} from "@bitmacro/relay-connect";

console.log(RELAY_CONNECT_PRODUCT_NAME, RELAY_CONNECT_VERSION); // BitMacro Connect — marketing name

Logs → host app (browser or Node)

The SDK does not assume console. Register a sink once; your UI can append entries to state, forward to analytics, or print:

import {
  relayConnectLog,
  setRelayConnectLogSink,
  type RelayConnectLogEntry,
} from "@bitmacro/relay-connect";

setRelayConnectLogSink((entry: RelayConnectLogEntry) => {
  // entry.product === "BitMacro Connect"
  // entry.package === "@bitmacro/relay-connect"
  myPanel.push(entry);
});

relayConnectLog("info", "Custom flow step", { step: "pairing" });

Optional second argument: setRelayConnectLogSink(sink, { minLevel: "warn" }). Call setRelayConnectLogSink(null) to detach.

Development

npm install
npm run typecheck
npm run build

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors