Skip to content

Commit

Permalink
improve(JSONUtils): Handle BigInt on JSON stringification (#733)
Browse files Browse the repository at this point in the history
This is one prerequisite for trialing ethers v6 and viem in the bots.
  • Loading branch information
pxrl committed Sep 17, 2024
1 parent b55a6de commit 436baad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/JSONUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function jsonReplacerWithBigNumbers(_key: string, value: unknown): unknow
// We need to check if this is a big number, because the JSON parser
// is not aware of BigNumbers and will convert them to the string representation
// of the object itself which is not what we want.
if (BigNumber.isBigNumber(value)) {
if (BigNumber.isBigNumber(value) || typeof value === "bigint") {
return value.toString();
}
// There's a legacy issues that returns BigNumbers as { type: "BigNumber", hex: "0x..." }
Expand Down

0 comments on commit 436baad

Please sign in to comment.