Skip to content

Commit

Permalink
feat(utils): remove hash utils and ethers (#1783)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Oct 31, 2023
1 parent de47d69 commit 52182f7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 25 deletions.
22 changes: 22 additions & 0 deletions .changeset/breezy-seahorses-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
"@latticexyz/utils": major
---

Removed `keccak256` and `keccak256Coord` hash utils in favor of [viem's `keccak256`](https://viem.sh/docs/utilities/keccak256.html#keccak256).

```diff
- import { keccak256 } from "@latticexyz/utils";
+ import { keccak256, toHex } from "viem";

- const hash = keccak256("some string");
+ const hash = keccak256(toHex("some string"));
```

```diff
- import { keccak256Coord } from "@latticexyz/utils";
+ import { encodeAbiParameters, keccak256, parseAbiParameters } from "viem";

const coord = { x: 1, y: 1 };
- const hash = keccak256Coord(coord);
+ const hash = keccak256(encodeAbiParameters(parseAbiParameters("int32, int32"), [coord.x, coord.y]));
```
1 change: 0 additions & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"test:ci": "pnpm run test"
},
"dependencies": {
"ethers": "^5.7.2",
"mobx": "^6.7.0",
"proxy-deep": "^3.1.1",
"rxjs": "7.5.5"
Expand Down
20 changes: 0 additions & 20 deletions packages/utils/src/hash.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export * from "./promise";
export * from "./sleep";
export * from "./iterable";
export * from "./area";
export * from "./hash";
export * from "./worker";
export * from "./pack";
export * from "./CoordMap";
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 52182f7

Please sign in to comment.