3box-dapp
3box-dapp copied to clipboard
Feature Request: Add ETH, ERC20, and ERC721 token view on 3box.io
Request from Kevin Owocki and others to include collectibles so his Kudos and other tokens can show up.
@owocki I'm excited about Kudos! and wanted to pick up the convo we started in ETH SF about beginning to support them in 3Box somehow. I think there have been ideas floating around about off-chain tokens (@dazuck can weigh in), but the most immediate thing I could think of is supporting them in the UI. Will Kudos token data be available through any block explorer APIs, or how are you planning for Coinbase Wallet and others to support Kudos?
Another idea people had was to fire a 3Box alert if you received a new Kudos, however we need to first implement a system for notifying users on 3box.io
Hey @michaelsena thanks for the ping. Glad you're still excited about Kudos.
Kudos will be an OpenZeppelin ERC721 contract.
cc @jasonrhaas who is our smart contract dev for this product
the most immediate thing I could think of is supporting them in the UI. Will Kudos token data be available through any block explorer APIs, or how are you planning for Coinbase Wallet and others to support Kudos?
I believe that listening for the Transfer event is probably the best thing you can do to put ERC721 kudos into your UI - ref - You can also query balanceOf - Jason did I get that right?
That is correct. Any new kudos mint, clone, or burn emits a Transfer event. For example,
https://github.com/OpenZeppelin/openzeppelin-solidity/blob/9b3710465583284b8c4c5d2245749246bb2e0094/contracts/token/ERC721/ERC721.sol#L251
The balanceOf will get you the total number of tokens given an ETH address. If you want to get all the token data, you need to do some iteration, like this:
for (let index = 0; index < balance; index++) {
kudosContractInstance.tokenOfOwnerByIndex(account, index, function(error, kudosId) {
kudosContractInstance.getKudosById(kudosId, function(error, kudos) {
App.addKudosArtifact(kudosId, kudos, section)
})
})
}
Cool, thanks @jasonrhaas and @owocki. We'll keep this in mind and will ping you when we circle back to this issue.