mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35:49 +00:00
Initial import
This commit is contained in:
1
packages/ripple-binary-codec/src/README.md
Normal file
1
packages/ripple-binary-codec/src/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# ripple-binary-codec
|
||||
15
packages/ripple-binary-codec/src/index.js
Normal file
15
packages/ripple-binary-codec/src/index.js
Normal 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));
|
||||
};
|
||||
Reference in New Issue
Block a user