{"name":"ripple-address-codec","version":"5.0.1","description":"encodes/decodes base58 encoded XRP Ledger identifiers","main":"dist/index.js","types":"dist/index.d.ts","license":"ISC","dependencies":{"@scure/base":"^2.0.0","@xrplf/isomorphic":"^1.0.2"},"keywords":["ripple","xrp","xrp ledger","xrpl"],"repository":{"type":"git","url":"git+ssh://git@github.com/XRPLF/xrpl.js.git"},"prepublish":"tsc -b","prepublishOnly":"tslint -b ./ && jest","scripts":{"build":"tsc --build tsconfig.build.json","test":"jest --verbose false --silent=false ./test/*.test.ts","test:browser":"npm run build && karma start ./karma.config.js","lint":"eslint . --max-warnings 0","clean":"rm -rf ./dist ./coverage ./test/testCompiledForWeb tsconfig.build.tsbuildinfo"},"prettier":"@xrplf/prettier-config","engines":{"node":">= 18"},"_id":"ripple-address-codec@5.0.1","bugs":{"url":"https://github.com/XRPLF/xrpl.js/issues"},"homepage":"https://github.com/XRPLF/xrpl.js#readme","_integrity":"sha512-JQHLKuVJV8lv9Qobmn4aUM2Dpv9WRRLKnNWfM8tN02fAbUtG8mUPsu9q9UYX8P76G4qzytEc5ZKMp/3JggNYmw==","_resolved":"/home/runner/work/xrpl.js/xrpl.js/dist/ripple-address-codec-5.0.1.tgz","_from":"file:ripple-address-codec-5.0.1.tgz","_nodeVersion":"20.20.2","_npmVersion":"11.6.0","dist":{"integrity":"sha512-JQHLKuVJV8lv9Qobmn4aUM2Dpv9WRRLKnNWfM8tN02fAbUtG8mUPsu9q9UYX8P76G4qzytEc5ZKMp/3JggNYmw==","shasum":"63d4245bf716753432ff46724c8f018c0a6de30c","tarball":"http://registry-npm.ywwl.com/ripple-address-codec/download/ripple-address-codec-5.0.1.tgz","fileCount":15,"unpackedSize":62226,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/ripple-address-codec@5.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC74SOhP1SFS7spOeYgWvUspBQzG2wFvhcLbSvghKzMLwIhAIWSw3IHu3XUtkf+xfUqlLKUByFl5Si4CILLukwt5hRR"}],"size":17469,"noattachment":false,"key":"/ripple-address-codec/-/ripple-address-codec-5.0.1.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e6db69da-de6d-4d3d-9741-a3bd6609616f"}},"directories":{},"maintainers":[{"name":"pdp2121","email":"ppham@ripple.com"},{"name":"shichengripple001","email":"cshi@ripple.com"},{"name":"ripplex-automation","email":"ripplegithub@ripple.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ripple-address-codec_5.0.1_1780611952743_0.3724717471783243"},"_hasShrinkwrap":false,"readme":"# ripple-address-codec\n\n[![NPM Version][npm-version-image]][npm-url]\n[![NPM Downloads][npm-downloads-image]][npm-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nFunctions for encoding and decoding XRP Ledger addresses and seeds.\n\nAlso includes support for encoding/decoding [rippled validator (node) public keys](https://xrpl.org/run-rippled-as-a-validator.html).\n\n[![NPM](https://nodei.co/npm/ripple-address-codec.png)](https://www.npmjs.org/package/ripple-address-codec)\n\n## X-address Conversion\n\nAll tools and apps in the XRP Ledger ecosystem are encouraged to adopt support for the X-address format. The X-address format is a single Base58 string that encodes an 'Account ID', a (destination) tag, and whether the address is intended for a test network. This prevents users from unintentionally omitting the destination tag when sending and receiving payments and other transactions.\n\n## API\n\n### classicAddressToXAddress(classicAddress: string, tag: number | false, test: boolean): string\n\nConvert a classic address and (optional) tag to an X-address. If `tag` is `false`, the returned X-address explicitly indicates that the recipient does not want a tag to be used. If `test` is `true`, consumers of the address will know that the address is intended for use on test network(s) and the address will start with `T`.\n\n```js\n> const api = require('ripple-address-codec')\n> api.classicAddressToXAddress('rGWrZyQqhTp9Xu7G5Pkayo7bXjH4k4QYpf', 4294967295)\n'XVLhHMPHU98es4dbozjVtdWzVrDjtV18pX8yuPT7y4xaEHi'\n```\n\nEncode a test address e.g. for use with [Testnet or Devnet](https://xrpl.org/xrp-testnet-faucet.html):\n\n```js\n> const api = require('ripple-address-codec')\n> api.classicAddressToXAddress('r3SVzk8ApofDJuVBPKdmbbLjWGCCXpBQ2g', 123, true)\n'T7oKJ3q7s94kDH6tpkBowhetT1JKfcfdSCmAXbS75iATyLD'\n```\n\n### xAddressToClassicAddress(xAddress: string): {classicAddress: string, tag: number | false, test: boolean}\n\nConvert an X-address to a classic address and tag. If the X-address did not have a tag, the returned object's `tag` will be `false`. (Since `0` is a valid tag, instead of `if (tag)`, use `if (tag !== false)` if you want to check for a tag.) If the X-address is intended for use on test network(s), `test` will be `true`; if it is intended for use on the main network (mainnet), `test` will be `false`.\n\n```js\n> const api = require('ripple-address-codec')\n> api.xAddressToClassicAddress('XVLhHMPHU98es4dbozjVtdWzVrDjtV18pX8yuPT7y4xaEHi')\n{\n  classicAddress: 'rGWrZyQqhTp9Xu7G5Pkayo7bXjH4k4QYpf',\n  tag: 4294967295,\n  test: false\n}\n```\n\n### isValidXAddress(xAddress: string): boolean\n\nReturns `true` if the provided X-address is valid, or `false` otherwise.\n\n```js\n> const api = require('ripple-address-codec')\n> api.isValidXAddress('XVLhHMPHU98es4dbozjVtdWzVrDjtV18pX8yuPT7y4xaEHi')\ntrue\n```\n\nReturns `false` for classic addresses (starting with `r`). To validate a classic address, use `isValidClassicAddress`.\n\n### isValidClassicAddress(address: string): boolean\n\nCheck whether a classic address (starting with `r`...) is valid.\n\nReturns `false` for X-addresses (extended addresses). To validate an X-address, use `isValidXAddress`.\n\n### encodeSeed(entropy: UInt8Array, type: 'ed25519' | 'secp256k1'): string\n\nEncode the given entropy as an XRP Ledger seed (secret). The entropy must be exactly 16 bytes (128 bits). The encoding includes which elliptic curve digital signature algorithm (ECDSA) the seed is intended to be used with. The seed is used to produce the private key.\n\n### decodeSeed(seed: string): object\n\nDecode a seed into an object with its version, type, and bytes.\n\nReturn object type:\n```\n{\n  version: number[],\n  bytes: UInt8Array,\n  type: string | null\n}\n```\n\n### encodeAccountID(bytes: UInt8Array): string\n\nEncode bytes as a classic address (starting with `r`...).\n\n### decodeAccountID(accountId: string): UInt8Array\n\nDecode a classic address (starting with `r`...) to its raw bytes.\n\n### encodeNodePublic(bytes: UInt8Array): string\n\nEncode bytes to the XRP Ledger \"node public key\" format (base58).\n\nThis is useful for rippled validators.\n\n### decodeNodePublic(base58string: string): UInt8Array\n\nDecode an XRP Ledger \"node public key\" (in base58 format) into its raw bytes.\n\n### encodeAccountPublic(bytes: UInt8Array): string\n\nEncode a public key, as for payment channels.\n\n### decodeAccountPublic(base58string: string): UInt8Array\n\nDecode a public key, as for payment channels.\n\n### encodeXAddress(accountId: UInt8Array, tag: number | false, test: boolean): string\n\nEncode account ID, tag, and network ID to X-address.\n\n`accountId` must be 20 bytes because it is a RIPEMD160 hash, which is 160 bits (160 bits = 20 bytes).\n\nAt this time, `tag` must be <= MAX_32_BIT_UNSIGNED_INT (4294967295) as the XRP Ledger only supports 32-bit tags.\n\nIf `test` is `true`, this address is intended for use with a test network such as Testnet or Devnet.\n\n### decodeXAddress(xAddress: string): {accountId: UInt8Array, tag: number | false, test: boolean}\n\nConvert an X-address to its classic address, tag, and network ID.\n\n### Other functions\n\n```js\n> var api = require('ripple-address-codec');\n> api.decodeSeed('sEdTM1uX8pu2do5XvTnutH6HsouMaM2')\n{ version: [ 1, 225, 75 ],\n  bytes: [ 76, 58, 29, 33, 63, 189, 251, 20, 199, 194, 141, 96, 148, 105, 179, 65 ],\n  type: 'ed25519' }\n> api.decodeSeed('sn259rEFXrQrWyx3Q7XneWcwV6dfL')\n{ version: 33,\n  bytes: [ 207, 45, 227, 120, 251, 221, 126, 46, 232, 125, 72, 109, 251, 90, 123, 255 ],\n  type: 'secp256k1' }\n> api.decodeAccountID('rJrRMgiRgrU6hDF4pgu5DXQdWyPbY35ErN')\n[ 186,\n  142,\n  120,\n  98,\n  110,\n  228,\n  44,\n  65,\n  180,\n  109,\n  70,\n  195,\n  4,\n  141,\n  243,\n  161,\n  195,\n  200,\n  112,\n  114 ]\n```\n\n## Tests\n\nRun unit tests with:\n\n    npm test\n\nUse `--watch` to run in watch mode, so that when you modify the tests, they are automatically re-run:\n\n    npm test -- --watch\n\nUse `--coverage` to generate and display code coverage information:\n\n    npm test -- --coverage\n\nThis tells jest to output code coverage info in the `./coverage` directory, in addition to showing it on the command line.\n\n## Releases\n\nUse the [xrpl.js release process](https://github.com/XRPLF/xrpl.js/blob/main/CONTRIBUTING.md#release).\n\n## Acknowledgements\n\nThis library references and adopts code and standards from the following sources:\n\n- [XLS-5d Standard for Tagged Addresses](https://github.com/xrp-community/standards-drafts/issues/6) by @nbougalis\n- [XRPL Tagged Address Codec](https://github.com/xrp-community/xrpl-tagged-address-codec) by @WietseWind\n- [X-Address transaction functions](https://github.com/codetsunami/xrpl-tools/tree/master/xaddress-functions) by @codetsunami\n\n[coveralls-image]: https://badgen.net/coveralls/c/github/ripple/ripple-address-codec/master\n[coveralls-url]: https://coveralls.io/r/ripple/ripple-address/codec?branch=master\n[npm-downloads-image]: https://badgen.net/npm/dm/ripple-address-codec\n[npm-url]: https://npmjs.org/package/ripple-address-codec\n[npm-version-image]: https://badgen.net/npm/v/ripple-address-codec\n[travis-image]: https://badgen.net/travis/ripple/ripple-address-codec/master\n[travis-url]: https://travis-ci.org/github/ripple/ripple-address-codec\n","publish_time":1780611952930,"_cnpm_publish_time":1780611952930,"dist-tags":{"beta":"5.0.0-beta.1","latest":"5.0.1"}}