jsonStringify bug
zjb0807 opened this issue · 0 comments
zjb0807 commented
const jsonStringify = (spec: any) =>
// JSON.stringify will serialize big number to scientific notation such as 1e+21, which is not supported by Substrate
JSON.stringify(spec, (_, v) => (typeof v === 'number' ? `@${BigInt(v).toString()}@` : v), 2).replace(
/"@(.*?)@"/g,
'$1',
);
const balances = 2000000000000000000000000;
console.log(jsonStringify(balances));
1999999999999999966445568