是否可以使用Web3或任何其他方式获取MetAmask帐户名称?
我已经尝试在MetAmask文档中搜索,但是我没有找到有关帐户信息的任何信息,所以是否有API或可以使用Web3获取帐户名称?
I've tried to search in Metamask doc, but I did not find anything about the account info, so is there any API or can I use Web3 to get the account name?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MetAmask不会在其API上共享帐户名。如果用户明确确认此操作,则只有当前选择的地址和网络。
MetaMask does not share the account name over its API. Only the currently selected address and network, if the user explicitly confirms this action.
您无法将用户设置为特定钱包中的别名,但是您可以尝试获取 ens domain name ,如果它存在,正如ENS现在支持反向分辨率的那样,如文档中所述:
VIEM解决方案:
WAGMI解决方案:
两个示例均应解析为
luc.eth
。You cannot get the aliases users set in specific wallets, but you can try to get the ENS domain name, if it exists, as ENS now supports reverse resolution, as explained in the docs:
Viem solution:
Wagmi solution:
Both examples should resolve to
luc.eth
.