web3 - Metamask eth_requestAccounts 不适用于 localhost:3000
问题描述
我尝试在 localhost:3000 和 localhost:3001 上启动相同的 react 应用程序。当我执行
const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' });
在浏览器控制台中,或在我的 react 应用程序中运行它,在后者中一切正常。但是在前者(3000)中,metamask没有弹出连接提示,但它仍然可以获取地址。
有人知道为什么会这样吗?
解决方案
推荐阅读
- javascript - 节点计划未按时执行
- discord.py - 有没有办法获取我存储在 json 中的频道 ID 并在命令中使用它?[不和谐.py]
- matlab - 如何将 histfit 图中的 Y 轴从计数更改为百分比?(MATLAB)
- php - 在特定 WooCommerce 电子邮件通知上显示自定义字段
- android - 在主页按钮单击时保持当前活动
- php - Laravel 检查唯一规则而不将属性作为数据而不是作为 url 参数发送
- python - 如何在 Python 中以交互方式分配类变量?
- activemq - ActiveMQ 上的实时日志
- javascript - 你真的可以有不同的参数名称但相同的功能吗?
- javascript - 如何在 onBlur 事件之后将可编辑的值传递给 JS 函数?