From c9d0166892aa9262efbedb5717aae2326b204817 Mon Sep 17 00:00:00 2001 From: Sebastian Pape Date: Thu, 20 Oct 2022 10:26:57 +0200 Subject: [PATCH] v10.1.1: fix tests --- dist/esm/index.evm.js | 6 +++--- dist/esm/index.js | 12 ++++++------ dist/umd/index.evm.js | 6 +++--- dist/umd/index.js | 12 ++++++------ package.json | 2 +- src/platforms/evm/provider.js | 6 +++--- src/platforms/solana/provider.js | 6 +++--- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/dist/esm/index.evm.js b/dist/esm/index.evm.js index 4b646b2..a514fdd 100644 --- a/dist/esm/index.evm.js +++ b/dist/esm/index.evm.js @@ -15211,7 +15211,9 @@ const setProviderEndpoints$1 = async (blockchain, endpoints)=> { let endpoint; let window = getWindow(); - if(window.fetch != undefined) { + if(window.fetch == undefined || (process && process.env && "production" == 'test')) { + endpoint = endpoints[0]; + } else { let responseTimes = await Promise.all(endpoints.map((endpoint)=>{ return new Promise(async (resolve)=>{ @@ -15235,8 +15237,6 @@ const setProviderEndpoints$1 = async (blockchain, endpoints)=> { const fastestResponse = Math.min(...responseTimes); const fastestIndex = responseTimes.indexOf(fastestResponse); endpoint = endpoints[fastestIndex]; - } else { - endpoint = endpoints[0]; } setProvider$1( diff --git a/dist/esm/index.js b/dist/esm/index.js index 6c8cae9..d5f5363 100644 --- a/dist/esm/index.js +++ b/dist/esm/index.js @@ -15212,7 +15212,9 @@ const setProviderEndpoints$2 = async (blockchain, endpoints)=> { let endpoint; let window = getWindow(); - if(window.fetch != undefined) { + if(window.fetch == undefined || (process && process.env && "production" == 'test')) { + endpoint = endpoints[0]; + } else { let responseTimes = await Promise.all(endpoints.map((endpoint)=>{ return new Promise(async (resolve)=>{ @@ -15236,8 +15238,6 @@ const setProviderEndpoints$2 = async (blockchain, endpoints)=> { const fastestResponse = Math.min(...responseTimes); const fastestIndex = responseTimes.indexOf(fastestResponse); endpoint = endpoints[fastestIndex]; - } else { - endpoint = endpoints[0]; } setProvider$2( @@ -15476,7 +15476,9 @@ const setProviderEndpoints$1 = async (blockchain, endpoints)=> { let endpoint; let window = getWindow(); - if(window.fetch != undefined) { + if(window.fetch == undefined || (process && process.env && "production" == 'test')) { + endpoint = endpoints[0]; + } else { let responseTimes = await Promise.all(endpoints.map((endpoint)=>{ return new Promise(async (resolve)=>{ @@ -15500,8 +15502,6 @@ const setProviderEndpoints$1 = async (blockchain, endpoints)=> { const fastestResponse = Math.min(...responseTimes); const fastestIndex = responseTimes.indexOf(fastestResponse); endpoint = endpoints[fastestIndex]; - } else { - endpoint = endpoints[0]; } setProvider$1( diff --git a/dist/umd/index.evm.js b/dist/umd/index.evm.js index 10eb66e..5fddd86 100644 --- a/dist/umd/index.evm.js +++ b/dist/umd/index.evm.js @@ -15214,7 +15214,9 @@ let endpoint; let window = getWindow(); - if(window.fetch != undefined) { + if(window.fetch == undefined || (process && process.env && "production" == 'test')) { + endpoint = endpoints[0]; + } else { let responseTimes = await Promise.all(endpoints.map((endpoint)=>{ return new Promise(async (resolve)=>{ @@ -15238,8 +15240,6 @@ const fastestResponse = Math.min(...responseTimes); const fastestIndex = responseTimes.indexOf(fastestResponse); endpoint = endpoints[fastestIndex]; - } else { - endpoint = endpoints[0]; } setProvider$1( diff --git a/dist/umd/index.js b/dist/umd/index.js index a211627..64d86aa 100644 --- a/dist/umd/index.js +++ b/dist/umd/index.js @@ -15214,7 +15214,9 @@ let endpoint; let window = getWindow(); - if(window.fetch != undefined) { + if(window.fetch == undefined || (process && process.env && "production" == 'test')) { + endpoint = endpoints[0]; + } else { let responseTimes = await Promise.all(endpoints.map((endpoint)=>{ return new Promise(async (resolve)=>{ @@ -15238,8 +15240,6 @@ const fastestResponse = Math.min(...responseTimes); const fastestIndex = responseTimes.indexOf(fastestResponse); endpoint = endpoints[fastestIndex]; - } else { - endpoint = endpoints[0]; } setProvider$2( @@ -15478,7 +15478,9 @@ let endpoint; let window = getWindow(); - if(window.fetch != undefined) { + if(window.fetch == undefined || (process && process.env && "production" == 'test')) { + endpoint = endpoints[0]; + } else { let responseTimes = await Promise.all(endpoints.map((endpoint)=>{ return new Promise(async (resolve)=>{ @@ -15502,8 +15504,6 @@ const fastestResponse = Math.min(...responseTimes); const fastestIndex = responseTimes.indexOf(fastestResponse); endpoint = endpoints[fastestIndex]; - } else { - endpoint = endpoints[0]; } setProvider$1( diff --git a/package.json b/package.json index 061fb36..f53b19c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client", "moduleName": "Web3Client", - "version": "10.1.0", + "version": "10.1.1", "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", diff --git a/src/platforms/evm/provider.js b/src/platforms/evm/provider.js index 80380a9..1c2d4b7 100644 --- a/src/platforms/evm/provider.js +++ b/src/platforms/evm/provider.js @@ -24,7 +24,9 @@ const setProviderEndpoints = async (blockchain, endpoints)=> { let endpoint let window = getWindow() - if(window.fetch != undefined) { + if(window.fetch == undefined || (process && process.env && process.env.NODE_ENV == 'test')) { + endpoint = endpoints[0] + } else { let responseTimes = await Promise.all(endpoints.map((endpoint)=>{ return new Promise(async (resolve)=>{ @@ -48,8 +50,6 @@ const setProviderEndpoints = async (blockchain, endpoints)=> { const fastestResponse = Math.min(...responseTimes) const fastestIndex = responseTimes.indexOf(fastestResponse) endpoint = endpoints[fastestIndex] - } else { - endpoint = endpoints[0] } setProvider( diff --git a/src/platforms/solana/provider.js b/src/platforms/solana/provider.js index 952e677..7dbe858 100644 --- a/src/platforms/solana/provider.js +++ b/src/platforms/solana/provider.js @@ -21,7 +21,9 @@ const setProviderEndpoints = async (blockchain, endpoints)=> { let endpoint let window = getWindow() - if(window.fetch != undefined) { + if(window.fetch == undefined || (process && process.env && process.env.NODE_ENV == 'test')) { + endpoint = endpoints[0] + } else { let responseTimes = await Promise.all(endpoints.map((endpoint)=>{ return new Promise(async (resolve)=>{ @@ -45,8 +47,6 @@ const setProviderEndpoints = async (blockchain, endpoints)=> { const fastestResponse = Math.min(...responseTimes) const fastestIndex = responseTimes.indexOf(fastestResponse) endpoint = endpoints[fastestIndex] - } else { - endpoint = endpoints[0] } setProvider(