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

xrpl-tagged-address-codec

v1.0.0

Published

Encode and Decode an XRPL account address and destination tag to/from X-formatted (tagged) address

Downloads

3,175

Readme

XRPL Tagged Address Codec npm version

Encode and Decode an XRPL account address and destination tag to/from X-formatted (tagged) address.

Destination tags provide a way for exchanges, payment processors, corporates or entities which accept incoming payments, escrows, checks and similar transcations to use a single receiving wallet while being able to disambiguate incoming transactions by instructing the senders to include a destination tag.

This package allows encoding and decoding from an XRPL address and destination tag to / from 'Tagged Addresses', containing both the destination account address and tag in one string. This way users can simply copy-paste the string, eliminating possible user error when copying / entering a numeric destination tag.

Hopefully all exchanges, wallets & other software using destination tags will implement this address codec. A migration period will be required to allow users to enter both address formats.

The website https://xrpaddress.info is available for users, exchanges and developers to provide some context and best practices.

Use

1. Import

Node
const {Encode, Decode} = require('xrpl-tagged-address-codec')

... and use: Encode() / Decode() or:

const codec = require('xrpl-tagged-address-codec')

... and use: codec.Encode() / codec.Decode()

TypeScript
import {Encode, Decode} from 'xrpl-tagged-address-codec'

... and use: Encode() / Decode() or:

import * as codec from 'xrpl-tagged-address-codec'

... and use: codec.Encode() / codec.Decode()

2. Encode / Decode

Encode a separate account address and destination tag:

const tagged = Encode({
  account: 'rPEPPER7kfTD9w2To4CQk6UCfuHM9c6GDY',
  tag: 1337,
  test: false
})

The output will be a tagged address (string). The tag and test can be omitted, rendering tag to be null and test to be false.

Decode a tagged address:

const tagged = 'XVLhHMPHU98es4dbozjVtdWzVrDjtV8xvjGQTYPiAx6gwDC'
const untagged = Decode(tagged)

The output will be a destination object containing the untagged address (r....), the destination tag (null or a string containing the destination tag) and a test (bool) indicator.

Development

Run npm run prepublish to clean, lint, test and build. Or just run npm run build, npm run test or npm run lint.

Tests are in ./test. Run tsc -w if you want are developing and want to auto-build to ./dist when you make changes on the fly.

Scripts:

  • Build: npm run build, output: ./dist
  • Test: npm run test
  • Lint: npm run lint
  • Clean, test, lint and build: npm run prepublish
  • Browserify: npm run browserify, output: dist/xrpl-tagged-address-codec-browser.js

Credits

This concept is based on the concept from @nbougalis

Big thanks to @sublimator for his fiddles, ideas and fixes and @intelliot for the idea of adding an X / T prefix for (new) address recognizability.