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

@xyrawallet/tx-parser

v1.1.1

Published

Human-readable transaction parser for XRPL and Xahau

Downloads

279

Readme

@xyrawallet/tx-parser

Human-readable transaction parser for XRPL and Xahau. Converts raw transaction JSON into structured, display-ready objects with titles, descriptions, labeled fields, and warnings. Zero runtime dependencies — pure TypeScript.

Installation

npm install @xyrawallet/tx-parser

Basic Usage

import { parseTransaction } from '@xyrawallet/tx-parser';

const tx = {
  TransactionType: 'Payment',
  Account: 'rN7n3473SaZBCG4dFL83w7p1W9cgZw6w3T',
  Destination: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
  Amount: '5000000',
  Fee: '12',
};

const result = parseTransaction(tx);
// result.title → "Payment"
// result.description → "Send 5 XRP (5,000,000 drops) to rfkE1aSy..."
// result.fields → [{label, value, displayValue, type}, ...]
// result.network → "xrpl"

Specifying the Network

By default the parser infers the network from the transaction type. For standard XRPL transaction types executed on Xahau (where the native currency is XAH, not XRP), pass the network option explicitly:

import { parseTransaction, ParseOptions } from '@xyrawallet/tx-parser';

const result = parseTransaction(tx, { network: 'xahau' });
// result.description → "Send 5 XAH (5,000,000 drops) to rfkE1aSy..."
// result.network → "xahau"

The displayValue Pattern

Every ParsedField includes a displayValue string — always a flat, human-readable string, even for nested fields. Simple consumers can render a flat list using only displayValue:

result.fields.forEach(field => {
  console.log(`${field.label}: ${field.displayValue}`);
});

Structured Value for Rich UIs

For rich UIs, use field.value which can be either a string or a nested ParsedField[] (for array/object types). This enables recursive rendering of complex fields like Memos, Hooks, and Signer Lists.

Exported Helpers

These standalone helpers are available for consumers who need them independently:

  • decodeCurrencyCode(currency) — Decode 40-char hex currency codes (e.g., RLUSD)
  • formatAmount(amount, nativeCurrency?) — Format drops or IOU amounts
  • formatAsset(asset) — Format asset specifiers (no value, just currency/issuer)
  • shortenAddress(address) — Truncate long addresses for display
  • rippleTimeToDate(rippleTime) — Convert Ripple epoch to JS Date
  • decodeMemoData(hex) — Decode hex-encoded memo data
  • decodeFlagBitmask(flags, flagMap) — Decode transaction flag bitmasks

Supported Networks

  • XRPL: Payment, TrustSet, OfferCreate, OfferCancel, AccountSet, AccountDelete, DepositPreauth, SignerListSet, EscrowCreate/Finish/Cancel, PaymentChannelCreate/Claim/Fund, CheckCreate/Cash/Cancel, NFTokenMint/Burn/CreateOffer/CancelOffer/AcceptOffer, AMMCreate/Deposit/Withdraw/Vote/Bid/Delete, Clawback
  • Xahau: Import, Invoke, ClaimReward, GenesisMint, URITokenMint/Burn/Buy/CreateSellOffer/CancelSellOffer, Remit, SetHook, EmitFailure

All standard XRPL transaction types are also supported on Xahau when { network: 'xahau' } is provided — native amounts will display as XAH instead of XRP.

Unknown transaction types return a graceful fallback with raw field display rather than throwing an error.