paradigmxyz / rivet

Developer Wallet & DevTools for Anvil
MIT License
817 stars 65 forks source link

Feature: View & set ERC20/721/1155 balances #39

Open jxom opened 1 year ago

jxom commented 1 year ago

The Request

The ability to view & set ERC20, ERC721 and ERC1155 tokens & balances.

Problem

Right now, a user cannot view or set their ERC20/721/1155 tokens & balances.

Solution

As a user, I want the ability to drill into my account and view my ERC20/721/1155 tokens. I should be able to:

jxom commented 1 year ago

Assigned to @ditto-eth

MimmyJau commented 9 months ago

@jxom Hey! I might be interested in tackling this. If I'm not mistaken, importing and setting ERC-20 tokens has already been implemented, so completing this issue will require adding:

Clarifications: 1) Is the idea to let users manually import each token / NFT? Or should all tokens and NFTs automatically-populate (like in Etherscan)? If the latter, might have to discuss the feasibility of a couple different approaches. 2) For the UI, my thought was to have another tab next to Tokens (see below) titled NFTs, and there would be two input fields: address and tokenId. That section can contain both ERC-721 and ERC-1155, distinguished by a tag next to their names (how Etherscan displays it).

Rivet

image

Etherscan

image
ditto-eth commented 9 months ago
  1. Is the idea to let users manually import each token / NFT? Or should all tokens and NFTs automatically-populate (like in Etherscan)? If the latter, might have to discuss the feasibility of a couple different approaches.
  2. For the UI, my thought was to have another tab next to Tokens (see below) titled NFTs, and there would be two input fields: address and tokenId. That section can contain both ERC-721 and ERC-1155, distinguished by a tag next to their names (how Etherscan displays it).

yo I did the initial implementation. There are issues regarding token imports https://github.com/paradigmxyz/rivet/issues/56 (sync after fork, already done) and https://github.com/paradigmxyz/rivet/issues/57 (before fork). Only thought on auto populate is how far back to search and to ignore certain tokens potentially since some accounts are spammed with NFTs (say you import vitalik.eth or the default foundry ones). For the UI yea there is already a commented out NFT section in the code that is separate. We discussed probably needing to separate the sections but also to separate it in the code, potentially as a separate store to store different metadata from erc20 (also need some code to check if it's an NFT, like checking getApproved, setApprovalForAll, isApprovedForAll, or even the different approve interface from erc20)