To bring zero knowledge privacy primitives to all web3 developers.
This code is unaudited and under construction. This is experimental software and is provided on an "as is" and "as available" basis and may not work at all. This code is not fit for human or AI consumption and should not be used in production.
pnpm install
pnpm test
pnpm build
pnpm wallet
// Get the standard ethers contract
const token = await ethers.Contract(address, abi, signer);
const account = Account.create(token, "password123");
await account.loginWithEthersSigner(signer);
expect(account.isLoggedIn()).toBe(true);
// Generate proof that shields 1 token
// Call the deposit method on the contract which will
// call `transferFrom` to spend 1 of your ERC-20 tokens and
// commit the transaction. If the transfer fails the transaction will fail
const shieldProof = await account.proveShield(1e18);
await token.deposit(shieldProof);
// Generate proof that sends 0.5 tokens to toAddress
const transferProof = await account.proveTransfer(5e17, receiver);
// Call the transfer method on the contract which will
// verify and commit the transaction
await token.transfer(transferProof);
// Generate proof that burns 0.5 tokens to the receiver address
const unshieldProof = await account.proveUnshield(5e17, receiver);
// Call the withdraw method on the contract which will
// call `transferFrom` to return 0.5 of your ERC-20 tokens to your public account
await token.withdraw(unshieldProof);
Generated using TypeDoc