@cryptorubic/web3 1.9.0-alpha.rub-3140.1 → 1.9.0-alpha.rub-3140.2
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/package.json
CHANGED
|
@@ -132,8 +132,6 @@ class EvmAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
132
132
|
const customViemConfig = this.clientParams?.viemConfig?.[this.blockchain];
|
|
133
133
|
const transportConfig = {
|
|
134
134
|
batch: { batchSize: 2000, wait: 16 },
|
|
135
|
-
// viem reads the response body as a stream to enforce this limit, which fails on
|
|
136
|
-
// `node-fetch`-based fetch polyfills, where `response.body` is not a ReadableStream.
|
|
137
135
|
maxResponseBodySize: false,
|
|
138
136
|
onFetchResponse: (response) => this.handlePossibleError(response),
|
|
139
137
|
retryCount: 2,
|
|
@@ -486,14 +484,12 @@ class EvmAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
486
484
|
return feedSum.dividedBy(feeHistory.baseFeePerGas.length).toNumber();
|
|
487
485
|
}
|
|
488
486
|
async handlePossibleError(response) {
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
const lowerCasedBody = body.toLowerCase();
|
|
492
|
-
const isError = !response.ok || possible_errors_1.possibleErrors.some((error) => lowerCasedBody.includes(error));
|
|
487
|
+
const body = JSON.stringify(response.body);
|
|
488
|
+
const isError = !response.ok || 'error' in response || possible_errors_1.possibleErrors.some((error) => body.includes(error));
|
|
493
489
|
if (isError) {
|
|
494
490
|
this.logger?.customError('Rpc fetch error', {
|
|
495
491
|
blockchain: this.blockchain,
|
|
496
|
-
text:
|
|
492
|
+
text: await response.text(),
|
|
497
493
|
url: response.url
|
|
498
494
|
});
|
|
499
495
|
}
|