Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ripple-binary-codec

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ripple-binary-codec - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

22

distrib/npm/index.js

@@ -9,4 +9,21 @@ 'use strict';var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;};var assert = require('assert');

coreTypes.quality;var _coreTypes$binary = coreTypes.binary;var bytesToHex = _coreTypes$binary.bytesToHex;var signingData = _coreTypes$binary.signingData;var signingClaimData = _coreTypes$binary.signingClaimData;var multiSigningData = _coreTypes$binary.multiSigningData;var binaryToJSON = _coreTypes$binary.binaryToJSON;var serializeObject = _coreTypes$binary.serializeObject;
coreTypes.quality;var _coreTypes$binary = coreTypes.binary;var bytesToHex = _coreTypes$binary.bytesToHex;var signingData = _coreTypes$binary.signingData;var signingClaimData = _coreTypes$binary.signingClaimData;var multiSigningData = _coreTypes$binary.multiSigningData;var binaryToJSON = _coreTypes$binary.binaryToJSON;var serializeObject = _coreTypes$binary.serializeObject;var BinaryParser = _coreTypes$binary.BinaryParser;
function decodeLedgerData(binary) {
assert(typeof binary === 'string', 'binary must be a hex string');
var parser = new BinaryParser(binary);
return {
ledger_index: parser.readUInt32(),
total_coins: parser.readType(coreTypes.UInt64).valueOf().toString(),
parent_hash: parser.readType(coreTypes.Hash256).toHex(),
transaction_hash: parser.readType(coreTypes.Hash256).toHex(),
account_hash: parser.readType(coreTypes.Hash256).toHex(),
parent_close_time: parser.readUInt32(),
close_time: parser.readUInt32(),
close_time_resolution: parser.readUInt8(),
close_flags: parser.readUInt8() };}
function decode(binary) {

@@ -55,2 +72,3 @@ assert(typeof binary === 'string', 'binary must be a hex string');

encodeQuality: encodeQuality,
decodeQuality: decodeQuality };
decodeQuality: decodeQuality,
decodeLedgerData: decodeLedgerData };

2

package.json
{
"name": "ripple-binary-codec",
"version": "0.1.10",
"version": "0.1.11",
"description": "ripple binary codec",

@@ -5,0 +5,0 @@ "files": [

const assert = require('assert');
const fixtures = require('./fixtures/codec-fixtures.json');
const {decode, encode} = require('../src');
const {decode, encode, decodeLedgerData} = require('../src');

@@ -27,2 +27,12 @@ function json(object) {

makeSuite('accountState', fixtures.accountState);
describe('ledgerData', function() {
fixtures.ledgerData.forEach((t, test_n) => {
it(`ledgerData[${test_n}] can decode ${t.binary} to ${json(t.json)}`,
() => {
const decoded = decodeLedgerData(t.binary);
assert.deepEqual(t.json, decoded);
});
});
})
});

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc