据我们所知,从2020年1月13日开始,metamask将不再注入web3.js。我们应该采取哪些方法来停止对web3的依赖?
另外,我们如何使用目前正在注入 web3.js 的现有 Metamask 来测试它。
window.ethereum
仍将包含 Web3 Provider。您可以使用它来设置您选择的 web3 便利库,例如 web3.js 或 ethers.js。例如:
const Web3 = require('web3');
// web3 lib instance
const web3 = new Web3(window.ethereum);
// get all accounts
const accounts = await web3.eth.getAccounts();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)