Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
switch to ethereum-cryptography (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio committed Apr 5, 2022
1 parent 53d9c8e commit e270a63
Show file tree
Hide file tree
Showing 3 changed files with 12,285 additions and 105 deletions.
6 changes: 3 additions & 3 deletions lib/gasData.js
@@ -1,5 +1,6 @@
const ethersABI = require("@ethersproject/abi");
const ejsUtil = require("ethereumjs-util");
const { keccak256 } = require("ethereum-cryptography/keccak");
const { utf8ToBytes, bytesToHex } = require("ethereum-cryptography/utils");
const sha1 = require("sha1");
const utils = require("./utils");
const SyncRequest = require("./syncRequest");
Expand Down Expand Up @@ -89,8 +90,7 @@ class GasData {
// Generate sighashes and remap ethers to something similar
// to abiDecoder.getMethodIDs
Object.keys(methods).forEach(key => {
const raw = ejsUtil.keccak256(key);
const sighash = ejsUtil.bufferToHex(raw).slice(2, 10);
const sighash = bytesToHex(keccak256(utf8ToBytes(key))).slice(0, 8);
methodIDs[sighash] = Object.assign({ fnSig: key }, methods[key]);
});

Expand Down

0 comments on commit e270a63

Please sign in to comment.