Skip to content

Instantly share code, notes, and snippets.

@shadowcodex
Last active December 7, 2018 16:17
Show Gist options
  • Save shadowcodex/cf7189d18e366a27772cf58330ea6afb to your computer and use it in GitHub Desktop.
Save shadowcodex/cf7189d18e366a27772cf58330ea6afb to your computer and use it in GitHub Desktop.
Fix Web3 for timestamp overflow.
const fs = require("fs");
const path = "node_modules/web3-core-helpers/src/formatters.js";
if (fs.existsSync(path)) {
fs.readFile(path, "utf8", (err, data) => {
if (err) {
return console.error(err);
}
const result = data.replace(
/block\.timestamp \= utils\.hexToNumber\(/gm,
"block.timestamp = utils.hexToNumberString(",
);
fs.writeFile(path, result, "utf8", err => {
if (err) return console.error(err);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment