Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: import error #8

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading