mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-25 14:45:48 +00:00
Add encodeForSigning
This commit is contained in:
@@ -2,10 +2,14 @@
|
|||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const coreTypes = require('@niq/ripple-core-types');
|
const coreTypes = require('@niq/ripple-core-types');
|
||||||
const {binary: {bytesToHex, binaryToJSON, serializeObject}} = coreTypes;
|
const {binary: {bytesToHex,
|
||||||
|
signingData,
|
||||||
|
multiSigningData,
|
||||||
|
binaryToJSON,
|
||||||
|
serializeObject}} = coreTypes;
|
||||||
|
|
||||||
exports.decode = function(binary) {
|
exports.decode = function(binary) {
|
||||||
assert(typeof binary === 'string');
|
assert(typeof binary === 'string', 'binary must be a hex string');
|
||||||
return binaryToJSON(binary);
|
return binaryToJSON(binary);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -13,3 +17,13 @@ exports.encode = function(json) {
|
|||||||
assert(typeof json === 'object');
|
assert(typeof json === 'object');
|
||||||
return bytesToHex(serializeObject(json));
|
return bytesToHex(serializeObject(json));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.encodeForSigning = function(json) {
|
||||||
|
assert(typeof json === 'object');
|
||||||
|
return bytesToHex(signingData(json));
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.encodeForMultisigning = function(json, signer) {
|
||||||
|
assert(typeof json === 'object');
|
||||||
|
return bytesToHex(multiSigningData(json, signer));
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user