@pyratzlabs/react-fhevm-utils 2.1.0 → 2.2.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.
@@ -0,0 +1,17 @@
1
+ import { Address } from "viem";
2
+ interface Props {
3
+ batcherAddress: Address;
4
+ }
5
+ interface BatchTransferData {
6
+ to: Address;
7
+ encryptedAmount: Address;
8
+ inputProof: Address;
9
+ }
10
+ export declare const useEncryptedBatchTransfer: ({ batcherAddress }: Props) => {
11
+ batchTransfer: (tokenAddress: Address, batchTransferData: BatchTransferData[]) => void;
12
+ isLoading: boolean;
13
+ isFailed: boolean;
14
+ isSuccess: boolean;
15
+ error: import("@wagmi/core").WriteContractErrorType | null;
16
+ };
17
+ export {};
@@ -0,0 +1,21 @@
1
+ import { usePerformTransaction } from "./usePerformTransaction";
2
+ import { TRANSFER_BATCHER_ABI } from "../../types/ABI/TransferBatcher.abi";
3
+ export const useEncryptedBatchTransfer = ({ batcherAddress }) => {
4
+ const { perform, isLoading, isFailed, isSuccess, error } = usePerformTransaction({
5
+ abi: TRANSFER_BATCHER_ABI,
6
+ address: batcherAddress,
7
+ functionName: "confidentialBatchTransfer",
8
+ });
9
+ const batchTransfer = (tokenAddress, batchTransferData) => {
10
+ perform({
11
+ args: [tokenAddress, batchTransferData],
12
+ });
13
+ };
14
+ return {
15
+ batchTransfer,
16
+ isLoading,
17
+ isFailed,
18
+ isSuccess,
19
+ error,
20
+ };
21
+ };
package/dist/index.d.ts CHANGED
@@ -5,4 +5,5 @@ export { useGetEncryptedBalance } from "./client/hooks/useGetEncryptedBalance";
5
5
  export { useEncryptedTransfer } from "./client/hooks/useEncryptedTransfer";
6
6
  export { useEncryptValue } from "./client/hooks/useEncryptValue";
7
7
  export { useUnwrap } from "./client/hooks/useUnwrap";
8
+ export { useEncryptedBatchTransfer } from "./client/hooks/useEncryptedBatchTransfer";
8
9
  export { type FhevmConfig } from "./types/fhevmConfig";
package/dist/index.js CHANGED
@@ -7,3 +7,4 @@ export { useGetEncryptedBalance } from "./client/hooks/useGetEncryptedBalance";
7
7
  export { useEncryptedTransfer } from "./client/hooks/useEncryptedTransfer";
8
8
  export { useEncryptValue } from "./client/hooks/useEncryptValue";
9
9
  export { useUnwrap } from "./client/hooks/useUnwrap";
10
+ export { useEncryptedBatchTransfer } from "./client/hooks/useEncryptedBatchTransfer";
@@ -0,0 +1,63 @@
1
+ export declare const TRANSFER_BATCHER_ABI: readonly [{
2
+ readonly anonymous: false;
3
+ readonly inputs: readonly [{
4
+ readonly indexed: false;
5
+ readonly internalType: "address";
6
+ readonly name: "cToken";
7
+ readonly type: "address";
8
+ }, {
9
+ readonly indexed: false;
10
+ readonly internalType: "address";
11
+ readonly name: "sender";
12
+ readonly type: "address";
13
+ }, {
14
+ readonly indexed: false;
15
+ readonly internalType: "uint256";
16
+ readonly name: "startTxId";
17
+ readonly type: "uint256";
18
+ }, {
19
+ readonly indexed: false;
20
+ readonly internalType: "uint256";
21
+ readonly name: "endTxId";
22
+ readonly type: "uint256";
23
+ }];
24
+ readonly name: "BatchTransfer";
25
+ readonly type: "event";
26
+ }, {
27
+ readonly inputs: readonly [{
28
+ readonly internalType: "contract RegulatedERC7984Upgradeable";
29
+ readonly name: "cToken";
30
+ readonly type: "address";
31
+ }, {
32
+ readonly components: readonly [{
33
+ readonly internalType: "address";
34
+ readonly name: "to";
35
+ readonly type: "address";
36
+ }, {
37
+ readonly internalType: "externalEuint64";
38
+ readonly name: "encryptedAmount";
39
+ readonly type: "bytes32";
40
+ }, {
41
+ readonly internalType: "bytes";
42
+ readonly name: "inputProof";
43
+ readonly type: "bytes";
44
+ }];
45
+ readonly internalType: "struct ERC7984TransferBatcher.ConfidentialTransferInput[]";
46
+ readonly name: "transfers";
47
+ readonly type: "tuple[]";
48
+ }];
49
+ readonly name: "confidentialBatchTransfer";
50
+ readonly outputs: readonly [];
51
+ readonly stateMutability: "nonpayable";
52
+ readonly type: "function";
53
+ }, {
54
+ readonly inputs: readonly [];
55
+ readonly name: "protocolId";
56
+ readonly outputs: readonly [{
57
+ readonly internalType: "uint256";
58
+ readonly name: "";
59
+ readonly type: "uint256";
60
+ }];
61
+ readonly stateMutability: "pure";
62
+ readonly type: "function";
63
+ }];
@@ -0,0 +1,81 @@
1
+ export const TRANSFER_BATCHER_ABI = [
2
+ {
3
+ anonymous: false,
4
+ inputs: [
5
+ {
6
+ indexed: false,
7
+ internalType: "address",
8
+ name: "cToken",
9
+ type: "address",
10
+ },
11
+ {
12
+ indexed: false,
13
+ internalType: "address",
14
+ name: "sender",
15
+ type: "address",
16
+ },
17
+ {
18
+ indexed: false,
19
+ internalType: "uint256",
20
+ name: "startTxId",
21
+ type: "uint256",
22
+ },
23
+ {
24
+ indexed: false,
25
+ internalType: "uint256",
26
+ name: "endTxId",
27
+ type: "uint256",
28
+ },
29
+ ],
30
+ name: "BatchTransfer",
31
+ type: "event",
32
+ },
33
+ {
34
+ inputs: [
35
+ {
36
+ internalType: "contract RegulatedERC7984Upgradeable",
37
+ name: "cToken",
38
+ type: "address",
39
+ },
40
+ {
41
+ components: [
42
+ {
43
+ internalType: "address",
44
+ name: "to",
45
+ type: "address",
46
+ },
47
+ {
48
+ internalType: "externalEuint64",
49
+ name: "encryptedAmount",
50
+ type: "bytes32",
51
+ },
52
+ {
53
+ internalType: "bytes",
54
+ name: "inputProof",
55
+ type: "bytes",
56
+ },
57
+ ],
58
+ internalType: "struct ERC7984TransferBatcher.ConfidentialTransferInput[]",
59
+ name: "transfers",
60
+ type: "tuple[]",
61
+ },
62
+ ],
63
+ name: "confidentialBatchTransfer",
64
+ outputs: [],
65
+ stateMutability: "nonpayable",
66
+ type: "function",
67
+ },
68
+ {
69
+ inputs: [],
70
+ name: "protocolId",
71
+ outputs: [
72
+ {
73
+ internalType: "uint256",
74
+ name: "",
75
+ type: "uint256",
76
+ },
77
+ ],
78
+ stateMutability: "pure",
79
+ type: "function",
80
+ },
81
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyratzlabs/react-fhevm-utils",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "React hooks and utilities for Fhevmjs",
5
5
  "main": "dist/index.js",
6
6
  "files": [