Skip to content

Commit

Permalink
solve issue: irisnet#60
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhiqiang committed Jan 18, 2019
1 parent 463024f commit 7ea0e65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/crypto_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('CryPto test', function () {
});


let chain_id = "irishub-test";
let chain_id = "rainbow-dev";
let from = "faa1ljemm0yznz58qxxs8xyak7fashcfxf5lssn6jm";
let gas = 200000;
let account_number = 4;
Expand All @@ -53,7 +53,7 @@ describe('CryPto test', function () {
chain_id: chain_id,
from: from,
account_number: account_number,
sequence:0 ,
sequence:21 ,
fees: fees,
gas: gas,
memo: memo,
Expand All @@ -77,7 +77,7 @@ describe('CryPto test', function () {
chain_id: chain_id,
from: from,
account_number: account_number,
sequence:1 ,
sequence:15 ,
fees: fees,
gas: gas,
memo: memo,
Expand Down
9 changes: 7 additions & 2 deletions util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = class Utils {
} else if (obj[k] != null && typeof(obj[k]) === "object") {
tmp[k] = sort(obj[k]);
} else if (obj[k] != null && typeof(obj[k]) === "function") {
tmp[k] = eval(obj[k].toString())
tmp[k] = evil(obj[k].toString())
} else {
tmp[k] = new String(obj[k]).toString();
}
Expand Down Expand Up @@ -60,4 +60,9 @@ module.exports = class Utils {
return str.toString()
}
}
};
};

function evil(fn) {
let Fn = Function;
return new Fn('return ' + fn)();
}

0 comments on commit 7ea0e65

Please sign in to comment.