-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: clean up code and dependencies
- Loading branch information
Showing
16 changed files
with
112 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/thirdweb/src/utils/any-evm/is-eip155-enforced.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { describe, it, expect } from "vitest"; | ||
import { isEIP155Enforced } from "./is-eip155-enforced.js"; | ||
import { TEST_CLIENT } from "../../../test/src/test-clients.js"; | ||
|
||
describe("isEIP155Enforced", () => { | ||
it("should return true if EIP-155 is enforced", async () => { | ||
// Call the isEIP155Enforced function with a chain that enforces EIP-155 | ||
const result = await isEIP155Enforced({ | ||
// optimism enforce eip155 | ||
chain: 10, | ||
client: TEST_CLIENT, | ||
}); | ||
|
||
// Assert that the result is true | ||
expect(result).toBe(true); | ||
}); | ||
|
||
it("should return false if EIP-155 is not enforced", async () => { | ||
// Call the isEIP155Enforced function with a chain that does not enforce EIP-155 | ||
const result = await isEIP155Enforced({ | ||
// ethereum does not enforce eip155 | ||
chain: 1, | ||
client: TEST_CLIENT, | ||
}); | ||
|
||
// Assert that the result is false | ||
expect(result).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { describe, bench } from "vitest"; | ||
import { keccackId } from "./keccack-id.js"; | ||
import { id } from "ethers6"; | ||
|
||
const input = "Hello, World!"; | ||
describe("keccackId", () => { | ||
bench("thirdweb", () => { | ||
keccackId(input); | ||
}); | ||
bench("ethers", () => { | ||
id(input); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { describe, it, expect } from "vitest"; | ||
import { keccackId } from "./keccack-id.js"; | ||
|
||
describe("keccackId", () => { | ||
it("should return the keccak256 hash of the input", () => { | ||
const input = "Hello, World!"; | ||
const result = keccackId(input); | ||
expect(result).toMatchInlineSnapshot( | ||
`"0xacaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f"`, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters