UI for direct function call on contract

Why does MetaMask not have a built-in UI for calling any arbitrary function on a contract? It is a shame to have to create a dapp just to call a contract method.

This raises the question of how a contact’s API (in particular, function parameter names) could be declared by a contract, so that an API to call its functions could be constructed automatically.

Hey @lukehutch ,

Wouldn’t this make more sense to do on a site rather than a wallet? Can you give more details on what you’re thinking. Thanks!

Not necessarily. I want my users to be able to call a payable function by simply selecting my contract, choosing a function, and then filling in values for the parameters. Yes, I could and should build a UI, but it boggles my mind that this is not already built into MetaMask.

1 Like

Hi Luke,

Have you created an issue for it on GitHub for this? If not, would you be willing?

I’m definitely willing, but the MetaMask app directs all feature requests here. Is GitHub the right place for feature requests to actually get implemented?

hi @lukehutch ,

No, you’re correct on coming here for feature requests however my initial thought was your request may actually make sense on Github. However, I can also share this internally. I’ll send this to someone and see what they respond with the best course for this one so I can be sure I’m telling you the best path. I will come back and update this thread once I hear back.

Hey @lukehutch,
thanks for posting this feature request here! That’s an interesting one and we’ll keep an eye open to check if others might be interested in this too.

In the meantime, if you want to avoid creating an UI, verifying your contract on Etherscan and directing your users there might solve your need.

1 Like

Thanks for the response. How would directing my users to Etherscan solve the need to call functions in a contract? It would allow users to verify the source code of the contract, yes. But I still need to give users the ability to construct a transaction that properly ABI-encodes the function selector and parameter values, attaches any required ETH balance, then launches the transaction from an EOA (wallet).

It’s a gaping hole in the features offered by MetaMask, that this is not supported, and I can’t believe MetaMask does not have this feature yet, given how mature it supposedly is as a product. This functionality is critical to the smart contract ecosystem, and developers should not have to build a dapp UI for every smart contract, especially when the API is simple. It should be trivial for users to call functions by choosing the function name and supplying parameters.

If the contract is verified in Etherscan, you can connect your wallet and call contract functions directly from there. Just go to Contract > Write Contract tab :slight_smile: @lukehutch

5 Likes

Awesome, I didn’t know about that. Thanks! That will probably work for now. Although I suspect not everybody will know they can trust Etherscan – so it would be great if there were native support in Metamask for the same thing. The function signatures could be obtained by Metamask from Etherscan.

1 Like