@zama-fhe/react-sdk 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +28 -0
- package/README.md +990 -0
- package/dist/chunk-463DUSLG.js +1005 -0
- package/dist/chunk-463DUSLG.js.map +1 -0
- package/dist/ethers/index.d.ts +142 -0
- package/dist/ethers/index.js +173 -0
- package/dist/ethers/index.js.map +1 -0
- package/dist/index.d.ts +1082 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/use-approve-underlying-DAkxWhfm.d.ts +784 -0
- package/dist/viem/index.d.ts +142 -0
- package/dist/viem/index.js +173 -0
- package/dist/viem/index.js.map +1 -0
- package/dist/wagmi/index.d.ts +7139 -0
- package/dist/wagmi/index.js +280 -0
- package/dist/wagmi/index.js.map +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { useActivityFeed, useApproveUnderlying, useAuthorizeAll, useConfidentialApprove, useConfidentialBalance, useConfidentialBalances, useConfidentialTransferFrom, useResumeUnshield, useTokenMetadata, useUnshield, useUnshieldAll, useUnwrapAll } from '../chunk-463DUSLG.js';
|
|
3
|
+
import { useQuery, useSuspenseQuery, useMutation } from '@tanstack/react-query';
|
|
4
|
+
import { readConfidentialBalanceOfContract, writeConfidentialTransferContract, writeConfidentialBatchTransferContract, writeUnwrapContract, writeUnwrapFromBalanceContract, writeFinalizeUnwrapContract, writeSetOperatorContract, readWrapperForTokenContract, readUnderlyingTokenContract, writeWrapContract, writeWrapETHContract, readWrapperExistsContract, readSupportsInterfaceContract } from '@zama-fhe/sdk/ethers';
|
|
5
|
+
export { EthersSigner } from '@zama-fhe/sdk/ethers';
|
|
6
|
+
|
|
7
|
+
function useConfidentialBalanceOf(config) {
|
|
8
|
+
const { provider, tokenAddress, userAddress } = config;
|
|
9
|
+
const enabled = !!tokenAddress && !!userAddress;
|
|
10
|
+
return useQuery({
|
|
11
|
+
queryKey: ["confidentialBalanceOf", provider, tokenAddress, userAddress],
|
|
12
|
+
queryFn: () => readConfidentialBalanceOfContract(provider, tokenAddress, userAddress),
|
|
13
|
+
enabled
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function useConfidentialBalanceOfSuspense(config) {
|
|
17
|
+
const { provider, tokenAddress, userAddress } = config;
|
|
18
|
+
return useSuspenseQuery({
|
|
19
|
+
queryKey: ["confidentialBalanceOf", provider, tokenAddress, userAddress],
|
|
20
|
+
queryFn: () => readConfidentialBalanceOfContract(provider, tokenAddress, userAddress)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function useConfidentialTransfer() {
|
|
24
|
+
return useMutation({
|
|
25
|
+
mutationFn: (params) => writeConfidentialTransferContract(
|
|
26
|
+
params.signer,
|
|
27
|
+
params.tokenAddress,
|
|
28
|
+
params.to,
|
|
29
|
+
params.handle,
|
|
30
|
+
params.inputProof
|
|
31
|
+
)
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function useConfidentialBatchTransfer() {
|
|
35
|
+
return useMutation({
|
|
36
|
+
mutationFn: (params) => writeConfidentialBatchTransferContract(
|
|
37
|
+
params.signer,
|
|
38
|
+
params.batcherAddress,
|
|
39
|
+
params.tokenAddress,
|
|
40
|
+
params.fromAddress,
|
|
41
|
+
params.batchTransferData,
|
|
42
|
+
params.fees
|
|
43
|
+
)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function useUnwrap() {
|
|
47
|
+
return useMutation({
|
|
48
|
+
mutationFn: (params) => writeUnwrapContract(
|
|
49
|
+
params.signer,
|
|
50
|
+
params.encryptedErc20,
|
|
51
|
+
params.from,
|
|
52
|
+
params.to,
|
|
53
|
+
params.encryptedAmount,
|
|
54
|
+
params.inputProof
|
|
55
|
+
)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function useUnwrapFromBalance() {
|
|
59
|
+
return useMutation({
|
|
60
|
+
mutationFn: (params) => writeUnwrapFromBalanceContract(
|
|
61
|
+
params.signer,
|
|
62
|
+
params.encryptedErc20,
|
|
63
|
+
params.from,
|
|
64
|
+
params.to,
|
|
65
|
+
params.encryptedBalance
|
|
66
|
+
)
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function useFinalizeUnwrap() {
|
|
70
|
+
return useMutation({
|
|
71
|
+
mutationFn: (params) => writeFinalizeUnwrapContract(
|
|
72
|
+
params.signer,
|
|
73
|
+
params.wrapper,
|
|
74
|
+
params.burntAmount,
|
|
75
|
+
params.burntAmountCleartext,
|
|
76
|
+
params.decryptionProof
|
|
77
|
+
)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function useSetOperator() {
|
|
81
|
+
return useMutation({
|
|
82
|
+
mutationFn: (params) => writeSetOperatorContract(
|
|
83
|
+
params.signer,
|
|
84
|
+
params.tokenAddress,
|
|
85
|
+
params.spender,
|
|
86
|
+
params.timestamp
|
|
87
|
+
)
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function useWrapperForToken(config) {
|
|
91
|
+
const { provider, coordinator, tokenAddress } = config;
|
|
92
|
+
const enabled = !!coordinator && !!tokenAddress;
|
|
93
|
+
return useQuery({
|
|
94
|
+
queryKey: ["wrapperForToken", provider, coordinator, tokenAddress],
|
|
95
|
+
queryFn: () => readWrapperForTokenContract(provider, coordinator, tokenAddress),
|
|
96
|
+
enabled
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function useWrapperForTokenSuspense(config) {
|
|
100
|
+
const { provider, coordinator, tokenAddress } = config;
|
|
101
|
+
return useSuspenseQuery({
|
|
102
|
+
queryKey: ["wrapperForToken", provider, coordinator, tokenAddress],
|
|
103
|
+
queryFn: () => readWrapperForTokenContract(provider, coordinator, tokenAddress)
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function useUnderlyingToken(config) {
|
|
107
|
+
const { provider, wrapperAddress } = config;
|
|
108
|
+
const enabled = !!wrapperAddress;
|
|
109
|
+
return useQuery({
|
|
110
|
+
queryKey: ["underlyingToken", provider, wrapperAddress],
|
|
111
|
+
queryFn: () => readUnderlyingTokenContract(provider, wrapperAddress),
|
|
112
|
+
enabled
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function useUnderlyingTokenSuspense(config) {
|
|
116
|
+
const { provider, wrapperAddress } = config;
|
|
117
|
+
return useSuspenseQuery({
|
|
118
|
+
queryKey: ["underlyingToken", provider, wrapperAddress],
|
|
119
|
+
queryFn: () => readUnderlyingTokenContract(provider, wrapperAddress)
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function useShield() {
|
|
123
|
+
return useMutation({
|
|
124
|
+
mutationFn: (params) => writeWrapContract(params.signer, params.wrapperAddress, params.to, params.amount)
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function useShieldETH() {
|
|
128
|
+
return useMutation({
|
|
129
|
+
mutationFn: (params) => writeWrapETHContract(
|
|
130
|
+
params.signer,
|
|
131
|
+
params.wrapperAddress,
|
|
132
|
+
params.to,
|
|
133
|
+
params.amount,
|
|
134
|
+
params.value
|
|
135
|
+
)
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function useWrapperExists(config) {
|
|
139
|
+
const { provider, coordinator, tokenAddress } = config;
|
|
140
|
+
const enabled = !!coordinator && !!tokenAddress;
|
|
141
|
+
return useQuery({
|
|
142
|
+
queryKey: ["wrapperExists", provider, coordinator, tokenAddress],
|
|
143
|
+
queryFn: () => readWrapperExistsContract(provider, coordinator, tokenAddress),
|
|
144
|
+
enabled
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function useWrapperExistsSuspense(config) {
|
|
148
|
+
const { provider, coordinator, tokenAddress } = config;
|
|
149
|
+
return useSuspenseQuery({
|
|
150
|
+
queryKey: ["wrapperExists", provider, coordinator, tokenAddress],
|
|
151
|
+
queryFn: () => readWrapperExistsContract(provider, coordinator, tokenAddress)
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function useSupportsInterface(config) {
|
|
155
|
+
const { provider, tokenAddress, interfaceId } = config;
|
|
156
|
+
const enabled = !!tokenAddress && !!interfaceId;
|
|
157
|
+
return useQuery({
|
|
158
|
+
queryKey: ["supportsInterface", provider, tokenAddress, interfaceId],
|
|
159
|
+
queryFn: () => readSupportsInterfaceContract(provider, tokenAddress, interfaceId),
|
|
160
|
+
enabled
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function useSupportsInterfaceSuspense(config) {
|
|
164
|
+
const { provider, tokenAddress, interfaceId } = config;
|
|
165
|
+
return useSuspenseQuery({
|
|
166
|
+
queryKey: ["supportsInterface", provider, tokenAddress, interfaceId],
|
|
167
|
+
queryFn: () => readSupportsInterfaceContract(provider, tokenAddress, interfaceId)
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { useConfidentialBalanceOf, useConfidentialBalanceOfSuspense, useConfidentialBatchTransfer, useConfidentialTransfer, useFinalizeUnwrap, useSetOperator, useShield, useShieldETH, useSupportsInterface, useSupportsInterfaceSuspense, useUnderlyingToken, useUnderlyingTokenSuspense, useUnwrap, useUnwrapFromBalance, useWrapperExists, useWrapperExistsSuspense, useWrapperForToken, useWrapperForTokenSuspense };
|
|
172
|
+
//# sourceMappingURL=index.js.map
|
|
173
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ethers/use-confidential-balance-of.ts","../../src/ethers/use-confidential-transfer.ts","../../src/ethers/use-confidential-batch-transfer.ts","../../src/ethers/use-unwrap.ts","../../src/ethers/use-unwrap-from-balance.ts","../../src/ethers/use-finalize-unwrap.ts","../../src/ethers/use-set-operator.ts","../../src/ethers/use-wrapper-for-token.ts","../../src/ethers/use-underlying-token.ts","../../src/ethers/use-wrap.ts","../../src/ethers/use-wrap-eth.ts","../../src/ethers/use-wrapper-exists.ts","../../src/ethers/use-supports-interface.ts"],"names":["useMutation","useQu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jBO,SAAS,qBAAqB,MAAA,EAAoC;AACvE,EAAA,MAAM,EAAE,QAAA,EAAU,YAAA,EAAc,WAAA,EAAY,GAAI,MAAA;AAChD,EAAA,MAAM,OAAA,GAAU,CAAC,CAAC,YAAA,IAAgB,CAAC,CAAC,WAAA;AACpC,EAAA,OAAOD,QAAAA,CAAS;AAAA,IACd,QAAA,EAAU,CAAC,mBAAA,EAAqB,QAAA,EAAU,cAAc,WAAW,CAAA;AAAA,IACnE,OAAA,EAAS,MACP,6BAAA,CAA8B,QAAA,EAAU,cAAyB,WAAsB,CAAA;AAAA,IACzF;AAAA,GACD,CAAA;AACH;AAEO,SAAS,6BAA6B,MAAA,EAA4C;AACvF,EAAA,MAAM,EAAE,QAAA,EAAU,YAAA,EAAc,WAAA,EAAY,GAAI,MAAA;AAChD,EAAA,OAAOC,gBAAAA,CAAiB;AAAA,IACtB,QAAA,EAAU,CAAC,mBAAA,EAAqB,QAAA,EAAU,cAAc,WAAW,CAAA;AAAA,IACnE,OAAA,EAAS,MAAM,6BAAA,CAA8B,QAAA,EAAU,cAAc,WAAW;AAAA,GACjF,CAAA;AACH","file":"index.js","sourcesContent":["\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Provider, Signer } from \"ethers\";\nimport { readConfidentialBalanceOfContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface UseConfidentialBalanceOfConfig {\n provider: Provider | Signer;\n tokenAddress: Address | undefined;\n userAddress: Address | undefined;\n}\n\nexport interface UseConfidentialBalanceOfSuspenseConfig {\n provider: Provider | Signer;\n tokenAddress: Address;\n userAddress: Address;\n}\n\nexport function useConfidentialBalanceOf(config: UseConfidentialBalanceOfConfig) {\n const { provider, tokenAddress, userAddress } = config;\n const enabled = !!tokenAddress && !!userAddress;\n return useQuery({\n queryKey: [\"confidentialBalanceOf\", provider, tokenAddress, userAddress],\n queryFn: () =>\n readConfidentialBalanceOfContract(provider, tokenAddress as Address, userAddress as Address),\n enabled,\n });\n}\n\nexport function useConfidentialBalanceOfSuspense(config: UseConfidentialBalanceOfSuspenseConfig) {\n const { provider, tokenAddress, userAddress } = config;\n return useSuspenseQuery({\n queryKey: [\"confidentialBalanceOf\", provider, tokenAddress, userAddress],\n queryFn: () => readConfidentialBalanceOfContract(provider, tokenAddress, userAddress),\n });\n}\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Signer } from \"ethers\";\nimport { writeConfidentialTransferContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface ConfidentialTransferParams {\n signer: Signer;\n tokenAddress: Address;\n to: Address;\n handle: Uint8Array;\n inputProof: Uint8Array;\n}\nexport function useConfidentialTransfer() {\n return useMutation<\n Awaited<ReturnType<typeof writeConfidentialTransferContract>>,\n Error,\n ConfidentialTransferParams\n >({\n mutationFn: (params) =>\n writeConfidentialTransferContract(\n params.signer,\n params.tokenAddress,\n params.to,\n params.handle,\n params.inputProof,\n ),\n });\n}\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, BatchTransferData } from \"@zama-fhe/sdk\";\nimport type { Signer } from \"ethers\";\nimport { writeConfidentialBatchTransferContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface ConfidentialBatchTransferParams {\n signer: Signer;\n batcherAddress: Address;\n tokenAddress: Address;\n fromAddress: Address;\n batchTransferData: BatchTransferData[];\n fees: bigint;\n}\nexport function useConfidentialBatchTransfer() {\n return useMutation<\n Awaited<ReturnType<typeof writeConfidentialBatchTransferContract>>,\n Error,\n ConfidentialBatchTransferParams\n >({\n mutationFn: (params) =>\n writeConfidentialBatchTransferContract(\n params.signer,\n params.batcherAddress,\n params.tokenAddress,\n params.fromAddress,\n params.batchTransferData,\n params.fees,\n ),\n });\n}\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Signer } from \"ethers\";\nimport { writeUnwrapContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface UnwrapParams {\n signer: Signer;\n encryptedErc20: Address;\n from: Address;\n to: Address;\n encryptedAmount: Uint8Array;\n inputProof: Uint8Array;\n}\nexport function useUnwrap() {\n return useMutation<Awaited<ReturnType<typeof writeUnwrapContract>>, Error, UnwrapParams>({\n mutationFn: (params) =>\n writeUnwrapContract(\n params.signer,\n params.encryptedErc20,\n params.from,\n params.to,\n params.encryptedAmount,\n params.inputProof,\n ),\n });\n}\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Signer } from \"ethers\";\nimport { writeUnwrapFromBalanceContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface UnwrapFromBalanceParams {\n signer: Signer;\n encryptedErc20: Address;\n from: Address;\n to: Address;\n encryptedBalance: Address;\n}\nexport function useUnwrapFromBalance() {\n return useMutation<\n Awaited<ReturnType<typeof writeUnwrapFromBalanceContract>>,\n Error,\n UnwrapFromBalanceParams\n >({\n mutationFn: (params) =>\n writeUnwrapFromBalanceContract(\n params.signer,\n params.encryptedErc20,\n params.from,\n params.to,\n params.encryptedBalance,\n ),\n });\n}\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Signer } from \"ethers\";\nimport { writeFinalizeUnwrapContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface FinalizeUnwrapParams {\n signer: Signer;\n wrapper: Address;\n burntAmount: Address;\n burntAmountCleartext: bigint;\n decryptionProof: Address;\n}\nexport function useFinalizeUnwrap() {\n return useMutation<\n Awaited<ReturnType<typeof writeFinalizeUnwrapContract>>,\n Error,\n FinalizeUnwrapParams\n >({\n mutationFn: (params) =>\n writeFinalizeUnwrapContract(\n params.signer,\n params.wrapper,\n params.burntAmount,\n params.burntAmountCleartext,\n params.decryptionProof,\n ),\n });\n}\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Signer } from \"ethers\";\nimport { writeSetOperatorContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface SetOperatorParams {\n signer: Signer;\n tokenAddress: Address;\n spender: Address;\n timestamp?: number;\n}\nexport function useSetOperator() {\n return useMutation<\n Awaited<ReturnType<typeof writeSetOperatorContract>>,\n Error,\n SetOperatorParams\n >({\n mutationFn: (params) =>\n writeSetOperatorContract(\n params.signer,\n params.tokenAddress,\n params.spender,\n params.timestamp,\n ),\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Provider, Signer } from \"ethers\";\nimport { readWrapperForTokenContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface UseWrapperForZamaConfig {\n provider: Provider | Signer;\n coordinator: Address | undefined;\n tokenAddress: Address | undefined;\n}\n\nexport interface UseWrapperForTokenSuspenseConfig {\n provider: Provider | Signer;\n coordinator: Address;\n tokenAddress: Address;\n}\n\nexport function useWrapperForToken(config: UseWrapperForZamaConfig) {\n const { provider, coordinator, tokenAddress } = config;\n const enabled = !!coordinator && !!tokenAddress;\n return useQuery({\n queryKey: [\"wrapperForToken\", provider, coordinator, tokenAddress],\n queryFn: () =>\n readWrapperForTokenContract(provider, coordinator as Address, tokenAddress as Address),\n enabled,\n });\n}\n\nexport function useWrapperForTokenSuspense(config: UseWrapperForTokenSuspenseConfig) {\n const { provider, coordinator, tokenAddress } = config;\n return useSuspenseQuery({\n queryKey: [\"wrapperForToken\", provider, coordinator, tokenAddress],\n queryFn: () => readWrapperForTokenContract(provider, coordinator, tokenAddress),\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Provider, Signer } from \"ethers\";\nimport { readUnderlyingTokenContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface UseUnderlyingZamaConfig {\n provider: Provider | Signer;\n wrapperAddress: Address | undefined;\n}\n\nexport interface UseUnderlyingTokenSuspenseConfig {\n provider: Provider | Signer;\n wrapperAddress: Address;\n}\n\nexport function useUnderlyingToken(config: UseUnderlyingZamaConfig) {\n const { provider, wrapperAddress } = config;\n const enabled = !!wrapperAddress;\n return useQuery({\n queryKey: [\"underlyingToken\", provider, wrapperAddress],\n queryFn: () => readUnderlyingTokenContract(provider, wrapperAddress as Address),\n enabled,\n });\n}\n\nexport function useUnderlyingTokenSuspense(config: UseUnderlyingTokenSuspenseConfig) {\n const { provider, wrapperAddress } = config;\n return useSuspenseQuery({\n queryKey: [\"underlyingToken\", provider, wrapperAddress],\n queryFn: () => readUnderlyingTokenContract(provider, wrapperAddress),\n });\n}\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Signer } from \"ethers\";\nimport { writeWrapContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface ShieldParams {\n signer: Signer;\n wrapperAddress: Address;\n to: Address;\n amount: bigint;\n}\nexport function useShield() {\n return useMutation<Awaited<ReturnType<typeof writeWrapContract>>, Error, ShieldParams>({\n mutationFn: (params) =>\n writeWrapContract(params.signer, params.wrapperAddress, params.to, params.amount),\n });\n}\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Signer } from \"ethers\";\nimport { writeWrapETHContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface ShieldETHParams {\n signer: Signer;\n wrapperAddress: Address;\n to: Address;\n amount: bigint;\n value: bigint;\n}\nexport function useShieldETH() {\n return useMutation<Awaited<ReturnType<typeof writeWrapETHContract>>, Error, ShieldETHParams>({\n mutationFn: (params) =>\n writeWrapETHContract(\n params.signer,\n params.wrapperAddress,\n params.to,\n params.amount,\n params.value,\n ),\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Provider, Signer } from \"ethers\";\nimport { readWrapperExistsContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface UseWrapperExistsConfig {\n provider: Provider | Signer;\n coordinator: Address | undefined;\n tokenAddress: Address | undefined;\n}\n\nexport interface UseWrapperExistsSuspenseConfig {\n provider: Provider | Signer;\n coordinator: Address;\n tokenAddress: Address;\n}\n\nexport function useWrapperExists(config: UseWrapperExistsConfig) {\n const { provider, coordinator, tokenAddress } = config;\n const enabled = !!coordinator && !!tokenAddress;\n return useQuery({\n queryKey: [\"wrapperExists\", provider, coordinator, tokenAddress],\n queryFn: () =>\n readWrapperExistsContract(provider, coordinator as Address, tokenAddress as Address),\n enabled,\n });\n}\n\nexport function useWrapperExistsSuspense(config: UseWrapperExistsSuspenseConfig) {\n const { provider, coordinator, tokenAddress } = config;\n return useSuspenseQuery({\n queryKey: [\"wrapperExists\", provider, coordinator, tokenAddress],\n queryFn: () => readWrapperExistsContract(provider, coordinator, tokenAddress),\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport type { Provider, Signer } from \"ethers\";\nimport { readSupportsInterfaceContract } from \"@zama-fhe/sdk/ethers\";\n\nexport interface UseSupportsInterfaceConfig {\n provider: Provider | Signer;\n tokenAddress: Address | undefined;\n interfaceId: Address | undefined;\n}\n\nexport interface UseSupportsInterfaceSuspenseConfig {\n provider: Provider | Signer;\n tokenAddress: Address;\n interfaceId: Address;\n}\n\nexport function useSupportsInterface(config: UseSupportsInterfaceConfig) {\n const { provider, tokenAddress, interfaceId } = config;\n const enabled = !!tokenAddress && !!interfaceId;\n return useQuery({\n queryKey: [\"supportsInterface\", provider, tokenAddress, interfaceId],\n queryFn: () =>\n readSupportsInterfaceContract(provider, tokenAddress as Address, interfaceId as Address),\n enabled,\n });\n}\n\nexport function useSupportsInterfaceSuspense(config: UseSupportsInterfaceSuspenseConfig) {\n const { provider, tokenAddress, interfaceId } = config;\n return useSuspenseQuery({\n queryKey: [\"supportsInterface\", provider, tokenAddress, interfaceId],\n queryFn: () => readSupportsInterfaceContract(provider, tokenAddress, interfaceId),\n });\n}\n"]}
|