@atomiqlabs/chain-evm 1.0.0-dev.80 → 1.0.0-dev.82
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.
|
@@ -8,7 +8,7 @@ class JsonRpcProviderWithRetries extends ethers_1.JsonRpcProvider {
|
|
|
8
8
|
constructor(url, network, options) {
|
|
9
9
|
if (typeof (url) === "string")
|
|
10
10
|
url = new ethers_2.FetchRequest(url);
|
|
11
|
-
url.timeout = options
|
|
11
|
+
url.timeout = options?.timeout ?? 10 * 1000;
|
|
12
12
|
super(url, network, options);
|
|
13
13
|
this.retryPolicy = options;
|
|
14
14
|
}
|
|
@@ -245,6 +245,8 @@ class SocketProvider extends ethers_1.JsonRpcApiProvider {
|
|
|
245
245
|
async _send(payload) {
|
|
246
246
|
// WebSocket provider doesn't accept batches
|
|
247
247
|
(0, ethers_1.assertArgument)(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload);
|
|
248
|
+
if (!__classPrivateFieldGet(this, _SocketProvider_connected, "f") && payload.method === "eth_subscribe")
|
|
249
|
+
return Promise.reject((0, ethers_1.makeError)("WebSocket not connected!", "NETWORK_ERROR"));
|
|
248
250
|
// Wait until the socket is connected before writing to it
|
|
249
251
|
await this._waitUntilReady();
|
|
250
252
|
if (!__classPrivateFieldGet(this, _SocketProvider_connected, "f") && payload.method === "eth_subscribe")
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ export class JsonRpcProviderWithRetries extends JsonRpcProvider {
|
|
|
12
12
|
maxRetries?: number, delay?: number, exponential?: boolean, timeout?: number
|
|
13
13
|
}) {
|
|
14
14
|
if(typeof(url)==="string") url = new FetchRequest(url);
|
|
15
|
-
url.timeout = options
|
|
15
|
+
url.timeout = options?.timeout ?? 10*1000;
|
|
16
16
|
super(url, network, options);
|
|
17
17
|
this.retryPolicy = options;
|
|
18
18
|
}
|
|
@@ -271,6 +271,9 @@ export class SocketProvider extends JsonRpcApiProvider {
|
|
|
271
271
|
// WebSocket provider doesn't accept batches
|
|
272
272
|
assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload);
|
|
273
273
|
|
|
274
|
+
if(!this.#connected && payload.method==="eth_subscribe")
|
|
275
|
+
return Promise.reject(makeError("WebSocket not connected!", "NETWORK_ERROR"));
|
|
276
|
+
|
|
274
277
|
// Wait until the socket is connected before writing to it
|
|
275
278
|
await this._waitUntilReady();
|
|
276
279
|
|