@gearbox-protocol/sdk 8.27.4 → 8.27.6
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.
|
@@ -87,6 +87,25 @@ async function simulateWithPriceUpdates(client, parameters) {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
if (parameters.blockNumber && // this does not work for default multicall3 contracts on some L2 chains, so check on Eth Mainnet only
|
|
91
|
+
// https://docs.arbitrum.io/build-decentralized-apps/arbitrum-vs-ethereum/block-numbers-and-time#case-study-the-multicall-contract
|
|
92
|
+
(client.chain?.id === 1 || parameters.forceBlockNumberCheck)) {
|
|
93
|
+
const r = multicallResults[1];
|
|
94
|
+
if (r.status === "success") {
|
|
95
|
+
const fromMc = BigInt(r.result);
|
|
96
|
+
if (!!r.result && fromMc !== parameters.blockNumber) {
|
|
97
|
+
throw getSimulateWithPriceUpdatesError(
|
|
98
|
+
new import_viem.BaseError(
|
|
99
|
+
`block number returned from multicall (${fromMc}) is different from the one provided (${parameters.blockNumber})`
|
|
100
|
+
),
|
|
101
|
+
priceUpdates,
|
|
102
|
+
restContracts,
|
|
103
|
+
multicallResults,
|
|
104
|
+
request
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
90
109
|
if (hasError) {
|
|
91
110
|
const err = getSimulateWithPriceUpdatesError(
|
|
92
111
|
void 0,
|
|
@@ -68,6 +68,25 @@ async function simulateWithPriceUpdates(client, parameters) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
if (parameters.blockNumber && // this does not work for default multicall3 contracts on some L2 chains, so check on Eth Mainnet only
|
|
72
|
+
// https://docs.arbitrum.io/build-decentralized-apps/arbitrum-vs-ethereum/block-numbers-and-time#case-study-the-multicall-contract
|
|
73
|
+
(client.chain?.id === 1 || parameters.forceBlockNumberCheck)) {
|
|
74
|
+
const r = multicallResults[1];
|
|
75
|
+
if (r.status === "success") {
|
|
76
|
+
const fromMc = BigInt(r.result);
|
|
77
|
+
if (!!r.result && fromMc !== parameters.blockNumber) {
|
|
78
|
+
throw getSimulateWithPriceUpdatesError(
|
|
79
|
+
new BaseError(
|
|
80
|
+
`block number returned from multicall (${fromMc}) is different from the one provided (${parameters.blockNumber})`
|
|
81
|
+
),
|
|
82
|
+
priceUpdates,
|
|
83
|
+
restContracts,
|
|
84
|
+
multicallResults,
|
|
85
|
+
request
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
71
90
|
if (hasError) {
|
|
72
91
|
const err = getSimulateWithPriceUpdatesError(
|
|
73
92
|
void 0,
|
|
@@ -13,6 +13,10 @@ export type SimulateWithPriceUpdatesParameters<contracts extends readonly unknow
|
|
|
13
13
|
* Defaults to false
|
|
14
14
|
*/
|
|
15
15
|
strictPrices?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Always check block number from multicall
|
|
18
|
+
*/
|
|
19
|
+
forceBlockNumberCheck?: boolean;
|
|
16
20
|
};
|
|
17
21
|
export type SimulateWithPriceUpdatesReturnType<contracts extends readonly unknown[] = readonly ContractFunctionParameters[], options extends {
|
|
18
22
|
error?: Error;
|