UNPKG

openzeppelin-network-test

Version:

An easy to use and reliable library that provides one line access to Web3 API.

33 lines 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function getProviderName(provider) { if (provider.isMetaMask) return 'metamask'; if (provider.isTrust) return 'trust'; if (provider.isGoWallet) return 'goWallet'; if (provider.isAlphaWallet) return 'alphaWallet'; if (provider.isStatus) return 'status'; if (provider.isToshi) return 'coinbase'; if (provider.isGSNProvider) return 'GSN'; if (provider.constructor.name === 'EthereumProvider') return 'mist'; if (provider.constructor.name === 'Web3FrameProvider') return 'parity'; if (provider.host && provider.host.indexOf('infura') !== -1) return 'infura'; if (provider.connection && provider.connection.url.indexOf('infura') !== -1) return 'infura'; if (provider.host && provider.host.indexOf('localhost') !== -1) return 'localhost'; if (provider.host && provider.host.indexOf('127.0.0.1') !== -1) return 'localhost'; return 'unknown'; } exports.default = getProviderName; //# sourceMappingURL=providerName.js.map