Skip to content

Commit

Permalink
fix import #93
Browse files Browse the repository at this point in the history
  • Loading branch information
KlonD90 committed Jul 17, 2024
1 parent e15e3dc commit 4185c19
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clever-stingrays-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nilfoundation/niljs": patch
---

fix for tsx use default
14 changes: 13 additions & 1 deletion src/encoding/poseidon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
import { poseidon } from "@iden3/js-crypto";
import * as pkg from "@iden3/js-crypto";
let poseidon: typeof pkg.poseidon;
if (
"default" in pkg &&
typeof pkg.default === "object" &&
pkg.default !== null &&
"poseidon" in pkg.default &&
typeof pkg.default.poseidon === "function"
) {
poseidon = pkg.default.poseidon as typeof pkg.poseidon;
} else {
poseidon = pkg.poseidon;
}

/**
* Creates the Poseidon hash of the given bytes.
Expand Down

0 comments on commit 4185c19

Please sign in to comment.