<script src="https://cdn.ethers.io/lib/ethers-5.2.umd.min.js" src="application/javascript"></script>
<!-- Web3 Component Template -->
<button onclick="transact()">
<p class="button text" id='Interact'>Name</p>
</button>
<script type="application/javascript">
const ABI = [YOUR_ABI]
const contract_address = "YOUR_CONTRACT_ADDRESS"
async function transact() {
try {
const provider = new ethers.providers.Web3Provider(window.ethereum)
await provider.send("eth_requestAccounts", [])
const signer = provider.getSigner()
const contract = new ethers.Contract(contract_address, ABI, signer)
/* contract method */
await contract.`METHOD_NAME`({ value: ethers.utils.parseUnits("100000000", "gwei") })
} catch (e) {
/* handle transaction error */
console.log(e);
}
}
</script>