@gitmyabi/multicall 1.0.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/README.md +108 -0
- package/contracts/Multicall3_json.d.ts +696 -0
- package/contracts/Multicall3_json.js +716 -0
- package/contracts/Multicall3_json.ts +926 -0
- package/contracts/OwnableDelegateProxy_json.d.ts +351 -0
- package/contracts/OwnableDelegateProxy_json.js +379 -0
- package/contracts/OwnableDelegateProxy_json.ts +480 -0
- package/contracts/index.d.ts +4 -0
- package/contracts/index.js +10 -0
- package/contracts/index.ts +5 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Multicall3_json = exports.Multicall3_jsonAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* Multicall3_json ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.Multicall3_jsonAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"components": [
|
|
15
|
+
{
|
|
16
|
+
"internalType": "address",
|
|
17
|
+
"name": "target",
|
|
18
|
+
"type": "address"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"internalType": "bytes",
|
|
22
|
+
"name": "callData",
|
|
23
|
+
"type": "bytes"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"internalType": "struct Multicall3.Call[]",
|
|
27
|
+
"name": "calls",
|
|
28
|
+
"type": "tuple[]"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"name": "aggregate",
|
|
32
|
+
"outputs": [
|
|
33
|
+
{
|
|
34
|
+
"internalType": "uint256",
|
|
35
|
+
"name": "blockNumber",
|
|
36
|
+
"type": "uint256"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"internalType": "bytes[]",
|
|
40
|
+
"name": "returnData",
|
|
41
|
+
"type": "bytes[]"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"stateMutability": "payable",
|
|
45
|
+
"type": "function"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"inputs": [
|
|
49
|
+
{
|
|
50
|
+
"components": [
|
|
51
|
+
{
|
|
52
|
+
"internalType": "address",
|
|
53
|
+
"name": "target",
|
|
54
|
+
"type": "address"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"internalType": "bool",
|
|
58
|
+
"name": "allowFailure",
|
|
59
|
+
"type": "bool"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"internalType": "bytes",
|
|
63
|
+
"name": "callData",
|
|
64
|
+
"type": "bytes"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"internalType": "struct Multicall3.Call3[]",
|
|
68
|
+
"name": "calls",
|
|
69
|
+
"type": "tuple[]"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"name": "aggregate3",
|
|
73
|
+
"outputs": [
|
|
74
|
+
{
|
|
75
|
+
"components": [
|
|
76
|
+
{
|
|
77
|
+
"internalType": "bool",
|
|
78
|
+
"name": "success",
|
|
79
|
+
"type": "bool"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"internalType": "bytes",
|
|
83
|
+
"name": "returnData",
|
|
84
|
+
"type": "bytes"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"internalType": "struct Multicall3.Result[]",
|
|
88
|
+
"name": "returnData",
|
|
89
|
+
"type": "tuple[]"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"stateMutability": "payable",
|
|
93
|
+
"type": "function"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"inputs": [
|
|
97
|
+
{
|
|
98
|
+
"components": [
|
|
99
|
+
{
|
|
100
|
+
"internalType": "address",
|
|
101
|
+
"name": "target",
|
|
102
|
+
"type": "address"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"internalType": "bool",
|
|
106
|
+
"name": "allowFailure",
|
|
107
|
+
"type": "bool"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"internalType": "uint256",
|
|
111
|
+
"name": "value",
|
|
112
|
+
"type": "uint256"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"internalType": "bytes",
|
|
116
|
+
"name": "callData",
|
|
117
|
+
"type": "bytes"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
"internalType": "struct Multicall3.Call3Value[]",
|
|
121
|
+
"name": "calls",
|
|
122
|
+
"type": "tuple[]"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"name": "aggregate3Value",
|
|
126
|
+
"outputs": [
|
|
127
|
+
{
|
|
128
|
+
"components": [
|
|
129
|
+
{
|
|
130
|
+
"internalType": "bool",
|
|
131
|
+
"name": "success",
|
|
132
|
+
"type": "bool"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"internalType": "bytes",
|
|
136
|
+
"name": "returnData",
|
|
137
|
+
"type": "bytes"
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"internalType": "struct Multicall3.Result[]",
|
|
141
|
+
"name": "returnData",
|
|
142
|
+
"type": "tuple[]"
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"stateMutability": "payable",
|
|
146
|
+
"type": "function"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"inputs": [
|
|
150
|
+
{
|
|
151
|
+
"components": [
|
|
152
|
+
{
|
|
153
|
+
"internalType": "address",
|
|
154
|
+
"name": "target",
|
|
155
|
+
"type": "address"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"internalType": "bytes",
|
|
159
|
+
"name": "callData",
|
|
160
|
+
"type": "bytes"
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"internalType": "struct Multicall3.Call[]",
|
|
164
|
+
"name": "calls",
|
|
165
|
+
"type": "tuple[]"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"name": "blockAndAggregate",
|
|
169
|
+
"outputs": [
|
|
170
|
+
{
|
|
171
|
+
"internalType": "uint256",
|
|
172
|
+
"name": "blockNumber",
|
|
173
|
+
"type": "uint256"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"internalType": "bytes32",
|
|
177
|
+
"name": "blockHash",
|
|
178
|
+
"type": "bytes32"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"components": [
|
|
182
|
+
{
|
|
183
|
+
"internalType": "bool",
|
|
184
|
+
"name": "success",
|
|
185
|
+
"type": "bool"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"internalType": "bytes",
|
|
189
|
+
"name": "returnData",
|
|
190
|
+
"type": "bytes"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"internalType": "struct Multicall3.Result[]",
|
|
194
|
+
"name": "returnData",
|
|
195
|
+
"type": "tuple[]"
|
|
196
|
+
}
|
|
197
|
+
],
|
|
198
|
+
"stateMutability": "payable",
|
|
199
|
+
"type": "function"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"inputs": [],
|
|
203
|
+
"name": "getBasefee",
|
|
204
|
+
"outputs": [
|
|
205
|
+
{
|
|
206
|
+
"internalType": "uint256",
|
|
207
|
+
"name": "basefee",
|
|
208
|
+
"type": "uint256"
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"stateMutability": "view",
|
|
212
|
+
"type": "function"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"inputs": [
|
|
216
|
+
{
|
|
217
|
+
"internalType": "uint256",
|
|
218
|
+
"name": "blockNumber",
|
|
219
|
+
"type": "uint256"
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
"name": "getBlockHash",
|
|
223
|
+
"outputs": [
|
|
224
|
+
{
|
|
225
|
+
"internalType": "bytes32",
|
|
226
|
+
"name": "blockHash",
|
|
227
|
+
"type": "bytes32"
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
"stateMutability": "view",
|
|
231
|
+
"type": "function"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"inputs": [],
|
|
235
|
+
"name": "getBlockNumber",
|
|
236
|
+
"outputs": [
|
|
237
|
+
{
|
|
238
|
+
"internalType": "uint256",
|
|
239
|
+
"name": "blockNumber",
|
|
240
|
+
"type": "uint256"
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
"stateMutability": "view",
|
|
244
|
+
"type": "function"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"inputs": [],
|
|
248
|
+
"name": "getChainId",
|
|
249
|
+
"outputs": [
|
|
250
|
+
{
|
|
251
|
+
"internalType": "uint256",
|
|
252
|
+
"name": "chainid",
|
|
253
|
+
"type": "uint256"
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"stateMutability": "view",
|
|
257
|
+
"type": "function"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"inputs": [],
|
|
261
|
+
"name": "getCurrentBlockCoinbase",
|
|
262
|
+
"outputs": [
|
|
263
|
+
{
|
|
264
|
+
"internalType": "address",
|
|
265
|
+
"name": "coinbase",
|
|
266
|
+
"type": "address"
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"stateMutability": "view",
|
|
270
|
+
"type": "function"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"inputs": [],
|
|
274
|
+
"name": "getCurrentBlockDifficulty",
|
|
275
|
+
"outputs": [
|
|
276
|
+
{
|
|
277
|
+
"internalType": "uint256",
|
|
278
|
+
"name": "difficulty",
|
|
279
|
+
"type": "uint256"
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
"stateMutability": "view",
|
|
283
|
+
"type": "function"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"inputs": [],
|
|
287
|
+
"name": "getCurrentBlockGasLimit",
|
|
288
|
+
"outputs": [
|
|
289
|
+
{
|
|
290
|
+
"internalType": "uint256",
|
|
291
|
+
"name": "gaslimit",
|
|
292
|
+
"type": "uint256"
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
"stateMutability": "view",
|
|
296
|
+
"type": "function"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"inputs": [],
|
|
300
|
+
"name": "getCurrentBlockTimestamp",
|
|
301
|
+
"outputs": [
|
|
302
|
+
{
|
|
303
|
+
"internalType": "uint256",
|
|
304
|
+
"name": "timestamp",
|
|
305
|
+
"type": "uint256"
|
|
306
|
+
}
|
|
307
|
+
],
|
|
308
|
+
"stateMutability": "view",
|
|
309
|
+
"type": "function"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"inputs": [
|
|
313
|
+
{
|
|
314
|
+
"internalType": "address",
|
|
315
|
+
"name": "addr",
|
|
316
|
+
"type": "address"
|
|
317
|
+
}
|
|
318
|
+
],
|
|
319
|
+
"name": "getEthBalance",
|
|
320
|
+
"outputs": [
|
|
321
|
+
{
|
|
322
|
+
"internalType": "uint256",
|
|
323
|
+
"name": "balance",
|
|
324
|
+
"type": "uint256"
|
|
325
|
+
}
|
|
326
|
+
],
|
|
327
|
+
"stateMutability": "view",
|
|
328
|
+
"type": "function"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"inputs": [],
|
|
332
|
+
"name": "getLastBlockHash",
|
|
333
|
+
"outputs": [
|
|
334
|
+
{
|
|
335
|
+
"internalType": "bytes32",
|
|
336
|
+
"name": "blockHash",
|
|
337
|
+
"type": "bytes32"
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
"stateMutability": "view",
|
|
341
|
+
"type": "function"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"inputs": [
|
|
345
|
+
{
|
|
346
|
+
"internalType": "bool",
|
|
347
|
+
"name": "requireSuccess",
|
|
348
|
+
"type": "bool"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"components": [
|
|
352
|
+
{
|
|
353
|
+
"internalType": "address",
|
|
354
|
+
"name": "target",
|
|
355
|
+
"type": "address"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"internalType": "bytes",
|
|
359
|
+
"name": "callData",
|
|
360
|
+
"type": "bytes"
|
|
361
|
+
}
|
|
362
|
+
],
|
|
363
|
+
"internalType": "struct Multicall3.Call[]",
|
|
364
|
+
"name": "calls",
|
|
365
|
+
"type": "tuple[]"
|
|
366
|
+
}
|
|
367
|
+
],
|
|
368
|
+
"name": "tryAggregate",
|
|
369
|
+
"outputs": [
|
|
370
|
+
{
|
|
371
|
+
"components": [
|
|
372
|
+
{
|
|
373
|
+
"internalType": "bool",
|
|
374
|
+
"name": "success",
|
|
375
|
+
"type": "bool"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"internalType": "bytes",
|
|
379
|
+
"name": "returnData",
|
|
380
|
+
"type": "bytes"
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"internalType": "struct Multicall3.Result[]",
|
|
384
|
+
"name": "returnData",
|
|
385
|
+
"type": "tuple[]"
|
|
386
|
+
}
|
|
387
|
+
],
|
|
388
|
+
"stateMutability": "payable",
|
|
389
|
+
"type": "function"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"inputs": [
|
|
393
|
+
{
|
|
394
|
+
"internalType": "bool",
|
|
395
|
+
"name": "requireSuccess",
|
|
396
|
+
"type": "bool"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"components": [
|
|
400
|
+
{
|
|
401
|
+
"internalType": "address",
|
|
402
|
+
"name": "target",
|
|
403
|
+
"type": "address"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"internalType": "bytes",
|
|
407
|
+
"name": "callData",
|
|
408
|
+
"type": "bytes"
|
|
409
|
+
}
|
|
410
|
+
],
|
|
411
|
+
"internalType": "struct Multicall3.Call[]",
|
|
412
|
+
"name": "calls",
|
|
413
|
+
"type": "tuple[]"
|
|
414
|
+
}
|
|
415
|
+
],
|
|
416
|
+
"name": "tryBlockAndAggregate",
|
|
417
|
+
"outputs": [
|
|
418
|
+
{
|
|
419
|
+
"internalType": "uint256",
|
|
420
|
+
"name": "blockNumber",
|
|
421
|
+
"type": "uint256"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"internalType": "bytes32",
|
|
425
|
+
"name": "blockHash",
|
|
426
|
+
"type": "bytes32"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"components": [
|
|
430
|
+
{
|
|
431
|
+
"internalType": "bool",
|
|
432
|
+
"name": "success",
|
|
433
|
+
"type": "bool"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"internalType": "bytes",
|
|
437
|
+
"name": "returnData",
|
|
438
|
+
"type": "bytes"
|
|
439
|
+
}
|
|
440
|
+
],
|
|
441
|
+
"internalType": "struct Multicall3.Result[]",
|
|
442
|
+
"name": "returnData",
|
|
443
|
+
"type": "tuple[]"
|
|
444
|
+
}
|
|
445
|
+
],
|
|
446
|
+
"stateMutability": "payable",
|
|
447
|
+
"type": "function"
|
|
448
|
+
}
|
|
449
|
+
];
|
|
450
|
+
/**
|
|
451
|
+
* Multicall3_json Contract Class
|
|
452
|
+
*
|
|
453
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```typescript
|
|
457
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
458
|
+
* import { mainnet } from 'viem/chains';
|
|
459
|
+
* import { Multicall3_json } from 'Multicall3_json';
|
|
460
|
+
*
|
|
461
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
462
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
463
|
+
*
|
|
464
|
+
* const contract = new Multicall3_json('0x...', { publicClient, walletClient });
|
|
465
|
+
*
|
|
466
|
+
* // Read functions
|
|
467
|
+
* const result = await contract.balanceOf('0x...');
|
|
468
|
+
*
|
|
469
|
+
* // Write functions
|
|
470
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
471
|
+
*
|
|
472
|
+
* // Simulate transactions (dry-run)
|
|
473
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
474
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
475
|
+
*
|
|
476
|
+
* // Watch events
|
|
477
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
478
|
+
* console.log('Transfer event:', event);
|
|
479
|
+
* });
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
class Multicall3_json {
|
|
483
|
+
constructor(address, clients) {
|
|
484
|
+
this.contractAddress = address;
|
|
485
|
+
this.publicClient = clients.publicClient;
|
|
486
|
+
this.contract = (0, viem_1.getContract)({
|
|
487
|
+
address,
|
|
488
|
+
abi: exports.Multicall3_jsonAbi,
|
|
489
|
+
client: {
|
|
490
|
+
public: clients.publicClient,
|
|
491
|
+
wallet: clients.walletClient,
|
|
492
|
+
},
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Get the contract address
|
|
497
|
+
*/
|
|
498
|
+
get address() {
|
|
499
|
+
return this.contractAddress;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Get the underlying viem contract instance
|
|
503
|
+
*/
|
|
504
|
+
getContract() {
|
|
505
|
+
return this.contract;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* getBasefee
|
|
509
|
+
* view
|
|
510
|
+
*/
|
|
511
|
+
async getBasefee() {
|
|
512
|
+
return this.contract.read.getBasefee();
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* getBlockHash
|
|
516
|
+
* view
|
|
517
|
+
*/
|
|
518
|
+
async getBlockHash(blockNumber) {
|
|
519
|
+
return this.contract.read.getBlockHash([blockNumber]);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* getBlockNumber
|
|
523
|
+
* view
|
|
524
|
+
*/
|
|
525
|
+
async getBlockNumber() {
|
|
526
|
+
return this.contract.read.getBlockNumber();
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* getChainId
|
|
530
|
+
* view
|
|
531
|
+
*/
|
|
532
|
+
async getChainId() {
|
|
533
|
+
return this.contract.read.getChainId();
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* getCurrentBlockCoinbase
|
|
537
|
+
* view
|
|
538
|
+
*/
|
|
539
|
+
async getCurrentBlockCoinbase() {
|
|
540
|
+
return this.contract.read.getCurrentBlockCoinbase();
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* getCurrentBlockDifficulty
|
|
544
|
+
* view
|
|
545
|
+
*/
|
|
546
|
+
async getCurrentBlockDifficulty() {
|
|
547
|
+
return this.contract.read.getCurrentBlockDifficulty();
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* getCurrentBlockGasLimit
|
|
551
|
+
* view
|
|
552
|
+
*/
|
|
553
|
+
async getCurrentBlockGasLimit() {
|
|
554
|
+
return this.contract.read.getCurrentBlockGasLimit();
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* getCurrentBlockTimestamp
|
|
558
|
+
* view
|
|
559
|
+
*/
|
|
560
|
+
async getCurrentBlockTimestamp() {
|
|
561
|
+
return this.contract.read.getCurrentBlockTimestamp();
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* getEthBalance
|
|
565
|
+
* view
|
|
566
|
+
*/
|
|
567
|
+
async getEthBalance(addr) {
|
|
568
|
+
return this.contract.read.getEthBalance([addr]);
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* getLastBlockHash
|
|
572
|
+
* view
|
|
573
|
+
*/
|
|
574
|
+
async getLastBlockHash() {
|
|
575
|
+
return this.contract.read.getLastBlockHash();
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* aggregate
|
|
579
|
+
* payable
|
|
580
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
581
|
+
*/
|
|
582
|
+
async aggregate(calls, options) {
|
|
583
|
+
if (!this.contract.write) {
|
|
584
|
+
throw new Error('Wallet client is required for write operations');
|
|
585
|
+
}
|
|
586
|
+
return this.contract.write.aggregate([calls], options);
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* aggregate3
|
|
590
|
+
* payable
|
|
591
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
592
|
+
*/
|
|
593
|
+
async aggregate3(calls, options) {
|
|
594
|
+
if (!this.contract.write) {
|
|
595
|
+
throw new Error('Wallet client is required for write operations');
|
|
596
|
+
}
|
|
597
|
+
return this.contract.write.aggregate3([calls], options);
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* aggregate3Value
|
|
601
|
+
* payable
|
|
602
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
603
|
+
*/
|
|
604
|
+
async aggregate3Value(calls, options) {
|
|
605
|
+
if (!this.contract.write) {
|
|
606
|
+
throw new Error('Wallet client is required for write operations');
|
|
607
|
+
}
|
|
608
|
+
return this.contract.write.aggregate3Value([calls], options);
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* blockAndAggregate
|
|
612
|
+
* payable
|
|
613
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
614
|
+
*/
|
|
615
|
+
async blockAndAggregate(calls, options) {
|
|
616
|
+
if (!this.contract.write) {
|
|
617
|
+
throw new Error('Wallet client is required for write operations');
|
|
618
|
+
}
|
|
619
|
+
return this.contract.write.blockAndAggregate([calls], options);
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* tryAggregate
|
|
623
|
+
* payable
|
|
624
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
625
|
+
*/
|
|
626
|
+
async tryAggregate(requireSuccess, calls, options) {
|
|
627
|
+
if (!this.contract.write) {
|
|
628
|
+
throw new Error('Wallet client is required for write operations');
|
|
629
|
+
}
|
|
630
|
+
return this.contract.write.tryAggregate([requireSuccess, calls], options);
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* tryBlockAndAggregate
|
|
634
|
+
* payable
|
|
635
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
636
|
+
*/
|
|
637
|
+
async tryBlockAndAggregate(requireSuccess, calls, options) {
|
|
638
|
+
if (!this.contract.write) {
|
|
639
|
+
throw new Error('Wallet client is required for write operations');
|
|
640
|
+
}
|
|
641
|
+
return this.contract.write.tryBlockAndAggregate([requireSuccess, calls], options);
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
645
|
+
*
|
|
646
|
+
* @example
|
|
647
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
648
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
649
|
+
* console.log('Would succeed:', result.result);
|
|
650
|
+
*/
|
|
651
|
+
get simulate() {
|
|
652
|
+
const contract = this.contract;
|
|
653
|
+
if (!contract.simulate) {
|
|
654
|
+
throw new Error('Public client is required for simulation');
|
|
655
|
+
}
|
|
656
|
+
return {
|
|
657
|
+
/**
|
|
658
|
+
* Simulate aggregate
|
|
659
|
+
* Returns gas estimate and result without sending transaction
|
|
660
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
661
|
+
*/
|
|
662
|
+
async aggregate(calls, options) {
|
|
663
|
+
return contract.simulate.aggregate([calls], options);
|
|
664
|
+
},
|
|
665
|
+
/**
|
|
666
|
+
* Simulate aggregate3
|
|
667
|
+
* Returns gas estimate and result without sending transaction
|
|
668
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
669
|
+
*/
|
|
670
|
+
async aggregate3(calls, options) {
|
|
671
|
+
return contract.simulate.aggregate3([calls], options);
|
|
672
|
+
},
|
|
673
|
+
/**
|
|
674
|
+
* Simulate aggregate3Value
|
|
675
|
+
* Returns gas estimate and result without sending transaction
|
|
676
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
677
|
+
*/
|
|
678
|
+
async aggregate3Value(calls, options) {
|
|
679
|
+
return contract.simulate.aggregate3Value([calls], options);
|
|
680
|
+
},
|
|
681
|
+
/**
|
|
682
|
+
* Simulate blockAndAggregate
|
|
683
|
+
* Returns gas estimate and result without sending transaction
|
|
684
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
685
|
+
*/
|
|
686
|
+
async blockAndAggregate(calls, options) {
|
|
687
|
+
return contract.simulate.blockAndAggregate([calls], options);
|
|
688
|
+
},
|
|
689
|
+
/**
|
|
690
|
+
* Simulate tryAggregate
|
|
691
|
+
* Returns gas estimate and result without sending transaction
|
|
692
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
693
|
+
*/
|
|
694
|
+
async tryAggregate(requireSuccess, calls, options) {
|
|
695
|
+
return contract.simulate.tryAggregate([requireSuccess, calls], options);
|
|
696
|
+
},
|
|
697
|
+
/**
|
|
698
|
+
* Simulate tryBlockAndAggregate
|
|
699
|
+
* Returns gas estimate and result without sending transaction
|
|
700
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
701
|
+
*/
|
|
702
|
+
async tryBlockAndAggregate(requireSuccess, calls, options) {
|
|
703
|
+
return contract.simulate.tryBlockAndAggregate([requireSuccess, calls], options);
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Watch contract events
|
|
709
|
+
*
|
|
710
|
+
* Note: This contract has no events, so watch returns an empty object.
|
|
711
|
+
*/
|
|
712
|
+
get watch() {
|
|
713
|
+
return {};
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
exports.Multicall3_json = Multicall3_json;
|