@utexo/wdk-rgb-lightning is a WDK module for RGB-over-Lightning, built on rgb-lightning-node (RLN). It runs an LDK + rgb-lib node behind WDK’s manager/account contract: channels, BOLT11 and RGB invoices, payments, HODL invoices, optional VSS backup, and an LSP client.
The node runs in external-signer mode. The BIP-39 mnemonic stays in the WDK secret manager. Channel-state crypto runs in-process through a VLS signer.
Why a Separate Package
This module complements@utexo/wdk-wallet-rgb. Each owns its own rgb-lib SQLite state and they do not share asset records. Give each module a separate dataDir — rgb-lib takes an exclusive lock on a wallet directory.
This module holds and transfers RGB assets for channels and invoices. For issuance, use @utexo/wdk-wallet-rgb. Node-level issuance calls are forwarded on the account, but wdk-wallet-rgb is the supported path.
Installation
postinstall downloads a prebuilt native artifact; no Rust toolchain is required.
On Node, import '@utexo/wdk-rgb-lightning' wires @utexo/rgb-lightning-node-nodejs. In a Bare worklet, require('@utexo/wdk-rgb-lightning') wires @utexo/rgb-lightning-node-bare. Both re-export the same manager, account, errors, and LSP surface.
Configuration
WalletManagerRgbLightning takes the seed at construction. network and dataDir are required.
Classes
WalletManagerRgbLightning
Default export. Construct with a BIP-39 mnemonic (or Uint8Array seed) and config.
Methods
indexer_url, or all four bitcoind_rpc_* fields (bitcoind_rpc_username, bitcoind_rpc_password, bitcoind_rpc_host, bitcoind_rpc_port). Mixing both is rejected. proxy_endpoint, announce_addresses, and announce_alias are always required.
WalletAccountRgbLightning
Returned by getAccount(0). RGB Lightning is single-account; RLN owns one LDK node per dataDir.
Lifecycle
Node Info
Peers
Channels
Set
virtual_open_mode: 'trusted_no_broadcast' for APay virtual channels. Requires enableVirtualChannelsV0: true and the peer in virtualPeerPubkeys.
Invoices & Payments
HODL Invoices
RGB Assets
RGB receive supports two invoice styles:- Blinded invoice — most common. The receiver creates a blinded endpoint; the sender pays the invoice directly.
- Witness invoice — the receiver binds the transfer to witness data. The sender must provide
witnessData(at minimumamountSats) intransfer().
transfer() rejects witnessData on a blinded recipient. decodeRgbInvoice() reports recipient_type as 'Blind' or 'Witness'.
Issuance (
issueAssetNia, issueAssetUda, issueAssetCfa, issueAssetIfa, inflate) is forwarded to the binding. Prefer @utexo/wdk-wallet-rgb for issuance.
Atomic swaps are on the native binding but are not on the WDK account.
BTC
Prepare/commit/cancel variants exist for BTC sends, RGB sends, and UTXO creation (
prepareBtcSend, commitPreparedBtcSend, prepareRgbSend, prepareCreateUtxos, …).
VSS
RequiresvssUrl at construction. Otherwise these throw VssNotConfiguredError.
VSS replicates RLN’s LDK and wallet KV state. It does not replicate the VLS signer database under
dataDir, so same-device restarts work; cross-device recovery with open channels does not.
APay / LSP
Production APay needsenableVirtualChannelsV0: true and the LSP node ID in virtualPeerPubkeys.
UtexoLsp also exposes sendAsset(), quoteAddress(), payAddress(), enableLightningAddress(), and claimPendingPayments(). Do not call apayNew immediately before enableLightningAddress — the native batch can fill the LSP hash-pool cap.
WDK-standard
Error Handling
Typed errors are exported from the package root. Branch onerr.name / err.code. The original RLN message is on cause.
LspError / LspProtocolError. Channel and liquidity waits throw LspChannelTimeoutError and LspLiquidityTimeoutError.
Usage Example
Using with wdk-wallet-rgb
Both packages use rgb-lib, but they do not share asset records. Use @utexo/wdk-wallet-rgb for issuance and on-chain inventory; use this module for channels, invoices, and Lightning transfers. Give each module its own dataDir.