Rah*_*nas 4 blockchain ethereum web3js metamask decentralized-applications
据我们所知,从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();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7205 次 |
| 最近记录: |