@pyratzlabs/react-fhevm-utils 3.2.0 → 3.2.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/dist/client/hooks/useFinalizeUnwrap.d.ts +1 -1
- package/dist/client/hooks/useFinalizeUnwrap.js +2 -2
- package/dist/client/hooks/usePerformTransaction.d.ts +20 -0
- package/dist/client/hooks/usePerformTransaction.js +2 -1
- package/dist/client/hooks/useUnwrap.d.ts +20 -0
- package/dist/client/hooks/useUnwrap.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ interface Props {
|
|
|
3
3
|
wrapper: Address;
|
|
4
4
|
}
|
|
5
5
|
export declare const useFinalizeUnwrap: ({ wrapper }: Props) => {
|
|
6
|
-
|
|
6
|
+
finalizeUnwrap: (requestId: bigint, unwrapStartedAmounts: Address[], clearValues: Address, decryptionProof: Address) => void;
|
|
7
7
|
isFailed: boolean;
|
|
8
8
|
isLoading: boolean;
|
|
9
9
|
isSuccess: boolean;
|
|
@@ -8,12 +8,12 @@ export const useFinalizeUnwrap = ({ wrapper }) => {
|
|
|
8
8
|
address: wrapper,
|
|
9
9
|
functionName: "finalizeUnwrap",
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const finalizeUnwrap = (requestId, unwrapStartedAmounts, clearValues, decryptionProof) => {
|
|
12
12
|
if (!address)
|
|
13
13
|
throw new Error("UNWRAP: User is not connected");
|
|
14
14
|
perform({
|
|
15
15
|
args: [requestId, unwrapStartedAmounts, [clearValues, decryptionProof]],
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
return {
|
|
18
|
+
return { finalizeUnwrap, isFailed, isLoading, isSuccess };
|
|
19
19
|
};
|
|
@@ -5,6 +5,26 @@ interface Props<TAbi extends Abi, TFunction extends ContractFunctionName<TAbi, "
|
|
|
5
5
|
functionName: TFunction;
|
|
6
6
|
}
|
|
7
7
|
export declare const usePerformTransaction: <TAbi extends Abi, TFunction extends ContractFunctionName<TAbi, "nonpayable" | "payable">>({ abi, address, functionName, }: Props<TAbi, TFunction>) => {
|
|
8
|
+
data: {
|
|
9
|
+
blobGasPrice?: bigint | undefined;
|
|
10
|
+
blobGasUsed?: bigint | undefined;
|
|
11
|
+
blockHash: import("viem").Hash;
|
|
12
|
+
blockNumber: bigint;
|
|
13
|
+
contractAddress: Address | null | undefined;
|
|
14
|
+
cumulativeGasUsed: bigint;
|
|
15
|
+
effectiveGasPrice: bigint;
|
|
16
|
+
from: Address;
|
|
17
|
+
gasUsed: bigint;
|
|
18
|
+
logs: import("viem").Log<bigint, number, false>[];
|
|
19
|
+
logsBloom: import("viem").Hex;
|
|
20
|
+
root?: `0x${string}` | undefined;
|
|
21
|
+
status: "success" | "reverted";
|
|
22
|
+
to: Address | null;
|
|
23
|
+
transactionHash: import("viem").Hash;
|
|
24
|
+
transactionIndex: number;
|
|
25
|
+
type: import("viem").TransactionType;
|
|
26
|
+
chainId: number;
|
|
27
|
+
} | undefined;
|
|
8
28
|
error: import("@wagmi/core").WriteContractErrorType | null;
|
|
9
29
|
isSuccess: boolean;
|
|
10
30
|
isLoading: boolean;
|
|
@@ -12,7 +12,7 @@ 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();
|
|
15
|
-
const { isSuccess, isLoading, isError } = useWaitForTransactionReceipt({
|
|
15
|
+
const { data, isSuccess, isLoading, isError } = useWaitForTransactionReceipt({
|
|
16
16
|
hash: writeContractData,
|
|
17
17
|
});
|
|
18
18
|
const perform = (_a) => __awaiter(void 0, [_a], void 0, function* ({ args, value, }) {
|
|
@@ -31,6 +31,7 @@ export const usePerformTransaction = ({ abi, address, functionName, }) => {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
return {
|
|
34
|
+
data,
|
|
34
35
|
error,
|
|
35
36
|
isSuccess,
|
|
36
37
|
isLoading,
|
|
@@ -3,6 +3,26 @@ interface Props {
|
|
|
3
3
|
encryptedErc20: Address;
|
|
4
4
|
}
|
|
5
5
|
export declare const useUnwrap: ({ encryptedErc20 }: Props) => {
|
|
6
|
+
unwrapData: {
|
|
7
|
+
blobGasPrice?: bigint | undefined;
|
|
8
|
+
blobGasUsed?: bigint | undefined;
|
|
9
|
+
blockHash: import("viem").Hash;
|
|
10
|
+
blockNumber: bigint;
|
|
11
|
+
contractAddress: Address | null | undefined;
|
|
12
|
+
cumulativeGasUsed: bigint;
|
|
13
|
+
effectiveGasPrice: bigint;
|
|
14
|
+
from: Address;
|
|
15
|
+
gasUsed: bigint;
|
|
16
|
+
logs: import("viem").Log<bigint, number, false>[];
|
|
17
|
+
logsBloom: import("viem").Hex;
|
|
18
|
+
root?: `0x${string}` | undefined;
|
|
19
|
+
status: "success" | "reverted";
|
|
20
|
+
to: Address | null;
|
|
21
|
+
transactionHash: import("viem").Hash;
|
|
22
|
+
transactionIndex: number;
|
|
23
|
+
type: import("viem").TransactionType;
|
|
24
|
+
chainId: number;
|
|
25
|
+
} | undefined;
|
|
6
26
|
unwrap: (wrapperAddress: Address, handles: Uint8Array[], inputProof: Uint8Array) => void;
|
|
7
27
|
isFailed: boolean;
|
|
8
28
|
isLoading: boolean;
|
|
@@ -5,7 +5,7 @@ import { toHexString } from "../../utils/string.utils";
|
|
|
5
5
|
import { useAccount } from "wagmi";
|
|
6
6
|
export const useUnwrap = ({ encryptedErc20 }) => {
|
|
7
7
|
const { address } = useAccount();
|
|
8
|
-
const { perform, isFailed, isLoading, isSuccess } = usePerformTransaction({
|
|
8
|
+
const { data, perform, isFailed, isLoading, isSuccess } = usePerformTransaction({
|
|
9
9
|
abi: encryptedABI,
|
|
10
10
|
address: encryptedErc20,
|
|
11
11
|
functionName: "confidentialTransferAndCall",
|
|
@@ -20,5 +20,5 @@ export const useUnwrap = ({ encryptedErc20 }) => {
|
|
|
20
20
|
args: [wrapperAddress, handle, proof, data],
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
|
-
return { unwrap, isFailed, isLoading, isSuccess };
|
|
23
|
+
return { unwrapData: data, unwrap, isFailed, isLoading, isSuccess };
|
|
24
24
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export { useUnwrap } from "./client/hooks/useUnwrap";
|
|
|
8
8
|
export { useEncryptedBatchTransfer } from "./client/hooks/useEncryptedBatchTransfer";
|
|
9
9
|
export { useSetOperator } from "./client/hooks/useSetOperator";
|
|
10
10
|
export { usePublicDecrypt } from "./client/hooks/usePublicDecrypt";
|
|
11
|
+
export { useFinalizeUnwrap } from "./client/hooks/useFinalizeUnwrap";
|
|
11
12
|
export { type FhevmConfig } from "./types/fhevmConfig";
|
package/dist/index.js
CHANGED
|
@@ -10,3 +10,4 @@ export { useUnwrap } from "./client/hooks/useUnwrap";
|
|
|
10
10
|
export { useEncryptedBatchTransfer } from "./client/hooks/useEncryptedBatchTransfer";
|
|
11
11
|
export { useSetOperator } from "./client/hooks/useSetOperator";
|
|
12
12
|
export { usePublicDecrypt } from "./client/hooks/usePublicDecrypt";
|
|
13
|
+
export { useFinalizeUnwrap } from "./client/hooks/useFinalizeUnwrap";
|