Skip to content

Commit 52a8d1d

Browse files
authored
fix: issue with decrypt patched (#40)
1 parent 35cee0f commit 52a8d1d

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

packages/erc7984example/app/layout.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ export const metadata = getMetadata({
1313
const DappWrapper = ({ children }: { children: React.ReactNode }) => {
1414
return (
1515
<html suppressHydrationWarning className={``}>
16-
<head>
17-
<link href="https://api.fontshare.com/v2/css?f[]=telegraf@400,500,700&display=swap" rel="stylesheet" />
18-
</head>
16+
<head></head>
1917
<body suppressHydrationWarning>
20-
<Script src="https://cdn.zama.org/relayer-sdk-js/0.4.0-2/relayer-sdk-js.umd.cjs" strategy="beforeInteractive" />
18+
<Script src="https://cdn.zama.org/relayer-sdk-js/0.4.0-4/relayer-sdk-js.umd.cjs" strategy="beforeInteractive" />
2119
<ThemeProvider enableSystem>
2220
<DappWrapperWithProviders>{children}</DappWrapperWithProviders>
2321
</ThemeProvider>

packages/erc7984example/contracts/deployedContracts.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { GenericContractsDeclaration } from "~~/utils/helper/contract";
77
const deployedContracts = {
88
31337: {
99
Airdrop: {
10-
address: "0xaa79c20a43C74bD77c392Ca0e71E032FeF2C908A",
10+
address: "0x380ee13b0039852314fFF513821729B052D06a71",
1111
abi: [
1212
{
1313
inputs: [],
@@ -188,10 +188,10 @@ const deployedContracts = {
188188
renounceOwnership: "@openzeppelin/contracts/access/Ownable.sol",
189189
transferOwnership: "@openzeppelin/contracts/access/Ownable.sol",
190190
},
191-
deployedOnBlock: 9,
191+
deployedOnBlock: 4,
192192
},
193193
ERC7984Example: {
194-
address: "0xab9E69656210f333c3164A86372d013C646bf0eC",
194+
address: "0xc1b7223f08F52fbfA263c27674AE577911c3b20e",
195195
abi: [
196196
{
197197
inputs: [
@@ -1053,7 +1053,7 @@ const deployedContracts = {
10531053
renounceOwnership: "@openzeppelin/contracts/access/Ownable2Step.sol",
10541054
transferOwnership: "@openzeppelin/contracts/access/Ownable2Step.sol",
10551055
},
1056-
deployedOnBlock: 8,
1056+
deployedOnBlock: 3,
10571057
},
10581058
},
10591059
11155111: {

packages/erc7984example/hooks/erc7984/useERC7984Wagmi.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ export const useERC7984Wagmi = (parameters: {
6363
abi: (hasContract ? ((erc7984 as ERC7984Info).abi as any) : undefined) as any,
6464
functionName: "confidentialBalanceOf" as const,
6565
args: [address as `0x${string}`],
66+
chainId: chainId,
6667
query: {
67-
enabled: Boolean(hasContract && hasProvider && address),
68+
enabled: Boolean(hasContract && hasProvider && address && chainId),
6869
refetchOnWindowFocus: false,
6970
},
7071
});
@@ -89,6 +90,7 @@ export const useERC7984Wagmi = (parameters: {
8990
isDecrypting,
9091
message: decMsg,
9192
results,
93+
error: decryptError,
9294
} = useFHEDecrypt({
9395
instance,
9496
ethersSigner: ethersSigner as any,
@@ -101,6 +103,14 @@ export const useERC7984Wagmi = (parameters: {
101103
if (decMsg) setMessage(decMsg);
102104
}, [decMsg]);
103105

106+
// Log decryption errors for debugging
107+
useEffect(() => {
108+
if (decryptError) {
109+
console.error("[useERC7984Wagmi] Decryption error:", decryptError);
110+
setMessage(`Decryption error: ${decryptError}`);
111+
}
112+
}, [decryptError]);
113+
104114
const clearBalance = useMemo(() => {
105115
if (!balanceHandle) return undefined;
106116
if (balanceHandle === ethers.ZeroHash) return { handle: balanceHandle, clear: BigInt(0) } as const;
@@ -189,6 +199,7 @@ export const useERC7984Wagmi = (parameters: {
189199
isDecrypting,
190200
isRefreshing,
191201
isProcessing,
202+
decryptError,
192203
// Wagmi-specific values
193204
chainId,
194205
accounts,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./.next/types/routes.d.ts";
3+
import "./.next/dev/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

0 commit comments

Comments
 (0)