mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
make code uglify-compatible - do not use Function.name
This commit is contained in:
@@ -12,7 +12,7 @@ const {sha512Half, transactionID} = require('./hashes');
|
||||
|
||||
const makeParser = bytes => new BinaryParser(bytes);
|
||||
const readJSON = parser => parser.readType(types.STObject).toJSON();
|
||||
const binaryToJSON = (bytes) => readJSON(makeParser(bytes));
|
||||
const binaryToJSON = bytes => readJSON(makeParser(bytes));
|
||||
|
||||
function serializeObject(object, opts = {}) {
|
||||
const {prefix, suffix, signingFieldsOnly = false} = opts;
|
||||
|
||||
@@ -15,7 +15,7 @@ const {
|
||||
const FULL_CANONICAL_SIGNATURE = 0x80000000;
|
||||
|
||||
const toHex = v => bytesToHex(v);
|
||||
const getSigner = (o) => AccountID.from(o.Signer.Account);
|
||||
const getSigner = o => AccountID.from(o.Signer.Account);
|
||||
const signerComparator = (a, b) => getSigner(a).compareTo(getSigner(b));
|
||||
|
||||
function setCanonicalSignatureFlag(tx_json) {
|
||||
|
||||
@@ -38,8 +38,8 @@ module.exports = function makeClass(klass_, definition_) {
|
||||
klass = function() {};
|
||||
}
|
||||
const proto = klass.prototype;
|
||||
function addFunc(original, wrapper) {
|
||||
proto[original.name] = wrapper || original;
|
||||
function addFunc(original, name, wrapper) {
|
||||
proto[name] = wrapper || original;
|
||||
}
|
||||
(definition.getters || []).forEach(k => {
|
||||
const key = '_' + k;
|
||||
@@ -47,24 +47,24 @@ module.exports = function makeClass(klass_, definition_) {
|
||||
return this[key];
|
||||
};
|
||||
});
|
||||
forEach(definition.virtuals, f => {
|
||||
addFunc(f, function() {
|
||||
forEach(definition.virtuals, (f, n) => {
|
||||
addFunc(f, n, function() {
|
||||
throw new Error('unimplemented');
|
||||
});
|
||||
});
|
||||
forEach(definition.methods, addFunc);
|
||||
forEach(definition, f => {
|
||||
forEach(definition, (f, n) => {
|
||||
if (_.isFunction(f) && f !== klass) {
|
||||
addFunc(f);
|
||||
addFunc(f, n);
|
||||
}
|
||||
});
|
||||
_.assign(klass, definition.statics);
|
||||
if (typeof klass.init === 'function') {
|
||||
klass.init();
|
||||
}
|
||||
forEach(definition.cached, f => {
|
||||
const key = '_' + f.name;
|
||||
addFunc(f, function() {
|
||||
forEach(definition.cached, (f, n) => {
|
||||
const key = '_' + n;
|
||||
addFunc(f, n, function() {
|
||||
let value = this[key];
|
||||
if (value === undefined) {
|
||||
value = this[key] = f.call(this);
|
||||
|
||||
@@ -78,10 +78,10 @@ function UIntTest() {
|
||||
|
||||
|
||||
function parseLedger4320278() {
|
||||
it(`can parse object`, (done) => {
|
||||
it(`can parse object`, done => {
|
||||
this.timeout(30e3);
|
||||
const json = loadFixture('as-ledger-4320278.json');
|
||||
json.forEach((e) => {
|
||||
json.forEach(e => {
|
||||
assertRecycles(e.binary);
|
||||
});
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user