In the frontend i just do this:
import MyContract fom './contracts/MyContract.json'; //truffle project dir web3 = new Web3(Web3.givenProvider); const myContractWeb3 = new web3.eth.contract(MyContract.abi, "0x00"); // and then call the function that i want to const functionThatIWantToUseFromSmartContract = async () =>{ const account = await window.ethereum.enable(); const accounts = account[0]; const gas = await myContractWeb3.methods.theFunction(args).estimateGas(); await myContractWeb3.methods.theFunction(args).send(); } import MyContract fom './contracts/MyContract.json'; //truffle project dir web3 = new Web3(Web3.givenProvider); const myContractWeb3 = new web3.eth.contract(MyContract.abi, "0x00"); // and then call the function that I want to const functionThatIWantToUseFromSmartContract = async () =>{ const account = await window.ethereum.enable(); const accounts = account[0]; const gas = await myContractWeb3.methods.theFunction(args).estimateGas(); await myContractWeb3.methods.theFunction(args).send(); }