UNPKG

@web3-wallet/metamask

Version:
29 lines (28 loc) 910 B
import { Connector } from '@web3-wallet/core'; import { icon } from './assets'; const providerFilter = (p) => !!p.isMetaMask; const _walletName = 'MetaMask'; const walletName = _walletName; export class MetaMask extends Connector { /** {@inheritdoc Connector.constructor} */ constructor(options) { super({ providerFilter, ...options, }); this.walletName = walletName; } /** * {@inheritdoc Connector.constructor} * * Certain versions of MetaMask incorrectly emit the "disconnect" event when chain is changed. * need to override the default "onDisconnect" method, so that we don't reset the connector * store state. * * @see: https://github.com/MetaMask/metamask-extension/issues/13375#issuecomment-1027663334 * */ onDisconnect(_) { } } MetaMask.walletName = walletName; MetaMask.walletIcon = icon;