Small Node.js service that connects to the XRP Ledger over WebSocket, subscribes to validated transactions, and dispatches each one to a per-type handler under TransactionTypes/.
- Node.js 20 or newer (see
enginesinpackage.json)
npm installnode index.jsBy default the client uses the public hub wss://honeycluster.io (see index.js). On each transaction, if a handler exists for tx_json.TransactionType, its result is printed as JSON to stdout.
- Add one file per transaction type:
TransactionTypes/<TransactionType>.js(name must matchTransactionTypeexactly, e.g.Payment.js). - The file must
module.exportsa single async function(transaction, client) => parsedObject. transactionis the stream payload (tx_json,meta,hash, etc.).clientis the sharedxrpl.Client.
Handlers are provided for every transaction type recognized by the installed xrpl version’s transaction validator, plus validator pseudo-transactions EnableAmendment, SetFee, and UNLModify. Many types use a small default parser in lib/defaultTransactionHandler.js; you can replace any file with custom logic (e.g. Payment.js).
After upgrading xrpl, run:
node scripts/populate-default-handlers.jsto create default handler stubs for any newly added types (existing files are not overwritten).
npm testUses the built-in node:test runner. Tests assert:
tx_json/txjsonnormalization behavior (lib/normalizeTransactionMessage.js)- A handler module exists and exports a function for every expected
TransactionType
- Output is
console.logof parsed JSON; there is no HTTP API or persistence layer. - Reconnection waits 5 seconds between attempts; tune in
index.jsif needed. - No
.envfile: WebSocket URL and options are hard-coded unless you extend the project.
ISC (see package.json).