window.ethereumobject to make the page manipulate the user's account in the metamask and obtain configuration information. Similarly, while
window.onekeymaintains a large number of APIs compatible with
window.ethereum, and OneKey Browser Extension also injects
window.ethereumto ensure the compatibility of other Dapps. Users can manually turn on "Alternative MetaMask" in OneKey browser Extension v2.0.1 or later to prevent possible conflicts during co-installation with MetaMask.
window.ethereumwhen calling internal methods, namely:
window.onekeyfor subsequent operations.
window.ethereumfor subsequent operations.At the same time, through the following JS code, you can ensure that the user wakes up MetaMask.
window.onekey, the OneKey browser Extension will also add
window.ethereumto the page to assist in operations.
window.ethereum.switchProvidermethod to switch between the variables injected by the OneKey browser Extension and the variables injected by MetaMask.
window.ethereum.switchProvideris the new content of OneKey browser plugin v2.0.1 and later, and it is also a unique method of OneKey browser Extension.