From f27e943258746fc61fbf8030e5b0e0c2c193bb76 Mon Sep 17 00:00:00 2001 From: Tom Schmidt Date: Tue, 6 Mar 2018 09:47:13 -0800 Subject: Added provider canonical name mapping --- packages/website/ts/utils/utils.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'packages/website/ts') 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 { if (document.readyState === 'complete') { return; // Already loaded @@ -316,5 +335,5 @@ export const utils = { return new Promise((resolve, reject) => { window.onload = () => resolve(); }); - }, + } }; -- cgit v1.2.3