@woof-software/contracts-tools-sdk-ethers 0.0.10 → 0.0.12

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,5 +1,5 @@
1
- import { Contract as EthersContract, type Interface, type InterfaceAbi, type Listener, type LogDescription, type Provider, type Signer } from "ethers";
2
- import { type ContractCall, type ContractCallOptions, type ContractGetLogsOptions, type ContractOptions, type DynamicContractConstructor } from "../types";
1
+ import { Contract as EthersContract, type Interface, type InterfaceAbi, type Listener, type Provider, type Signer } from "ethers";
2
+ import { type ContractCall, type ContractCallOptions, type ContractGetLogsOptions, type ContractLog, type ContractOptions, type DynamicContractConstructor } from "../types";
3
3
  export declare class BaseContract {
4
4
  readonly address: string;
5
5
  readonly driver?: Signer | Provider;
@@ -14,10 +14,11 @@ export declare class BaseContract {
14
14
  get signer(): Signer | null;
15
15
  get interface(): Interface;
16
16
  call<T>(method: string, args?: any[], options?: ContractCallOptions): Promise<Awaited<T>>;
17
+ estimate(method: string, args?: any[], options?: ContractCallOptions): Promise<bigint>;
17
18
  getCall(methodName: string, args?: any[], callData?: {}): ContractCall;
18
19
  listenEvent(eventName: string, listener: Listener): Promise<EthersContract>;
19
- getLogs(fromBlock: number, eventsNames?: string[], toBlock?: number, options?: ContractGetLogsOptions): Promise<LogDescription[]>;
20
+ getLogs(fromBlock: number, eventsNames?: string[], toBlock?: number, options?: ContractGetLogsOptions): Promise<ContractLog[]>;
20
21
  getLogsStream(fromBlock: number, eventsNames?: string[], toBlock?: number, // Latest by default
21
- options?: ContractGetLogsOptions): AsyncGenerator<LogDescription, void>;
22
+ options?: ContractGetLogsOptions): AsyncGenerator<ContractLog, void>;
22
23
  private getTimeoutSignal;
23
24
  }
@@ -1,7 +1,7 @@
1
1
  import { Contract as EthersContract, WebSocketProvider, } from "ethers";
2
2
  import { config } from "../config.js";
3
3
  import { CONTRACTS_ERRORS } from "../errors/index.js";
4
- import { isSigner, isStaticMethod, priorityCall } from "../helpers/index.js";
4
+ import { isSigner, isStaticMethod, priorityCall, priorityCallEstimate, } from "../helpers/index.js";
5
5
  import { CallMutability, } from "../types/index.js";
6
6
  import { checkSignals, createTimeoutSignal, raceWithSignals, waitWithSignals, } from "../utils/index.js";
7
7
  import { contractCreateCallName } from "./contract-create-call-name.js";
@@ -107,6 +107,42 @@ export class BaseContract {
107
107
  return tx;
108
108
  }
109
109
  }
110
+ async estimate(method, args = [], options = {}) {
111
+ if (!this.isCallable)
112
+ throw CONTRACTS_ERRORS.NON_CALLABLE_CONTRACT_INVOCATION;
113
+ const methodFn = this.contract[method];
114
+ if (!methodFn)
115
+ throw CONTRACTS_ERRORS.METHOD_NOT_DEFINED(method);
116
+ const functionFragment = this.contract.interface.getFunction(method);
117
+ if (!functionFragment)
118
+ throw CONTRACTS_ERRORS.FRAGMENT_NOT_DEFINED(method);
119
+ if (isStaticMethod(functionFragment.stateMutability))
120
+ throw CONTRACTS_ERRORS.ESTIMATE_STATIC_CALL(method);
121
+ const callOptions = {
122
+ highPriorityTx: this.contractOptions.highPriorityTxs,
123
+ priorityOptions: this.contractOptions.priorityOptions,
124
+ ...options,
125
+ };
126
+ const localSignals = [];
127
+ if (callOptions.signals)
128
+ localSignals.push(...callOptions.signals);
129
+ if (callOptions.timeoutMs)
130
+ localSignals.push(this.getTimeoutSignal(false, callOptions.timeoutMs));
131
+ if (this.isReadonly)
132
+ throw CONTRACTS_ERRORS.READ_ONLY_CONTRACT_MUTATION;
133
+ let estimate;
134
+ if (callOptions.highPriorityTx) {
135
+ const provider = this.driver?.provider;
136
+ estimate = await raceWithSignals(() => priorityCallEstimate(provider, this.driver, this.contract, method, args, {
137
+ signals: localSignals,
138
+ ...options.priorityOptions,
139
+ }), localSignals);
140
+ }
141
+ else {
142
+ estimate = await raceWithSignals(() => this.contract[method].estimateGas(...args), localSignals);
143
+ }
144
+ return estimate;
145
+ }
110
146
  getCall(methodName, args = [], callData = {}) {
111
147
  if (!this.address)
112
148
  throw CONTRACTS_ERRORS.NON_CALLABLE_CONTRACT_INVOCATION;
@@ -168,7 +204,10 @@ export class BaseContract {
168
204
  const description = this.interface.parseLog(log);
169
205
  if (!description)
170
206
  continue;
171
- yield description;
207
+ yield {
208
+ log,
209
+ description,
210
+ };
172
211
  }
173
212
  await waitWithSignals(streamOptions.delayMs, options.signals);
174
213
  }
@@ -6,4 +6,5 @@ export declare const CONTRACTS_ERRORS: {
6
6
  FRAGMENT_NOT_DEFINED: (methodName: any) => Error;
7
7
  MISSING_WEBSOCKET_PROVIDER: Error;
8
8
  MISSING_PROVIDER: Error;
9
+ ESTIMATE_STATIC_CALL: (methodName: any) => Error;
9
10
  };
@@ -6,4 +6,5 @@ export const CONTRACTS_ERRORS = {
6
6
  FRAGMENT_NOT_DEFINED: (methodName) => new Error(`Fragment for method "${methodName}" was not found on the contract!`),
7
7
  MISSING_WEBSOCKET_PROVIDER: new Error("Attempted to listen for contract events, but no WebSocketProvider was provided!"),
8
8
  MISSING_PROVIDER: new Error("A provider is required, but none was provided!"),
9
+ ESTIMATE_STATIC_CALL: (methodName) => new Error(`Cannot estimate gas for static (view/pure) method "${methodName}"!`),
9
10
  };
@@ -1,3 +1,4 @@
1
1
  import type { Contract, Provider, Signer } from "ethers";
2
2
  import type { PriorityCallOptions } from "../types";
3
3
  export declare function priorityCall(provider: Provider, signer: Signer, contract: Contract, method: string, args?: any[], options?: PriorityCallOptions): Promise<any>;
4
+ export declare function priorityCallEstimate(provider: Provider, signer: Signer, contract: Contract, method: string, args?: any[], options?: PriorityCallOptions): Promise<bigint>;
@@ -1,8 +1,16 @@
1
- import { DEFAULT_PRIORITY_CALL_MULTIPLIER } from "../constant.js";
1
+ import { config } from "../config.js";
2
2
  import { checkSignals, createTimeoutSignal } from "../utils/index.js";
3
3
  export async function priorityCall(provider, signer, contract, method, args = [], options = {}) {
4
+ const txn = await formTx(provider, signer, contract, method, args, options);
5
+ return signer.sendTransaction(txn);
6
+ }
7
+ export async function priorityCallEstimate(provider, signer, contract, method, args = [], options = {}) {
8
+ const txn = await formTx(provider, signer, contract, method, args, options);
9
+ return signer.estimateGas(txn);
10
+ }
11
+ async function formTx(provider, signer, contract, method, args = [], options = {}) {
4
12
  const localOptions = {
5
- multiplier: DEFAULT_PRIORITY_CALL_MULTIPLIER,
13
+ multiplier: config.priorityCalls.multiplier,
6
14
  ...options,
7
15
  };
8
16
  const localSignals = [];
@@ -16,9 +24,7 @@ export async function priorityCall(provider, signer, contract, method, args = []
16
24
  const maxPriorityFeePerGas = Math.ceil(localOptions.multiplier * Number(originalFeeData.maxPriorityFeePerGas));
17
25
  const gasLimit = Math.ceil(localOptions.multiplier * Number(originalGasLimit));
18
26
  checkSignals(localSignals);
19
- const txn = await contract
20
- .getFunction(method)
21
- .populateTransaction(...args, {
27
+ const txn = await contract.getFunction(method).populateTransaction(...args, {
22
28
  gasLimit,
23
29
  maxFeePerGas,
24
30
  maxPriorityFeePerGas,
@@ -31,11 +37,11 @@ export async function priorityCall(provider, signer, contract, method, args = []
31
37
  const network = await provider.getNetwork();
32
38
  txn.chainId = network.chainId;
33
39
  }
34
- else if (localOptions.chainId) {
35
- txn.chainId = localOptions.chainId;
40
+ else {
41
+ if (localOptions.chainId)
42
+ txn.chainId = localOptions.chainId;
36
43
  }
37
- checkSignals(localSignals);
38
- return signer.sendTransaction(txn);
44
+ return txn;
39
45
  }
40
46
  async function gatherOriginalData(provider, contract, method, args = [], asynchronous, signals) {
41
47
  let originalFeeData;
@@ -30,8 +30,11 @@ export declare class MulticallUnit extends BaseContract {
30
30
  getArray<T>(tags: MulticallTags, deep?: boolean): T | null;
31
31
  getArrayOrThrow<T>(tags: MulticallTags, deep?: boolean): T;
32
32
  run(options?: Partial<MulticallOptions>): Promise<boolean>;
33
+ estimateRun(options?: MulticallOptions): Promise<bigint[]>;
34
+ private splitCalls;
33
35
  private processStaticCalls;
34
36
  private processMutableCalls;
37
+ private estimateMutableCallsBatch;
35
38
  private saveResponse;
36
39
  getOrThrow<T>(tags: MulticallTags, deep?: boolean): T;
37
40
  get<T>(tags: MulticallTags, deep?: boolean): T | null;
@@ -119,35 +119,7 @@ export class MulticallUnit extends BaseContract {
119
119
  this._response = Array(tags.length).fill([undefined, null]);
120
120
  try {
121
121
  checkSignals(runOptions.signals);
122
- let staticCalls;
123
- let staticIndexes;
124
- let mutableCalls;
125
- let mutableTags;
126
- let mutableIndexes;
127
- if (runOptions.forceMutability) {
128
- if (runOptions.forceMutability === CallMutability.Static) {
129
- staticCalls = calls;
130
- staticIndexes = Array.from({ length: calls.length }, (_, i) => i);
131
- mutableCalls = [];
132
- mutableTags = [];
133
- mutableIndexes = [];
134
- }
135
- else {
136
- staticCalls = [];
137
- staticIndexes = [];
138
- mutableCalls = calls;
139
- mutableTags = tags;
140
- mutableIndexes = Array.from({ length: calls.length }, (_, i) => i);
141
- }
142
- }
143
- else {
144
- const split = multicallSplitCalls(calls, tags);
145
- staticCalls = split.staticCalls;
146
- staticIndexes = split.staticIndexes;
147
- mutableCalls = split.mutableCalls;
148
- mutableTags = split.mutableTags;
149
- mutableIndexes = split.mutableIndexes;
150
- }
122
+ const { staticCalls, staticIndexes, mutableCalls, mutableTags, mutableIndexes, } = this.splitCalls(calls, tags, options.forceMutability);
151
123
  // Process mutable
152
124
  for (let i = 0; i < mutableCalls.length; i += runOptions.maxMutableCallsStack) {
153
125
  checkSignals(runOptions.signals);
@@ -180,6 +152,65 @@ export class MulticallUnit extends BaseContract {
180
152
  }
181
153
  return this._lastSuccess ?? false;
182
154
  }
155
+ async estimateRun(options = {}) {
156
+ const runOptions = {
157
+ ...this._multicallOptions,
158
+ ...options,
159
+ };
160
+ const tags = this.tags;
161
+ const calls = this.calls;
162
+ checkSignals(runOptions.signals);
163
+ const { mutableCalls, mutableTags } = this.splitCalls(calls, tags, options.forceMutability);
164
+ const estimates = [];
165
+ // Process mutable
166
+ for (let i = 0; i < mutableCalls.length; i += runOptions.maxMutableCallsStack) {
167
+ checkSignals(runOptions.signals);
168
+ const border = Math.min(i + runOptions.maxMutableCallsStack, mutableCalls.length);
169
+ const iterationCalls = mutableCalls.slice(i, border); // half-opened interval
170
+ const iterationTags = mutableTags.slice(i, border);
171
+ const estimation = await this.estimateMutableCallsBatch(iterationCalls, iterationTags, runOptions);
172
+ estimates.push(estimation);
173
+ }
174
+ return estimates;
175
+ }
176
+ splitCalls(calls, tags, forceMutability) {
177
+ let staticCalls;
178
+ let staticIndexes;
179
+ let mutableCalls;
180
+ let mutableTags;
181
+ let mutableIndexes;
182
+ if (forceMutability) {
183
+ if (forceMutability === CallMutability.Static) {
184
+ staticCalls = calls;
185
+ staticIndexes = Array.from({ length: calls.length }, (_, i) => i);
186
+ mutableCalls = [];
187
+ mutableTags = [];
188
+ mutableIndexes = [];
189
+ }
190
+ else {
191
+ staticCalls = [];
192
+ staticIndexes = [];
193
+ mutableCalls = calls;
194
+ mutableTags = tags;
195
+ mutableIndexes = Array.from({ length: calls.length }, (_, i) => i);
196
+ }
197
+ }
198
+ else {
199
+ const split = multicallSplitCalls(calls, tags);
200
+ staticCalls = split.staticCalls;
201
+ staticIndexes = split.staticIndexes;
202
+ mutableCalls = split.mutableCalls;
203
+ mutableTags = split.mutableTags;
204
+ mutableIndexes = split.mutableIndexes;
205
+ }
206
+ return {
207
+ staticCalls,
208
+ staticIndexes,
209
+ mutableCalls,
210
+ mutableTags,
211
+ mutableIndexes,
212
+ };
213
+ }
183
214
  async processStaticCalls(iterationCalls, runOptions) {
184
215
  const result = await this.call(aggregate3, [iterationCalls], {
185
216
  forceMutability: CallMutability.Static,
@@ -217,6 +248,15 @@ export class MulticallUnit extends BaseContract {
217
248
  }
218
249
  return result;
219
250
  }
251
+ async estimateMutableCallsBatch(iterationCalls, iterationTags, runOptions) {
252
+ return this.estimate(aggregate3, [iterationCalls], {
253
+ forceMutability: CallMutability.Mutable,
254
+ highPriorityTx: runOptions.highPriorityTxs,
255
+ priorityOptions: runOptions.priorityOptions,
256
+ signals: runOptions.signals,
257
+ timeoutMs: runOptions.mutableCallsTimeoutMs,
258
+ });
259
+ }
220
260
  saveResponse(iterationResponse, iterationIndexes, globalTags) {
221
261
  iterationResponse.forEach((el, index) => {
222
262
  const [success, data] = el;
@@ -0,0 +1,5 @@
1
+ import type { Log, LogDescription } from "ethers";
2
+ export interface ContractLog {
3
+ log: Log;
4
+ description: LogDescription;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  export * from "./contract-call";
2
2
  export * from "./contract-call-options";
3
3
  export * from "./contract-get-logs-options";
4
+ export * from "./contract-log";
4
5
  export * from "./contract-options";
5
6
  export * from "./dynamic-contract";
6
7
  export * from "./dynamic-contract-constructor";
@@ -1,6 +1,7 @@
1
1
  export * from "./contract-call.js";
2
2
  export * from "./contract-call-options.js";
3
3
  export * from "./contract-get-logs-options.js";
4
+ export * from "./contract-log.js";
4
5
  export * from "./contract-options.js";
5
6
  export * from "./dynamic-contract.js";
6
7
  export * from "./dynamic-contract-constructor.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@woof-software/contracts-tools-sdk-ethers",
3
3
  "description": "Module simplify smart contract interactions and multicall3 aggregation on the Ethereum blockchain and other EVM-compatible networks.",
4
- "version": "0.0.10",
4
+ "version": "0.0.12",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/woof-compound/sandbox-sdks.git"
@@ -1,440 +0,0 @@
1
- [
2
- {
3
- "inputs": [
4
- {
5
- "components": [
6
- {
7
- "internalType": "address",
8
- "name": "target",
9
- "type": "address"
10
- },
11
- {
12
- "internalType": "bytes",
13
- "name": "callData",
14
- "type": "bytes"
15
- }
16
- ],
17
- "internalType": "struct Multicall3.Call[]",
18
- "name": "calls",
19
- "type": "tuple[]"
20
- }
21
- ],
22
- "name": "aggregate",
23
- "outputs": [
24
- {
25
- "internalType": "uint256",
26
- "name": "blockNumber",
27
- "type": "uint256"
28
- },
29
- {
30
- "internalType": "bytes[]",
31
- "name": "returnData",
32
- "type": "bytes[]"
33
- }
34
- ],
35
- "stateMutability": "payable",
36
- "type": "function"
37
- },
38
- {
39
- "inputs": [
40
- {
41
- "components": [
42
- {
43
- "internalType": "address",
44
- "name": "target",
45
- "type": "address"
46
- },
47
- {
48
- "internalType": "bool",
49
- "name": "allowFailure",
50
- "type": "bool"
51
- },
52
- {
53
- "internalType": "bytes",
54
- "name": "callData",
55
- "type": "bytes"
56
- }
57
- ],
58
- "internalType": "struct Multicall3.Call3[]",
59
- "name": "calls",
60
- "type": "tuple[]"
61
- }
62
- ],
63
- "name": "aggregate3",
64
- "outputs": [
65
- {
66
- "components": [
67
- {
68
- "internalType": "bool",
69
- "name": "success",
70
- "type": "bool"
71
- },
72
- {
73
- "internalType": "bytes",
74
- "name": "returnData",
75
- "type": "bytes"
76
- }
77
- ],
78
- "internalType": "struct Multicall3.Result[]",
79
- "name": "returnData",
80
- "type": "tuple[]"
81
- }
82
- ],
83
- "stateMutability": "payable",
84
- "type": "function"
85
- },
86
- {
87
- "inputs": [
88
- {
89
- "components": [
90
- {
91
- "internalType": "address",
92
- "name": "target",
93
- "type": "address"
94
- },
95
- {
96
- "internalType": "bool",
97
- "name": "allowFailure",
98
- "type": "bool"
99
- },
100
- {
101
- "internalType": "uint256",
102
- "name": "value",
103
- "type": "uint256"
104
- },
105
- {
106
- "internalType": "bytes",
107
- "name": "callData",
108
- "type": "bytes"
109
- }
110
- ],
111
- "internalType": "struct Multicall3.Call3Value[]",
112
- "name": "calls",
113
- "type": "tuple[]"
114
- }
115
- ],
116
- "name": "aggregate3Value",
117
- "outputs": [
118
- {
119
- "components": [
120
- {
121
- "internalType": "bool",
122
- "name": "success",
123
- "type": "bool"
124
- },
125
- {
126
- "internalType": "bytes",
127
- "name": "returnData",
128
- "type": "bytes"
129
- }
130
- ],
131
- "internalType": "struct Multicall3.Result[]",
132
- "name": "returnData",
133
- "type": "tuple[]"
134
- }
135
- ],
136
- "stateMutability": "payable",
137
- "type": "function"
138
- },
139
- {
140
- "inputs": [
141
- {
142
- "components": [
143
- {
144
- "internalType": "address",
145
- "name": "target",
146
- "type": "address"
147
- },
148
- {
149
- "internalType": "bytes",
150
- "name": "callData",
151
- "type": "bytes"
152
- }
153
- ],
154
- "internalType": "struct Multicall3.Call[]",
155
- "name": "calls",
156
- "type": "tuple[]"
157
- }
158
- ],
159
- "name": "blockAndAggregate",
160
- "outputs": [
161
- {
162
- "internalType": "uint256",
163
- "name": "blockNumber",
164
- "type": "uint256"
165
- },
166
- {
167
- "internalType": "bytes32",
168
- "name": "blockHash",
169
- "type": "bytes32"
170
- },
171
- {
172
- "components": [
173
- {
174
- "internalType": "bool",
175
- "name": "success",
176
- "type": "bool"
177
- },
178
- {
179
- "internalType": "bytes",
180
- "name": "returnData",
181
- "type": "bytes"
182
- }
183
- ],
184
- "internalType": "struct Multicall3.Result[]",
185
- "name": "returnData",
186
- "type": "tuple[]"
187
- }
188
- ],
189
- "stateMutability": "payable",
190
- "type": "function"
191
- },
192
- {
193
- "inputs": [],
194
- "name": "getBasefee",
195
- "outputs": [
196
- {
197
- "internalType": "uint256",
198
- "name": "basefee",
199
- "type": "uint256"
200
- }
201
- ],
202
- "stateMutability": "view",
203
- "type": "function"
204
- },
205
- {
206
- "inputs": [
207
- {
208
- "internalType": "uint256",
209
- "name": "blockNumber",
210
- "type": "uint256"
211
- }
212
- ],
213
- "name": "getBlockHash",
214
- "outputs": [
215
- {
216
- "internalType": "bytes32",
217
- "name": "blockHash",
218
- "type": "bytes32"
219
- }
220
- ],
221
- "stateMutability": "view",
222
- "type": "function"
223
- },
224
- {
225
- "inputs": [],
226
- "name": "getBlockNumber",
227
- "outputs": [
228
- {
229
- "internalType": "uint256",
230
- "name": "blockNumber",
231
- "type": "uint256"
232
- }
233
- ],
234
- "stateMutability": "view",
235
- "type": "function"
236
- },
237
- {
238
- "inputs": [],
239
- "name": "getChainId",
240
- "outputs": [
241
- {
242
- "internalType": "uint256",
243
- "name": "chainid",
244
- "type": "uint256"
245
- }
246
- ],
247
- "stateMutability": "view",
248
- "type": "function"
249
- },
250
- {
251
- "inputs": [],
252
- "name": "getCurrentBlockCoinbase",
253
- "outputs": [
254
- {
255
- "internalType": "address",
256
- "name": "coinbase",
257
- "type": "address"
258
- }
259
- ],
260
- "stateMutability": "view",
261
- "type": "function"
262
- },
263
- {
264
- "inputs": [],
265
- "name": "getCurrentBlockDifficulty",
266
- "outputs": [
267
- {
268
- "internalType": "uint256",
269
- "name": "difficulty",
270
- "type": "uint256"
271
- }
272
- ],
273
- "stateMutability": "view",
274
- "type": "function"
275
- },
276
- {
277
- "inputs": [],
278
- "name": "getCurrentBlockGasLimit",
279
- "outputs": [
280
- {
281
- "internalType": "uint256",
282
- "name": "gaslimit",
283
- "type": "uint256"
284
- }
285
- ],
286
- "stateMutability": "view",
287
- "type": "function"
288
- },
289
- {
290
- "inputs": [],
291
- "name": "getCurrentBlockTimestamp",
292
- "outputs": [
293
- {
294
- "internalType": "uint256",
295
- "name": "timestamp",
296
- "type": "uint256"
297
- }
298
- ],
299
- "stateMutability": "view",
300
- "type": "function"
301
- },
302
- {
303
- "inputs": [
304
- {
305
- "internalType": "address",
306
- "name": "addr",
307
- "type": "address"
308
- }
309
- ],
310
- "name": "getEthBalance",
311
- "outputs": [
312
- {
313
- "internalType": "uint256",
314
- "name": "balance",
315
- "type": "uint256"
316
- }
317
- ],
318
- "stateMutability": "view",
319
- "type": "function"
320
- },
321
- {
322
- "inputs": [],
323
- "name": "getLastBlockHash",
324
- "outputs": [
325
- {
326
- "internalType": "bytes32",
327
- "name": "blockHash",
328
- "type": "bytes32"
329
- }
330
- ],
331
- "stateMutability": "view",
332
- "type": "function"
333
- },
334
- {
335
- "inputs": [
336
- {
337
- "internalType": "bool",
338
- "name": "requireSuccess",
339
- "type": "bool"
340
- },
341
- {
342
- "components": [
343
- {
344
- "internalType": "address",
345
- "name": "target",
346
- "type": "address"
347
- },
348
- {
349
- "internalType": "bytes",
350
- "name": "callData",
351
- "type": "bytes"
352
- }
353
- ],
354
- "internalType": "struct Multicall3.Call[]",
355
- "name": "calls",
356
- "type": "tuple[]"
357
- }
358
- ],
359
- "name": "tryAggregate",
360
- "outputs": [
361
- {
362
- "components": [
363
- {
364
- "internalType": "bool",
365
- "name": "success",
366
- "type": "bool"
367
- },
368
- {
369
- "internalType": "bytes",
370
- "name": "returnData",
371
- "type": "bytes"
372
- }
373
- ],
374
- "internalType": "struct Multicall3.Result[]",
375
- "name": "returnData",
376
- "type": "tuple[]"
377
- }
378
- ],
379
- "stateMutability": "payable",
380
- "type": "function"
381
- },
382
- {
383
- "inputs": [
384
- {
385
- "internalType": "bool",
386
- "name": "requireSuccess",
387
- "type": "bool"
388
- },
389
- {
390
- "components": [
391
- {
392
- "internalType": "address",
393
- "name": "target",
394
- "type": "address"
395
- },
396
- {
397
- "internalType": "bytes",
398
- "name": "callData",
399
- "type": "bytes"
400
- }
401
- ],
402
- "internalType": "struct Multicall3.Call[]",
403
- "name": "calls",
404
- "type": "tuple[]"
405
- }
406
- ],
407
- "name": "tryBlockAndAggregate",
408
- "outputs": [
409
- {
410
- "internalType": "uint256",
411
- "name": "blockNumber",
412
- "type": "uint256"
413
- },
414
- {
415
- "internalType": "bytes32",
416
- "name": "blockHash",
417
- "type": "bytes32"
418
- },
419
- {
420
- "components": [
421
- {
422
- "internalType": "bool",
423
- "name": "success",
424
- "type": "bool"
425
- },
426
- {
427
- "internalType": "bytes",
428
- "name": "returnData",
429
- "type": "bytes"
430
- }
431
- ],
432
- "internalType": "struct Multicall3.Result[]",
433
- "name": "returnData",
434
- "type": "tuple[]"
435
- }
436
- ],
437
- "stateMutability": "payable",
438
- "type": "function"
439
- }
440
- ]