mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35:49 +00:00
Add encodeForSigning
This commit is contained in:
@@ -2,10 +2,14 @@
|
||||
|
||||
const assert = require('assert');
|
||||
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) {
|
||||
assert(typeof binary === 'string');
|
||||
assert(typeof binary === 'string', 'binary must be a hex string');
|
||||
return binaryToJSON(binary);
|
||||
};
|
||||
|
||||
@@ -13,3 +17,13 @@ exports.encode = function(json) {
|
||||
assert(typeof json === 'object');
|
||||
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