{"name":"ripple-binary-codec","version":"0.2.6","license":"ISC","_id":"ripple-binary-codec@0.2.6","homepage":"https://github.com/ripple/ripple-binary-codec#readme","bugs":{"url":"https://github.com/ripple/ripple-binary-codec/issues"},"dist":{"shasum":"a8c45c905c12d5dc6fa7e179c3584d56fb8bdb07","tarball":"http://registry-npm.ywwl.com/ripple-binary-codec/download/ripple-binary-codec-0.2.6.tgz","fileCount":89,"integrity":"sha512-k0efyjpcde7p+rJ9PXW9tJSYsUDdlC9Z9xU7OPM7fJiHVKlR1E7nfu0jqw9vVXtTG3tujqKeEgtcb8yaa7rMXA==","signatures":[{"sig":"MEYCIQCgBLYhJBT4uNdvMztGnigYrg+L29JZNgGRXXnq5ynuOAIhAIXexOJCak2P0GUAzjlUxDXuMoUSv4JlR5z2apnbGrhg","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":913345,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeC7sdCRA9TVsSAnZWagAAnQgP/jxNIEDGrsxEmgqTVoic\n8bbTuauOTBYyqOmM2BfzdMo5P1NfIFd3W7j6W43JVeVVaQKQvOF4oqk0e4jK\nVYb5ckhd3cO1g3W39lLSnkz2GWe3jUYBeT9Fc7/vnSHENF8SOZxA7HtrCZdp\nXJmWEUujLciB+xoL9KBc1BP9GDJQQnAwrSvkvzKDpdeTkZ2GHdvxo2nZnDPL\nSBcjHt8i2QvEEgQYs8AZnJK5NqtM4SaxjRTijEoIP9CV2rJWNJdpyURcICOA\n9g9k6423f1f7OR5ZjBg1hFk7POPK41MnkIHUuuMCpDitEU06tuBA3QknLHYR\nkD7yL0I3wQR1t+xRPrnYRMEwnA3qu6bYGjUe2CUxrO2zTK72fjzQ/uhjHpX5\nfUqlkRuAw5tSZRofKuqVU5ige0RHEapoaiosiDZwFw4Z7EFEGTOJvX304q6A\naq4/mxi0PX78I+I8maL752A7GYXVw/FKea4bctlqU8PKKuLO5dPwUFtdOr1r\nQ7TqHaODw/iWgFL56vDHTNScIfkdC7xmPmj0nhfY0baMKgkKIdCR1cf33z9D\nOIDS8QgWfxKoAxlSKxMNYnZCjnfllT1IZSqys7qBVy3RiXxOijxRoGD7HeTr\n9RiswskJx0kYfKKhcJdKvxijhaAHgEAJrTZRSL4V6Jtxn1fuYvEQzL7o35mM\nrurk\r\n=YHKd\r\n-----END PGP SIGNATURE-----\r\n","size":222445,"noattachment":false,"key":"/ripple-binary-codec/-/ripple-binary-codec-0.2.6.tgz"},"main":"distrib/npm/","scripts":{"lint":"if ! [ -f eslintrc ]; then curl -o eslintrc 'https://raw.githubusercontent.com/ripple/javascript-style-guide/es6/eslintrc'; echo 'parser: babel-eslint' >> eslintrc; fi; eslint -c eslintrc src/**/*.js test/*.js examples/*.js","test":"istanbul test _mocha","compile":"babel --optional runtime -d distrib/npm/ src/ && cp src/enums/definitions.json distrib/npm/enums","prepublish":"npm test && npm run lint && npm run compile"},"_npmUser":{"name":"intelliot","email":"github.public@intelliot.com"},"repository":{"url":"git://github.com/ripple/ripple-binary-codec.git","type":"git"},"description":"XRP Ledger binary codec","directories":{},"licenseText":"Copyright (c) 2015 Ripple Labs Inc.\n\nPermission to use, copy, modify, and distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n","dependencies":{"bn.js":"^5.1.1","lodash":"^4.17.15","inherits":"^2.0.1","decimal.js":"^10.2.0","create-hash":"^1.1.2","babel-runtime":"^6.6.1","ripple-address-codec":"^4.0.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"~6.2.0","eslint":"^4.18.2","fs-extra":"^8.1.0","istanbul":"~0.4.3","babel-cli":"^6.8.0","babel-core":"^6.8.0","babel-eslint":"^10.0.2","babel-loader":"^6.2.4","babel-register":"^6.8.0","intercept-stdout":"^0.1.2","babel-preset-es2015":"^6.6.0"},"_npmOperationalInternal":{"tmp":"tmp/ripple-binary-codec_0.2.6_1577827101324_0.3519213514147479","host":"s3://npm-registry-packages"},"readme":"# ripple-binary-codec [![NPM](https://img.shields.io/npm/v/ripple-binary-codec.svg)](https://npmjs.org/package/ripple-binary-codec)\n\nFunctions to encode/decode to/from the ripple [binary serialization format](https://xrpl.org/serialization.html)\n\n[![NPM](https://nodei.co/npm/ripple-binary-codec.png)](https://www.npmjs.org/package/ripple-binary-codec)\n\n## API\n```js\n> const api = require('ripple-binary-codec')\n```\n\n\n### decode(binary: string): object\nDecode a hex-string into a transaction object.\n```js\n> api.decode('1100612200000000240000000125000000072D0000000055DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF6240000002540BE4008114D0F5430B66E06498D4CEEC816C7B3337F9982337')\n{\n  LedgerEntryType: 'AccountRoot',\n  Flags: 0,\n  Sequence: 1,\n  PreviousTxnLgrSeq: 7,\n  OwnerCount: 0,\n  PreviousTxnID: 'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',\n  Balance: '10000000000',\n  Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv'\n}\n```\n\n### encode(json: object): string\nEncode a transaction object into a hex-string. Note that encode filters out fields with undefined values.\n```js\n> api.encode({\n  LedgerEntryType: 'AccountRoot',\n  Flags: 0,\n  Sequence: 1,\n  PreviousTxnLgrSeq: 7,\n  OwnerCount: 0,\n  PreviousTxnID: 'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',\n  Balance: '10000000000',\n  Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv' \n})\n'1100612200000000240000000125000000072D0000000055DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF6240000002540BE4008114D0F5430B66E06498D4CEEC816C7B3337F9982337'\n```\n\n#### X-Address Compatibility \n  * ripple-binary-codec handles X-addresses by looking for a few specific files (Account/SourceTag, Destination/DestinationTag).\n  * If other fields (in the future) must to support X-addresses with tags, this library will need to be updated.\n  * When decoding rippled binary, the output will always output classic address + tag, with no X-addresses. X-address support only applies when encoding to binary.\n\n#### Encoding Currency Codes\n  * The standard format for currency codes is a three-letter string such as `USD`. This is intended for use with ISO 4217 Currency Codes.\n  * Currency codes must be exactly 3 ASCII characters in length and there are [a few other rules](https://xrpl.org/currency-formats.html#currency-codes).\n  * ripple-binary-codec allows any 3-character ASCII string to be encoded as a currency code, although rippled may enforce tighter restrictions.\n  * When _decoding_, if a currency code is three uppercase letters or numbers (`/^[A-Z0-9]{3}$/`), then it will be decoded into that string. For example,`0000000000000000000000004142430000000000` decodes as `ABC`.\n  * When decoding, if a currency code is does not match the regex, then it is not considered to be an ISO 4217 or pseudo-ISO currency. ripple-binary-codec will return a 160-bit hex-string (40 hex characters). For example, `0000000000000000000000006142430000000000` (`aBC`) decodes as `0000000000000000000000006142430000000000` because it contains a lowercase letter.\n\n### encodeForSigning(json: object): string\n\nEncode the transaction object for signing.\n\n### encodeForSigningClaim(json: object): string\n\nEncode the transaction object for payment channel claim.\n\n### encodeForMultisigning(json: object, signer: string): string\n\nEncode the transaction object for multi-signing.\n\n### encodeQuality(value: string): string\n```js\n> api.encodeQuality('195796912.5171664')\n'5D06F4C3362FE1D0'\n```\n\n### decodeQuality(value: string): string \n```js\n> api.decodeQuality('5D06F4C3362FE1D0')\n'195796912.5171664'\n```\n\n### decodeLedgerData(binary: string): object\n```js\n> api.decodeLedgerData(\"01E91435016340767BF1C4A3EACEB081770D8ADE216C85445DD6FB002C6B5A2930F2DECE006DA18150CB18F6DD33F6F0990754C962A7CCE62F332FF9C13939B03B864117F0BDA86B6E9B4F873B5C3E520634D343EF5D9D9A4246643D64DAD278BA95DC0EAC6EB5350CF970D521276CDE21276CE60A00\")\n{\n  ledger_index: 32052277,\n  total_coins: '99994494362043555',\n  parent_hash: 'EACEB081770D8ADE216C85445DD6FB002C6B5A2930F2DECE006DA18150CB18F6',\n  transaction_hash: 'DD33F6F0990754C962A7CCE62F332FF9C13939B03B864117F0BDA86B6E9B4F87',\n  account_hash: '3B5C3E520634D343EF5D9D9A4246643D64DAD278BA95DC0EAC6EB5350CF970D5',\n  parent_close_time: 556231902,\n  close_time: 556231910,\n  close_time_resolution: 10,\n  close_flags: 0\n}\n```\n\n## Tests\n\nRun unit tests with:\n\n    npm test\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","publish_time":1577827101542,"maintainers":[{"name":"anissa-ripple","email":"anissaw@ripple.com"},{"name":"justinr1234","email":"justinr1234@gmail.com"},{"name":"intelliot","email":"github.public@intelliot.com"},{"name":"wilsonianb","email":"bwilson@ripple.com"},{"name":"shekenahglory","email":"matthew@ripple.com"},{"name":"natenichols","email":"natenichols@cox.net"},{"name":"mvadari","email":"mvadari@ripple.com"},{"name":"ledhed2222","email":"greg.weisbrod@gmail.com"},{"name":"jst5000","email":"aim4math@gmail.com"},{"name":"ckniffen","email":"ckniffen@ripple.com"},{"name":"khancode_","email":"khancodegt@gmail.com"},{"name":"pdp2121","email":"ppham@ripple.com"},{"name":"shawnxie9999","email":"shawnxie@ripple.com"}],"_cnpm_publish_time":1577827101542,"dist-tags":{"batch-experimental":"2.9.0-batch.1","beta-experimental":"2.12.0-beta.0","latest":"2.11.0","smart-contract-experimental":"2.8.0-smartcontract.0","smart-escrow-experimental":"2.12.0-smartescrow.0"}}