0

I have a custom ERC20 deployed on Hardhat. I set a random token balance on 10 Hardhat accounts, which have all been imported into Metamask. A call to balanceOf in the contract confirms the account balances are correct. In Metamask I imported the contract address under "import tokens", and I see the correct token balance for the first two Hardhat accounts, but the other eight accounts don't show the imported token at all.

When I click "import tokens" for these other eight accounts, and enter the contract address, it shows the token name and balance correctly, then I confirm by clicking "Import tokens" and the token doesn't appear in the token list.

I'm using Metamask 10.23.2 and Hardhat 2.12.5. My Hardhat chain ID is 1337 (not 31337) and I believe the two Hardhat accounts showing the token are doing so because I previously added the token to these two accounts weeks ago. Something has changed and I now can't add the same token to other Hardhat accounts.

Can anyone offer any advice on this problem?

2
  • 1
    did you try doing settings -> advanced -> reset account and still have the issue? Jan 3, 2023 at 14:32
  • Yes, it made no difference. I have since discovered that Metamask has removed support for chain 1337, I'm getting the error: “TokenService Error: ChainId 0x539 is not supported”. I didn't see it before because you have to go to "import account" after trying to add a token to see the error. This explains the two accounts where my token is showing, I added the token to these accounts some time ago when chain 1337 was supported.
    – Rick
    Jan 4, 2023 at 12:07

1 Answer 1

0

I fixed it by simply using the standard Hardhat chain ID 31337 and everything works, seems like the Metamask bug is fixed and it now works fine with this chain ID.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.