MetaMask / MetaMask/metamask-extension

[Bug]: Thousands of RPC calls made in seconds whenever confirming a generic transaction request, prevents user from being able to successfully confirm

Open
#30,319 9 comments 0 reactions 1 assignee Assigned to @matthewwalsh0 View on GitHub
Bugs---Low-Priority external-contributor INVALID-ISSUE-TEMPLATE regression-prod-12.11.0 Sev2-normal team-confirmations type-bug
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

**Describe the bug**

When the confirmation pops up for a generic transaction, multiple rpc requests are fired off for every token in the user's wallet, including NFTs.

This causes rate limiting errors and prevents the user from being able to confirm the transaction, because other calls such as estimating gas or getting the current block number fails because of the rate limit

**Expected behavior**

Only fetch info for the contract relevant to the transaction.

If all might be relevant, then only make the RPC calls that are needed.

I think where this is occurring is the DataTree component, in which case, it fetches the token standard and metadata for a token just to get its `decimals` value, because fetching this data is all bundled together in `getTokenStandardAndDetails`. So even if we do require getting the `decimals` value of all tokens the user has, we should change it to simply fetch that (which isn't even a thing for NFTs), instead of fetching all the additional info like token metadata.

It will save a lot of RPC calls for users with a lot of NFTs, because its multiple calls per NFT and users can have thousands.

**Screenshots/Recordings**

https://github.com/user-attachments/assets/0b4ce4f2-d6b3-4eec-8e35-8271753a1b4f

**Steps to reproduce**

1. Have a wallet with a lot of NFTs
2. Try to confirm any generic transaction

Note it will not occur on NFT transfer transaction confirmations, only generic ones.

**Error messages or log output**

```shell

```

**Detection stage**

In production (default)

**Version**

12.11.0

**Build type**

None

**Browser**

Chrome

**Operating system**

Windows

**Severity**

This affects all users.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.