aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorTom Schmidt <imtomhschmidt@gmail.com>2018-03-07 01:47:13 +0800
committerTom Schmidt <imtomhschmidt@gmail.com>2018-03-07 01:47:13 +0800
commitf27e943258746fc61fbf8030e5b0e0c2c193bb76 (patch)
treead10e77344918e2c05b714d450415e0f91933bcd /packages
parent994935b5da0b15796958a32c5bab0a25b9430b5a (diff)
downloaddexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.tar
dexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.tar.gz
dexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.tar.bz2
dexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.tar.lz
dexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.tar.xz
dexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.tar.zst
dexon-0x-contracts-f27e943258746fc61fbf8030e5b0e0c2c193bb76.zip
Added provider canonical name mapping
Diffstat (limited to 'packages')
-rw-r--r--packages/website/ts/utils/utils.ts21
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();
});
- },
+ }
};