diff options
Diffstat (limited to 'packages/website')
-rw-r--r-- | packages/website/ts/utils/utils.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index a1e045af7..3d24cb1f4 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -309,6 +309,25 @@ export const utils = { containerId, }); }, + web3ProviderNameToString(web3ProviderName: string): string { + let parsedProviderName = "UNKNOWN"; + if(web3ProviderName === "MetamaskInpageProvider") { + parsedProviderName = "METAMASK"; + } + else if(web3ProviderName === "EthereumProvider") { + parsedProviderName = "MIST"; + } + else if(web3ProviderName === "o") { + parsedProviderName = "PARITY"; + } + else if(web3ProviderName.indexOf("infura") !== -1) { + parsedProviderName = "INFURA"; + } + else if(web3ProviderName.indexOf("localhost") !== -1) { + parsedProviderName ="LOCALHOST"; + } + return parsedProviderName; + }, async onPageLoadAsync(): Promise<void> { if (document.readyState === 'complete') { return; // Already loaded @@ -316,5 +335,5 @@ export const utils = { return new Promise<void>((resolve, reject) => { window.onload = () => resolve(); }); - }, + } }; |