@gitmyabi/vault 1.0.5 → 1.0.7
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/README.md +5 -5
- package/contracts/ERC1967Proxy_json.d.ts +144 -0
- package/contracts/ERC1967Proxy_json.js +180 -0
- package/contracts/ERC1967Proxy_json.ts +209 -0
- package/contracts/Vault_json.d.ts +1069 -129
- package/contracts/Vault_json.js +1008 -126
- package/contracts/Vault_json.ts +1421 -210
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +4 -1
- package/contracts/index.ts +2 -0
- package/package.json +3 -3
package/contracts/Vault_json.js
CHANGED
|
@@ -9,57 +9,165 @@ const viem_1 = require("viem");
|
|
|
9
9
|
*/
|
|
10
10
|
exports.Vault_jsonAbi = [
|
|
11
11
|
{
|
|
12
|
+
"inputs": [],
|
|
13
|
+
"stateMutability": "nonpayable",
|
|
14
|
+
"type": "constructor"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"anonymous": false,
|
|
18
|
+
"inputs": [
|
|
19
|
+
{
|
|
20
|
+
"indexed": false,
|
|
21
|
+
"internalType": "address",
|
|
22
|
+
"name": "previousAdmin",
|
|
23
|
+
"type": "address"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"indexed": false,
|
|
27
|
+
"internalType": "address",
|
|
28
|
+
"name": "newAdmin",
|
|
29
|
+
"type": "address"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"name": "AdminChanged",
|
|
33
|
+
"type": "event"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"anonymous": false,
|
|
37
|
+
"inputs": [
|
|
38
|
+
{
|
|
39
|
+
"indexed": true,
|
|
40
|
+
"internalType": "address",
|
|
41
|
+
"name": "beacon",
|
|
42
|
+
"type": "address"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"name": "BeaconUpgraded",
|
|
46
|
+
"type": "event"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"anonymous": false,
|
|
50
|
+
"inputs": [
|
|
51
|
+
{
|
|
52
|
+
"indexed": false,
|
|
53
|
+
"internalType": "uint8",
|
|
54
|
+
"name": "version",
|
|
55
|
+
"type": "uint8"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"name": "Initialized",
|
|
59
|
+
"type": "event"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"anonymous": false,
|
|
63
|
+
"inputs": [
|
|
64
|
+
{
|
|
65
|
+
"indexed": true,
|
|
66
|
+
"internalType": "address",
|
|
67
|
+
"name": "previousOwner",
|
|
68
|
+
"type": "address"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"indexed": true,
|
|
72
|
+
"internalType": "address",
|
|
73
|
+
"name": "newOwner",
|
|
74
|
+
"type": "address"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"name": "OwnershipTransferred",
|
|
78
|
+
"type": "event"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"anonymous": false,
|
|
12
82
|
"inputs": [
|
|
13
83
|
{
|
|
84
|
+
"indexed": true,
|
|
85
|
+
"internalType": "bytes32",
|
|
86
|
+
"name": "role",
|
|
87
|
+
"type": "bytes32"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"indexed": true,
|
|
91
|
+
"internalType": "bytes32",
|
|
92
|
+
"name": "previousAdminRole",
|
|
93
|
+
"type": "bytes32"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"indexed": true,
|
|
14
97
|
"internalType": "bytes32",
|
|
15
|
-
"name": "
|
|
98
|
+
"name": "newAdminRole",
|
|
16
99
|
"type": "bytes32"
|
|
17
100
|
}
|
|
18
101
|
],
|
|
19
|
-
"
|
|
20
|
-
"type": "
|
|
102
|
+
"name": "RoleAdminChanged",
|
|
103
|
+
"type": "event"
|
|
21
104
|
},
|
|
22
105
|
{
|
|
23
106
|
"anonymous": false,
|
|
24
107
|
"inputs": [
|
|
108
|
+
{
|
|
109
|
+
"indexed": true,
|
|
110
|
+
"internalType": "bytes32",
|
|
111
|
+
"name": "role",
|
|
112
|
+
"type": "bytes32"
|
|
113
|
+
},
|
|
25
114
|
{
|
|
26
115
|
"indexed": true,
|
|
27
116
|
"internalType": "address",
|
|
28
|
-
"name": "
|
|
117
|
+
"name": "account",
|
|
29
118
|
"type": "address"
|
|
30
119
|
},
|
|
31
120
|
{
|
|
32
|
-
"indexed":
|
|
33
|
-
"internalType": "
|
|
34
|
-
"name": "
|
|
35
|
-
"type": "
|
|
121
|
+
"indexed": true,
|
|
122
|
+
"internalType": "address",
|
|
123
|
+
"name": "sender",
|
|
124
|
+
"type": "address"
|
|
36
125
|
}
|
|
37
126
|
],
|
|
38
|
-
"name": "
|
|
127
|
+
"name": "RoleGranted",
|
|
39
128
|
"type": "event"
|
|
40
129
|
},
|
|
41
130
|
{
|
|
42
131
|
"anonymous": false,
|
|
43
132
|
"inputs": [
|
|
133
|
+
{
|
|
134
|
+
"indexed": true,
|
|
135
|
+
"internalType": "bytes32",
|
|
136
|
+
"name": "role",
|
|
137
|
+
"type": "bytes32"
|
|
138
|
+
},
|
|
44
139
|
{
|
|
45
140
|
"indexed": true,
|
|
46
141
|
"internalType": "address",
|
|
47
|
-
"name": "
|
|
142
|
+
"name": "account",
|
|
48
143
|
"type": "address"
|
|
49
144
|
},
|
|
50
145
|
{
|
|
51
|
-
"indexed":
|
|
52
|
-
"internalType": "
|
|
53
|
-
"name": "
|
|
54
|
-
"type": "
|
|
146
|
+
"indexed": true,
|
|
147
|
+
"internalType": "address",
|
|
148
|
+
"name": "sender",
|
|
149
|
+
"type": "address"
|
|
55
150
|
}
|
|
56
151
|
],
|
|
57
|
-
"name": "
|
|
152
|
+
"name": "RoleRevoked",
|
|
153
|
+
"type": "event"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"anonymous": false,
|
|
157
|
+
"inputs": [
|
|
158
|
+
{
|
|
159
|
+
"indexed": true,
|
|
160
|
+
"internalType": "address",
|
|
161
|
+
"name": "implementation",
|
|
162
|
+
"type": "address"
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"name": "Upgraded",
|
|
58
166
|
"type": "event"
|
|
59
167
|
},
|
|
60
168
|
{
|
|
61
169
|
"inputs": [],
|
|
62
|
-
"name": "
|
|
170
|
+
"name": "DEFAULT_ADMIN_ROLE",
|
|
63
171
|
"outputs": [
|
|
64
172
|
{
|
|
65
173
|
"internalType": "bytes32",
|
|
@@ -72,12 +180,12 @@ exports.Vault_jsonAbi = [
|
|
|
72
180
|
},
|
|
73
181
|
{
|
|
74
182
|
"inputs": [],
|
|
75
|
-
"name": "
|
|
183
|
+
"name": "PAYEE_ROLE",
|
|
76
184
|
"outputs": [
|
|
77
185
|
{
|
|
78
|
-
"internalType": "
|
|
186
|
+
"internalType": "bytes32",
|
|
79
187
|
"name": "",
|
|
80
|
-
"type": "
|
|
188
|
+
"type": "bytes32"
|
|
81
189
|
}
|
|
82
190
|
],
|
|
83
191
|
"stateMutability": "view",
|
|
@@ -85,38 +193,119 @@ exports.Vault_jsonAbi = [
|
|
|
85
193
|
},
|
|
86
194
|
{
|
|
87
195
|
"inputs": [],
|
|
88
|
-
"name": "
|
|
196
|
+
"name": "PAYER_ROLE",
|
|
89
197
|
"outputs": [
|
|
90
198
|
{
|
|
91
|
-
"internalType": "
|
|
199
|
+
"internalType": "bytes32",
|
|
92
200
|
"name": "",
|
|
93
|
-
"type": "
|
|
201
|
+
"type": "bytes32"
|
|
94
202
|
}
|
|
95
203
|
],
|
|
96
204
|
"stateMutability": "view",
|
|
97
205
|
"type": "function"
|
|
98
206
|
},
|
|
99
207
|
{
|
|
100
|
-
"inputs": [
|
|
101
|
-
|
|
208
|
+
"inputs": [
|
|
209
|
+
{
|
|
210
|
+
"internalType": "contract IERC20Upgradeable[]",
|
|
211
|
+
"name": "tokens",
|
|
212
|
+
"type": "address[]"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"internalType": "address[]",
|
|
216
|
+
"name": "payees",
|
|
217
|
+
"type": "address[]"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"internalType": "uint256[]",
|
|
221
|
+
"name": "amounts",
|
|
222
|
+
"type": "uint256[]"
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
"name": "batchTransferErc20",
|
|
226
|
+
"outputs": [],
|
|
227
|
+
"stateMutability": "nonpayable",
|
|
228
|
+
"type": "function"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"inputs": [
|
|
232
|
+
{
|
|
233
|
+
"internalType": "contract IERC721Upgradeable[]",
|
|
234
|
+
"name": "tokens",
|
|
235
|
+
"type": "address[]"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"internalType": "address[]",
|
|
239
|
+
"name": "payees",
|
|
240
|
+
"type": "address[]"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"internalType": "uint256[]",
|
|
244
|
+
"name": "tokenIds",
|
|
245
|
+
"type": "uint256[]"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"name": "batchTransferErc721",
|
|
249
|
+
"outputs": [],
|
|
250
|
+
"stateMutability": "nonpayable",
|
|
251
|
+
"type": "function"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"inputs": [
|
|
255
|
+
{
|
|
256
|
+
"internalType": "address[]",
|
|
257
|
+
"name": "payees",
|
|
258
|
+
"type": "address[]"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"internalType": "uint256[]",
|
|
262
|
+
"name": "amounts",
|
|
263
|
+
"type": "uint256[]"
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
"name": "batchTransferEther",
|
|
267
|
+
"outputs": [],
|
|
268
|
+
"stateMutability": "nonpayable",
|
|
269
|
+
"type": "function"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"inputs": [
|
|
273
|
+
{
|
|
274
|
+
"internalType": "bytes32",
|
|
275
|
+
"name": "role",
|
|
276
|
+
"type": "bytes32"
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
"name": "getRoleAdmin",
|
|
102
280
|
"outputs": [
|
|
103
281
|
{
|
|
104
|
-
"internalType": "
|
|
282
|
+
"internalType": "bytes32",
|
|
105
283
|
"name": "",
|
|
106
|
-
"type": "
|
|
284
|
+
"type": "bytes32"
|
|
107
285
|
}
|
|
108
286
|
],
|
|
109
|
-
"stateMutability": "
|
|
287
|
+
"stateMutability": "view",
|
|
110
288
|
"type": "function"
|
|
111
289
|
},
|
|
112
290
|
{
|
|
113
|
-
"inputs": [
|
|
114
|
-
|
|
291
|
+
"inputs": [
|
|
292
|
+
{
|
|
293
|
+
"internalType": "bytes32",
|
|
294
|
+
"name": "role",
|
|
295
|
+
"type": "bytes32"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"internalType": "uint256",
|
|
299
|
+
"name": "index",
|
|
300
|
+
"type": "uint256"
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
"name": "getRoleMember",
|
|
115
304
|
"outputs": [
|
|
116
305
|
{
|
|
117
|
-
"internalType": "
|
|
306
|
+
"internalType": "address",
|
|
118
307
|
"name": "",
|
|
119
|
-
"type": "
|
|
308
|
+
"type": "address"
|
|
120
309
|
}
|
|
121
310
|
],
|
|
122
311
|
"stateMutability": "view",
|
|
@@ -125,128 +314,597 @@ exports.Vault_jsonAbi = [
|
|
|
125
314
|
{
|
|
126
315
|
"inputs": [
|
|
127
316
|
{
|
|
128
|
-
"internalType": "
|
|
129
|
-
"name": "
|
|
130
|
-
"type": "
|
|
317
|
+
"internalType": "bytes32",
|
|
318
|
+
"name": "role",
|
|
319
|
+
"type": "bytes32"
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"name": "getRoleMemberCount",
|
|
323
|
+
"outputs": [
|
|
324
|
+
{
|
|
325
|
+
"internalType": "uint256",
|
|
326
|
+
"name": "",
|
|
327
|
+
"type": "uint256"
|
|
328
|
+
}
|
|
329
|
+
],
|
|
330
|
+
"stateMutability": "view",
|
|
331
|
+
"type": "function"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"inputs": [
|
|
335
|
+
{
|
|
336
|
+
"internalType": "bytes32",
|
|
337
|
+
"name": "role",
|
|
338
|
+
"type": "bytes32"
|
|
131
339
|
},
|
|
132
340
|
{
|
|
133
|
-
"internalType": "address
|
|
134
|
-
"name": "
|
|
341
|
+
"internalType": "address",
|
|
342
|
+
"name": "account",
|
|
135
343
|
"type": "address"
|
|
136
344
|
}
|
|
137
345
|
],
|
|
138
|
-
"name": "
|
|
346
|
+
"name": "grantRole",
|
|
139
347
|
"outputs": [],
|
|
140
348
|
"stateMutability": "nonpayable",
|
|
141
349
|
"type": "function"
|
|
142
350
|
},
|
|
143
351
|
{
|
|
144
|
-
"
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
* Vault_json Contract Class
|
|
150
|
-
*
|
|
151
|
-
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* ```typescript
|
|
155
|
-
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
156
|
-
* import { mainnet } from 'viem/chains';
|
|
157
|
-
* import { Vault_json } from 'Vault_json';
|
|
158
|
-
*
|
|
159
|
-
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
160
|
-
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
161
|
-
*
|
|
162
|
-
* const contract = new Vault_json('0x...', { publicClient, walletClient });
|
|
163
|
-
*
|
|
164
|
-
* // Read functions
|
|
165
|
-
* const result = await contract.balanceOf('0x...');
|
|
166
|
-
*
|
|
167
|
-
* // Write functions
|
|
168
|
-
* const hash = await contract.transfer('0x...', 1000n);
|
|
169
|
-
*
|
|
170
|
-
* // Simulate transactions (dry-run)
|
|
171
|
-
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
172
|
-
* console.log('Gas estimate:', simulation.request.gas);
|
|
173
|
-
*
|
|
174
|
-
* // Watch events
|
|
175
|
-
* const unwatch = contract.watch.Transfer((event) => {
|
|
176
|
-
* console.log('Transfer event:', event);
|
|
177
|
-
* });
|
|
178
|
-
* ```
|
|
179
|
-
*/
|
|
180
|
-
class Vault_json {
|
|
181
|
-
constructor(address, clients) {
|
|
182
|
-
this.contractAddress = address;
|
|
183
|
-
this.publicClient = clients.publicClient;
|
|
184
|
-
this.contract = (0, viem_1.getContract)({
|
|
185
|
-
address,
|
|
186
|
-
abi: exports.Vault_jsonAbi,
|
|
187
|
-
client: {
|
|
188
|
-
public: clients.publicClient,
|
|
189
|
-
wallet: clients.walletClient,
|
|
352
|
+
"inputs": [
|
|
353
|
+
{
|
|
354
|
+
"internalType": "bytes32",
|
|
355
|
+
"name": "role",
|
|
356
|
+
"type": "bytes32"
|
|
190
357
|
},
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
358
|
+
{
|
|
359
|
+
"internalType": "address",
|
|
360
|
+
"name": "account",
|
|
361
|
+
"type": "address"
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
"name": "hasRole",
|
|
365
|
+
"outputs": [
|
|
366
|
+
{
|
|
367
|
+
"internalType": "bool",
|
|
368
|
+
"name": "",
|
|
369
|
+
"type": "bool"
|
|
370
|
+
}
|
|
371
|
+
],
|
|
372
|
+
"stateMutability": "view",
|
|
373
|
+
"type": "function"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"inputs": [],
|
|
377
|
+
"name": "initialize",
|
|
378
|
+
"outputs": [],
|
|
379
|
+
"stateMutability": "nonpayable",
|
|
380
|
+
"type": "function"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"inputs": [
|
|
384
|
+
{
|
|
385
|
+
"internalType": "address",
|
|
386
|
+
"name": "",
|
|
387
|
+
"type": "address"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"internalType": "address",
|
|
391
|
+
"name": "",
|
|
392
|
+
"type": "address"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"internalType": "uint256",
|
|
396
|
+
"name": "",
|
|
397
|
+
"type": "uint256"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"internalType": "bytes",
|
|
401
|
+
"name": "",
|
|
402
|
+
"type": "bytes"
|
|
403
|
+
}
|
|
404
|
+
],
|
|
405
|
+
"name": "onERC721Received",
|
|
406
|
+
"outputs": [
|
|
407
|
+
{
|
|
408
|
+
"internalType": "bytes4",
|
|
409
|
+
"name": "",
|
|
410
|
+
"type": "bytes4"
|
|
411
|
+
}
|
|
412
|
+
],
|
|
413
|
+
"stateMutability": "nonpayable",
|
|
414
|
+
"type": "function"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"inputs": [],
|
|
418
|
+
"name": "owner",
|
|
419
|
+
"outputs": [
|
|
420
|
+
{
|
|
421
|
+
"internalType": "address",
|
|
422
|
+
"name": "",
|
|
423
|
+
"type": "address"
|
|
424
|
+
}
|
|
425
|
+
],
|
|
426
|
+
"stateMutability": "view",
|
|
427
|
+
"type": "function"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"inputs": [],
|
|
431
|
+
"name": "proxiableUUID",
|
|
432
|
+
"outputs": [
|
|
433
|
+
{
|
|
434
|
+
"internalType": "bytes32",
|
|
435
|
+
"name": "",
|
|
436
|
+
"type": "bytes32"
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
"stateMutability": "view",
|
|
440
|
+
"type": "function"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"inputs": [],
|
|
444
|
+
"name": "renounceOwnership",
|
|
445
|
+
"outputs": [],
|
|
446
|
+
"stateMutability": "nonpayable",
|
|
447
|
+
"type": "function"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"inputs": [
|
|
451
|
+
{
|
|
452
|
+
"internalType": "bytes32",
|
|
453
|
+
"name": "role",
|
|
454
|
+
"type": "bytes32"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"internalType": "address",
|
|
458
|
+
"name": "account",
|
|
459
|
+
"type": "address"
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
"name": "renounceRole",
|
|
463
|
+
"outputs": [],
|
|
464
|
+
"stateMutability": "nonpayable",
|
|
465
|
+
"type": "function"
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"inputs": [
|
|
469
|
+
{
|
|
470
|
+
"internalType": "bytes32",
|
|
471
|
+
"name": "role",
|
|
472
|
+
"type": "bytes32"
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"internalType": "address",
|
|
476
|
+
"name": "account",
|
|
477
|
+
"type": "address"
|
|
478
|
+
}
|
|
479
|
+
],
|
|
480
|
+
"name": "revokeRole",
|
|
481
|
+
"outputs": [],
|
|
482
|
+
"stateMutability": "nonpayable",
|
|
483
|
+
"type": "function"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"inputs": [
|
|
487
|
+
{
|
|
488
|
+
"internalType": "bytes4",
|
|
489
|
+
"name": "interfaceId",
|
|
490
|
+
"type": "bytes4"
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
"name": "supportsInterface",
|
|
494
|
+
"outputs": [
|
|
495
|
+
{
|
|
496
|
+
"internalType": "bool",
|
|
497
|
+
"name": "",
|
|
498
|
+
"type": "bool"
|
|
499
|
+
}
|
|
500
|
+
],
|
|
501
|
+
"stateMutability": "view",
|
|
502
|
+
"type": "function"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"inputs": [
|
|
506
|
+
{
|
|
507
|
+
"internalType": "contract IERC20Upgradeable",
|
|
508
|
+
"name": "token",
|
|
509
|
+
"type": "address"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"internalType": "address",
|
|
513
|
+
"name": "payee",
|
|
514
|
+
"type": "address"
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
"internalType": "uint256",
|
|
518
|
+
"name": "amount",
|
|
519
|
+
"type": "uint256"
|
|
520
|
+
}
|
|
521
|
+
],
|
|
522
|
+
"name": "transferErc20",
|
|
523
|
+
"outputs": [],
|
|
524
|
+
"stateMutability": "nonpayable",
|
|
525
|
+
"type": "function"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"inputs": [
|
|
529
|
+
{
|
|
530
|
+
"internalType": "contract IERC721Upgradeable",
|
|
531
|
+
"name": "token",
|
|
532
|
+
"type": "address"
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
"internalType": "address",
|
|
536
|
+
"name": "payee",
|
|
537
|
+
"type": "address"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"internalType": "uint256",
|
|
541
|
+
"name": "tokenId",
|
|
542
|
+
"type": "uint256"
|
|
543
|
+
}
|
|
544
|
+
],
|
|
545
|
+
"name": "transferErc721",
|
|
546
|
+
"outputs": [],
|
|
547
|
+
"stateMutability": "nonpayable",
|
|
548
|
+
"type": "function"
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
"inputs": [
|
|
552
|
+
{
|
|
553
|
+
"internalType": "address",
|
|
554
|
+
"name": "payee",
|
|
555
|
+
"type": "address"
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"internalType": "uint256",
|
|
559
|
+
"name": "amount",
|
|
560
|
+
"type": "uint256"
|
|
561
|
+
}
|
|
562
|
+
],
|
|
563
|
+
"name": "transferEther",
|
|
564
|
+
"outputs": [],
|
|
565
|
+
"stateMutability": "nonpayable",
|
|
566
|
+
"type": "function"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"inputs": [
|
|
570
|
+
{
|
|
571
|
+
"internalType": "address",
|
|
572
|
+
"name": "newOwner",
|
|
573
|
+
"type": "address"
|
|
574
|
+
}
|
|
575
|
+
],
|
|
576
|
+
"name": "transferOwnership",
|
|
577
|
+
"outputs": [],
|
|
578
|
+
"stateMutability": "nonpayable",
|
|
579
|
+
"type": "function"
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"inputs": [
|
|
583
|
+
{
|
|
584
|
+
"internalType": "address",
|
|
585
|
+
"name": "newImplementation",
|
|
586
|
+
"type": "address"
|
|
587
|
+
}
|
|
588
|
+
],
|
|
589
|
+
"name": "upgradeTo",
|
|
590
|
+
"outputs": [],
|
|
591
|
+
"stateMutability": "nonpayable",
|
|
592
|
+
"type": "function"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"inputs": [
|
|
596
|
+
{
|
|
597
|
+
"internalType": "address",
|
|
598
|
+
"name": "newImplementation",
|
|
599
|
+
"type": "address"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
"internalType": "bytes",
|
|
603
|
+
"name": "data",
|
|
604
|
+
"type": "bytes"
|
|
605
|
+
}
|
|
606
|
+
],
|
|
607
|
+
"name": "upgradeToAndCall",
|
|
608
|
+
"outputs": [],
|
|
609
|
+
"stateMutability": "payable",
|
|
610
|
+
"type": "function"
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"stateMutability": "payable",
|
|
614
|
+
"type": "receive"
|
|
615
|
+
}
|
|
616
|
+
];
|
|
617
|
+
/**
|
|
618
|
+
* Vault_json Contract Class
|
|
619
|
+
*
|
|
620
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* ```typescript
|
|
624
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
625
|
+
* import { mainnet } from 'viem/chains';
|
|
626
|
+
* import { Vault_json } from 'Vault_json';
|
|
627
|
+
*
|
|
628
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
629
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
630
|
+
*
|
|
631
|
+
* const contract = new Vault_json('0x...', { publicClient, walletClient });
|
|
632
|
+
*
|
|
633
|
+
* // Read functions
|
|
634
|
+
* const result = await contract.balanceOf('0x...');
|
|
635
|
+
*
|
|
636
|
+
* // Write functions
|
|
637
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
638
|
+
*
|
|
639
|
+
* // Simulate transactions (dry-run)
|
|
640
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
641
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
642
|
+
*
|
|
643
|
+
* // Watch events
|
|
644
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
645
|
+
* console.log('Transfer event:', event);
|
|
646
|
+
* });
|
|
647
|
+
* ```
|
|
648
|
+
*/
|
|
649
|
+
class Vault_json {
|
|
650
|
+
constructor(address, clients) {
|
|
651
|
+
this.contractAddress = address;
|
|
652
|
+
this.publicClient = clients.publicClient;
|
|
653
|
+
this.contract = (0, viem_1.getContract)({
|
|
654
|
+
address,
|
|
655
|
+
abi: exports.Vault_jsonAbi,
|
|
656
|
+
client: {
|
|
657
|
+
public: clients.publicClient,
|
|
658
|
+
wallet: clients.walletClient,
|
|
659
|
+
},
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Get the contract address
|
|
664
|
+
*/
|
|
665
|
+
get address() {
|
|
666
|
+
return this.contractAddress;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
200
669
|
* Get the underlying viem contract instance
|
|
201
670
|
*/
|
|
202
|
-
getContract() {
|
|
203
|
-
return this.contract;
|
|
671
|
+
getContract() {
|
|
672
|
+
return this.contract;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* DEFAULT_ADMIN_ROLE
|
|
676
|
+
* view
|
|
677
|
+
*/
|
|
678
|
+
async DEFAULT_ADMIN_ROLE() {
|
|
679
|
+
return this.contract.read.DEFAULT_ADMIN_ROLE();
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* PAYEE_ROLE
|
|
683
|
+
* view
|
|
684
|
+
*/
|
|
685
|
+
async PAYEE_ROLE() {
|
|
686
|
+
return this.contract.read.PAYEE_ROLE();
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* PAYER_ROLE
|
|
690
|
+
* view
|
|
691
|
+
*/
|
|
692
|
+
async PAYER_ROLE() {
|
|
693
|
+
return this.contract.read.PAYER_ROLE();
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* getRoleAdmin
|
|
697
|
+
* view
|
|
698
|
+
*/
|
|
699
|
+
async getRoleAdmin(role) {
|
|
700
|
+
return this.contract.read.getRoleAdmin([role]);
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* getRoleMember
|
|
704
|
+
* view
|
|
705
|
+
*/
|
|
706
|
+
async getRoleMember(role, index) {
|
|
707
|
+
return this.contract.read.getRoleMember([role, index]);
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* getRoleMemberCount
|
|
711
|
+
* view
|
|
712
|
+
*/
|
|
713
|
+
async getRoleMemberCount(role) {
|
|
714
|
+
return this.contract.read.getRoleMemberCount([role]);
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* hasRole
|
|
718
|
+
* view
|
|
719
|
+
*/
|
|
720
|
+
async hasRole(role, account) {
|
|
721
|
+
return this.contract.read.hasRole([role, account]);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* owner
|
|
725
|
+
* view
|
|
726
|
+
*/
|
|
727
|
+
async owner() {
|
|
728
|
+
return this.contract.read.owner();
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* proxiableUUID
|
|
732
|
+
* view
|
|
733
|
+
*/
|
|
734
|
+
async proxiableUUID() {
|
|
735
|
+
return this.contract.read.proxiableUUID();
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* supportsInterface
|
|
739
|
+
* view
|
|
740
|
+
*/
|
|
741
|
+
async supportsInterface(interfaceId) {
|
|
742
|
+
return this.contract.read.supportsInterface([interfaceId]);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* batchTransferErc20
|
|
746
|
+
* nonpayable
|
|
747
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
748
|
+
*/
|
|
749
|
+
async batchTransferErc20(tokens, payees, amounts, options) {
|
|
750
|
+
if (!this.contract.write) {
|
|
751
|
+
throw new Error('Wallet client is required for write operations');
|
|
752
|
+
}
|
|
753
|
+
return this.contract.write.batchTransferErc20([tokens, payees, amounts], options);
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* batchTransferErc721
|
|
757
|
+
* nonpayable
|
|
758
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
759
|
+
*/
|
|
760
|
+
async batchTransferErc721(tokens, payees, tokenIds, options) {
|
|
761
|
+
if (!this.contract.write) {
|
|
762
|
+
throw new Error('Wallet client is required for write operations');
|
|
763
|
+
}
|
|
764
|
+
return this.contract.write.batchTransferErc721([tokens, payees, tokenIds], options);
|
|
204
765
|
}
|
|
205
766
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
767
|
+
* batchTransferEther
|
|
768
|
+
* nonpayable
|
|
769
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
208
770
|
*/
|
|
209
|
-
async
|
|
210
|
-
|
|
771
|
+
async batchTransferEther(payees, amounts, options) {
|
|
772
|
+
if (!this.contract.write) {
|
|
773
|
+
throw new Error('Wallet client is required for write operations');
|
|
774
|
+
}
|
|
775
|
+
return this.contract.write.batchTransferEther([payees, amounts], options);
|
|
211
776
|
}
|
|
212
777
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
778
|
+
* grantRole
|
|
779
|
+
* nonpayable
|
|
780
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
215
781
|
*/
|
|
216
|
-
async
|
|
217
|
-
|
|
782
|
+
async grantRole(role, account, options) {
|
|
783
|
+
if (!this.contract.write) {
|
|
784
|
+
throw new Error('Wallet client is required for write operations');
|
|
785
|
+
}
|
|
786
|
+
return this.contract.write.grantRole([role, account], options);
|
|
218
787
|
}
|
|
219
788
|
/**
|
|
220
|
-
*
|
|
221
|
-
*
|
|
789
|
+
* initialize
|
|
790
|
+
* nonpayable
|
|
791
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
222
792
|
*/
|
|
223
|
-
async
|
|
224
|
-
|
|
793
|
+
async initialize(options) {
|
|
794
|
+
if (!this.contract.write) {
|
|
795
|
+
throw new Error('Wallet client is required for write operations');
|
|
796
|
+
}
|
|
797
|
+
return this.contract.write.initialize(options);
|
|
225
798
|
}
|
|
226
799
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
800
|
+
* onERC721Received
|
|
801
|
+
* nonpayable
|
|
802
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
229
803
|
*/
|
|
230
|
-
async
|
|
231
|
-
|
|
804
|
+
async onERC721Received(arg0, arg1, arg2, arg3, options) {
|
|
805
|
+
if (!this.contract.write) {
|
|
806
|
+
throw new Error('Wallet client is required for write operations');
|
|
807
|
+
}
|
|
808
|
+
return this.contract.write.onERC721Received([arg0, arg1, arg2, arg3], options);
|
|
232
809
|
}
|
|
233
810
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
811
|
+
* renounceOwnership
|
|
812
|
+
* nonpayable
|
|
813
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
814
|
+
*/
|
|
815
|
+
async renounceOwnership(options) {
|
|
816
|
+
if (!this.contract.write) {
|
|
817
|
+
throw new Error('Wallet client is required for write operations');
|
|
818
|
+
}
|
|
819
|
+
return this.contract.write.renounceOwnership(options);
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* renounceRole
|
|
823
|
+
* nonpayable
|
|
824
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
825
|
+
*/
|
|
826
|
+
async renounceRole(role, account, options) {
|
|
827
|
+
if (!this.contract.write) {
|
|
828
|
+
throw new Error('Wallet client is required for write operations');
|
|
829
|
+
}
|
|
830
|
+
return this.contract.write.renounceRole([role, account], options);
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* revokeRole
|
|
834
|
+
* nonpayable
|
|
835
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
836
|
+
*/
|
|
837
|
+
async revokeRole(role, account, options) {
|
|
838
|
+
if (!this.contract.write) {
|
|
839
|
+
throw new Error('Wallet client is required for write operations');
|
|
840
|
+
}
|
|
841
|
+
return this.contract.write.revokeRole([role, account], options);
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* transferErc20
|
|
845
|
+
* nonpayable
|
|
846
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
847
|
+
*/
|
|
848
|
+
async transferErc20(token, payee, amount, options) {
|
|
849
|
+
if (!this.contract.write) {
|
|
850
|
+
throw new Error('Wallet client is required for write operations');
|
|
851
|
+
}
|
|
852
|
+
return this.contract.write.transferErc20([token, payee, amount], options);
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* transferErc721
|
|
856
|
+
* nonpayable
|
|
857
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
858
|
+
*/
|
|
859
|
+
async transferErc721(token, payee, tokenId, options) {
|
|
860
|
+
if (!this.contract.write) {
|
|
861
|
+
throw new Error('Wallet client is required for write operations');
|
|
862
|
+
}
|
|
863
|
+
return this.contract.write.transferErc721([token, payee, tokenId], options);
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* transferEther
|
|
867
|
+
* nonpayable
|
|
868
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
869
|
+
*/
|
|
870
|
+
async transferEther(payee, amount, options) {
|
|
871
|
+
if (!this.contract.write) {
|
|
872
|
+
throw new Error('Wallet client is required for write operations');
|
|
873
|
+
}
|
|
874
|
+
return this.contract.write.transferEther([payee, amount], options);
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* transferOwnership
|
|
878
|
+
* nonpayable
|
|
879
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
236
880
|
*/
|
|
237
|
-
async
|
|
238
|
-
|
|
881
|
+
async transferOwnership(newOwner, options) {
|
|
882
|
+
if (!this.contract.write) {
|
|
883
|
+
throw new Error('Wallet client is required for write operations');
|
|
884
|
+
}
|
|
885
|
+
return this.contract.write.transferOwnership([newOwner], options);
|
|
239
886
|
}
|
|
240
887
|
/**
|
|
241
|
-
*
|
|
888
|
+
* upgradeTo
|
|
242
889
|
* nonpayable
|
|
243
890
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
244
891
|
*/
|
|
245
|
-
async
|
|
892
|
+
async upgradeTo(newImplementation, options) {
|
|
893
|
+
if (!this.contract.write) {
|
|
894
|
+
throw new Error('Wallet client is required for write operations');
|
|
895
|
+
}
|
|
896
|
+
return this.contract.write.upgradeTo([newImplementation], options);
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* upgradeToAndCall
|
|
900
|
+
* payable
|
|
901
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
902
|
+
*/
|
|
903
|
+
async upgradeToAndCall(newImplementation, data, options) {
|
|
246
904
|
if (!this.contract.write) {
|
|
247
905
|
throw new Error('Wallet client is required for write operations');
|
|
248
906
|
}
|
|
249
|
-
return this.contract.write.
|
|
907
|
+
return this.contract.write.upgradeToAndCall([newImplementation, data], options);
|
|
250
908
|
}
|
|
251
909
|
/**
|
|
252
910
|
* Simulate contract write operations (dry-run without sending transaction)
|
|
@@ -263,12 +921,124 @@ class Vault_json {
|
|
|
263
921
|
}
|
|
264
922
|
return {
|
|
265
923
|
/**
|
|
266
|
-
* Simulate
|
|
924
|
+
* Simulate batchTransferErc20
|
|
925
|
+
* Returns gas estimate and result without sending transaction
|
|
926
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
927
|
+
*/
|
|
928
|
+
async batchTransferErc20(tokens, payees, amounts, options) {
|
|
929
|
+
return contract.simulate.batchTransferErc20([tokens, payees, amounts], options);
|
|
930
|
+
},
|
|
931
|
+
/**
|
|
932
|
+
* Simulate batchTransferErc721
|
|
933
|
+
* Returns gas estimate and result without sending transaction
|
|
934
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
935
|
+
*/
|
|
936
|
+
async batchTransferErc721(tokens, payees, tokenIds, options) {
|
|
937
|
+
return contract.simulate.batchTransferErc721([tokens, payees, tokenIds], options);
|
|
938
|
+
},
|
|
939
|
+
/**
|
|
940
|
+
* Simulate batchTransferEther
|
|
941
|
+
* Returns gas estimate and result without sending transaction
|
|
942
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
943
|
+
*/
|
|
944
|
+
async batchTransferEther(payees, amounts, options) {
|
|
945
|
+
return contract.simulate.batchTransferEther([payees, amounts], options);
|
|
946
|
+
},
|
|
947
|
+
/**
|
|
948
|
+
* Simulate grantRole
|
|
949
|
+
* Returns gas estimate and result without sending transaction
|
|
950
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
951
|
+
*/
|
|
952
|
+
async grantRole(role, account, options) {
|
|
953
|
+
return contract.simulate.grantRole([role, account], options);
|
|
954
|
+
},
|
|
955
|
+
/**
|
|
956
|
+
* Simulate initialize
|
|
957
|
+
* Returns gas estimate and result without sending transaction
|
|
958
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
959
|
+
*/
|
|
960
|
+
async initialize(options) {
|
|
961
|
+
return contract.simulate.initialize(options);
|
|
962
|
+
},
|
|
963
|
+
/**
|
|
964
|
+
* Simulate onERC721Received
|
|
965
|
+
* Returns gas estimate and result without sending transaction
|
|
966
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
967
|
+
*/
|
|
968
|
+
async onERC721Received(arg0, arg1, arg2, arg3, options) {
|
|
969
|
+
return contract.simulate.onERC721Received([arg0, arg1, arg2, arg3], options);
|
|
970
|
+
},
|
|
971
|
+
/**
|
|
972
|
+
* Simulate renounceOwnership
|
|
973
|
+
* Returns gas estimate and result without sending transaction
|
|
974
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
975
|
+
*/
|
|
976
|
+
async renounceOwnership(options) {
|
|
977
|
+
return contract.simulate.renounceOwnership(options);
|
|
978
|
+
},
|
|
979
|
+
/**
|
|
980
|
+
* Simulate renounceRole
|
|
981
|
+
* Returns gas estimate and result without sending transaction
|
|
982
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
983
|
+
*/
|
|
984
|
+
async renounceRole(role, account, options) {
|
|
985
|
+
return contract.simulate.renounceRole([role, account], options);
|
|
986
|
+
},
|
|
987
|
+
/**
|
|
988
|
+
* Simulate revokeRole
|
|
989
|
+
* Returns gas estimate and result without sending transaction
|
|
990
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
991
|
+
*/
|
|
992
|
+
async revokeRole(role, account, options) {
|
|
993
|
+
return contract.simulate.revokeRole([role, account], options);
|
|
994
|
+
},
|
|
995
|
+
/**
|
|
996
|
+
* Simulate transferErc20
|
|
997
|
+
* Returns gas estimate and result without sending transaction
|
|
998
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
999
|
+
*/
|
|
1000
|
+
async transferErc20(token, payee, amount, options) {
|
|
1001
|
+
return contract.simulate.transferErc20([token, payee, amount], options);
|
|
1002
|
+
},
|
|
1003
|
+
/**
|
|
1004
|
+
* Simulate transferErc721
|
|
1005
|
+
* Returns gas estimate and result without sending transaction
|
|
1006
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1007
|
+
*/
|
|
1008
|
+
async transferErc721(token, payee, tokenId, options) {
|
|
1009
|
+
return contract.simulate.transferErc721([token, payee, tokenId], options);
|
|
1010
|
+
},
|
|
1011
|
+
/**
|
|
1012
|
+
* Simulate transferEther
|
|
1013
|
+
* Returns gas estimate and result without sending transaction
|
|
1014
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1015
|
+
*/
|
|
1016
|
+
async transferEther(payee, amount, options) {
|
|
1017
|
+
return contract.simulate.transferEther([payee, amount], options);
|
|
1018
|
+
},
|
|
1019
|
+
/**
|
|
1020
|
+
* Simulate transferOwnership
|
|
1021
|
+
* Returns gas estimate and result without sending transaction
|
|
1022
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1023
|
+
*/
|
|
1024
|
+
async transferOwnership(newOwner, options) {
|
|
1025
|
+
return contract.simulate.transferOwnership([newOwner], options);
|
|
1026
|
+
},
|
|
1027
|
+
/**
|
|
1028
|
+
* Simulate upgradeTo
|
|
1029
|
+
* Returns gas estimate and result without sending transaction
|
|
1030
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1031
|
+
*/
|
|
1032
|
+
async upgradeTo(newImplementation, options) {
|
|
1033
|
+
return contract.simulate.upgradeTo([newImplementation], options);
|
|
1034
|
+
},
|
|
1035
|
+
/**
|
|
1036
|
+
* Simulate upgradeToAndCall
|
|
267
1037
|
* Returns gas estimate and result without sending transaction
|
|
268
1038
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
269
1039
|
*/
|
|
270
|
-
async
|
|
271
|
-
return contract.simulate.
|
|
1040
|
+
async upgradeToAndCall(newImplementation, data, options) {
|
|
1041
|
+
return contract.simulate.upgradeToAndCall([newImplementation, data], options);
|
|
272
1042
|
}
|
|
273
1043
|
};
|
|
274
1044
|
}
|
|
@@ -287,16 +1057,128 @@ class Vault_json {
|
|
|
287
1057
|
get watch() {
|
|
288
1058
|
return {
|
|
289
1059
|
/**
|
|
290
|
-
* Watch
|
|
1060
|
+
* Watch AdminChanged events
|
|
1061
|
+
* @param callback Function to call when event is emitted
|
|
1062
|
+
* @param filter Optional filter for indexed parameters
|
|
1063
|
+
* @returns Unwatch function to stop listening
|
|
1064
|
+
*/
|
|
1065
|
+
AdminChanged: (callback) => {
|
|
1066
|
+
return this.publicClient.watchContractEvent({
|
|
1067
|
+
address: this.contractAddress,
|
|
1068
|
+
abi: exports.Vault_jsonAbi,
|
|
1069
|
+
eventName: 'AdminChanged',
|
|
1070
|
+
onLogs: (logs) => {
|
|
1071
|
+
logs.forEach((log) => {
|
|
1072
|
+
callback(log.args);
|
|
1073
|
+
});
|
|
1074
|
+
},
|
|
1075
|
+
});
|
|
1076
|
+
},
|
|
1077
|
+
/**
|
|
1078
|
+
* Watch BeaconUpgraded events
|
|
1079
|
+
* @param callback Function to call when event is emitted
|
|
1080
|
+
* @param filter Optional filter for indexed parameters
|
|
1081
|
+
* @returns Unwatch function to stop listening
|
|
1082
|
+
*/
|
|
1083
|
+
BeaconUpgraded: (callback, filter) => {
|
|
1084
|
+
return this.publicClient.watchContractEvent({
|
|
1085
|
+
address: this.contractAddress,
|
|
1086
|
+
abi: exports.Vault_jsonAbi,
|
|
1087
|
+
eventName: 'BeaconUpgraded',
|
|
1088
|
+
args: filter,
|
|
1089
|
+
onLogs: (logs) => {
|
|
1090
|
+
logs.forEach((log) => {
|
|
1091
|
+
callback(log.args);
|
|
1092
|
+
});
|
|
1093
|
+
},
|
|
1094
|
+
});
|
|
1095
|
+
},
|
|
1096
|
+
/**
|
|
1097
|
+
* Watch Initialized events
|
|
1098
|
+
* @param callback Function to call when event is emitted
|
|
1099
|
+
* @param filter Optional filter for indexed parameters
|
|
1100
|
+
* @returns Unwatch function to stop listening
|
|
1101
|
+
*/
|
|
1102
|
+
Initialized: (callback) => {
|
|
1103
|
+
return this.publicClient.watchContractEvent({
|
|
1104
|
+
address: this.contractAddress,
|
|
1105
|
+
abi: exports.Vault_jsonAbi,
|
|
1106
|
+
eventName: 'Initialized',
|
|
1107
|
+
onLogs: (logs) => {
|
|
1108
|
+
logs.forEach((log) => {
|
|
1109
|
+
callback(log.args);
|
|
1110
|
+
});
|
|
1111
|
+
},
|
|
1112
|
+
});
|
|
1113
|
+
},
|
|
1114
|
+
/**
|
|
1115
|
+
* Watch OwnershipTransferred events
|
|
1116
|
+
* @param callback Function to call when event is emitted
|
|
1117
|
+
* @param filter Optional filter for indexed parameters
|
|
1118
|
+
* @returns Unwatch function to stop listening
|
|
1119
|
+
*/
|
|
1120
|
+
OwnershipTransferred: (callback, filter) => {
|
|
1121
|
+
return this.publicClient.watchContractEvent({
|
|
1122
|
+
address: this.contractAddress,
|
|
1123
|
+
abi: exports.Vault_jsonAbi,
|
|
1124
|
+
eventName: 'OwnershipTransferred',
|
|
1125
|
+
args: filter,
|
|
1126
|
+
onLogs: (logs) => {
|
|
1127
|
+
logs.forEach((log) => {
|
|
1128
|
+
callback(log.args);
|
|
1129
|
+
});
|
|
1130
|
+
},
|
|
1131
|
+
});
|
|
1132
|
+
},
|
|
1133
|
+
/**
|
|
1134
|
+
* Watch RoleAdminChanged events
|
|
1135
|
+
* @param callback Function to call when event is emitted
|
|
1136
|
+
* @param filter Optional filter for indexed parameters
|
|
1137
|
+
* @returns Unwatch function to stop listening
|
|
1138
|
+
*/
|
|
1139
|
+
RoleAdminChanged: (callback, filter) => {
|
|
1140
|
+
return this.publicClient.watchContractEvent({
|
|
1141
|
+
address: this.contractAddress,
|
|
1142
|
+
abi: exports.Vault_jsonAbi,
|
|
1143
|
+
eventName: 'RoleAdminChanged',
|
|
1144
|
+
args: filter,
|
|
1145
|
+
onLogs: (logs) => {
|
|
1146
|
+
logs.forEach((log) => {
|
|
1147
|
+
callback(log.args);
|
|
1148
|
+
});
|
|
1149
|
+
},
|
|
1150
|
+
});
|
|
1151
|
+
},
|
|
1152
|
+
/**
|
|
1153
|
+
* Watch RoleGranted events
|
|
1154
|
+
* @param callback Function to call when event is emitted
|
|
1155
|
+
* @param filter Optional filter for indexed parameters
|
|
1156
|
+
* @returns Unwatch function to stop listening
|
|
1157
|
+
*/
|
|
1158
|
+
RoleGranted: (callback, filter) => {
|
|
1159
|
+
return this.publicClient.watchContractEvent({
|
|
1160
|
+
address: this.contractAddress,
|
|
1161
|
+
abi: exports.Vault_jsonAbi,
|
|
1162
|
+
eventName: 'RoleGranted',
|
|
1163
|
+
args: filter,
|
|
1164
|
+
onLogs: (logs) => {
|
|
1165
|
+
logs.forEach((log) => {
|
|
1166
|
+
callback(log.args);
|
|
1167
|
+
});
|
|
1168
|
+
},
|
|
1169
|
+
});
|
|
1170
|
+
},
|
|
1171
|
+
/**
|
|
1172
|
+
* Watch RoleRevoked events
|
|
291
1173
|
* @param callback Function to call when event is emitted
|
|
292
1174
|
* @param filter Optional filter for indexed parameters
|
|
293
1175
|
* @returns Unwatch function to stop listening
|
|
294
1176
|
*/
|
|
295
|
-
|
|
1177
|
+
RoleRevoked: (callback, filter) => {
|
|
296
1178
|
return this.publicClient.watchContractEvent({
|
|
297
1179
|
address: this.contractAddress,
|
|
298
1180
|
abi: exports.Vault_jsonAbi,
|
|
299
|
-
eventName: '
|
|
1181
|
+
eventName: 'RoleRevoked',
|
|
300
1182
|
args: filter,
|
|
301
1183
|
onLogs: (logs) => {
|
|
302
1184
|
logs.forEach((log) => {
|
|
@@ -306,16 +1188,16 @@ class Vault_json {
|
|
|
306
1188
|
});
|
|
307
1189
|
},
|
|
308
1190
|
/**
|
|
309
|
-
* Watch
|
|
1191
|
+
* Watch Upgraded events
|
|
310
1192
|
* @param callback Function to call when event is emitted
|
|
311
1193
|
* @param filter Optional filter for indexed parameters
|
|
312
1194
|
* @returns Unwatch function to stop listening
|
|
313
1195
|
*/
|
|
314
|
-
|
|
1196
|
+
Upgraded: (callback, filter) => {
|
|
315
1197
|
return this.publicClient.watchContractEvent({
|
|
316
1198
|
address: this.contractAddress,
|
|
317
1199
|
abi: exports.Vault_jsonAbi,
|
|
318
|
-
eventName: '
|
|
1200
|
+
eventName: 'Upgraded',
|
|
319
1201
|
args: filter,
|
|
320
1202
|
onLogs: (logs) => {
|
|
321
1203
|
logs.forEach((log) => {
|