@pyratzlabs/react-fhevm-utils 3.3.1 → 3.4.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.
@@ -23,7 +23,7 @@ export declare const useUnwrap: ({ encryptedErc20 }: Props) => {
23
23
  type: import("viem").TransactionType;
24
24
  chainId: number;
25
25
  } | undefined;
26
- unwrap: (wrapperAddress: Address, handles: Uint8Array[], inputProof: Uint8Array) => void;
26
+ unwrap: (handles: Uint8Array[], inputProof: Uint8Array) => void;
27
27
  isFailed: boolean;
28
28
  isLoading: boolean;
29
29
  isSuccess: boolean;
@@ -1,23 +1,21 @@
1
- import { encryptedABI } from "../../types/ABI/encryptedABI";
2
- import { encodeAbiParameters } from "viem";
3
1
  import { usePerformTransaction } from "./usePerformTransaction";
4
2
  import { toHexString } from "../../utils/string.utils";
5
3
  import { useAccount } from "./useAccount";
4
+ import { WRAPPER_ABI } from "../../types/ABI/Wrapper.abi";
6
5
  export const useUnwrap = ({ encryptedErc20 }) => {
7
6
  const { address } = useAccount();
8
7
  const { data, perform, isFailed, isLoading, isSuccess } = usePerformTransaction({
9
- abi: encryptedABI,
8
+ abi: WRAPPER_ABI,
10
9
  address: encryptedErc20,
11
- functionName: "confidentialTransferAndCall",
10
+ functionName: "unwrap",
12
11
  });
13
- const unwrap = (wrapperAddress, handles, inputProof) => {
12
+ const unwrap = (handles, inputProof) => {
14
13
  if (!address)
15
14
  throw new Error("UNWRAP: User is not connected");
16
15
  const handle = toHexString(handles[0]);
17
16
  const proof = toHexString(inputProof);
18
- const data = encodeAbiParameters([{ type: "address" }, { type: "address" }, { type: "bytes" }], [address, address, "0x"]);
19
17
  perform({
20
- args: [wrapperAddress, handle, proof, data],
18
+ args: [address, address, handle, proof],
21
19
  });
22
20
  };
23
21
  return { unwrapData: data, unwrap, isFailed, isLoading, isSuccess };