Skip to content

Commit 8f9feb6

Browse files
yancy1012Stumble
andauthored
fix: import error (#8)
Co-authored-by: Yumin Xia <me@yumin-xia.com>
1 parent abb7142 commit 8f9feb6

5 files changed

Lines changed: 5 additions & 7 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ yarn-error.log*
3636
# Misc
3737
.DS_Store
3838
*.pem
39+
40+
.idea

packages/sdk/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
"ethers": "^6.12.1",
8484
"ffjavascript": "^0.2.63",
8585
"idb-keyval": "^6.2.1",
86-
"js-sha3": "^0.8.0",
8786
"node-fetch": "^2.7.0",
8887
"snarkjs": "^0.7.4"
8988
}

packages/sdk/src/crypto/hash.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { keccak256 } from "js-sha3";
1+
import { keccak256, toUtf8Bytes } from "ethers";
22

33
import { poseidon, BigInter } from "@/crypto/babyzk/deps";
44
import { Result, Err, Ok, encase } from "@/errors";
@@ -89,7 +89,7 @@ function poseidonBytesX(msg: Uint8Array, frameSize: number): Result<bigint> {
8989
* @returns a bigint, uint256 hash result.
9090
*/
9191
export const keccak256Str = (s: string): Result<bigint> => {
92-
return Ok(BigInt("0x" + keccak256(s)));
92+
return Ok(BigInt(keccak256(toUtf8Bytes(s))));
9393
};
9494

9595
const bytesBEtoBigInt = (bytes: Uint8Array): bigint => {

packages/sdk/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const COMMON_CONFIG: MandatoryOptions = {
3535
// ESM config
3636
const ESM_CONFIG: MandatoryOptions = {
3737
...DEFAULT_CONFIG,
38-
entry: ["src/**/*.ts", "!src/**/*.test.*", "!src/testutils"], // Include all files but tests, better tree-shaking
38+
entry: ["src/index.ts", "!src/**/*.test.*", "!src/testutils"], // Include all files but tests, better tree-shaking
3939
format: "esm",
4040
outDir: "dist/esm",
4141
platform: "browser",

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)