Unshield tokens
Convert confidential tokens back to public ERC-20 by unshielding them.
Steps
1. Unshield a specific amount
import { createConfig } from "@zama-fhe/sdk/viem";
import { ZamaSDK } from "@zama-fhe/sdk";
import { web } from "@zama-fhe/sdk/web";
import { sepolia } from "@zama-fhe/sdk/chains";
const config = createConfig({
chains: [sepolia],
publicClient,
walletClient,
storage,
relayers: { [sepolia.id]: web() },
});
const sdk = new ZamaSDK(config);
const wrappedToken = sdk.createWrappedToken("0xWrappedEncryptedERC20");
const { txHash, receipt } = await wrappedToken.unshield(500n);2. Track progress with callbacks
3. Unshield your entire balance
4. Handle interrupted unshields
5. Use unshield hooks in React
Next steps
Last updated