UNPKG

harsta

Version:

Harsta is a contract development tool based on Hardhat, designed to streamline the development, testing, and referencing of contracts, addresses, ABIs, and contract instances.

21 lines (16 loc) 651 B
/* eslint-disable no-extend-native */ /* eslint-disable ts/ban-ts-comment */ import fs from 'node:fs' import { resolveImport } from 'resolve-import-path' export function fixtureHardhatAndBigInt() { const hardhatFsUtilsFile = resolveImport('hardhat/internal/util/fs-utils.js') // @ts-expect-error BigInt.prototype.toJSON = function (this) { return this.toString() } if (!fs.existsSync(hardhatFsUtilsFile)) return const fixFsUtilsContent = fs.readFileSync(hardhatFsUtilsFile, 'utf-8') .replace('throw new FileNotFoundError(absolutePath, e)', 'return absolutePath') fs.writeFileSync(hardhatFsUtilsFile, fixFsUtilsContent) }