首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从注册表读取uPort人物角色

从注册表读取uPort人物角色
EN

Ethereum用户
提问于 2017-02-12 17:47:33
回答 1查看 170关注 0票数 2

我在试着通过uport-人物角色来读取个人资料。在文档中,这听起来很简单,但我无法访问我的角色。

代码语言:javascript
复制
export function loginUser() {
  return function(dispatch) {
    web3.eth.getCoinbase(function (err, address) {
      if (err) { throw err }
      web3.eth.defaultAccount = address;

      uport.getUserPersona().then((userPersona) => {

        registry.getPublicProfile(userPersona.profileAddress).then((profile) => {
        console.log(profile);
      });
        return dispatch(userLoggedIn(userPersona.profile))
      })
    })
  }
} 

首先,我获得了我的userPersona,然后我试图从注册表中获取我的公共配置文件(带有我的地址)。但在控制台里我有:

未知(承诺)错误:无法从注册表获取值

EN

回答 1

Ethereum用户

回答已采纳

发布于 2017-02-13 06:21:43

我是uport的工程主管。我们即将放弃一些库,因为它们并不像我们想要的那样简单易用。

我们的新浏览器库是:https://github.com/uport-project/uport-connect

代码语言:javascript
复制
import { Connect } from 'uport-connect'

const uport = new Connect('MyDApp')
uport.requestCredentials().then((credentials) => {
  console.log(credentials)
})

我们正在更新文档和示例代码,所以请耐心,但是上面的代码应该没有问题。

票数 5
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/12096

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档