Skip to content

Commit

Permalink
fix jsonStringify (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjb0807 authored Dec 8, 2023
1 parent f3b6ab5 commit ff50460
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ const exportParachainGenesis = (parachain: Parachain, output: string) => {

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',
);
JSON.stringify(
spec,
(_, v) => (typeof v === 'number' ? `@${v.toLocaleString('fullwide', { useGrouping: false })}@` : v),
2,
).replace(/"@(.*?)@"/g, '$1');

/**
* Generate relay chain genesis file
Expand Down

0 comments on commit ff50460

Please sign in to comment.