如何获取给定 herotag 的钱包地址?

How can I get the wallet address for a given herotag?

如果我想获取给定钱包地址的 herotag,我可以简单地调用以下端点:

https://api.elrond.com/accounts/erd1hw78kxyj353x52hmmq6dzxgexynwt4m29q2uvpq6xdm90z3halvsl7cn6g

我得到:

{
   "address":"erd1hw78kxyj353x52hmmq6dzxgexynwt4m29q2uvpq6xdm90z3halvsl7cn6g",
   "nonce":4,
   "balance":"0",
   "rootHash":"QU6o17Qw4KUPnpU6e6QbEuvKUTA8SPy52QFseslWsG4=",
   "txCount":4,
   "username":"event.elrond",
   "shard":1
}

我在哪里看到 username

但现在我想获取给定 herotag 的钱包地址。

是否有用于此目的的任何 API 端点?

使用API

https://api.elrond.com/usernames/<herotag>

例如:

https://api.elrond.com/usernames/event

重定向到

https://api.elrond.com/accounts/erd1hw78kxyj353x52hmmq6dzxgexynwt4m29q2uvpq6xdm90z3halvsl7cn6g

和returns

{
  "address": "erd1hw78kxyj353x52hmmq6dzxgexynwt4m29q2uvpq6xdm90z3halvsl7cn6g",
  "nonce": 7,
  "balance": "254914476000000000",
  "rootHash": "QU6o17Qw4KUPnpU6e6QbEuvKUTA8SPy52QFseslWsG4=",
  "txCount": 9,
  "scrCount": 12,
  "username": "event.elrond",
  "shard": 1,
  "developerReward": "0"
}

使用erdpy

erdpy dns resolve <herotag>.elrond --proxy=https://gateway.elrond.com

其中 <herotag> 应替换为其值。

例如:

erdpy dns resolve event.elrond --proxy=https://gateway.elrond.com

产出

erd1hw78kxyj353x52hmmq6dzxgexynwt4m29q2uvpq6xdm90z3halvsl7cn6g

详情:

$ erdpy --version
erdpy 1.0.12