@gearbox-protocol/sdk 8.1.4 → 8.1.5
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.
|
@@ -91,31 +91,13 @@ async function simulateMulticall(client, parameters) {
|
|
|
91
91
|
account
|
|
92
92
|
};
|
|
93
93
|
const results = [];
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
data: data || "0x"
|
|
102
|
-
});
|
|
103
|
-
} catch (e) {
|
|
104
|
-
if (!allowFailure) {
|
|
105
|
-
throw e;
|
|
106
|
-
}
|
|
107
|
-
for (const _ of contracts) {
|
|
108
|
-
results.push({
|
|
109
|
-
status: "failure",
|
|
110
|
-
error: e,
|
|
111
|
-
result: void 0
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
results,
|
|
116
|
-
request
|
|
117
|
-
};
|
|
118
|
-
}
|
|
94
|
+
const { data } = await (0, import_utils.getAction)(client, import_actions.call, "call")(request);
|
|
95
|
+
const result = (0, import_viem.decodeFunctionResult)({
|
|
96
|
+
abi: import_viem.multicall3Abi,
|
|
97
|
+
args: [calls],
|
|
98
|
+
functionName: "aggregate3",
|
|
99
|
+
data: data || "0x"
|
|
100
|
+
});
|
|
119
101
|
for (let j = 0; j < result.length; j++) {
|
|
120
102
|
const { returnData, success } = result[j];
|
|
121
103
|
const { callData } = calls[j];
|
|
@@ -77,31 +77,13 @@ async function simulateMulticall(client, parameters) {
|
|
|
77
77
|
account
|
|
78
78
|
};
|
|
79
79
|
const results = [];
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
data: data || "0x"
|
|
88
|
-
});
|
|
89
|
-
} catch (e) {
|
|
90
|
-
if (!allowFailure) {
|
|
91
|
-
throw e;
|
|
92
|
-
}
|
|
93
|
-
for (const _ of contracts) {
|
|
94
|
-
results.push({
|
|
95
|
-
status: "failure",
|
|
96
|
-
error: e,
|
|
97
|
-
result: void 0
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return {
|
|
101
|
-
results,
|
|
102
|
-
request
|
|
103
|
-
};
|
|
104
|
-
}
|
|
80
|
+
const { data } = await getAction(client, call, "call")(request);
|
|
81
|
+
const result = decodeFunctionResult({
|
|
82
|
+
abi: multicall3Abi,
|
|
83
|
+
args: [calls],
|
|
84
|
+
functionName: "aggregate3",
|
|
85
|
+
data: data || "0x"
|
|
86
|
+
});
|
|
105
87
|
for (let j = 0; j < result.length; j++) {
|
|
106
88
|
const { returnData, success } = result[j];
|
|
107
89
|
const { callData } = calls[j];
|
|
@@ -23,6 +23,10 @@ export interface SimulateMulticallReturnType<contracts extends readonly unknown[
|
|
|
23
23
|
/**
|
|
24
24
|
* This is "multicall" action from viem, modified to use "simulateContract" instead of "readContract"
|
|
25
25
|
* Unlike viem's multicall there's no batching, since for simulation we assume that calls are dependent
|
|
26
|
+
*
|
|
27
|
+
* Another difference is how network errors are threated
|
|
28
|
+
* In case of multicall-level error (network, out of gas, header not found, etc.) this method will throw even with allowFailure=true,
|
|
29
|
+
* while original multicall with allowFailure=true will return `failure` for all calls, and push error down to each call
|
|
26
30
|
* @param client
|
|
27
31
|
* @param parameters
|
|
28
32
|
* @returns
|