最終更新:

Introducing xrpl.js

RippleX and the XRP Ledger Foundation (XRPLF) are excited to announce xrpl.js version 2.0.0, a JavaScript/TypeScript library for interacting with the XRP Ledger (XRPL). Formerly known as ripple-lib, the library was renamed to better represent its role in the XRPL ecosystem and overhauled to take advantage of modern JavaScript features.

Background

JavaScript is one of the most widely-used programming languages, and as such has a massive community of active developers. Maintaining a JavaScript SDK enables these developers to seamlessly interact with the XRP Ledger, both in the browser and in Node.js. In addition, the JavaScript libraries (xrpl.js, ripple-binary-codec, ripple-keypairs, and ripple-address-codec) power many apps in the XRPL ecosystem, as well as packages from companies such as BitGo and Ledger.

Changes

With this release of xrpl.js, the JavaScript, Java, and Python libraries provided by the XRPLF now have parallel structures and systems. This enables developers to easily work with their preferred programming language depending on their specific needs, without having to learn an entirely new interface.

xrpl.js will continue to support all ripple-lib features, such as:

  • Serializing, signing, and submitting transactions to the XRPL
  • Retrieving information from the XRPL
  • Helpful utility functions (such as converting between drops and XRP)
  • Support for Node.js, web browsers, and React

It also introduces a number of new features, including:

  • TypeScript types for all transaction types and WebSocket requests
  • A Wallet class to make it easier to work with key pairs
  • Protections against the partial payment attack vector
  • An additional submit implementation that returns the transaction's final outcome after validation.

In version 2.0, the library is now much more aligned with the core XRP Ledger interface. This means XRPL developers—whether new or experienced—can refer to multiple sources of documentation instead of needing to rely solely on the library-specific documentation. There are also a number of general architecture improvements, such as simplifying code, making user interfaces more intuitive (especially in relation to the core ledger), and revamping the testing structure. For a detailed list of changes, visit the changelog.

Start Building

To get started using xrpl.js, see this tutorial on xrpl.org, or check out the project repo or reference documentation.

If you already have a project that uses ripple-lib, migrate today! We have a migration guide for moving your code from ripple-lib v1.10 to xrpl.js v2.0.

We hope you enjoy building the Internet of Value, and feel welcome to reach out to the XRP Ledger developer community if you have any questions!