Skip to content

LedgerCraft/XRPL-Transaction-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XRPL Transaction Parser

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/.

Requirements

  • Node.js 20 or newer (see engines in package.json)

Install

npm install

Run

node index.js

By 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.

Handlers

  • Add one file per transaction type: TransactionTypes/<TransactionType>.js (name must match TransactionType exactly, e.g. Payment.js).
  • The file must module.exports a single async function (transaction, client) => parsedObject.
  • transaction is the stream payload (tx_json, meta, hash, etc.). client is the shared xrpl.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.js

to create default handler stubs for any newly added types (existing files are not overwritten).

Tests

npm test

Uses the built-in node:test runner. Tests assert:

  • tx_json / txjson normalization behavior (lib/normalizeTransactionMessage.js)
  • A handler module exists and exports a function for every expected TransactionType

Limitations

  • Output is console.log of parsed JSON; there is no HTTP API or persistence layer.
  • Reconnection waits 5 seconds between attempts; tune in index.js if needed.
  • No .env file: WebSocket URL and options are hard-coded unless you extend the project.

License

ISC (see package.json).

About

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/.

Resources

Stars

Watchers

Forks

Contributors