@pyratzlabs/react-fhevm-utils 3.4.3 → 3.4.5
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/dist/client/hooks/useFinalizeUnwrap.d.ts +2 -2
- package/dist/client/hooks/useFinalizeUnwrap.js +3 -3
- package/dist/client/hooks/usePerformTransaction.d.ts +1 -1
- package/dist/client/hooks/usePerformTransaction.js +9 -14
- package/dist/types/ABI/Wrapper.abi.d.ts +485 -237
- package/dist/types/ABI/Wrapper.abi.js +632 -311
- package/package.json +2 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Address } from "viem";
|
|
2
2
|
interface Props {
|
|
3
3
|
wrapper: Address;
|
|
4
4
|
}
|
|
5
5
|
export declare const useFinalizeUnwrap: ({ wrapper }: Props) => {
|
|
6
|
-
finalizeUnwrap: (
|
|
6
|
+
finalizeUnwrap: (requestId: bigint, clearValues: Address, decryptionProof: Address) => void;
|
|
7
7
|
isFailed: boolean;
|
|
8
8
|
isLoading: boolean;
|
|
9
9
|
isSuccess: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { usePerformTransaction } from "./usePerformTransaction";
|
|
1
2
|
import { WRAPPER_ABI } from "../../types/ABI/Wrapper.abi";
|
|
2
3
|
import { useAccount } from "./useAccount";
|
|
3
|
-
import { usePerformTransaction } from "./usePerformTransaction";
|
|
4
4
|
export const useFinalizeUnwrap = ({ wrapper }) => {
|
|
5
5
|
const { address } = useAccount();
|
|
6
6
|
const { perform, isFailed, isLoading, isSuccess } = usePerformTransaction({
|
|
@@ -8,11 +8,11 @@ export const useFinalizeUnwrap = ({ wrapper }) => {
|
|
|
8
8
|
address: wrapper,
|
|
9
9
|
functionName: "finalizeUnwrap",
|
|
10
10
|
});
|
|
11
|
-
const finalizeUnwrap = (
|
|
11
|
+
const finalizeUnwrap = (requestId, clearValues, decryptionProof) => {
|
|
12
12
|
if (!address)
|
|
13
13
|
throw new Error("UNWRAP: User is not connected");
|
|
14
14
|
perform({
|
|
15
|
-
args: [
|
|
15
|
+
args: [requestId, clearValues, decryptionProof],
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
return { finalizeUnwrap, isFailed, isLoading, isSuccess };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Abi, Address, ContractFunctionArgs, ContractFunctionName } from "viem";
|
|
2
2
|
interface Props<TAbi extends Abi, TFunction extends ContractFunctionName<TAbi, "nonpayable" | "payable">> {
|
|
3
3
|
abi: TAbi;
|
|
4
4
|
address: Address;
|
|
@@ -7,8 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { simulateContract } from "@wagmi/core";
|
|
11
10
|
import { useConfig, useWaitForTransactionReceipt, useWriteContract, } from "wagmi";
|
|
11
|
+
import { simulateContract } from "@wagmi/core";
|
|
12
12
|
export const usePerformTransaction = ({ abi, address, functionName, }) => {
|
|
13
13
|
const config = useConfig();
|
|
14
14
|
const { writeContract, data: writeContractData, isError: isWriteError, error, } = useWriteContract();
|
|
@@ -16,19 +16,14 @@ export const usePerformTransaction = ({ abi, address, functionName, }) => {
|
|
|
16
16
|
hash: writeContractData,
|
|
17
17
|
});
|
|
18
18
|
const perform = (_a) => __awaiter(void 0, [_a], void 0, function* ({ args, value, }) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
writeContract(result.request);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
throw new Error(`Simulation failed: ${error}`);
|
|
31
|
-
}
|
|
19
|
+
const result = yield simulateContract(config, {
|
|
20
|
+
address,
|
|
21
|
+
abi: abi,
|
|
22
|
+
functionName,
|
|
23
|
+
value,
|
|
24
|
+
args: args,
|
|
25
|
+
});
|
|
26
|
+
writeContract(result.request);
|
|
32
27
|
});
|
|
33
28
|
return {
|
|
34
29
|
data,
|