@pyratzlabs/react-fhevm-utils 3.2.3 → 3.3.0

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.
@@ -1,6 +1,8 @@
1
1
  import { usePerformTransaction } from "./usePerformTransaction";
2
2
  import { TRANSFER_BATCHER_ABI } from "../../types/ABI/TransferBatcher.abi";
3
+ import { useAccount } from "wagmi";
3
4
  export const useEncryptedBatchTransfer = ({ batcherAddress }) => {
5
+ const { address } = useAccount();
4
6
  const { perform, isLoading, isFailed, isSuccess, error } = usePerformTransaction({
5
7
  abi: TRANSFER_BATCHER_ABI,
6
8
  address: batcherAddress,
@@ -9,8 +11,10 @@ export const useEncryptedBatchTransfer = ({ batcherAddress }) => {
9
11
  const batchTransfer = (tokenAddress, batchTransferData, fees) => {
10
12
  if (!fees)
11
13
  throw new Error("BATCH TRANSFER: Fees must be provided");
14
+ if (!address)
15
+ throw new Error("BATCH TRANSFER: User address is not available");
12
16
  perform({
13
- args: [tokenAddress, batchTransferData],
17
+ args: [tokenAddress, address, batchTransferData],
14
18
  value: fees,
15
19
  });
16
20
  };
@@ -3,7 +3,7 @@ interface Props {
3
3
  wrapper: Address;
4
4
  }
5
5
  export declare const useFinalizeUnwrap: ({ wrapper }: Props) => {
6
- finalizeUnwrap: (requestId: bigint, unwrapStartedAmounts: Address[], clearValues: Address, decryptionProof: Address) => void;
6
+ finalizeUnwrap: (requestId: bigint, clearValues: Address, decryptionProof: Address) => void;
7
7
  isFailed: boolean;
8
8
  isLoading: boolean;
9
9
  isSuccess: boolean;
@@ -8,11 +8,11 @@ export const useFinalizeUnwrap = ({ wrapper }) => {
8
8
  address: wrapper,
9
9
  functionName: "finalizeUnwrap",
10
10
  });
11
- const finalizeUnwrap = (requestId, unwrapStartedAmounts, clearValues, decryptionProof) => {
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: [requestId, unwrapStartedAmounts, [clearValues, decryptionProof]],
15
+ args: [requestId, clearValues, decryptionProof],
16
16
  });
17
17
  };
18
18
  return { finalizeUnwrap, isFailed, isLoading, isSuccess };
@@ -15,7 +15,7 @@ export const useUnwrap = ({ encryptedErc20 }) => {
15
15
  throw new Error("UNWRAP: User is not connected");
16
16
  const handle = toHexString(handles[0]);
17
17
  const proof = toHexString(inputProof);
18
- const data = encodeAbiParameters([{ type: "address" }, { type: "bytes" }], [address, "0x"]);
18
+ const data = encodeAbiParameters([{ type: "address" }, { type: "address" }, { type: "bytes" }], [address, address, "0x"]);
19
19
  perform({
20
20
  args: [wrapperAddress, handle, proof, data],
21
21
  });
@@ -6,6 +6,18 @@ export declare const TRANSFER_BATCHER_ABI: readonly [{
6
6
  }];
7
7
  readonly stateMutability: "nonpayable";
8
8
  readonly type: "constructor";
9
+ }, {
10
+ readonly inputs: readonly [{
11
+ readonly internalType: "address";
12
+ readonly name: "holder";
13
+ readonly type: "address";
14
+ }, {
15
+ readonly internalType: "address";
16
+ readonly name: "spender";
17
+ readonly type: "address";
18
+ }];
19
+ readonly name: "ERC7984UnauthorizedSpender";
20
+ readonly type: "error";
9
21
  }, {
10
22
  readonly inputs: readonly [];
11
23
  readonly name: "EmptyTransferArray";
@@ -22,6 +34,10 @@ export declare const TRANSFER_BATCHER_ABI: readonly [{
22
34
  readonly inputs: readonly [];
23
35
  readonly name: "OnlyOriginalSenderCanRetry";
24
36
  readonly type: "error";
37
+ }, {
38
+ readonly inputs: readonly [];
39
+ readonly name: "ZamaProtocolUnsupported";
40
+ readonly type: "error";
25
41
  }, {
26
42
  readonly anonymous: false;
27
43
  readonly inputs: readonly [{
@@ -92,6 +108,10 @@ export declare const TRANSFER_BATCHER_ABI: readonly [{
92
108
  readonly internalType: "contract RegulatedERC7984Upgradeable";
93
109
  readonly name: "cToken";
94
110
  readonly type: "address";
111
+ }, {
112
+ readonly internalType: "address";
113
+ readonly name: "from";
114
+ readonly type: "address";
95
115
  }, {
96
116
  readonly components: readonly [{
97
117
  readonly internalType: "address";
@@ -120,7 +140,7 @@ export declare const TRANSFER_BATCHER_ABI: readonly [{
120
140
  readonly type: "function";
121
141
  }, {
122
142
  readonly inputs: readonly [];
123
- readonly name: "protocolId";
143
+ readonly name: "confidentialProtocolId";
124
144
  readonly outputs: readonly [{
125
145
  readonly internalType: "uint256";
126
146
  readonly name: "";
@@ -10,6 +10,22 @@ export const TRANSFER_BATCHER_ABI = [
10
10
  stateMutability: "nonpayable",
11
11
  type: "constructor",
12
12
  },
13
+ {
14
+ inputs: [
15
+ {
16
+ internalType: "address",
17
+ name: "holder",
18
+ type: "address",
19
+ },
20
+ {
21
+ internalType: "address",
22
+ name: "spender",
23
+ type: "address",
24
+ },
25
+ ],
26
+ name: "ERC7984UnauthorizedSpender",
27
+ type: "error",
28
+ },
13
29
  {
14
30
  inputs: [],
15
31
  name: "EmptyTransferArray",
@@ -30,6 +46,11 @@ export const TRANSFER_BATCHER_ABI = [
30
46
  name: "OnlyOriginalSenderCanRetry",
31
47
  type: "error",
32
48
  },
49
+ {
50
+ inputs: [],
51
+ name: "ZamaProtocolUnsupported",
52
+ type: "error",
53
+ },
33
54
  {
34
55
  anonymous: false,
35
56
  inputs: [
@@ -118,6 +139,11 @@ export const TRANSFER_BATCHER_ABI = [
118
139
  name: "cToken",
119
140
  type: "address",
120
141
  },
142
+ {
143
+ internalType: "address",
144
+ name: "from",
145
+ type: "address",
146
+ },
121
147
  {
122
148
  components: [
123
149
  {
@@ -153,7 +179,7 @@ export const TRANSFER_BATCHER_ABI = [
153
179
  },
154
180
  {
155
181
  inputs: [],
156
- name: "protocolId",
182
+ name: "confidentialProtocolId",
157
183
  outputs: [
158
184
  {
159
185
  internalType: "uint256",