Skip to content

Commit

Permalink
v10.1.10: make getProvider a fully async function
Browse files Browse the repository at this point in the history
  • Loading branch information
10xSebastian committed Oct 24, 2022
1 parent a3e255f commit 26503ca
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 34 deletions.
8 changes: 4 additions & 4 deletions dist/esm/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15257,21 +15257,21 @@ const setProviderEndpoints$1 = async (blockchain, endpoints)=> {
);
};

const getProvider$1 = (blockchain)=> {
const getProvider$1 = async (blockchain)=> {

let providers = getProviders();
if(providers && providers[blockchain]){ return Promise.resolve(providers[blockchain]) }
if(providers && providers[blockchain]){ return providers[blockchain] }

let window = getWindow();
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return Promise.resolve(window._getProviderPromise[blockchain]) }
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return await window._getProviderPromise[blockchain] }

if(!window._getProviderPromise){ window._getProviderPromise = {}; }
window._getProviderPromise[blockchain] = new Promise(async(resolve)=> {
await setProviderEndpoints$1(blockchain, ENDPOINTS[blockchain]);
resolve(getWindow()._clientProviders[blockchain]);
});

return window._getProviderPromise[blockchain]
return await window._getProviderPromise[blockchain]
};

const getProvider = (blockchain)=>{
Expand Down
16 changes: 8 additions & 8 deletions dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15258,21 +15258,21 @@ const setProviderEndpoints$2 = async (blockchain, endpoints)=> {
);
};

const getProvider$3 = (blockchain)=> {
const getProvider$3 = async (blockchain)=> {

let providers = getProviders$1();
if(providers && providers[blockchain]){ return Promise.resolve(providers[blockchain]) }
if(providers && providers[blockchain]){ return providers[blockchain] }

let window = getWindow();
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return Promise.resolve(window._getProviderPromise[blockchain]) }
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return await window._getProviderPromise[blockchain] }

if(!window._getProviderPromise){ window._getProviderPromise = {}; }
window._getProviderPromise[blockchain] = new Promise(async(resolve)=> {
await setProviderEndpoints$2(blockchain, ENDPOINTS$1[blockchain]);
resolve(getWindow()._clientProviders[blockchain]);
});

return window._getProviderPromise[blockchain]
return await window._getProviderPromise[blockchain]
};

const getProvider$2 = (blockchain)=>{
Expand Down Expand Up @@ -15532,21 +15532,21 @@ const setProviderEndpoints$1 = async (blockchain, endpoints)=> {
);
};

const getProvider$1 = (blockchain)=> {
const getProvider$1 = async (blockchain)=> {

let providers = getProviders();
if(providers && providers[blockchain]){ return Promise.resolve(providers[blockchain]) }
if(providers && providers[blockchain]){ return providers[blockchain] }

let window = getWindow();
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return Promise.resolve(window._getProviderPromise[blockchain]) }
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return await window._getProviderPromise[blockchain] }

if(!window._getProviderPromise){ window._getProviderPromise = {}; }
window._getProviderPromise[blockchain] = new Promise(async(resolve)=> {
await setProviderEndpoints$1(blockchain, ENDPOINTS[blockchain]);
resolve(getWindow()._clientProviders[blockchain]);
});

return window._getProviderPromise[blockchain]
return await window._getProviderPromise[blockchain]
};

let accountInfo = async ({ address, api, method, params, provider, block }) => {
Expand Down
8 changes: 4 additions & 4 deletions dist/umd/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15260,21 +15260,21 @@
);
};

const getProvider$1 = (blockchain)=> {
const getProvider$1 = async (blockchain)=> {

let providers = getProviders();
if(providers && providers[blockchain]){ return Promise.resolve(providers[blockchain]) }
if(providers && providers[blockchain]){ return providers[blockchain] }

let window = getWindow();
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return Promise.resolve(window._getProviderPromise[blockchain]) }
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return await window._getProviderPromise[blockchain] }

if(!window._getProviderPromise){ window._getProviderPromise = {}; }
window._getProviderPromise[blockchain] = new Promise(async(resolve)=> {
await setProviderEndpoints$1(blockchain, ENDPOINTS[blockchain]);
resolve(getWindow()._clientProviders[blockchain]);
});

return window._getProviderPromise[blockchain]
return await window._getProviderPromise[blockchain]
};

const getProvider = (blockchain)=>{
Expand Down
16 changes: 8 additions & 8 deletions dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15260,21 +15260,21 @@
);
};

const getProvider$3 = (blockchain)=> {
const getProvider$3 = async (blockchain)=> {

let providers = getProviders$1();
if(providers && providers[blockchain]){ return Promise.resolve(providers[blockchain]) }
if(providers && providers[blockchain]){ return providers[blockchain] }

let window = getWindow();
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return Promise.resolve(window._getProviderPromise[blockchain]) }
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return await window._getProviderPromise[blockchain] }

if(!window._getProviderPromise){ window._getProviderPromise = {}; }
window._getProviderPromise[blockchain] = new Promise(async(resolve)=> {
await setProviderEndpoints$2(blockchain, ENDPOINTS$1[blockchain]);
resolve(getWindow()._clientProviders[blockchain]);
});

return window._getProviderPromise[blockchain]
return await window._getProviderPromise[blockchain]
};

const getProvider$2 = (blockchain)=>{
Expand Down Expand Up @@ -15534,21 +15534,21 @@
);
};

const getProvider$1 = (blockchain)=> {
const getProvider$1 = async (blockchain)=> {

let providers = getProviders();
if(providers && providers[blockchain]){ return Promise.resolve(providers[blockchain]) }
if(providers && providers[blockchain]){ return providers[blockchain] }

let window = getWindow();
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return Promise.resolve(window._getProviderPromise[blockchain]) }
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return await window._getProviderPromise[blockchain] }

if(!window._getProviderPromise){ window._getProviderPromise = {}; }
window._getProviderPromise[blockchain] = new Promise(async(resolve)=> {
await setProviderEndpoints$1(blockchain, ENDPOINTS[blockchain]);
resolve(getWindow()._clientProviders[blockchain]);
});

return window._getProviderPromise[blockchain]
return await window._getProviderPromise[blockchain]
};

let accountInfo = async ({ address, api, method, params, provider, block }) => {
Expand Down
2 changes: 1 addition & 1 deletion package.evm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-client-evm",
"moduleName": "Web3Client",
"version": "10.1.9",
"version": "10.1.10",
"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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-client",
"moduleName": "Web3Client",
"version": "10.1.9",
"version": "10.1.10",
"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",
Expand Down
8 changes: 4 additions & 4 deletions src/platforms/evm/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ const setProviderEndpoints = async (blockchain, endpoints)=> {
)
}

const getProvider = (blockchain)=> {
const getProvider = async (blockchain)=> {

let providers = getProviders()
if(providers && providers[blockchain]){ return Promise.resolve(providers[blockchain]) }
if(providers && providers[blockchain]){ return providers[blockchain] }

let window = getWindow()
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return Promise.resolve(window._getProviderPromise[blockchain]) }
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return await window._getProviderPromise[blockchain] }

if(!window._getProviderPromise){ window._getProviderPromise = {} }
window._getProviderPromise[blockchain] = new Promise(async(resolve)=> {
await setProviderEndpoints(blockchain, ENDPOINTS[blockchain])
resolve(getWindow()._clientProviders[blockchain])
})

return window._getProviderPromise[blockchain]
return await window._getProviderPromise[blockchain]
}

export {
Expand Down
8 changes: 4 additions & 4 deletions src/platforms/solana/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ const setProviderEndpoints = async (blockchain, endpoints)=> {
)
}

const getProvider = (blockchain)=> {
const getProvider = async (blockchain)=> {

let providers = getProviders()
if(providers && providers[blockchain]){ return Promise.resolve(providers[blockchain]) }
if(providers && providers[blockchain]){ return providers[blockchain] }

let window = getWindow()
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return Promise.resolve(window._getProviderPromise[blockchain]) }
if(window._getProviderPromise && window._getProviderPromise[blockchain]) { return await window._getProviderPromise[blockchain] }

if(!window._getProviderPromise){ window._getProviderPromise = {} }
window._getProviderPromise[blockchain] = new Promise(async(resolve)=> {
await setProviderEndpoints(blockchain, ENDPOINTS[blockchain])
resolve(getWindow()._clientProviders[blockchain])
})

return window._getProviderPromise[blockchain]
return await window._getProviderPromise[blockchain]
}

export {
Expand Down

0 comments on commit 26503ca

Please sign in to comment.