@pyratzlabs/react-fhevm-utils 3.2.2 → 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.
- package/dist/client/hooks/useEncryptedBatchTransfer.d.ts +1 -0
- package/dist/client/hooks/useEncryptedBatchTransfer.js +5 -1
- package/dist/client/hooks/useFinalizeUnwrap.d.ts +1 -1
- package/dist/client/hooks/useFinalizeUnwrap.js +2 -2
- package/dist/client/hooks/useUnwrap.js +1 -1
- package/dist/types/ABI/TransferBatcher.abi.d.ts +111 -5
- package/dist/types/ABI/TransferBatcher.abi.js +141 -5
- package/dist/types/ABI/Wrapper.abi.d.ts +575 -20
- package/dist/types/ABI/Wrapper.abi.js +745 -30
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ interface BatchTransferData {
|
|
|
6
6
|
to: Address;
|
|
7
7
|
encryptedAmount: Address;
|
|
8
8
|
inputProof: Address;
|
|
9
|
+
retryFor: bigint;
|
|
9
10
|
}
|
|
10
11
|
export declare const useEncryptedBatchTransfer: ({ batcherAddress }: Props) => {
|
|
11
12
|
batchTransfer: (tokenAddress: Address, batchTransferData: BatchTransferData[], fees?: bigint) => void;
|
|
@@ -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,
|
|
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,
|
|
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,
|
|
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
|
});
|
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
export declare const TRANSFER_BATCHER_ABI: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "contract AdminProvider";
|
|
4
|
+
readonly name: "adminProvider_";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}];
|
|
7
|
+
readonly stateMutability: "nonpayable";
|
|
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";
|
|
21
|
+
}, {
|
|
22
|
+
readonly inputs: readonly [];
|
|
23
|
+
readonly name: "EmptyTransferArray";
|
|
24
|
+
readonly type: "error";
|
|
25
|
+
}, {
|
|
26
|
+
readonly inputs: readonly [];
|
|
27
|
+
readonly name: "FeeTransferFailed";
|
|
28
|
+
readonly type: "error";
|
|
29
|
+
}, {
|
|
30
|
+
readonly inputs: readonly [];
|
|
31
|
+
readonly name: "InsufficientFee";
|
|
32
|
+
readonly type: "error";
|
|
33
|
+
}, {
|
|
34
|
+
readonly inputs: readonly [];
|
|
35
|
+
readonly name: "OnlyOriginalSenderCanRetry";
|
|
36
|
+
readonly type: "error";
|
|
37
|
+
}, {
|
|
38
|
+
readonly inputs: readonly [];
|
|
39
|
+
readonly name: "ZamaProtocolUnsupported";
|
|
40
|
+
readonly type: "error";
|
|
41
|
+
}, {
|
|
2
42
|
readonly anonymous: false;
|
|
3
43
|
readonly inputs: readonly [{
|
|
4
|
-
readonly indexed:
|
|
44
|
+
readonly indexed: true;
|
|
5
45
|
readonly internalType: "address";
|
|
6
46
|
readonly name: "cToken";
|
|
7
47
|
readonly type: "address";
|
|
8
48
|
}, {
|
|
9
|
-
readonly indexed:
|
|
49
|
+
readonly indexed: true;
|
|
10
50
|
readonly internalType: "address";
|
|
11
51
|
readonly name: "sender";
|
|
12
52
|
readonly type: "address";
|
|
@@ -20,14 +60,58 @@ export declare const TRANSFER_BATCHER_ABI: readonly [{
|
|
|
20
60
|
readonly internalType: "uint256";
|
|
21
61
|
readonly name: "endTxId";
|
|
22
62
|
readonly type: "uint256";
|
|
63
|
+
}, {
|
|
64
|
+
readonly indexed: false;
|
|
65
|
+
readonly internalType: "uint256";
|
|
66
|
+
readonly name: "fee";
|
|
67
|
+
readonly type: "uint256";
|
|
23
68
|
}];
|
|
24
69
|
readonly name: "BatchTransfer";
|
|
25
70
|
readonly type: "event";
|
|
71
|
+
}, {
|
|
72
|
+
readonly anonymous: false;
|
|
73
|
+
readonly inputs: readonly [{
|
|
74
|
+
readonly indexed: true;
|
|
75
|
+
readonly internalType: "address";
|
|
76
|
+
readonly name: "cToken";
|
|
77
|
+
readonly type: "address";
|
|
78
|
+
}, {
|
|
79
|
+
readonly indexed: true;
|
|
80
|
+
readonly internalType: "address";
|
|
81
|
+
readonly name: "sender";
|
|
82
|
+
readonly type: "address";
|
|
83
|
+
}, {
|
|
84
|
+
readonly indexed: false;
|
|
85
|
+
readonly internalType: "uint256";
|
|
86
|
+
readonly name: "originalTxId";
|
|
87
|
+
readonly type: "uint256";
|
|
88
|
+
}, {
|
|
89
|
+
readonly indexed: false;
|
|
90
|
+
readonly internalType: "uint256";
|
|
91
|
+
readonly name: "retryTxId";
|
|
92
|
+
readonly type: "uint256";
|
|
93
|
+
}];
|
|
94
|
+
readonly name: "RetryTransfer";
|
|
95
|
+
readonly type: "event";
|
|
96
|
+
}, {
|
|
97
|
+
readonly inputs: readonly [];
|
|
98
|
+
readonly name: "adminProvider";
|
|
99
|
+
readonly outputs: readonly [{
|
|
100
|
+
readonly internalType: "contract AdminProvider";
|
|
101
|
+
readonly name: "";
|
|
102
|
+
readonly type: "address";
|
|
103
|
+
}];
|
|
104
|
+
readonly stateMutability: "view";
|
|
105
|
+
readonly type: "function";
|
|
26
106
|
}, {
|
|
27
107
|
readonly inputs: readonly [{
|
|
28
108
|
readonly internalType: "contract RegulatedERC7984Upgradeable";
|
|
29
109
|
readonly name: "cToken";
|
|
30
110
|
readonly type: "address";
|
|
111
|
+
}, {
|
|
112
|
+
readonly internalType: "address";
|
|
113
|
+
readonly name: "from";
|
|
114
|
+
readonly type: "address";
|
|
31
115
|
}, {
|
|
32
116
|
readonly components: readonly [{
|
|
33
117
|
readonly internalType: "address";
|
|
@@ -41,6 +125,10 @@ export declare const TRANSFER_BATCHER_ABI: readonly [{
|
|
|
41
125
|
readonly internalType: "bytes";
|
|
42
126
|
readonly name: "inputProof";
|
|
43
127
|
readonly type: "bytes";
|
|
128
|
+
}, {
|
|
129
|
+
readonly internalType: "uint256";
|
|
130
|
+
readonly name: "retryFor";
|
|
131
|
+
readonly type: "uint256";
|
|
44
132
|
}];
|
|
45
133
|
readonly internalType: "struct ERC7984TransferBatcher.ConfidentialTransferInput[]";
|
|
46
134
|
readonly name: "transfers";
|
|
@@ -48,16 +136,34 @@ export declare const TRANSFER_BATCHER_ABI: readonly [{
|
|
|
48
136
|
}];
|
|
49
137
|
readonly name: "confidentialBatchTransfer";
|
|
50
138
|
readonly outputs: readonly [];
|
|
51
|
-
readonly stateMutability: "
|
|
139
|
+
readonly stateMutability: "payable";
|
|
52
140
|
readonly type: "function";
|
|
53
141
|
}, {
|
|
54
142
|
readonly inputs: readonly [];
|
|
55
|
-
readonly name: "
|
|
143
|
+
readonly name: "confidentialProtocolId";
|
|
56
144
|
readonly outputs: readonly [{
|
|
57
145
|
readonly internalType: "uint256";
|
|
58
146
|
readonly name: "";
|
|
59
147
|
readonly type: "uint256";
|
|
60
148
|
}];
|
|
61
|
-
readonly stateMutability: "
|
|
149
|
+
readonly stateMutability: "view";
|
|
150
|
+
readonly type: "function";
|
|
151
|
+
}, {
|
|
152
|
+
readonly inputs: readonly [{
|
|
153
|
+
readonly internalType: "address";
|
|
154
|
+
readonly name: "cToken";
|
|
155
|
+
readonly type: "address";
|
|
156
|
+
}, {
|
|
157
|
+
readonly internalType: "uint256";
|
|
158
|
+
readonly name: "txId";
|
|
159
|
+
readonly type: "uint256";
|
|
160
|
+
}];
|
|
161
|
+
readonly name: "txIdToSender";
|
|
162
|
+
readonly outputs: readonly [{
|
|
163
|
+
readonly internalType: "address";
|
|
164
|
+
readonly name: "sender";
|
|
165
|
+
readonly type: "address";
|
|
166
|
+
}];
|
|
167
|
+
readonly stateMutability: "view";
|
|
62
168
|
readonly type: "function";
|
|
63
169
|
}];
|
|
@@ -1,15 +1,67 @@
|
|
|
1
1
|
export const TRANSFER_BATCHER_ABI = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [
|
|
4
|
+
{
|
|
5
|
+
internalType: "contract AdminProvider",
|
|
6
|
+
name: "adminProvider_",
|
|
7
|
+
type: "address",
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
stateMutability: "nonpayable",
|
|
11
|
+
type: "constructor",
|
|
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
|
+
},
|
|
29
|
+
{
|
|
30
|
+
inputs: [],
|
|
31
|
+
name: "EmptyTransferArray",
|
|
32
|
+
type: "error",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
inputs: [],
|
|
36
|
+
name: "FeeTransferFailed",
|
|
37
|
+
type: "error",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
inputs: [],
|
|
41
|
+
name: "InsufficientFee",
|
|
42
|
+
type: "error",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
inputs: [],
|
|
46
|
+
name: "OnlyOriginalSenderCanRetry",
|
|
47
|
+
type: "error",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
inputs: [],
|
|
51
|
+
name: "ZamaProtocolUnsupported",
|
|
52
|
+
type: "error",
|
|
53
|
+
},
|
|
2
54
|
{
|
|
3
55
|
anonymous: false,
|
|
4
56
|
inputs: [
|
|
5
57
|
{
|
|
6
|
-
indexed:
|
|
58
|
+
indexed: true,
|
|
7
59
|
internalType: "address",
|
|
8
60
|
name: "cToken",
|
|
9
61
|
type: "address",
|
|
10
62
|
},
|
|
11
63
|
{
|
|
12
|
-
indexed:
|
|
64
|
+
indexed: true,
|
|
13
65
|
internalType: "address",
|
|
14
66
|
name: "sender",
|
|
15
67
|
type: "address",
|
|
@@ -26,10 +78,60 @@ export const TRANSFER_BATCHER_ABI = [
|
|
|
26
78
|
name: "endTxId",
|
|
27
79
|
type: "uint256",
|
|
28
80
|
},
|
|
81
|
+
{
|
|
82
|
+
indexed: false,
|
|
83
|
+
internalType: "uint256",
|
|
84
|
+
name: "fee",
|
|
85
|
+
type: "uint256",
|
|
86
|
+
},
|
|
29
87
|
],
|
|
30
88
|
name: "BatchTransfer",
|
|
31
89
|
type: "event",
|
|
32
90
|
},
|
|
91
|
+
{
|
|
92
|
+
anonymous: false,
|
|
93
|
+
inputs: [
|
|
94
|
+
{
|
|
95
|
+
indexed: true,
|
|
96
|
+
internalType: "address",
|
|
97
|
+
name: "cToken",
|
|
98
|
+
type: "address",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
indexed: true,
|
|
102
|
+
internalType: "address",
|
|
103
|
+
name: "sender",
|
|
104
|
+
type: "address",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
indexed: false,
|
|
108
|
+
internalType: "uint256",
|
|
109
|
+
name: "originalTxId",
|
|
110
|
+
type: "uint256",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
indexed: false,
|
|
114
|
+
internalType: "uint256",
|
|
115
|
+
name: "retryTxId",
|
|
116
|
+
type: "uint256",
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
name: "RetryTransfer",
|
|
120
|
+
type: "event",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
inputs: [],
|
|
124
|
+
name: "adminProvider",
|
|
125
|
+
outputs: [
|
|
126
|
+
{
|
|
127
|
+
internalType: "contract AdminProvider",
|
|
128
|
+
name: "",
|
|
129
|
+
type: "address",
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
stateMutability: "view",
|
|
133
|
+
type: "function",
|
|
134
|
+
},
|
|
33
135
|
{
|
|
34
136
|
inputs: [
|
|
35
137
|
{
|
|
@@ -37,6 +139,11 @@ export const TRANSFER_BATCHER_ABI = [
|
|
|
37
139
|
name: "cToken",
|
|
38
140
|
type: "address",
|
|
39
141
|
},
|
|
142
|
+
{
|
|
143
|
+
internalType: "address",
|
|
144
|
+
name: "from",
|
|
145
|
+
type: "address",
|
|
146
|
+
},
|
|
40
147
|
{
|
|
41
148
|
components: [
|
|
42
149
|
{
|
|
@@ -54,6 +161,11 @@ export const TRANSFER_BATCHER_ABI = [
|
|
|
54
161
|
name: "inputProof",
|
|
55
162
|
type: "bytes",
|
|
56
163
|
},
|
|
164
|
+
{
|
|
165
|
+
internalType: "uint256",
|
|
166
|
+
name: "retryFor",
|
|
167
|
+
type: "uint256",
|
|
168
|
+
},
|
|
57
169
|
],
|
|
58
170
|
internalType: "struct ERC7984TransferBatcher.ConfidentialTransferInput[]",
|
|
59
171
|
name: "transfers",
|
|
@@ -62,12 +174,12 @@ export const TRANSFER_BATCHER_ABI = [
|
|
|
62
174
|
],
|
|
63
175
|
name: "confidentialBatchTransfer",
|
|
64
176
|
outputs: [],
|
|
65
|
-
stateMutability: "
|
|
177
|
+
stateMutability: "payable",
|
|
66
178
|
type: "function",
|
|
67
179
|
},
|
|
68
180
|
{
|
|
69
181
|
inputs: [],
|
|
70
|
-
name: "
|
|
182
|
+
name: "confidentialProtocolId",
|
|
71
183
|
outputs: [
|
|
72
184
|
{
|
|
73
185
|
internalType: "uint256",
|
|
@@ -75,7 +187,31 @@ export const TRANSFER_BATCHER_ABI = [
|
|
|
75
187
|
type: "uint256",
|
|
76
188
|
},
|
|
77
189
|
],
|
|
78
|
-
stateMutability: "
|
|
190
|
+
stateMutability: "view",
|
|
191
|
+
type: "function",
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
inputs: [
|
|
195
|
+
{
|
|
196
|
+
internalType: "address",
|
|
197
|
+
name: "cToken",
|
|
198
|
+
type: "address",
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
internalType: "uint256",
|
|
202
|
+
name: "txId",
|
|
203
|
+
type: "uint256",
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
name: "txIdToSender",
|
|
207
|
+
outputs: [
|
|
208
|
+
{
|
|
209
|
+
internalType: "address",
|
|
210
|
+
name: "sender",
|
|
211
|
+
type: "address",
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
stateMutability: "view",
|
|
79
215
|
type: "function",
|
|
80
216
|
},
|
|
81
217
|
];
|