@gearbox-protocol/sdk 3.0.0-vfour.351 → 3.0.0-vfour.352
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.
|
@@ -31,7 +31,12 @@ const multicallTimestampAbi = (0, import_viem.parseAbi)([
|
|
|
31
31
|
]);
|
|
32
32
|
const updatePriceFeedAbi = [...import_abi.iUpdatablePriceFeedAbi, ...import_abi.errorAbis];
|
|
33
33
|
async function simulateWithPriceUpdates(client, parameters) {
|
|
34
|
-
const {
|
|
34
|
+
const {
|
|
35
|
+
contracts: restContracts,
|
|
36
|
+
priceUpdates,
|
|
37
|
+
strictPrices = false,
|
|
38
|
+
...rest
|
|
39
|
+
} = parameters;
|
|
35
40
|
if (restContracts.length === 0) {
|
|
36
41
|
throw getSimulateWithPriceUpdatesError(
|
|
37
42
|
new import_viem.BaseError("no contracts calls provided"),
|
|
@@ -63,13 +68,17 @@ async function simulateWithPriceUpdates(client, parameters) {
|
|
|
63
68
|
batchSize: 0
|
|
64
69
|
// we cannot have price updates and compressor request in different batches
|
|
65
70
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
for (let i = 0; i < resp.length; i++) {
|
|
72
|
+
if (resp[i].status === "failure") {
|
|
73
|
+
if (i > priceUpdates.length || i > 0 && strictPrices) {
|
|
74
|
+
throw getSimulateWithPriceUpdatesError(
|
|
75
|
+
void 0,
|
|
76
|
+
priceUpdates,
|
|
77
|
+
restContracts,
|
|
78
|
+
resp
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
73
82
|
}
|
|
74
83
|
const restResults = resp.slice(priceUpdates.length + 1).map((r) => r.result);
|
|
75
84
|
return restResults;
|
|
@@ -11,7 +11,12 @@ const multicallTimestampAbi = parseAbi([
|
|
|
11
11
|
]);
|
|
12
12
|
const updatePriceFeedAbi = [...iUpdatablePriceFeedAbi, ...errorAbis];
|
|
13
13
|
async function simulateWithPriceUpdates(client, parameters) {
|
|
14
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
contracts: restContracts,
|
|
16
|
+
priceUpdates,
|
|
17
|
+
strictPrices = false,
|
|
18
|
+
...rest
|
|
19
|
+
} = parameters;
|
|
15
20
|
if (restContracts.length === 0) {
|
|
16
21
|
throw getSimulateWithPriceUpdatesError(
|
|
17
22
|
new BaseError("no contracts calls provided"),
|
|
@@ -43,13 +48,17 @@ async function simulateWithPriceUpdates(client, parameters) {
|
|
|
43
48
|
batchSize: 0
|
|
44
49
|
// we cannot have price updates and compressor request in different batches
|
|
45
50
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
for (let i = 0; i < resp.length; i++) {
|
|
52
|
+
if (resp[i].status === "failure") {
|
|
53
|
+
if (i > priceUpdates.length || i > 0 && strictPrices) {
|
|
54
|
+
throw getSimulateWithPriceUpdatesError(
|
|
55
|
+
void 0,
|
|
56
|
+
priceUpdates,
|
|
57
|
+
restContracts,
|
|
58
|
+
resp
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
const restResults = resp.slice(priceUpdates.length + 1).map((r) => r.result);
|
|
55
64
|
return restResults;
|
|
@@ -10,6 +10,11 @@ export type SimulateWithPriceUpdatesParameters<contracts extends readonly unknow
|
|
|
10
10
|
contracts: MulticallContracts<Narrow<contracts>, {
|
|
11
11
|
mutability: AbiStateMutability;
|
|
12
12
|
}>;
|
|
13
|
+
/**
|
|
14
|
+
* If true, price updates are not allowed to fail
|
|
15
|
+
* Defaults to false
|
|
16
|
+
*/
|
|
17
|
+
strictPrices?: boolean;
|
|
13
18
|
};
|
|
14
19
|
export type SimulateWithPriceUpdatesReturnType<contracts extends readonly unknown[] = readonly ContractFunctionParameters[], options extends {
|
|
15
20
|
error?: Error;
|