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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@thebettermint/xrpl-tx-parser

v0.0.6

Published

Subscribe to an XRPL client and receive parsed transaction objects

Downloads

8

Readme

xrpl-tx-parser

Subscribe to an XRPL client and receive parsed transaction objects

Getting Started

To get started using this project, install the node package into your project

npm install @thebettermint/xrpl-tx-parser
yarn add @thebettermint/xrpl-tx-parser
import Client, { constants } from '@thebettermint/xrpl-tx-parser';

let api = new Client(params);

// Add event listeners...

Client Options

Currently, the only transactions support by the client are payment transaction object. I plan to expand this the other transaction objects. See wip folder

params = {
    url?: String[] || String, //Either an array of valid wss servers or just a single wss server. If Array is defined, the selected servers will rotate on every reconnect attempt. If undefined, the default wss will be used - 'wss://xrplcluster.com'
    registry?: String[] //Array of address to listen to, if undefined, all transaction objects will be returned
    timeout?: Number, //Time in ms for class timeout. If undefined, no timeout will be set
    reconnect?: Number, //Number of times the client will attempt to reconnect if inadvertantly disconnect. If undefind, the client will not attempt to reconnect
}

Examples

import Client, { constants } from '@thebettermint/xrpl-tx-parser';

const main = async () => {
  let api = new Client({
    url: [
      'wss://xls20-sandbox.rippletest.net:51233',
      constants.serverURL,
      constants.mainServerURL,
    ],
    registry: ['rMfCZhBfR4tRunHaE9jrtdsjF5stuuQ9JB'],
    timeout: 3000,
    reconnect: 10,
  });

  // Define possible emitted events using the package constants
  let events = constants.wsStatusMessages;

  // Add event listeners to catch parsed transactions

  api.once(events.connected, () => {
    console.log(events.connected);
  });

  api.on(events.tx, (e: any) => {
    console.log(events.tx);
    console.log(e);
  });

  api.on(events.reconnect, (e: any) => {
    console.log(events.reconnect);
    console.log(e); // Next wss server to attempt
  });

  api.on(events.timeout, () => {
    console.log(events.timeout);
  });

  api.once(events.closed, () => {
    console.log(events.closed);
  });
};

main();

See more examples here

Thanks

A lot of the parsing functionality was ported from a depreciated ripple package... link here still looking for the link

Contributing

Pull requests for new features, bug fixes, and suggestions are welcome! Please create an issue for discussion before working on a substantial change. CONTRIBUTING.md

License

GPL-3.0

Copyright 2022 thebettermint The GNU General Public License is a free, copyleft license for software and other kinds of works. Copyright (C) 2007 Free Software Foundation, Inc. https://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.