Programmatically access contract address from browser

Hi, is there any way we can programmatically access the contract address from the browser before confirming the transaction or an other extension listening for message events? For example using the window.ethereum api or anything else that can be used in the browser or extension?

How does the contract address get to metamask? Is it an message event via extension api or?


Hey @djole90, welcome to the MetaMask community! :fox_face:

You can actually already see a contract address before confirming the transaction.

By default, MetaMask uses Infura as it’s API service, you can read more about Infura and how MetaMask uses it on our Knowledge Base here:


Thanks @nakedwinnie for your response.

I know that there is the address visible, but i’d like to get the address programmatically using javascript.

What data from window.ethereum could i use to get the contract details from infura?

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