Improve popup speed by optimize transaction type determine?

There are some delays between a new transaction is requested to MetaMask popups, after some debugging, I believe the main bottleneck is the readAddressAsContract call in determineTransactionType, in order to determine if this transaction is a contract call or a simple send, this method pulls the entire contract code from Ethereum node. If the target contract is big(for example OpenSea), the delay introduced is pretty noticeable(several seconds in my setup).
So I’m thinking if this readAddressAsContract call could be replaced in this situation, one solution is to simply determine if the transaction is a contract call by checking if there is data in it. Of course this will get some false positive result(simple transfers that has data), but in most cases I think it’ll be fine.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.