diff --git a/dev.html b/dev.html index d39997b..538d45d 100644 --- a/dev.html +++ b/dev.html @@ -8,7 +8,7 @@ - + diff --git a/dist/esm/index.evm.js b/dist/esm/index.evm.js index 118e3d6..abd383c 100644 --- a/dist/esm/index.evm.js +++ b/dist/esm/index.evm.js @@ -127,6 +127,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider { method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { @@ -281,7 +282,8 @@ const setProviderEndpoints$1 = async (blockchain, endpoints, detectFastest = tru }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }); } catch (e) {} if(!_optionalChain$1([response, 'optionalAccess', _ => _.ok])) { return resolve(999) } diff --git a/dist/esm/index.js b/dist/esm/index.js index 00b60cc..e80e382 100644 --- a/dist/esm/index.js +++ b/dist/esm/index.js @@ -70,6 +70,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider { method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { @@ -224,7 +225,8 @@ const setProviderEndpoints$2 = async (blockchain, endpoints, detectFastest = tru }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }); } catch (e) {} if(!_optionalChain$4([response, 'optionalAccess', _ => _.ok])) { return resolve(999) } @@ -327,6 +329,7 @@ class StaticJsonRpcSequentialProvider extends Connection { method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { @@ -471,7 +474,8 @@ const setProviderEndpoints$1 = async (blockchain, endpoints, detectFastest = tru }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }); } catch (e) {} if(!_optionalChain$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) } diff --git a/dist/esm/index.solana.js b/dist/esm/index.solana.js index 695e355..7a4d2c4 100644 --- a/dist/esm/index.solana.js +++ b/dist/esm/index.solana.js @@ -71,6 +71,7 @@ class StaticJsonRpcSequentialProvider extends Connection { method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { @@ -215,7 +216,8 @@ const setProviderEndpoints$1 = async (blockchain, endpoints, detectFastest = tru }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }); } catch (e) {} if(!_optionalChain$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) } diff --git a/dist/umd/index.evm.js b/dist/umd/index.evm.js index bd2e6bb..8247d4b 100644 --- a/dist/umd/index.evm.js +++ b/dist/umd/index.evm.js @@ -134,6 +134,7 @@ method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { @@ -288,7 +289,8 @@ }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }); } catch (e) {} if(!_optionalChain$1([response, 'optionalAccess', _ => _.ok])) { return resolve(999) } diff --git a/dist/umd/index.js b/dist/umd/index.js index e9aa9aa..40f854a 100644 --- a/dist/umd/index.js +++ b/dist/umd/index.js @@ -76,6 +76,7 @@ method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { @@ -230,7 +231,8 @@ }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }); } catch (e) {} if(!_optionalChain$4([response, 'optionalAccess', _ => _.ok])) { return resolve(999) } @@ -333,6 +335,7 @@ method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { @@ -477,7 +480,8 @@ }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }); } catch (e) {} if(!_optionalChain$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) } diff --git a/dist/umd/index.solana.js b/dist/umd/index.solana.js index e0f4067..9bc155e 100644 --- a/dist/umd/index.solana.js +++ b/dist/umd/index.solana.js @@ -77,6 +77,7 @@ method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { @@ -221,7 +222,8 @@ }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }); } catch (e) {} if(!_optionalChain$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) } diff --git a/package.evm.json b/package.evm.json index 3179fd0..e37fae4 100644 --- a/package.evm.json +++ b/package.evm.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client-evm", "moduleName": "Web3Client", - "version": "10.19.1", + "version": "10.19.2", "description": "A web3 client to fetch blockchain data just like you are used to with HTTP clients.", "main": "dist/umd/index.evm.js", "module": "dist/esm/index.evm.js", @@ -23,7 +23,7 @@ "homepage": "https://depay.com", "private": false, "peerDependencies": { - "@depay/web3-blockchains": "^9.6.0", + "@depay/web3-blockchains": "^9.6.9", "ethers": "^5.7.1" }, "engines": { diff --git a/package.json b/package.json index 7592e1d..f82e879 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client", "moduleName": "Web3Client", - "version": "10.19.1", + "version": "10.19.2", "description": "A web3 client to fetch blockchain data just like you are used to with HTTP clients.", "main": "dist/umd/index.js", "module": "dist/esm/index.js", @@ -34,7 +34,7 @@ "private": false, "peerDependencies": { "@depay/solana-web3.js": "^1.26.0", - "@depay/web3-blockchains": "^9.6.0", + "@depay/web3-blockchains": "^9.6.9", "ethers": "^5.7.1" }, "engines": { @@ -44,8 +44,8 @@ "@babel/core": "^7.12.9", "@babel/preset-env": "^7.12.7", "@depay/solana-web3.js": "^1.26.0", - "@depay/web3-blockchains": "^9.6.0", - "@depay/web3-mock": "^14.19.0", + "@depay/web3-blockchains": "^9.6.9", + "@depay/web3-mock": "^14.19.1", "@rollup/plugin-commonjs": "^22.0.1", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.3.0", diff --git a/package.solana.json b/package.solana.json index 7d30853..92becb4 100644 --- a/package.solana.json +++ b/package.solana.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client-solana", "moduleName": "Web3Client", - "version": "10.19.1", + "version": "10.19.2", "description": "A web3 client to fetch blockchain data just like you are used to with HTTP clients.", "main": "dist/umd/index.solana.js", "module": "dist/esm/index.solana.js", @@ -23,7 +23,7 @@ "homepage": "https://depay.com", "private": false, "peerDependencies": { - "@depay/web3-blockchains": "^9.6.0", + "@depay/web3-blockchains": "^9.6.9", "@depay/solana-web3.js": "^1.26.0", "ethers": "^5.7.1" }, diff --git a/src/clients/ethers/provider.js b/src/clients/ethers/provider.js index 5522960..c163a17 100644 --- a/src/clients/ethers/provider.js +++ b/src/clients/ethers/provider.js @@ -45,6 +45,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider { method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { diff --git a/src/clients/solana/provider.js b/src/clients/solana/provider.js index 1f13ad5..38128dc 100644 --- a/src/clients/solana/provider.js +++ b/src/clients/solana/provider.js @@ -45,6 +45,7 @@ class StaticJsonRpcSequentialProvider extends Connection { method: 'POST', body: JSON.stringify(batch), headers: { 'Content-Type': 'application/json' }, + signal: AbortSignal.timeout(10000) // 10-second timeout } ).then((response)=>{ if(response.ok) { diff --git a/src/platforms/evm/provider.js b/src/platforms/evm/provider.js index c0d5897..16a9cd2 100644 --- a/src/platforms/evm/provider.js +++ b/src/platforms/evm/provider.js @@ -58,7 +58,8 @@ const setProviderEndpoints = async (blockchain, endpoints, detectFastest = true) }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }) } catch {} if(!response?.ok) { return resolve(999) } diff --git a/src/platforms/solana/provider.js b/src/platforms/solana/provider.js index 09ebd92..0ffe877 100644 --- a/src/platforms/solana/provider.js +++ b/src/platforms/solana/provider.js @@ -58,7 +58,8 @@ const setProviderEndpoints = async (blockchain, endpoints, detectFastest = true) }, referrer: "", referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }) + body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }), + signal: AbortSignal.timeout(10000) // 10-second timeout }) } catch {} if(!response?.ok) { return resolve(999) } diff --git a/yarn.lock b/yarn.lock index 31703b2..c44e5e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -903,18 +903,18 @@ dependencies: bs58 "^5.0.0" -"@depay/web3-blockchains@^9.6.0": - version "9.6.0" - resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.6.0.tgz#51bcd4cd6bcc9542b61f7792eabdccbe6385b476" - integrity sha512-+REyl5vva1e6t4yvSJKJE2IgidTNDPB7imn4xxAqqeVOFJryLBwaPddyh5C9pnX9GMpLhR6s6Su4AgrdLSZ/JQ== +"@depay/web3-blockchains@^9.6.1", "@depay/web3-blockchains@^9.6.9": + version "9.6.9" + resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.6.9.tgz#ea451a5aca840809a131e01232ff84e9463a2fbe" + integrity sha512-iAkWT+x6KlH7WsIprsruqVovCaR9R3yxKOp2AwsCsSwXDFsANP0BARnslFxwvGondeu0Hgt1D/zWIvOGm8+fBQ== -"@depay/web3-mock@^14.19.0": - version "14.19.0" - resolved "https://registry.yarnpkg.com/@depay/web3-mock/-/web3-mock-14.19.0.tgz#2e5430cc8240dea8a5f477d31f7861dc4e9666d7" - integrity sha512-/uTeJdxQTYEA4RFAZd8mAoMn1B+33UZ9s98cPKXQlksoRXstJiBUbPO+O7IOyZ4QUDsmcKTw1sjLH2+eIi4XTg== +"@depay/web3-mock@^14.19.1": + version "14.19.1" + resolved "https://registry.yarnpkg.com/@depay/web3-mock/-/web3-mock-14.19.1.tgz#3666a3fa0f2ae4e65f5cb90d88f59ba213414943" + integrity sha512-bBM1J0EWDWXJKVPtzo8YrX7fbGwUATYWN8kaJniQU2z5V+UK3kVhjQi+en0JMF9cCjinkERK7MqoZLaYR+cb+Q== dependencies: "@depay/solana-web3.js" "^1.26.0" - "@depay/web3-blockchains" "^9.6.0" + "@depay/web3-blockchains" "^9.6.1" ethers "^5.7.1" "@eslint/eslintrc@^0.4.3":