Standard Wallet Methods
Method | Parameters | Return Type | Description |
---|---|---|---|
enable |
() |
Promise |
Connection method, returns account information |
isConnected |
() |
boolean |
Gets connection status |
addCurrency |
() |
Promise |
Adds a token |
switchChain |
(method, data) |
Promise |
Switches blockchain network |
disconnect |
() |
Promise |
Disconnects the wallet |
signPersonalMessage |
(data) |
Promise |
Signs a personal message |
signTypedMessage |
(data) |
Promise |
Signs a typed message |
request |
(payload, callback) |
Promise |
General eth call method. payload.method can be eth_sign , personal_sign , eth_sendTransaction , eth_accounts , etc. callback is called after the method executes |
Provider
const provider = window.bitkeep.ethereum
enable

used to request account access from the user’s Ethereum wallet
Usage
/** * @returns {*} [ address ] address list / await provider.enable()
Try It
isConnected
- ethereum.isConnected() checks if the wallet is currently connected to the dApp.
- Returns true if the provider is connected, and false otherwise.
Usage
/** * @returns {*} Boolean : if connected the wallet / await provider.isConnected()
Try It
SignPersonalMessage


personal_sign (commonly referred to as signPersonalMessage) is used to sign arbitrary text messages with a user’s Ethereum private key.
Usage
interface PersonalSignMessage { method: string; params: { msgHex: string; // the message you sign, must convert to hex from: string; // user account address }; } /** * @param {*} PersonalSignMessage : * @returns {*} Boolean : if connected the wallet / await provider.signPersonalMessage(message)
Try It
wallet_swithEthereumChain

wallet_switchEthereumChain is a method provided by Ethereum-compatible wallets (like Bitget) that allows decentralized applications (dApps) to request the user to switch their wallet to a different blockchain network.
Usage
interface SwitchEthereumChainParams { method: 'wallet_switchEthereumChain'; params: { chainId: string; // 例如 '0xA4B1' }[]; } /* * @param SwitchEthereumChainParams */ await provider.request(switchEthereumChainParams)
Try It
wallet_AddEthereumChain
wallet_addEthereumChain is a method used by Ethereum-compatible wallets (like Bitget) that allows a decentralized application (dApp) to programmatically request the user to add a new blockchain network to their wallet.### Usage
interface AddEthereumChainParams { method: 'wallet_switchEthereumChain'; params: { chainId: string; // 例如 '0xA4B1' }[]; } /* * @param SwitchEthereumChainParams */ await provider.request(addEthereumChainParams)
Try It
SignTypedData


The eth_signTypedData function (or eth_signTypedData_v4 specifically) is used to sign structured data according to the EIP-712 standard. This standard allows applications to create cryptographic signatures for complex and structured data, ensuring that the signature is both human-readable and verifiable.
Usage
interface EIP712Domain { name: string; version: string; chainId: number; verifyingContract: string; } interface Person { name: string; wallet: string; } interface Mail { from: Person; to: Person; contents: string; } interface TypedDataField { name: string; type: string; } interface TypedData { types: { EIP712Domain: TypedDataField[]; [key: string]: TypedDataField[]; }; domain: EIP712Domain; primaryType: string; message: Record<string, any>; } interface SignTypedDataV4Param { method: 'eth_signTypedData_v4'; params: [string, string] // account and JSON.stringify(typedData) } /* * @param signTypedDataV4Param * @returns string : signature */ provider.request({ method: 'eth_signTypedData_v4', params: [account, data ], });
Try It
wallet_watchAsset
EIP-747
Specified by the EIP-747 standard.
Parameters
WatchAssetParams
- Metadata of the asset to be watched.
interface WatchAssetParams { type: 'ERC20'; // In the future, other standards will be supported options: { address: string; // The address of the token contract 'symbol': string; // A ticker symbol or shorthand, up to 11 characters decimals: number; // The number of token decimals image: string; // A string url of the token logo }; }
Returns
boolean
- True if the token is added, otherwise false.
Description
Requests the user to track a token in Bitget Wallet. Returns a boolean indicating whether the token was successfully added.
Ethereum wallets support a set of tokens, usually from a centrally managed token registry. wallet_watchAsset allows web3 application developers to request their users to track tokens in their wallet at runtime. Once added, the token is indistinguishable from tokens added through traditional methods (e.g., centralized registries).
Provider .request({ method: 'wallet_watchAsset', params: { type: 'ERC20', options: { address: '0xb60e8dd61c5d32be8058bb8eb970870f07233155', symbol: 'FOO', decimals: 18, image: 'https://foo.io/token-image.svg', }, }, }) .then((success) => { if (success) { console.log('FOO successfully added to wallet!'); } else { throw new Error('Something went wrong.'); } }) .catch(console.error);
SignTransaction


const transactionParameters = { nonce: '0x00', // ignored by Bitkeep gasPrice: '0x09184e72a000', // customizable by user during Bitkeep confirmation. gas: '0x2710', // customizable by user during Bitkeep confirmation. to: '0x0000000000000000000000000000000000000000', // Required except during contract publications. from: Provider.selectedAddress, // must match user's active address. value: '0x00', // Only required to send ether to the recipient from the initiating external account. data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057', // Optional, but used for defining smart contract creation and interaction. chainId: '0x3', // Used to prevent transaction reuse across blockchains. Auto-filled by Bitkeep. }; // txHash is a hex string // As with any RPC call, it may throw an error const txHash = await Provider.request({ method: 'eth_sendTransaction', params: [transactionParameters], }); // if used web3 const accounts = await Provider.request({ method: 'eth_requestAccounts' }); const web3 = new Web3(Provider); const result = await web3.eth.sendTransaction({ from: Provider.selectedAddress, to: '0x0000000000000000000000000000000000000000', value: web3.utils.toWei('1', 'ether'), });