Skip to content

Commit

Permalink
fix: import error (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: Yumin Xia <[email protected]>
  • Loading branch information
yancy1012 and Stumble committed Jul 2, 2024
1 parent abb7142 commit 8f9feb6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ yarn-error.log*
# Misc
.DS_Store
*.pem

.idea
1 change: 0 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"ethers": "^6.12.1",
"ffjavascript": "^0.2.63",
"idb-keyval": "^6.2.1",
"js-sha3": "^0.8.0",
"node-fetch": "^2.7.0",
"snarkjs": "^0.7.4"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/crypto/hash.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { keccak256 } from "js-sha3";
import { keccak256, toUtf8Bytes } from "ethers";

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

const bytesBEtoBigInt = (bytes: Uint8Array): bigint => {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const COMMON_CONFIG: MandatoryOptions = {
// ESM config
const ESM_CONFIG: MandatoryOptions = {
...DEFAULT_CONFIG,
entry: ["src/**/*.ts", "!src/**/*.test.*", "!src/testutils"], // Include all files but tests, better tree-shaking
entry: ["src/index.ts", "!src/**/*.test.*", "!src/testutils"], // Include all files but tests, better tree-shaking
format: "esm",
outDir: "dist/esm",
platform: "browser",
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 8f9feb6

Please sign in to comment.