Skip to content

Commit 0eaab37

Browse files
add return type and add test
1 parent c5e0374 commit 0eaab37

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { describe, expect, it } from "vitest";
2+
import { roleBytes } from "./role-bytes.js";
3+
4+
describe("roleBytes", () => {
5+
it('should calculate the value of lister role', () => {
6+
expect(roleBytes("LISTER_ROLE"))
7+
.toBe(
8+
"0xf94103142c1baabe9ac2b5d1487bf783de9e69cfeea9a72f5c9c94afd7877b8c"
9+
);
10+
});
11+
});

packages/thirdweb/src/utils/encoding/helpers/role-bytes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ import { toBytes } from "../to-bytes.js";
99
* @example
1010
* const AdminRole = roleBytes("ADMIN_ROLE");
1111
*/
12-
export const roleBytes = (role: string) => {
12+
export const roleBytes = (role: string): `0x${string}` => {
1313
return keccak256(toBytes(role));
1414
}

0 commit comments

Comments
 (0)