Initial import

This commit is contained in:
Nicholas Dudfield
2015-09-30 16:28:01 +07:00
parent 7fe8cd541a
commit 65987a83fd
7 changed files with 4626 additions and 0 deletions

View File

@@ -0,0 +1 @@
# ripple-binary-codec

View File

@@ -0,0 +1,15 @@
'use strict';
const assert = require('assert');
const coreTypes = require('@niq/ripple-core-types');
const {binary: {bytesToHex, binaryToJSON, serializeObject}} = coreTypes;
exports.binaryToJSON = function(binary) {
assert(typeof binary === 'string');
return binaryToJSON(binary);
};
exports.jsonToBinary = function (json) {
assert(typeof json === 'object');
return bytesToHex(serializeObject(json));
};