# Quickly support Bitget Wallet

# EVM

Note

Precondition: You have connected to Chrome extension wallets with the same protocol used to connect to MetaMask.

What’s the easiest way to connect to Bitget Wallet

Check if the provider is window.bitkeep.ethereum, if not, please replace it with the exclusive Bitget Wallet provider window.bitkeep.ethereum.

For example, see below:

function getProvider() {
  const provider = window.bitkeep && window.bitkeep.ethereum;
  if (!provider) {
    return window.open('https://web3.bitget.com/en/wallet-download?type=2');
  }
  return provider;
}
1
2
3
4
5
6
7

Attention

Don't forget to remove listeners, once it is detected that the address and network have been changed.

For example, see below:

//Bitkeep used
const BitKeepProvider = window.bitkeep && window.bitkeep.ethereum;
await BitKeepProvider.request({ method: 'eth_requestAccounts' });
BitKeepProvider.removeAllListeners();
BitKeepProvider.on('accountsChanged', async (accounts) => {
   console.log("accounts changed")
});
BitKeepProvider.on('chainChanged', async (chainId) => {
   console.log("chainId changed")
});
//MetaMask used
const MetaMaskProvider = window.ethereum;
//BitKeepProvider.removeAllListeners();
MetaMaskProvider.request({ method: 'eth_requestAccounts' });
MetaMaskProvider.removeAllListeners();
MetaMaskProvider.on('accountsChanged', async (accounts) => {
  console.log("accounts changed")
});
MetaMaskProvider.on('chainChanged', async (chainId) => {
  console.log("chainId changed")
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

# Solana

Note

Precondition: You have connected to Chrome extension wallets with the same protocol used to connect to MathWallet.

What’s the easiest way to connect to Bitget Wallet

Check if the provider is window.bitkeep.solana, if not, please replace it with the exclusive Bitget Wallet provider window.bitkeep.solana.

For example, see below:

function getProvider() {
  const provider = window.bitkeep && window.bitkeep.solana;
  if (!provider) {
    window.open('https://web3.bitget.com/en/wallet-download?type=2');
    throw  `Please guide users to download from our official website`
  }
  return provider;
}
1
2
3
4
5
6
7
8

# Aptos

Note

Precondition: You have connected to Chrome extension wallets with the same protocol of petra.

What’s the easiest way to connect to Bitget Wallet

Check if the provider is window.bitkeep.aptos, if not, please replace it with the exclusive Bitget Wallet provider window.bitkeep.aptos.

For example, see below:

function getAptosWallet() {
  const provider = window.bitkeep && window.bitkeep.aptos;
  if (!provider) {
    window.open('https://web3.bitget.com/en/wallet-download?type=2');
    throw 'Please go to  https://web3.bitget.com/en/wallet-download?type=2  to download!!';
  }
  return provider;
}
1
2
3
4
5
6
7
8

# Other

If the developer has not connected to other Chrome extension wallets using the above standards, please refer to the access mechanism of other mainnet APIs or third-party npm packages to connect to Bitget Chrome extension wallet.

# API

# Third-party npm packages supported

EVM

Solana

Last Updated: 9/4/2023, 7:13:58 PM