Skip to content
Wallet APIs
connectWallet

connectWallet

Connect wallet.

Usage

  1. Connect with built-in wallets supported by Meteor Wallet
import {
  Connector,
  WALLET,
  MeteorWalletProvider,
} from '@meteor-web3/connector';
 
const connector = new Connector(new MeteorWalletProvider());
const pkh = await connector.connectWallet({
  wallet: WALLET.METAMASK,
});
  1. Pass in any Ethereum Provider (opens in a new tab) to use
import {
  Connector,
  WALLET,
  MeteorWalletProvider,
} from '@meteor-web3/connector';
 
const connector = new Connector(new MeteorWalletProvider());
const pkh = await connector.connectWallet({
  provider: window.ethereum,
});

Parameters

  • enum WALLET - which wallet to connect with
enum WALLET {
  METAMASK = "MetaMask",
  WALLETCONNECT = "WalletConnect",
  COINBASE = "Coinbase",
  PARTICLE = "Particle",
  EXTERNAL_WALLET = "ExternalWallet",
}

or

Returns

Promise<{
    address: string;
    chain: Chain;
    wallet: WALLET;
    userInfo?: object;
}>
{
  "address": "0x312eA852726E3A9f633A0377c0ea882086d66666",
  "chain": {
    "chainId": 80001,
    "chainName": "mumbai"
  },
  "wallet": "MetaMask"
}