Skip to content

Commit

Permalink
tests: Update to ethers 6
Browse files Browse the repository at this point in the history
  • Loading branch information
shazow committed Aug 22, 2023
1 parent 6de11ef commit 6886c61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const env = {
ETHERSCAN_API_KEY: process.env.ETHERSCAN_API_KEY,
};

const provider = env.INFURA_API_KEY ? (new ethers.providers.InfuraProvider("homestead", env.INFURA_API_KEY)) : ethers.getDefaultProvider();
const provider = env.INFURA_API_KEY ? (new ethers.InfuraProvider("homestead", env.INFURA_API_KEY)) : ethers.getDefaultProvider("homestead");

type ItConcurrent = typeof test.skip;

Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ test.skip('WIP: abiFromBytecode functions', () => {
// toKnown converts a traditional ABI object to a subset that we know how to
// extract, so that we can make comparisons within our limitations.
function toKnown(abi: any[]) {
const iface = new ethers.utils.Interface(abi);
const iface = new ethers.Interface(abi);

return abi.map(a => {
if (a.type === "event") {
return a;
}
if (a.type === "function") {
a.selector = iface.getSighash(a.name);
a.selector = iface.getFunction(a.name)?.selector;
}

// We can only tell iff there are inputs/outputs, not what they are
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Utils', () => {
new Uint8Array([255,255]),
new Uint8Array([0,255,0,255]),
])("bytesToHex %s", (bytes) => {
expect(bytesToHex(bytes)).toStrictEqual(ethers.utils.hexlify(bytes));
expect(bytesToHex(bytes)).toStrictEqual(ethers.hexlify(bytes));
});

test("bytesToHex padding", () => {
Expand All @@ -29,7 +29,7 @@ describe('Utils', () => {
"0xffff",
"0x00ff00ff",
])("hexToBytes %s", (hex) => {
expect(hexToBytes(hex)).toStrictEqual(ethers.utils.arrayify(hex));
expect(hexToBytes(hex)).toStrictEqual(ethers.getBytes(hex));
});

test.each([
Expand All @@ -39,7 +39,7 @@ describe('Utils', () => {
new Uint8Array([0,1,2,3]),
new Uint8Array([255,0,255,0,255,0]),
])("keccak256 %s", (hex) => {
expect(keccak256(hex)).toStrictEqual(ethers.utils.keccak256(hex));
expect(keccak256(hex)).toStrictEqual(ethers.keccak256(hex));
});

});
Expand Down

0 comments on commit 6886c61

Please sign in to comment.