diff options
author | Tom Schmidt <imtomhschmidt@gmail.com> | 2018-03-07 01:47:13 +0800 |
---|---|---|
committer | Tom Schmidt <imtomhschmidt@gmail.com> | 2018-03-07 01:47:13 +0800 |
commit | f27e943258746fc61fbf8030e5b0e0c2c193bb76 (patch) | |
tree | ad10e77344918e2c05b714d450415e0f91933bcd /packages/website/ts/utils | |
parent | 994935b5da0b15796958a32c5bab0a25b9430b5a (diff) | |
download | dexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.tar.gz dexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.tar.zst dexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.zip |
Added provider canonical name mapping
Diffstat (limited to 'packages/website/ts/utils')
-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(); }); - }, + } }; |