diff --git a/dev.html b/dev.html index 71c7fc8..2c767a3 100644 --- a/dev.html +++ b/dev.html @@ -8,7 +8,7 @@ - + diff --git a/package.evm.json b/package.evm.json index f7b9bfc..6e1faee 100644 --- a/package.evm.json +++ b/package.evm.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client-evm", "moduleName": "Web3Client", - "version": "10.18.7", + "version": "10.18.8", "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.4.2", + "@depay/web3-blockchains": "^9.4.3", "ethers": "^5.7.1" }, "engines": { diff --git a/package.json b/package.json index c8924d2..2715018 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client", "moduleName": "Web3Client", - "version": "10.18.7", + "version": "10.18.8", "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", @@ -33,8 +33,8 @@ "homepage": "https://depay.com", "private": false, "peerDependencies": { - "@depay/solana-web3.js": "^1.25.1", - "@depay/web3-blockchains": "^9.4.2", + "@depay/solana-web3.js": "^1.26.0", + "@depay/web3-blockchains": "^9.4.3", "ethers": "^5.7.1" }, "engines": { @@ -43,9 +43,9 @@ "devDependencies": { "@babel/core": "^7.12.9", "@babel/preset-env": "^7.12.7", - "@depay/solana-web3.js": "^1.25.1", - "@depay/web3-blockchains": "^9.4.2", - "@depay/web3-mock": "^14.17.0", + "@depay/solana-web3.js": "^1.26.0", + "@depay/web3-blockchains": "^9.4.3", + "@depay/web3-mock": "^14.18.0", "@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 8e3e438..02ecf7f 100644 --- a/package.solana.json +++ b/package.solana.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client-solana", "moduleName": "Web3Client", - "version": "10.18.7", + "version": "10.18.8", "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,8 +23,8 @@ "homepage": "https://depay.com", "private": false, "peerDependencies": { - "@depay/web3-blockchains": "^9.4.2", - "@depay/solana-web3.js": "^1.25.1", + "@depay/web3-blockchains": "^9.4.3", + "@depay/solana-web3.js": "^1.26.0", "ethers": "^5.7.1" }, "engines": { diff --git a/src/platforms/evm/provider.js b/src/platforms/evm/provider.js index a448c2b..4fba3db 100644 --- a/src/platforms/evm/provider.js +++ b/src/platforms/evm/provider.js @@ -47,17 +47,20 @@ const setProviderEndpoints = async (blockchain, endpoints, detectFastest = true) let timeout = 900 let before = new Date().getTime() setTimeout(()=>resolve(timeout), timeout) - const response = await fetch(endpoint, { - method: 'POST', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - referrer: "", - referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }) - }) - if(!response.ok) { return resolve(999) } + let response + try { + response = await fetch(endpoint, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + referrer: "", + referrerPolicy: "no-referrer", + body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }) + }) + } catch {} + if(!response?.ok) { return resolve(999) } let after = new Date().getTime() resolve(after-before) }) diff --git a/src/platforms/solana/provider.js b/src/platforms/solana/provider.js index d134647..bfb30b4 100644 --- a/src/platforms/solana/provider.js +++ b/src/platforms/solana/provider.js @@ -47,17 +47,20 @@ const setProviderEndpoints = async (blockchain, endpoints, detectFastest = true) let timeout = 900 let before = new Date().getTime() setTimeout(()=>resolve(timeout), timeout) - const response = await fetch(endpoint, { - method: 'POST', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - referrer: "", - referrerPolicy: "no-referrer", - body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }) - }) - if(!response.ok) { return resolve(999) } + let response + try { + response = await fetch(endpoint, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + referrer: "", + referrerPolicy: "no-referrer", + body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }) + }) + } catch {} + if(!response?.ok) { return resolve(999) } let after = new Date().getTime() resolve(after-before) }) diff --git a/yarn.lock b/yarn.lock index 9744526..bd8ab61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -896,10 +896,10 @@ "@babel/helper-validator-identifier" "^7.14.9" to-fast-properties "^2.0.0" -"@depay/solana-web3.js@^1.25.1": - version "1.25.1" - resolved "https://registry.yarnpkg.com/@depay/solana-web3.js/-/solana-web3.js-1.25.1.tgz#2f4725007ff4cfc14af2606eb3d333e68097e13f" - integrity sha512-tKCHHQVoZV85wZ8r3ZuxuQlejBcVolIUf52Bq2Pne3KR1BpxYJF2/9XRTH9qCrLZMQsgsQHikQEH5eglDCKJkA== +"@depay/solana-web3.js@^1.26.0": + version "1.26.0" + resolved "https://registry.yarnpkg.com/@depay/solana-web3.js/-/solana-web3.js-1.26.0.tgz#6234cd46779924a930d6b6021b66a25c18b38365" + integrity sha512-aAhDxfNGraE8VBwM5g/BhHnNCENlLSKDJ3yIh2EZd4mfmKM/4utv0cNUhTEytUAvvFoaMcOXXQ5U5sE1IMXFrQ== dependencies: bs58 "^5.0.0" @@ -908,17 +908,17 @@ resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.1.4.tgz#f006c29c887c433e1824e2bfabf8f39ad13da907" integrity sha512-CQnXCNAt3sA1MphZDMPbrhAPtemzeQ/NKeHcd2aBF61nTjJCRUmSh1Ox8Z6rlSjgDP66842iy6JAoRiFDtlmFw== -"@depay/web3-blockchains@^9.4.2": - version "9.4.2" - resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.4.2.tgz#61cbe215482b6c2e70255291d10c7c9b4d2bd90c" - integrity sha512-1aT9ZhMEXl87BOZsdFgVEl9aY1MgO0uB7/Qf4Wb4+L0omiydygIhITPh4JlCNz2yVdFtcU35N4/xS+4jli+nCg== +"@depay/web3-blockchains@^9.4.3": + version "9.4.3" + resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.4.3.tgz#df7d1ae5bb6cf7ac1b1e556ab09eb314d7c5eee4" + integrity sha512-Pl+7EdTZGm1jUZWAYtShqE/xOszblCoWYQQ5p00eHuUkobHs3vg6Ih7fSINL3TvTIxaVTpTjhyyAc2afkbhbmQ== -"@depay/web3-mock@^14.17.0": - version "14.17.0" - resolved "https://registry.yarnpkg.com/@depay/web3-mock/-/web3-mock-14.17.0.tgz#cf188a9d810c49f7af4aeb60bc06b5ec61bc75b8" - integrity sha512-0WCIpHqGUTPmOb5l3iN+4wCY+P3nHnGWd3uyWB+Wrt5DygS6MWI2b50gwtSCgYUCfgmEv9KlRuCnHDC4TDKCeA== +"@depay/web3-mock@^14.18.0": + version "14.18.0" + resolved "https://registry.yarnpkg.com/@depay/web3-mock/-/web3-mock-14.18.0.tgz#149dcdc2e39f265beefa9b4ffa8a00512bc25d01" + integrity sha512-TGhb/8k4qHR6OlxQcFxAZXX8fuJzPA3wfobKtCRhldyKV0ZotNIUEgN5MXq0aNGJ7FAPVjZPjHk1T7bL4ipj0g== dependencies: - "@depay/solana-web3.js" "^1.25.1" + "@depay/solana-web3.js" "^1.26.0" "@depay/web3-blockchains" "^9.1.4" ethers "^5.7.1"