I’m wanting to use MetaMask in my app to let users pay a fixed ETH fee (plus gas) to call a method from my Solidity contract. I looked at the documentation, and the “eth_sendTransaction” method seems close to what I need; eth_sendTransaction would certainly allow me to request ETH from a user, but the “data” parameter is a bit confusing.
The Metamask docs say:
“data is optional, but used for defining smart contract creation and interaction”
“also used for specifying contract methods and their parameters.”
So “data” is to be the Keccak representation of my method and its parameters, right? But how does Metamask (or window.ethereum, rather) know the contract whose methods I’m trying to call? Don’t you normally have to provide a contract address and ABI/JSON in order to interact with a deployed contract? In short, is it possible to do what I’ve described with just Metamask, or do you have to do other client-side setup? Thanks in advance.